hc
2024-03-22 a0752693d998599af469473b8dc239ef973a012f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
/**
 ******************************************************************************
 *
 * rwnx_cmds.h
 *
 * Copyright (C) RivieraWaves 2014-2019
 *
 ******************************************************************************
 */
 
#ifndef _AIC_BSP_DRIVER_H
#define _AIC_BSP_DRIVER_H
 
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/module.h>
#include "aic_bsp_export.h"
 
#define RWNX_80211_CMD_TIMEOUT_MS    3000//500//300
 
#define RWNX_CMD_FLAG_NONBLOCK      BIT(0)
#define RWNX_CMD_FLAG_REQ_CFM       BIT(1)
#define RWNX_CMD_FLAG_WAIT_PUSH     BIT(2)
#define RWNX_CMD_FLAG_WAIT_ACK      BIT(3)
#define RWNX_CMD_FLAG_WAIT_CFM      BIT(4)
#define RWNX_CMD_FLAG_DONE          BIT(5)
/* ATM IPC design makes it possible to get the CFM before the ACK,
 * otherwise this could have simply been a state enum */
#define RWNX_CMD_WAIT_COMPLETE(flags) \
   (!(flags & (RWNX_CMD_FLAG_WAIT_ACK | RWNX_CMD_FLAG_WAIT_CFM)))
 
#define RWNX_CMD_MAX_QUEUED         8
 
#define IPC_E2A_MSG_PARAM_SIZE 256
 
#define RWNX_FN_ENTRY_STR ">>> %s()\n", __func__
 
/* message levels */
#define LOGERROR        0x0001
#define LOGINFO            0x0002
#define LOGTRACE        0x0004
#define LOGDEBUG        0x0008
#define LOGDATA            0x0010
 
extern int aicwf_dbg_level_bsp;
 
#define AICWF_LOG        "AICWFDBG("
 
#define AICWFDBG(level, args, arg...)    \
do {    \
   if (aicwf_dbg_level_bsp & level) {    \
       printk(AICWF_LOG#level")\t" args, ##arg); \
   }    \
} while (0)
 
#define RWNX_DBG(fmt, ...)    \
do {    \
   if (aicwf_dbg_level_bsp & LOGTRACE) {    \
       printk(AICWF_LOG"LOGTRACE)\t"fmt , ##__VA_ARGS__);     \
   }    \
} while (0)
 
/// Message structure for MSGs from Emb to App
struct ipc_e2a_msg {
   u16 id;                ///< Message id.
   u16 dummy_dest_id;
   u16 dummy_src_id;
   u16 param_len;         ///< Parameter embedded struct length.
   u32 pattern;           ///< Used to stamp a valid MSG buffer
   u32 param[IPC_E2A_MSG_PARAM_SIZE];  ///< Parameter embedded struct. Must be word-aligned.
};
 
typedef u16 lmac_msg_id_t;
typedef u16 lmac_task_id_t;
 
struct lmac_msg {
   lmac_msg_id_t     id;         ///< Message id.
   lmac_task_id_t    dest_id;    ///< Destination kernel identifier.
   lmac_task_id_t    src_id;     ///< Source kernel identifier.
   u16        param_len;  ///< Parameter embedded struct length.
   u32        param[];   ///< Parameter embedded struct. Must be word-aligned.
};
 
#define rwnx_cmd_e2amsg ipc_e2a_msg
#define rwnx_cmd_a2emsg lmac_msg
#define RWNX_CMD_A2EMSG_LEN(m) (sizeof(struct lmac_msg) + m->param_len)
#define RWNX_CMD_E2AMSG_LEN_MAX (IPC_E2A_MSG_PARAM_SIZE * 4)
 
static inline void put_u16(u8 *buf, u16 data)
{
   buf[0] = (u8)(data&0x00ff);
   buf[1] = (u8)((data >> 8)&0x00ff);
}
 
enum rwnx_cmd_mgr_state {
   RWNX_CMD_MGR_STATE_DEINIT,
   RWNX_CMD_MGR_STATE_INITED,
   RWNX_CMD_MGR_STATE_CRASHED,
};
 
struct rwnx_cmd {
   struct list_head list;
   lmac_msg_id_t id;
   lmac_msg_id_t reqid;
   struct rwnx_cmd_a2emsg *a2e_msg;
   char *e2a_msg;
   u32 tkn;
   u16 flags;
   struct completion complete;
   u32 result;
};
 
struct aic_sdio_dev;
struct rwnx_cmd;
typedef int (*msg_cb_fct)(struct rwnx_cmd *cmd, struct rwnx_cmd_e2amsg *msg);
 
struct rwnx_cmd_mgr {
   enum rwnx_cmd_mgr_state state;
   spinlock_t lock;
   u32 next_tkn;
   u32 queue_sz;
   u32 max_queue_sz;
   spinlock_t cb_lock;
   void *sdiodev;
 
   struct list_head cmds;
 
   int  (*queue)(struct rwnx_cmd_mgr *, struct rwnx_cmd *);
   int  (*llind)(struct rwnx_cmd_mgr *, struct rwnx_cmd *);
   int  (*msgind)(struct rwnx_cmd_mgr *, struct rwnx_cmd_e2amsg *, msg_cb_fct);
   void (*print)(struct rwnx_cmd_mgr *);
   void (*drain)(struct rwnx_cmd_mgr *);
 
   struct work_struct cmdWork;
   struct workqueue_struct *cmd_wq;
};
 
void rwnx_cmd_mgr_init(struct rwnx_cmd_mgr *cmd_mgr);
void rwnx_cmd_mgr_deinit(struct rwnx_cmd_mgr *cmd_mgr);
int cmd_mgr_queue_force_defer(struct rwnx_cmd_mgr *cmd_mgr, struct rwnx_cmd *cmd);
void rwnx_set_cmd_tx(void *dev, struct lmac_msg *msg, uint len);
 
enum {
   TASK_NONE = (u8) -1,
 
   // MAC Management task.
   TASK_MM = 0,
   // DEBUG task
   TASK_DBG,
   /// SCAN task
   TASK_SCAN,
   /// TDLS task
   TASK_TDLS,
   /// SCANU task
   TASK_SCANU,
   /// ME task
   TASK_ME,
   /// SM task
   TASK_SM,
   /// APM task
   TASK_APM,
   /// BAM task
   TASK_BAM,
   /// MESH task
   TASK_MESH,
   /// RXU task
   TASK_RXU,
   // This is used to define the last task that is running on the EMB processor
   TASK_LAST_EMB = TASK_RXU,
 
   // nX API task
   TASK_API,
   TASK_MAX,
};
 
#define LMAC_FIRST_MSG(task) ((lmac_msg_id_t)((task) << 10))
#define DRV_TASK_ID 100
#define MSG_I(msg) ((msg) & ((1<<10)-1))
#define MSG_T(msg) ((lmac_task_id_t)((msg) >> 10))
 
enum dbg_msg_tag {
   /// Memory read request
   DBG_MEM_READ_REQ = LMAC_FIRST_MSG(TASK_DBG),
   /// Memory read confirm
   DBG_MEM_READ_CFM,
   /// Memory write request
   DBG_MEM_WRITE_REQ,
   /// Memory write confirm
   DBG_MEM_WRITE_CFM,
   /// Module filter request
   DBG_SET_MOD_FILTER_REQ,
   /// Module filter confirm
   DBG_SET_MOD_FILTER_CFM,
   /// Severity filter request
   DBG_SET_SEV_FILTER_REQ,
   /// Severity filter confirm
   DBG_SET_SEV_FILTER_CFM,
   /// LMAC/MAC HW fatal error indication
   DBG_ERROR_IND,
   /// Request to get system statistics
   DBG_GET_SYS_STAT_REQ,
   /// COnfirmation of system statistics
   DBG_GET_SYS_STAT_CFM,
   /// Memory block write request
   DBG_MEM_BLOCK_WRITE_REQ,
   /// Memory block write confirm
   DBG_MEM_BLOCK_WRITE_CFM,
   /// Start app request
   DBG_START_APP_REQ,
   /// Start app confirm
   DBG_START_APP_CFM,
   /// Start npc request
   DBG_START_NPC_REQ,
   /// Start npc confirm
   DBG_START_NPC_CFM,
   /// Memory mask write request
   DBG_MEM_MASK_WRITE_REQ,
   /// Memory mask write confirm
   DBG_MEM_MASK_WRITE_CFM,
 
   DBG_RFTEST_CMD_REQ,
   DBG_RFTEST_CMD_CFM,
   DBG_BINDING_REQ,
   DBG_BINDING_CFM,
   DBG_BINDING_IND,
 
   DBG_CUSTOM_MSG_REQ,
   DBG_CUSTOM_MSG_CFM,
   DBG_CUSTOM_MSG_IND,
 
   DBG_GPIO_WRITE_REQ,
   DBG_GPIO_WRITE_CFM,
 
 
   /// Max number of Debug messages
   DBG_MAX,
};
 
#if !defined(CONFIG_M2D_OTA_LZMA_SUPPORT)
#define FW_M2D_OTA_NAME                 "m2d_ota.bin"
#else
#define FW_M2D_OTA_NAME                 "m2d_ota_lzma.bin"
#endif
 
enum {
   HOST_START_APP_AUTO = 1,
   HOST_START_APP_CUSTOM,
   HOST_START_APP_FNCALL = 4,
   HOST_START_APP_DUMMY  = 5,
};
 
 
struct dbg_mem_block_write_req {
   u32 memaddr;
   u32 memsize;
   u32 memdata[1024 / sizeof(u32)];
};
 
/// Structure containing the parameters of the @ref DBG_MEM_BLOCK_WRITE_CFM message.
struct dbg_mem_block_write_cfm {
   u32 wstatus;
};
 
/// Structure containing the parameters of the @ref DBG_MEM_WRITE_REQ message.
struct dbg_mem_write_req {
   u32 memaddr;
   u32 memdata;
};
 
/// Structure containing the parameters of the @ref DBG_MEM_WRITE_CFM message.
struct dbg_mem_write_cfm {
   u32 memaddr;
   u32 memdata;
};
 
/// Structure containing the parameters of the @ref DBG_MEM_READ_REQ message.
struct dbg_mem_read_req {
   u32 memaddr;
};
 
/// Structure containing the parameters of the @ref DBG_MEM_READ_CFM message.
struct dbg_mem_read_cfm {
   u32 memaddr;
   u32 memdata;
};
 
/// Structure containing the parameters of the @ref DBG_MEM_MASK_WRITE_REQ message.
struct dbg_mem_mask_write_req {
   u32 memaddr;
   u32 memmask;
   u32 memdata;
};
 
/// Structure containing the parameters of the @ref DBG_MEM_MASK_WRITE_CFM message.
struct dbg_mem_mask_write_cfm {
   u32 memaddr;
   u32 memdata;
};
 
/// Structure containing the parameters of the @ref DBG_START_APP_REQ message.
struct dbg_start_app_req {
   u32 bootaddr;
   u32 boottype;
};
 
/// Structure containing the parameters of the @ref DBG_START_APP_CFM message.
struct dbg_start_app_cfm {
   u32 bootstatus;
};
 
int aicwf_plat_patch_load_8800dc(struct aic_sdio_dev *sdiodev);
int aicwf_plat_rftest_load_8800dc(struct aic_sdio_dev *sdiodev);
#ifdef CONFIG_DPD
int aicwf_plat_calib_load_8800dc(struct aic_sdio_dev *sdiodev);
#endif
 
int rwnx_load_firmware(u32 **fw_buf, const char *name, struct device *device);
int aicwf_patch_table_load(struct aic_sdio_dev *rwnx_hw, char *filename);
 
int rwnx_send_dbg_mem_read_req(struct aic_sdio_dev *sdiodev, u32 mem_addr,
                              struct dbg_mem_read_cfm *cfm);
int rwnx_send_dbg_mem_block_write_req(struct aic_sdio_dev *sdiodev, u32 mem_addr,
                                     u32 mem_size, u32 *mem_data);
int rwnx_send_dbg_mem_write_req(struct aic_sdio_dev *sdiodev, u32 mem_addr, u32 mem_data);
int rwnx_send_dbg_mem_mask_write_req(struct aic_sdio_dev *sdiodev, u32 mem_addr,
                                    u32 mem_mask, u32 mem_data);
int rwnx_send_dbg_start_app_req(struct aic_sdio_dev *sdiodev, u32 boot_addr, u32 boot_type, struct dbg_start_app_cfm *start_app_cfm);
 
int rwnx_plat_bin_fw_upload_android(struct aic_sdio_dev *sdiodev, u32 fw_addr, const char *filename);
 
void rwnx_rx_handle_msg(struct aic_sdio_dev *sdiodev, struct ipc_e2a_msg *msg);
int aicbsp_platform_init(struct aic_sdio_dev *sdiodev);
void aicbsp_platform_deinit(struct aic_sdio_dev *sdiodev);
int aicbsp_driver_fw_init(struct aic_sdio_dev *sdiodev);
#ifdef CONFIG_DPD
int is_file_exist(char* name);
#endif
int aicbsp_resv_mem_init(void);
int aicbsp_resv_mem_deinit(void);
 
#define AICBSP_FW_PATH              CONFIG_AIC_FW_PATH
#define AICBSP_FW_PATH_MAX          200
 
#define RAM_FMAC_FW_ADDR                    0x00120000
#define FW_RAM_ADID_BASE_ADDR               0x00161928
#define FW_RAM_ADID_BASE_ADDR_U03           0x00161928
#define FW_RAM_PATCH_BASE_ADDR              0x00100000
#define RAM_8800DC_U01_ADID_ADDR            0x00101788
#define RAM_8800DC_U02_ADID_ADDR            0x001017d8
#define RAM_8800DC_FW_PATCH_ADDR            0x00184000
#define FW_RESET_START_ADDR                 0x40500128
#define FW_RESET_START_VAL                  0x40
#define FW_ADID_FLAG_ADDR                   0x40500150
#define FW_ADID_FLAG_VAL                    0x01
#define FW_RAM_ADID_BASE_ADDR_8800D80       0x002017E0
#define FW_RAM_PATCH_BASE_ADDR_8800D80      0x0020B2B0
#define FW_RAM_ADID_BASE_ADDR_8800D80_U02   0x00201940
#define FW_RAM_PATCH_BASE_ADDR_8800D80_U02  0x0020b43c
 
#define AICBT_PT_TAG                "AICBT_PT_TAG"
 
 
/*****************************************************************************
 * Addresses within RWNX_ADDR_CPU
 *****************************************************************************/
#define RAM_LMAC_FW_ADDR               0x00150000
 
#define ROM_FMAC_FW_ADDR               0x00010000
#define ROM_FMAC_PATCH_ADDR            0x00180000
 
#define RWNX_MAC_CALIB_BASE_NAME_8800DC        "fmacfw_calib_8800dc"
#define RWNX_MAC_CALIB_NAME_8800DC_U02          RWNX_MAC_CALIB_BASE_NAME_8800DC"_u02.bin"
#define RWNX_MAC_CALIB_NAME_8800DC_H_U02        RWNX_MAC_CALIB_BASE_NAME_8800DC"_h_u02.bin"
 
#ifdef CONFIG_DPD
#define ROM_FMAC_CALIB_ADDR            0x00130000
#ifndef CONFIG_FORCE_DPD_CALIB
#define FW_DPDRESULT_NAME_8800DC        "aic_dpdresult_lite_8800dc.bin"
#endif
#endif
 
#define RWNX_MAC_FW_RF_BASE_NAME_8800DC   "lmacfw_rf_8800dc.bin"
 
#ifdef CONFIG_FOR_IPCOM
#define RWNX_MAC_PATCH_BASE_NAME_8800DC        "fmacfw_patch_8800dc_ipc"
#define RWNX_MAC_PATCH_NAME2_8800DC RWNX_MAC_PATCH_BASE_NAME_8800DC".bin"
#else
#define RWNX_MAC_PATCH_BASE_NAME_8800DC        "fmacfw_patch_8800dc"
#define RWNX_MAC_PATCH_NAME2_8800DC RWNX_MAC_PATCH_BASE_NAME_8800DC".bin"
#define RWNX_MAC_PATCH_NAME2_8800DC_U02 RWNX_MAC_PATCH_BASE_NAME_8800DC"_u02.bin"
#define RWNX_MAC_PATCH_NAME2_8800DC_H_U02 RWNX_MAC_PATCH_BASE_NAME_8800DC"_h_u02.bin"
#endif
 
#define RWNX_MAC_PATCH_TABLE_NAME_8800DC "fmacfw_patch_tbl_8800dc"
#define RWNX_MAC_PATCH_TABLE_8800DC RWNX_MAC_PATCH_TABLE_NAME_8800DC ".bin"
#define RWNX_MAC_PATCH_TABLE_8800DC_U02 RWNX_MAC_PATCH_TABLE_NAME_8800DC "_u02.bin"
#define RWNX_MAC_PATCH_TABLE_8800DC_H_U02 RWNX_MAC_PATCH_TABLE_NAME_8800DC "_h_u02.bin"
 
#define RWNX_MAC_RF_PATCH_BASE_NAME_8800DC     "fmacfw_rf_patch_8800dc"
#define RWNX_MAC_RF_PATCH_NAME_8800DC RWNX_MAC_RF_PATCH_BASE_NAME_8800DC".bin"
#define FW_USERCONFIG_NAME_8800DC         "aic_userconfig_8800dc.txt"
 
enum {
    FW_NORMAL_MODE          = 0,
    FW_RFTEST_MODE          = 1,
    FW_BLE_SCAN_WAKEUP_MODE = 2,
    FW_M2D_OTA_MODE         = 3,
    FW_DPDCALIB_MODE        = 4,
    FW_BLE_SCAN_AD_FILTER_MODE = 5,
};
 
enum aicbt_patch_table_type {
   AICBT_PT_INF  = 0x00,
   AICBT_PT_TRAP = 0x1,
   AICBT_PT_B4,
   AICBT_PT_BTMODE,
   AICBT_PT_PWRON,
   AICBT_PT_AF,
   AICBT_PT_VER,
};
 
enum aicbt_btport_type {
   AICBT_BTPORT_NULL,
   AICBT_BTPORT_MB,
   AICBT_BTPORT_UART,
};
 
/*  btmode
 * used for force bt mode,if not AICBSP_MODE_NULL
 * efuse valid and vendor_info will be invalid, even has beed set valid
*/
enum aicbt_btmode_type {
   AICBT_BTMODE_BT_ONLY_SW = 0x0,    // bt only mode with switch
   AICBT_BTMODE_BT_WIFI_COMBO,       // wifi/bt combo mode
   AICBT_BTMODE_BT_ONLY,             // bt only mode without switch
   AICBT_BTMODE_BT_ONLY_TEST,        // bt only test mode
   AICBT_BTMODE_BT_WIFI_COMBO_TEST,  // wifi/bt combo test mode
   AICBT_BTMODE_BT_ONLY_COANT,       // bt only mode with no external switch
   AICBT_MODE_NULL = 0xFF,           // invalid value
};
 
/*  uart_baud
 * used for config uart baud when btport set to uart,
 * otherwise meaningless
*/
enum aicbt_uart_baud_type {
   AICBT_UART_BAUD_115200     = 115200,
   AICBT_UART_BAUD_921600     = 921600,
   AICBT_UART_BAUD_1_5M       = 1500000,
   AICBT_UART_BAUD_3_25M      = 3250000,
};
 
enum aicbt_uart_flowctrl_type {
   AICBT_UART_FLOWCTRL_DISABLE = 0x0,    // uart without flow ctrl
   AICBT_UART_FLOWCTRL_ENABLE,           // uart with flow ctrl
};
 
enum aicbsp_cpmode_type {
   AICBSP_CPMODE_WORK,
   AICBSP_CPMODE_TEST,
   AICBSP_CPMODE_MAX,
};
 
enum chip_rev {
   CHIP_REV_U01 = 1,
   CHIP_REV_U02 = 3,
   CHIP_REV_U03 = 7,
   CHIP_REV_U04 = 7,
};
 
#define AIC_M2D_OTA_INFO_ADDR       0x88000020
#define AIC_M2D_OTA_DATA_ADDR       0x88000040
#if !defined(CONFIG_M2D_OTA_LZMA_SUPPORT)
#define AIC_M2D_OTA_FLASH_ADDR      0x08004000
#define AIC_M2D_OTA_CODE_START_ADDR (AIC_M2D_OTA_FLASH_ADDR + 0x0188)
#define AIC_M2D_OTA_VER_ADDR        (AIC_M2D_OTA_FLASH_ADDR + 0x018C)
#else
#define AIC_M2D_OTA_FLASH_ADDR      0x08005000
#define AIC_M2D_OTA_CODE_START_ADDR (AIC_M2D_OTA_FLASH_ADDR + 0x1188)
#define AIC_M2D_OTA_VER_ADDR        (AIC_M2D_OTA_FLASH_ADDR + 0x0010)
#endif
///aic bt tx pwr lvl :lsb->msb: first byte, min pwr lvl; second byte, max pwr lvl;
///pwr lvl:20(min), 30 , 40 , 50 , 60(max)
#define AICBT_TXPWR_LVL            0x00006020
#define AICBT_TXPWR_LVL_8800dc            0x00006f2f
#define AICBT_TXPWR_LVL_8800d80           0x00006f2f
 
#define AICBSP_HWINFO_DEFAULT       (-1)
#define AICBSP_CPMODE_DEFAULT       AICBSP_CPMODE_WORK
#define AICBSP_FWLOG_EN_DEFAULT     0
 
#define AICBT_BTMODE_DEFAULT_8800d80    AICBT_BTMODE_BT_ONLY_COANT
#define AICBT_BTMODE_DEFAULT            AICBT_BTMODE_BT_ONLY_SW
#define AICBT_BTPORT_DEFAULT            AICBT_BTPORT_UART
#define AICBT_UART_BAUD_DEFAULT         AICBT_UART_BAUD_1_5M
#define AICBT_UART_FC_DEFAULT           AICBT_UART_FLOWCTRL_ENABLE
#define AICBT_LPM_ENABLE_DEFAULT         0
#define AICBT_TXPWR_LVL_DEFAULT         AICBT_TXPWR_LVL
#define AICBT_TXPWR_LVL_DEFAULT_8800dc  AICBT_TXPWR_LVL_8800dc
#define AICBT_TXPWR_LVL_DEFAULT_8800d80 AICBT_TXPWR_LVL_8800d80
 
 
#define AIC_IRQ_WAKE_FLAG           0          // 0: rising edge, 1: falling edge
#define FEATURE_SDIO_CLOCK          50000000 // 0: default, other: target clock rate
#define FEATURE_SDIO_CLOCK_V3       150000000 // 0: default, other: target clock rate
#define FEATURE_SDIO_PHASE          2        // 0: default, 2: 180°
 
struct aicbt_patch_table {
   char     *name;
   uint32_t type;
   uint32_t *data;
   uint32_t len;
   struct aicbt_patch_table *next;
};
 
struct aicbt_info_t {
   uint32_t btmode;
   uint32_t btport;
   uint32_t uart_baud;
   uint32_t uart_flowctrl;
   uint32_t lpm_enable;
   uint32_t txpwr_lvl;
};
 
struct aicbt_patch_info_t {
       uint32_t info_len;
       uint32_t adid_addrinf;
   uint32_t addr_adid;
       uint32_t patch_addrinf;
   uint32_t addr_patch;
   uint32_t reset_addr;
   uint32_t reset_val;
   uint32_t adid_flag_addr;
   uint32_t adid_flag;
};
 
struct aicbsp_firmware {
   const char *desc;
   const char *bt_adid;
   const char *bt_patch;
   const char *bt_table;
   const char *wl_fw;
};
 
struct aicbsp_info_t {
   int hwinfo;
   int hwinfo_r;
   uint32_t cpmode;
   uint32_t chip_rev;
   bool fwlog_en;
   uint8_t irqf;
};
 
extern struct aicbsp_info_t aicbsp_info;
extern struct mutex aicbsp_power_lock;
extern const struct aicbsp_firmware *aicbsp_firmware_list;
extern const struct aicbsp_firmware fw_u02[];
extern const struct aicbsp_firmware fw_u03[];
extern const struct aicbsp_firmware fw_8800dc_u01[];
extern const struct aicbsp_firmware fw_8800dc_u02[];
extern const struct aicbsp_firmware fw_8800d80_u01[];
extern const struct aicbsp_firmware fw_8800d80_u02[];
 
#endif