1 /****************************************************************************** 2 * Copyright (c) 2022 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 3 * All rights reserved. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 *****************************************************************************/ 18 #ifndef RF_REG_H 19 #define RF_REG_H 20 #include "../sys.h" 21 22 ///******************************* RF ******************************/ 23 #define APBADDR 0x140000 24 #define BBADDR (APBADDR + 0x800) // 0x140800 25 #define RADIOADDR (APBADDR + 0xe00) // 0x140e00 26 #define MODEMADDR (APBADDR + 0xc00) // 0x140c00 27 #define CHNADDR 0x100400 28 #define APBRG_BASE 0x140000 29 #define APBRG_APB_BASE (APBRG_BASE + 0x0000) 30 31 #define REG_TL_RADIO_BASE_ADDR (APBRG_BASE + 0x0e00) 32 33 #define reg_rf_bb_auto_ctrl REG_ADDR8(0x10050c) 34 35 enum { 36 FLD_RF_TX_MULTI_EN = BIT(0), 37 FLD_RF_RX_MULTI_EN = BIT(1), 38 FLD_RF_CH_0_RNUM_EN_BK = BIT(2), 39 FLD_RF_CH_1_RNUM_EN_BK = BIT(3), 40 FLD_RF_CH1_RX_ERR_EN = BIT(4), 41 FLD_RF_DMA_REQ_D1_EN = BIT(5), 42 }; 43 #define reg_rf_bb_tx_chn_dep REG_ADDR8(0x1004f3) 44 #define reg_rf_bb_tx_size REG_ADDR8(0x1004f2) 45 46 #define reg_rf_dma_rx_wptr REG_ADDR8(0x001004f4) 47 #define reg_rf_dma_rx_rptr REG_ADDR8(0x001004f5) 48 49 #define reg_rf_dma_tx_rptr(i) REG_ADDR8(0x00100501 + ((i) << 1)) 50 #define reg_rf_dma_tx_wptr(i) REG_ADDR8(0x00100500 + ((i) << 1)) 51 52 #define reg_rf_bb_rx_size REG_ADDR8(CHNADDR + 0xf6) 53 54 #define reg_rf_rx_wptr_mask REG_ADDR8(CHNADDR + 0x10d) 55 56 //****************************** RF_Register_list ******************************/ 57 #define REG_BASEBAND_BASE_ADDR 0x0140800 58 59 #define reg_rf_tx_mode1 REG_ADDR8(REG_BASEBAND_BASE_ADDR) 60 enum { 61 FLD_RF_DMA_EN = BIT(0), 62 FLD_RF_CRC_EN = BIT(1), 63 FLD_RF_TX_FMT = BIT_RNG(2, 3), 64 FLD_RF_TX_XOR_MODE = BIT(4), 65 FLD_RF_TX_TEST_DATA = BIT(5), 66 FLD_RF_TX_TEST_EN = BIT(6), 67 FLD_RF_BB_DEC = BIT(7), 68 }; 69 70 #define reg_rf_tx_mode2 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x01) 71 enum { 72 FLD_RF_ZB_PN_EN = BIT(0), 73 FLD_RF_RESERVED0 = BIT_RNG(1, 2), 74 FLD_RF_V_PN_EN = BIT(3), 75 FLD_RF_RESERVED1 = BIT_RNG(4, 5), 76 FLD_RF_TX_OUT_PLR = BIT(6), 77 }; 78 79 #define reg_rf_preamble_trail REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x02) 80 enum { 81 FLD_RF_PREAMBLE_LEN = BIT_RNG(0, 4), 82 FLD_RF_TRAILER_LEN = BIT_RNG(5, 7), 83 }; 84 85 #define reg_rf_bbdbg REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x03) 86 enum { 87 FLD_RF_SLOW_EN = BIT(0), 88 FLD_RF_SLOW_SEL = BIT(1), 89 FLD_RF_XMODE_EN = BIT(2), 90 FLD_RF_REV_ORDER = BIT(3), 91 FLD_RF_TX_MODE = BIT(4), 92 FLD_RF_R_DBG_SEL0 = BIT(5), 93 FLD_RF_MODEM1M_PAT = BIT(6), 94 FLD_RF_R_DBG_SEL1 = BIT(7), 95 }; 96 97 #define reg_rf_format REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x04) 98 enum { 99 FLD_RF_HEAD_MODE = BIT_RNG(0, 1), 100 FLD_RF_CRC_MODE = BIT_RNG(2, 3), 101 FLD_RF_BLE_1M = BIT(4), 102 FLD_RF_BLE_WT = BIT(5), 103 FLD_RF_TX_NOACK = BIT(6), 104 FLD_RF_PN_AUTO = BIT(7), 105 }; 106 107 #define reg_rf_acc_len REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x05) 108 enum { 109 FLD_RF_ACC_LEN = BIT_RNG(0, 2), 110 FLD_RF_LR_TX_SEL = BIT(4), 111 FLD_RF_BLE_LR = BIT(5), 112 }; 113 114 #define reg_rf_sblen REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x06) 115 116 #define reg_rf_rxchn REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x07) 117 enum { 118 FLD_RF_TEST_TXON = BIT(6), 119 FLD_RF_TEST_TXON_EN = BIT(7), 120 }; 121 122 #define reg_rf_access_code REG_ADDR32(REG_BASEBAND_BASE_ADDR + 0x08) 123 #define reg_rf_access_0 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x08) 124 #define reg_rf_access_1 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x09) 125 #define reg_rf_access_2 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x0a) 126 #define reg_rf_access_3 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x0b) 127 #define reg_rf_access_4 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x0c) 128 129 #define reg_rf_pn REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x0d) 130 enum { 131 FLD_RF_PN_INIT = BIT_RNG(0, 5), 132 }; 133 134 #define reg_rf_access_5 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x10) 135 #define reg_rf_access_6 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x11) 136 #define reg_rf_access_7 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x12) 137 #define reg_rf_access_8 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x13) 138 #define reg_rf_access_9 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x14) 139 #define reg_rf_access_10 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x18) 140 #define reg_rf_access_11 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x19) 141 #define reg_rf_access_12 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x1a) 142 #define reg_rf_access_13 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x1b) 143 #define reg_rf_access_code_base_pipe0 0x140808 144 #define reg_rf_access_code_base_pipe2 0x140818 145 146 #define reg_rf_txfifo REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x1c) 147 enum { 148 FLD_RF_TX_FIFO_FULL = BIT(0), 149 FLD_RF_TX_ACT_2D = BIT(1), 150 }; 151 152 #define reg_rf_rxgth1 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x21) 153 enum { 154 FLD_RF_R_PILOT_LEN_O = BIT_RNG(0, 3), 155 FLD_RF_R_ZB_SFD_O = BIT(4), 156 FLD_RF_R_PKTLEN_O = BIT(5), 157 FLD_RF_R_SN_LEN_O = BIT(6), 158 FLD_RF_R_LEN_0_EN_O = BIT(7), 159 }; 160 161 #define reg_rf_rxsfd0_num REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x22) 162 enum { 163 FLD_RF_RXCHN_MAN_EN = BIT(3), 164 FLD_RF_RXCHN_MAN = BIT_RNG(4, 6), 165 }; 166 167 #define reg_rf_crc_init0 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x24) 168 #define reg_rf_crc_init1 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x25) 169 #define reg_rf_crc_init2 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x26) 170 171 #define reg_rf_ctrl_0 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x27) 172 enum { 173 FLD_RF_H1M_ODD = BIT(0), 174 FLD_RF_REV_ZB_SAMP = BIT(1), 175 FLD_RF_SFD_LAST_CHIP = BIT(2), 176 }; 177 178 #define reg_rf_rxmode REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x28) 179 enum { 180 FLD_RF_RX_ENABLE = BIT(0), 181 }; 182 183 #define reg_rf_rxclk_on REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x2a) 184 enum { 185 FLD_RF_CLKON_O = BIT_RNG(0, 1), 186 }; 187 188 #define reg_rf_rxclk_auto REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x2b) 189 enum { 190 FLD_RF_CLK_AUTO = BIT_RNG(0, 1), 191 }; 192 193 #define reg_rf_rxdma_hs REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x2c) 194 enum { 195 FLD_RF_RXDMA_HS = BIT(0), 196 }; 197 198 #define reg_rf_rxtcrcpkt REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x30) 199 enum { 200 FLD_RF_FILTER_CRC_PKT = BIT(0), 201 FLD_RF_EN_TS_RX = BIT(2), 202 FLD_RF_EN_TS_TX = BIT(3), 203 FLD_RF_LEN_SET_O = BIT_RNG(4, 5), 204 }; 205 206 #define reg_rf_rxtmaxlen REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x31) 207 208 #define reg_rf_rxlatf REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x33) 209 enum { 210 FLD_RF_R_LATF_CNT_O = BIT_RNG(0, 3), 211 FLD_RF_R_LATF_AT_END_O = BIT(4), 212 }; 213 214 #define reg_rf_bank_cnt REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x34) 215 enum { 216 FLD_RF_BANK_CNT = BIT_RNG(0, 2), 217 }; 218 219 #define reg_rf_rxsupp REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x38) 220 enum { 221 FLD_RF_RX_SUPP_D_EN = BIT(0), 222 FLD_RF_RX_SUPP_A_EN = BIT(1), 223 FLD_RF_TX_SUPP_D_EN = BIT(2), 224 FLD_RF_TX_SUPP_A_EN = BIT(3), 225 FLD_RF_ANT_NUM = BIT_RNG(4, 7), 226 }; 227 228 #define reg_rf_tx_antoffset REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x39) 229 #define reg_rf_rx_antoffset REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x3a) 230 #define reg_rf_samp_offset REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x3b) 231 232 #define reg_rf_man_ant_slot REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x3c) 233 enum { 234 FLD_RF_ANT_SEL_MAN = BIT_RNG(0, 2), 235 FLD_RF_ANT_SEL_MAN_EN = BIT(3), 236 FLD_RF_SLOT_1US_MAN_EN = BIT(4), 237 FLD_RF_SLOT_1US_MAN = BIT(5), 238 FLD_RF_ANT_PAT = BIT_RNG(6, 7), 239 }; 240 241 #define reg_rf_sof_offset REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x3d) 242 enum { 243 FLD_RF_ANT_SOF_OFFSET = BIT_RNG(0, 1), 244 FLD_RF_SAMP_SOF_OFFSET = BIT_RNG(2, 3), 245 FLD_RF_SUPP_MODE = BIT_RNG(4, 6), 246 }; 247 248 #define reg_rf_mode_ctrl0 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x3e) 249 enum { 250 FLD_RF_INTV_MODE = BIT_RNG(0, 1), 251 FLD_RF_IQ_SAMP_EN = BIT(2), 252 FLD_RF_IQ_SAMP_INTERVAL = BIT_RNG(4, 7), 253 }; 254 255 #define reg_rf_iq_samp_start REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x3f) 256 257 #define reg_rf_dec_err REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x40) 258 enum { 259 FLD_RF_SS = BIT_RNG(0, 2), 260 FLD_RF_PKT_DEC_ERR = BIT_RNG(4, 7), 261 }; 262 263 #define reg_rf_timestamp REG_ADDR32(REG_BASEBAND_BASE_ADDR + 0x50) 264 #define reg_rf_tstamp0 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x50) 265 enum { 266 FLD_RF_R_TSTAMP0 = BIT_RNG(0, 7), 267 }; 268 269 #define reg_rf_tstamp1 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x51) 270 enum { 271 FLD_RF_R_TSTAMP1 = BIT_RNG(0, 7), 272 }; 273 274 #define reg_rf_tstamp2 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x52) 275 enum { 276 FLD_RF_R_TSTAMP2 = BIT_RNG(0, 7), 277 }; 278 279 #define reg_rf_tstamp3 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x53) 280 enum { 281 FLD_RF_R_TSTAMP3 = BIT_RNG(0, 7), 282 }; 283 284 #define reg_rf_ant_lut_0 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x68) 285 enum { 286 FLD_RF_ANT_LUT0 = BIT_RNG(0, 2), 287 FLD_RF_ANT_LUT1 = BIT_RNG(4, 6), 288 }; 289 290 #define reg_rf_rxdma_adr 0x140880 291 #define reg_rf_rxdma_fifo0 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x80) 292 enum { 293 FLD_RF_RXDMA_FIFO0 = BIT_RNG(0, 7), 294 }; 295 296 #define reg_rf_rxdma_fifo1 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x81) 297 enum { 298 FLD_RF_RXDMA_FIFO1 = BIT_RNG(0, 7), 299 }; 300 301 #define reg_rf_rxdma_fifo2 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x82) 302 enum { 303 FLD_RF_RXDMA_FIFO2 = BIT_RNG(0, 7), 304 }; 305 306 #define reg_rf_rxdma_fifo3 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x83) 307 enum { 308 FLD_RF_RXDMA_FIFO3 = BIT_RNG(0, 7), 309 }; 310 311 #define reg_rf_txdma_adr 0x140884 312 #define reg_rf_txdma_fifo0 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x84) 313 enum { 314 FLD_RF_TXDMA_FIFO0 = BIT_RNG(0, 7), 315 }; 316 317 #define reg_rf_txdma_fifo1 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x85) 318 enum { 319 FLD_RF_TXDMA_FIFO1 = BIT_RNG(0, 7), 320 }; 321 322 #define reg_rf_txdma_fifo2 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x86) 323 enum { 324 FLD_RF_TXDMA_FIFO2 = BIT_RNG(0, 7), 325 }; 326 327 #define reg_rf_txdma_fifo3 REG_ADDR8(REG_BASEBAND_BASE_ADDR + 0x87) 328 enum { 329 FLD_RF_TXDMA_FIFO3 = BIT_RNG(0, 7), 330 }; 331 332 /** 333 * BB_LL 334 */ 335 #define REG_BB_LL_BASE_ADDR 0x0140a00 336 337 #define reg_rf_ll_cmd REG_ADDR8(REG_BB_LL_BASE_ADDR) 338 enum { 339 FLD_RF_R_CMD = BIT_RNG(0, 3), 340 FLD_RF_R_STOP = 0, 341 FLD_RF_R_BTX = 1, 342 FLD_RF_R_BRX = 2, 343 FLD_RF_R_PTX = 3, 344 FLD_RF_R_PRX = 4, 345 FLD_RF_R_STX = 5, 346 FLD_RF_R_SRX = 6, 347 FLD_RF_R_STR = 7, 348 FLD_RF_R_SRT = 8, 349 FLD_RF_R_CMD_TRIG = BIT(7), 350 }; 351 352 #define reg_rf_ll_rest_pid REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x01) 353 enum { 354 FLD_RF_R_RESET_PID_0 = BIT(0), 355 FLD_RF_R_RESET_PID_1 = BIT(1), 356 FLD_RF_R_RESET_PID_2 = BIT(2), 357 FLD_RF_R_RESET_PID_3 = BIT(3), 358 FLD_RF_R_RESET_PID_4 = BIT(4), 359 FLD_RF_R_RESET_PID_5 = BIT(5), 360 }; 361 362 #define reg_rf_ll_ctrl0 REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x02) 363 enum { 364 FLD_RF_R_MD_EN = BIT(0), 365 FLD_RF_R_ID_EN = BIT(1), 366 FLD_RF_R_RX_NOACK_MAN = BIT(2), 367 FLD_RF_R_RX_NOACK_MAN_EN = BIT(3), 368 FLD_RF_R_TX_EN_MAN = BIT(4), 369 FLD_RF_R_RX_EN_MAN = BIT(5), 370 FLD_RF_R_TX_TRIQ_AUTO_EN = BIT(6), 371 FLD_RF_R_S_TX_TIMEOUT_EN = BIT(7), 372 }; 373 374 #define reg_rf_ll_ctrl_1 REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x03) 375 376 enum { 377 FLD_RF_FSM_TIMEOUT_EN = BIT(0), 378 FLD_RF_RX_FIRST_TIMEOUT_EN = BIT(1), 379 FLD_RF_RX_TIMEOUT_EN = BIT(2), 380 FLD_RF_CRC_2_EN = BIT(3), 381 382 // BLE mode 383 FLD_RF_BRX_SN_INIT = BIT(4), 384 FLD_RF_BRX_NESN_INIT = BIT(5), 385 FLD_RF_BTX_SN_INIT = BIT(6), 386 FLD_RF_BTX_NESN_INIT = BIT(7), 387 }; 388 389 #define FSM_TIMEOUT_ENABLE (reg_rf_ll_ctrl_1 |= FLD_RF_FSM_TIMEOUT_EN) 390 #define FSM_TIMEOUT_DISABLE (reg_rf_ll_ctrl_1 &= (~FLD_RF_FSM_TIMEOUT_EN)) 391 392 #define reg_rf_ll_tx_stl REG_ADDR16(REG_BB_LL_BASE_ADDR + 0x04) 393 394 #define reg_rf_ll_tx_stl_l REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x04) 395 396 #define reg_rf_ll_tx_stl_h REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x05) 397 enum { 398 FLD_RF_R_T_TXSTL_H = BIT_RNG(0, 3), 399 }; 400 401 #define reg_rf_ll_rxwait_l REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x06) 402 403 #define reg_rf_ll_rxwait_h REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x07) 404 enum { 405 FLD_RF_R_T_RXWAIT_H = BIT_RNG(0, 3), 406 }; 407 408 #define reg_rf_ll_rx_l REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x0a) 409 410 #define reg_rf_rx_timeout REG_ADDR16(REG_BB_LL_BASE_ADDR + 0x0a) 411 412 #define reg_rf_ll_rx_h REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x0b) 413 enum { 414 FLD_RF_R_T_RX_H = BIT_RNG(0, 3), 415 }; 416 417 #define reg_rf_ll_rxstl_l REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x0c) 418 419 #define reg_rf_ll_rxstl_h REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x0d) 420 enum { 421 FLD_RF_R_T_RXSTL_H = BIT_RNG(0, 3), 422 }; 423 424 #define reg_rf_ll_txwait_l REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x0e) 425 426 #define reg_rf_ll_txwait_h REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x0f) 427 enum { 428 FLD_RF_R_T_TXWAIT_H = BIT_RNG(0, 3), 429 }; 430 431 #define reg_rf_ll_ard_l REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x10) 432 433 #define reg_rf_ll_ard_h REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x11) 434 enum { 435 FLD_RF_R_T_ARD_H = BIT_RNG(0, 3), 436 }; 437 438 #define reg_rf_t_coex_t1 REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x12) 439 #define reg_rf_t_coex_t2 REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x13) 440 #define reg_rf_ll_max_reset_cnt REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x14) 441 442 #define reg_rf_ll_ctrl2 REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x15) 443 enum { 444 FLD_RF_R_TXCHN_MAN = BIT_RNG(0, 2), 445 FLD_RF_R_NOACK_RECNT_EN = BIT(3), 446 FLD_RF_R_TXCHN_MAN_EN = BIT(4), 447 FLD_RF_R_NOACK_REV_EN = BIT(5), 448 FLD_RF_R_RXIRQ_REPORT_ALL = BIT(6), 449 FLD_RF_R_REP_SN_PID_EN = BIT(7), 450 }; 451 452 #define reg_rf_ll_ctrl3 REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x16) 453 enum { 454 FLD_RF_R_TX_EN_DLY_EN = BIT(0), 455 FLD_RF_R_PLL_RESET_EN = BIT(1), 456 FLD_RF_R_CMD_SCHDULE_EN = BIT(2), 457 FLD_RF_R_PLL_EN_MAN = BIT(3), 458 FLD_RF_R_T_TX_EN_DLY = BIT_RNG(4, 7), 459 }; 460 461 #define reg_rf_ll_pll_reset REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x17) 462 #define reg_rf_ll_cmd_schedule REG_ADDR32(REG_BB_LL_BASE_ADDR + 0x18) 463 #define reg_rf_ll_cmd_schedule0 REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x18) 464 #define reg_rf_ll_cmd_schedule1 REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x19) 465 #define reg_rf_ll_cmd_schedule2 REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x1a) 466 #define reg_rf_ll_cmd_schedule3 REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x1b) 467 #define reg_rf_ll_irq_mask_l REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x1c) 468 #define reg_rf_ll_irq_mask_h REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x1d) 469 #define reg_rf_irq_mask REG_ADDR16(REG_BB_LL_BASE_ADDR + 0x1c) 470 471 #define reg_rf_ll_tx_id REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x1e) 472 enum { 473 FLD_RF_R_TX_ID = BIT_RNG(0, 6), 474 }; 475 476 #define reg_rf_ll_tx_committed REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x1f) 477 enum { 478 FLD_RF_R_TX_COMMITTED = BIT_RNG(0, 5), 479 }; 480 481 #define reg_rf_irq_status REG_ADDR16(REG_BB_LL_BASE_ADDR + 0x20) 482 483 typedef enum { 484 FLD_RF_IRQ_RX = BIT(0), 485 FLD_RF_IRQ_TX = BIT(1), 486 FLD_RF_IRQ_RX_TIMEOUT = BIT(2), 487 FLD_RF_IRQ_RX_FIFO_FULL = BIT(3), 488 FLD_RF_IRQ_RX_CRC_2 = BIT(4), 489 FLD_RF_IRQ_CMD_DONE = BIT(5), 490 FLD_RF_IRQ_FSM_TIMEOUT = BIT(6), 491 FLD_RF_IRQ_TX_RETRYCNT = BIT(7), 492 FLD_RF_IRQ_TX_DS = BIT(8), 493 FLD_RF_IRQ_RX_DR = BIT(9), 494 FLD_RF_IRQ_FIRST_TIMEOUT = BIT(10), 495 FLD_RF_IRQ_INVALID_PID = BIT(11), 496 FLD_RF_IRQ_STX_TIMEOUT = BIT(12), 497 FLD_RF_IRQ_WIFI_DENY = BIT(13), 498 FLD_RF_IRQ_SUPP_OF = BIT(14), 499 FLD_RF_IRQ_RXDMA_OF = BIT(15), 500 FLD_RF_IRQ_ALL = 0X1FFF, 501 } rf_irq_e; 502 503 #define reg_rf_ll_pid_l REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x22) 504 enum { 505 FLD_RF_PID0 = BIT_RNG(0, 1), 506 FLD_RF_PID1 = BIT_RNG(2, 3), 507 FLD_RF_PID2 = BIT_RNG(4, 5), 508 FLD_RF_PID3 = BIT_RNG(6, 7), 509 }; 510 511 #define reg_rf_ll_pid_h REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x23) 512 enum { 513 FLD_RF_PID4 = BIT_RNG(0, 1), 514 FLD_RF_PID5 = BIT_RNG(2, 3), 515 FLD_RF_NESN = BIT(4), 516 }; 517 518 #define reg_rf_ll_2d_sclk REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x24) 519 typedef enum { 520 FLD_RF_STATE_MACHINE_IDLE = 0, /**< idle */ 521 FLD_RF_STATE_MACHINE_TX_SETTLE, /**< tx settle*/ 522 FLD_RF_STATE_MACHINE_TX, /**< tx */ 523 FLD_RF_STATE_MACHINE_RX_WAIT, /**< rx wait */ 524 FLD_RF_STATE_MACHINE_RX, /**< rx */ 525 FLD_RF_STATE_MACHINE_TX_WAIT, /**< tx wait */ 526 } state_machine_status_e; 527 528 #define reg_rf_ll_retry_cnt REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x25) 529 enum { 530 FLD_RF_LL_RETRY_CNT = BIT_RNG(0, 7), 531 }; 532 533 #define reg_rf_ll_cnt0 REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x26) 534 enum { 535 FLD_RF_CRC_CNT = BIT_RNG(0, 3), 536 FLD_RF_NAK_CNT = BIT_RNG(4, 7), 537 }; 538 539 #define reg_rf_ll_cnt1 REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x27) 540 enum { 541 FLD_RF_OLD_CNT = BIT_RNG(0, 3), 542 FLD_RF_ID_CNT = BIT_RNG(4, 7), 543 }; 544 545 #define reg_rf_ll_rx_fst_timeout REG_ADDR32(REG_BB_LL_BASE_ADDR + 0x28) 546 #define reg_rf_ll_rx_fst_l REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x28) 547 #define reg_rf_ll_rx_fst_m REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x29) 548 #define reg_rf_ll_rx_fst_h REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x2a) 549 550 #define reg_rf_ll_fsm_timeout REG_ADDR32(REG_BB_LL_BASE_ADDR + 0x2c) 551 #define reg_rf_ll_fsm_timeout_l REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x2c) 552 #define reg_rf_ll_fsm_timeout_m REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x2d) 553 #define reg_rf_ll_fsm_timeout_h REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x2e) 554 555 #define reg_rf_fsm_timeout REG_ADDR32(0x80140a2c) 556 557 #define reg_rf_coex_enable REG_ADDR8(REG_BB_LL_BASE_ADDR + 0x30) 558 enum { 559 FLD_RF_COEX_EN = BIT(0), 560 FLD_RF_COEX_WF_DN_POL = BIT(1), 561 FLD_RF_COEX_STATUS = BIT(2), 562 FLD_RF_COEX_TRX_POL = BIT(3), 563 FLD_RF_TRX_PRIO = BIT(4), 564 FLD_RF_TX_PRIO = BIT(5), 565 FLD_RF_RX_PRIO = BIT(6), 566 }; 567 #define CLEAR_ALL_RFIRQ_STATUS (reg_rf_irq_status = 0xffff) 568 #define REG_TL_MODEM_BASE_ADDR 0x140c00 // 140c00 569 570 #define reg_rf_modem_mode_cfg_rx1_0 REG_ADDR8(REG_TL_MODEM_BASE_ADDR + 0x20) 571 enum { 572 FLD_RF_LR_MODE = BIT(0), 573 FLD_RF_BT_BLE_SEL_AUTO = BIT(1), 574 FLD_RF_BT_BLE_SEL_EN_RX = BIT(2), 575 FLD_RF_CONT_MODE = BIT(3), 576 FLD_RF_NTL_CV = BIT(4), 577 FLD_RF_RX_DATA_CLK_DBG = BIT(5), 578 FLD_RF_LR_TRIG_MODE = BIT(6), 579 FLD_RF_FDC_DBG_SEL = BIT(7), 580 }; 581 #define reg_rf_modem_mode_ctrl_tx1_0 REG_ADDR8(REG_TL_MODEM_BASE_ADDR + 0x22) 582 enum { 583 FLD_RF_BLE_MODEM_TX = BIT(0), 584 }; 585 586 #define reg_rf_modem_rx_ctrl_0 REG_ADDR8(REG_TL_MODEM_BASE_ADDR + 0x4c) 587 enum { 588 FLD_RF_RX_ACC_LNE = BIT_RNG(0, 2), 589 FLD_RF_RX_CRC_EN = BIT(3), 590 FLD_RF_SFD0_NUM = BIT_RNG(4, 6), 591 }; 592 593 #define reg_rf_modem_sync_thre_ble REG_ADDR8(REG_TL_MODEM_BASE_ADDR + 0x4e) 594 595 #define reg_rf_agc_rssi_lat REG_ADDR8(REG_TL_MODEM_BASE_ADDR + 0x5d) 596 597 #define reg_rf_tx_tl_ctrl REG_ADDR8(REG_TL_MODEM_BASE_ADDR + 0x9a) 598 enum { 599 FLD_RF_TX_TP_EN = BIT(0), 600 FLD_RF_TX_IQ_EN = BIT(1), 601 FLD_RF_TX_MPSK_EN = BIT(2), 602 FLD_RF_TX_TP_ALIGN = BIT(3), 603 }; 604 605 #define reg_rf_mode_cfg_rx1_0 REG_ADDR8(REG_TL_RADIO_BASE_ADDR + 0x20) 606 enum { 607 FLD_RF_BW_CODE = BIT_RNG(1, 3), 608 FLD_RF_SC_CODE = BIT(4), 609 }; 610 611 #define reg_rf_mode_cfg_rx1_1 REG_ADDR8(REG_TL_RADIO_BASE_ADDR + 0x21) 612 enum { 613 FLD_RF_MODE_VANT_RX = BIT(1), 614 FLD_RF_FE_RTRIM_RX = BIT_RNG(2, 4), 615 FLD_RF_IF_FREQ = BIT_RNG(5, 6), 616 }; 617 618 #define reg_rf_mode_cfg_tx1_0 REG_ADDR8(REG_TL_RADIO_BASE_ADDR + 0x22) 619 enum { 620 FLD_RF_BLE_MODE_TX = BIT(0), 621 FLD_RF_VCO_TRIM_KVM = BIT_RNG(1, 3), 622 FLD_RF_HPMC_EXP_DIFF_COUNT_L = BIT_RNG(4, 7), 623 }; 624 625 #define reg_rf_mode_cfg_tx1_1 REG_ADDR8(REG_TL_RADIO_BASE_ADDR + 0x23) 626 enum { 627 FLD_RF_HPMC_EXP_DIFF_COUNT_H = BIT_RNG(0, 4), 628 FLD_RF_DAC_TRIM_CFBK = BIT_RNG(5, 6), 629 }; 630 631 #define reg_rf_mode_cfg_txrx_0 REG_ADDR8(REG_TL_RADIO_BASE_ADDR + 0x26) 632 enum { 633 FLD_RF_DIS_CLK_DIG_O = BIT(0), 634 FLD_RF_VANT_PULLDN = BIT(1), 635 FLD_RF_GF_BT = BIT(2), 636 FLD_RF_LDO_ANT_TRIM = BIT_RNG(3, 5), 637 FLD_RF_CBPF_TYPE = BIT(6), 638 FLD_RF_TX_PA_PWR_L = BIT(7), 639 }; 640 641 #define reg_rf_mode_cfg_txrx_1 REG_ADDR8(REG_TL_RADIO_BASE_ADDR + 0x27) 642 643 enum { 644 FLD_RF_TX_PA_PWR_H = BIT_RNG(0, 4), 645 }; 646 647 #define reg_rf_burst_cfg_txrx_0 REG_ADDR8(REG_TL_RADIO_BASE_ADDR + 0x28) 648 enum { 649 FLD_RF_CHNL_NUM = BIT_RNG(0, 7), 650 }; 651 652 #define reg_rf_burst_cfg_txrx_1 REG_ADDR8(REG_TL_RADIO_BASE_ADDR + 0x29) 653 enum { 654 FLD_RF_CH_NUMLL_SEL = BIT(0), 655 FLD_RF_TX_EN_PIF = BIT(1), 656 FLD_RF_RX_EN_PIF = BIT(2), 657 FLD_RF_RX_TIM_SRQ_SEL_TESQ = BIT(3), 658 FLD_RF_TX_TIM_SRQ_SEL_TESQ = BIT(4), 659 FLD_RF_FE_CTRIM = BIT_RNG(5, 7), 660 }; 661 662 #define reg_rf_mode_cfg_tx3_0 REG_ADDR8(REG_TL_RADIO_BASE_ADDR + 0x3c) 663 enum { 664 FLD_RF_MODE_CFG_TX3 = BIT_RNG(0, 5), 665 FLD_RF_MODE_VANT_TX_BLE = BIT(6), 666 FLD_RF_TX_IQ_MODE_EN_BLE = BIT(7), 667 }; 668 669 #define reg_rf_mode_cfg_tx3_1 REG_ADDR8(REG_TL_RADIO_BASE_ADDR + 0x3d) 670 enum { 671 FLD_RF_LDO_ANT_TRIM_BLE = BIT_RNG(0, 2), 672 FLD_RF_BT_BLE_SEL_EN = BIT(3), 673 FLD_RF_TXC_PWR_SRL = BIT(4), 674 FLD_RF_BW_CODE_BLE = BIT_RNG(5, 7), 675 }; 676 677 #define reg_rf_txrx_dbg3_0 REG_ADDR8(REG_TL_RADIO_BASE_ADDR + 0x44) 678 enum { 679 FLD_RF_CHNL_FREQ_DIRECT = BIT(0), 680 FLD_RF_CHNL_FREQ_L = BIT_RNG(1, 7), 681 }; 682 683 #define reg_rf_txrx_dbg3_1 REG_ADDR8(REG_TL_RADIO_BASE_ADDR + 0x45) 684 enum { 685 FLD_RF_CHNL_FREQ_H = BIT_RNG(0, 5), 686 FLD_RF_DSN_DITHER_DISABLE = BIT(6), 687 FLD_RF_DSM_INT_MODE = BIT(7), 688 }; 689 690 #endif 691