rf_drv.h
Go to the documentation of this file.
1 /********************************************************************************************************
2  * @file rf_drv.h
3  *
4  * @brief This is the header file for TLSR8258
5  *
6  * @author Driver Group
7  * @date May 8, 2018
8  *
9  * @par Copyright (c) 2018, Telink Semiconductor (Shanghai) Co., Ltd.
10  * All rights reserved.
11  *
12  * The information contained herein is confidential property of Telink
13  * Semiconductor (Shanghai) Co., Ltd. and is available under the terms
14  * of Commercial License Agreement between Telink Semiconductor (Shanghai)
15  * Co., Ltd. and the licensee or the terms described here-in. This heading
16  * MUST NOT be removed from this file.
17  *
18  * Licensees are granted free, non-transferable use of the information in this
19  * file under Mutual Non-Disclosure Agreement. NO WARRENTY of ANY KIND is provided.
20  * @par History:
21  * 1.initial release(DEC. 26 2018)
22  *
23  * @version A001
24  *
25  *******************************************************************************************************/
26 #ifndef _RF_DRV_H_
27 #define _RF_DRV_H_
28 
29 #include "bsp.h"
30 #include "compiler.h"
31 #include "gpio_8258.h"
32 #define RF_CHN_TABLE 0x8000
33 
34 
35 
39 typedef enum {
53 
54 
59 typedef enum {
64 
65 
66 
67 
71 typedef enum {
76 
77 
81 typedef enum {
86 
90 typedef enum {
91  /*VBAT*/
92  RF_POWER_P10p46dBm = 63, // 10.46 dbm
93  RF_POWER_P10p29dBm = 61, // 10.29 dbm
94  RF_POWER_P10p01dBm = 58, // 10.01 dbm
95  RF_POWER_P9p81dBm = 56, // 9.81 dbm
96  RF_POWER_P9p48dBm = 53, // 9.48 dbm
97  RF_POWER_P9p24dBm = 51, // 9.24 dbm
98  RF_POWER_P8p97dBm = 49, // 8.97 dbm
99  RF_POWER_P8p73dBm = 47, // 8.73 dbm
100  RF_POWER_P8p44dBm = 45, // 8.44 dbm
101  RF_POWER_P8p13dBm = 43, // 8.13 dbm
102  RF_POWER_P7p79dBm = 41, // 7.79 dbm
103  RF_POWER_P7p41dBm = 39, // 7.41 dbm
104  RF_POWER_P7p02dBm = 37, // 7.02 dbm
105  RF_POWER_P6p60dBm = 35, // 6.60 dbm
106  RF_POWER_P6p14dBm = 33, // 6.14 dbm
107  RF_POWER_P5p65dBm = 31, // 5.65 dbm
108  RF_POWER_P5p13dBm = 29, // 5.13 dbm
109  RF_POWER_P4p57dBm = 27, // 4.57 dbm
110  RF_POWER_P3p94dBm = 25, // 3.94 dbm
111  RF_POWER_P3p23dBm = 23, // 3.23 dbm
112  /*VANT*/
113  RF_POWER_P3p01dBm = BIT(7) | 63, // 3.01 dbm
114  RF_POWER_P2p81dBm = BIT(7) | 61, // 2.81 dbm
115  RF_POWER_P2p61dBm = BIT(7) | 59, // 2.61 dbm
116  RF_POWER_P2p39dBm = BIT(7) | 57, // 2.39 dbm
117  RF_POWER_P1p99dBm = BIT(7) | 54, // 1.99 dbm
118  RF_POWER_P1p73dBm = BIT(7) | 52, // 1.73 dbm
119  RF_POWER_P1p45dBm = BIT(7) | 50, // 1.45 dbm
120  RF_POWER_P1p17dBm = BIT(7) | 48, // 1.17 dbm
121  RF_POWER_P0p90dBm = BIT(7) | 46, // 0.90 dbm
122  RF_POWER_P0p58dBm = BIT(7) | 44, // 0.58 dbm
123  RF_POWER_P0p04dBm = BIT(7) | 41, // 0.04 dbm
124  RF_POWER_N0p14dBm = BIT(7) | 40, // -0.14 dbm
125  RF_POWER_N0p97dBm = BIT(7) | 36, // -0.97 dbm
126  RF_POWER_N1p42dBm = BIT(7) | 34, // -1.42 dbm
127  RF_POWER_N1p89dBm = BIT(7) | 32, // -1.89 dbm
128  RF_POWER_N2p48dBm = BIT(7) | 30, // -2.48 dbm
129  RF_POWER_N3p03dBm = BIT(7) | 28, // -3.03 dbm
130  RF_POWER_N3p61dBm = BIT(7) | 26, // -3.61 dbm
131  RF_POWER_N4p26dBm = BIT(7) | 24, // -4.26 dbm
132  RF_POWER_N5p03dBm = BIT(7) | 22, // -5.03 dbm
133  RF_POWER_N5p81dBm = BIT(7) | 20, // -5.81 dbm
134  RF_POWER_N6p67dBm = BIT(7) | 18, // -6.67 dbm
135  RF_POWER_N7p65dBm = BIT(7) | 16, // -7.65 dbm
136  RF_POWER_N8p65dBm = BIT(7) | 14, // -8.65 dbm
137  RF_POWER_N9p89dBm = BIT(7) | 12, // -9.89 dbm
138  RF_POWER_N11p4dBm = BIT(7) | 10, // -11.4 dbm
139  RF_POWER_N13p29dBm = BIT(7) | 8, // -13.29 dbm
140  RF_POWER_N15p88dBm = BIT(7) | 6, // -15.88 dbm
141  RF_POWER_N19p27dBm = BIT(7) | 4, // -19.27 dbm
142  RF_POWER_N25p18dBm = BIT(7) | 2, // -25.18 dbm
143 
144  RF_POWER_N30dBm = 0xff, // -30 dbm
145  RF_POWER_N50dBm = BIT(7) | 0, // -50 dbm
146 
148 
149 extern const RF_PowerTypeDef rf_power_Level_list[60];
150 
151 #ifdef RF_MODE_250K
152 #define RF_FAST_MODE_2M 0
153 #define RF_FAST_MODE_1M 0
154 #endif
155 
156 #ifndef RF_FAST_MODE_1M
157 #define RF_FAST_MODE_1M 1
158 #endif
159 
160 #ifndef RF_FAST_MODE_2M
161 #define RF_FAST_MODE_2M 0
162 #endif
163 
164 #ifndef RF_LONG_PACKET_EN
165 #define RF_LONG_PACKET_EN 0
166 #endif
167 
168 #if RF_FAST_MODE_2M
169  #if RF_LONG_PACKET_EN
170  #define RF_PACKET_LENGTH_OK(p) (p[0] == p[12]+13)
171  #define RF_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x51) == 0x40)
172  #else
173  #define RF_PACKET_LENGTH_OK(p) (p[0] == (p[12]&0x3f)+15)
174  #define RF_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x51) == 0x40)
175  #endif
176 #elif RF_FAST_MODE_1M
177  #define RF_BLE_PACKET_LENGTH_OK(p) ( *((unsigned int*)p) == p[5]+13) //dma_len must 4 byte aligned
178  #define RF_BLE_PACKET_CRC_OK(p) ((p[*((unsigned int*)p) + 3] & 0x01) == 0x0)
179 
180  #if (1) // support RF RX/TX MAX data Length: 251byte
181  #define RF_PACKET_LENGTH_OK(p) (MAKE_U16(p[1], p[0]) == p[5]+13)
182  #define RF_PACKET_CRC_OK(p) ((p[MAKE_U16(p[1], p[0])+3] & 0x01) == 0x0)
183  #else
184  #define RF_PACKET_LENGTH_OK(p) (p[0] == p[5]+13)
185  #define RF_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x01) == 0x0)
186  #endif
187 #else
188 #define RF_PACKET_LENGTH_OK(p) (p[0] == p[12]+13)
189 #define RF_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x51) == 0x10)
190 #endif
191 
192 #define RF_PACKET_1M_LENGTH_OK(p) (p[0] == p[5]+13)
193 #define RF_PACKET_2M_LENGTH_OK(p) (p[0] == (p[12]&0x3f)+15)
194 
195 
196 #if (RF_FAST_MODE_2M)
197  #define RF_FAST_MODE 1
198  #define RF_TRX_MODE 0x80
199  #define RF_TRX_OFF 0x44 //f02
200 #elif (RF_FAST_MODE_1M)
201  #define RF_FAST_MODE 1
202  #define RF_TRX_MODE 0x80
203  #define RF_TRX_OFF 0x45 //f02
204 #else
205  #define RF_FAST_MODE 0
206  #define RF_TRX_MODE 0xe0
207  #define RF_TRX_OFF 0x45 //f02
208 #endif
209 
210 
211 
212 #define RF_ZIGBEE_PACKET_LENGTH_OK(p) (p[0] == p[4]+9)
213 #define RF_ZIGBEE_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x51) == 0x10)
214 #define RF_ZIGBEE_PACKET_RSSI_GET(p) (p[p[0]+2])
215 #define RF_ZIGBEE_PACKET_TIMESTAMP_GET(p) (p[p[0]-4] | (p[p[0]-3]<<8) | (p[p[0]-2]<<16) | (p[p[0]-1]<<24))
216 #define RF_ZIGBEE_PACKET_PAYLOAD_LENGTH_GET(p) (p[4])
217 #define RF_NRF_ESB_PACKET_LENGTH_OK(p) (p[0] == (p[4] & 0x3f) + 11)
218 #define RF_NRF_ESB_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x01) == 0x00)
219 #define RF_NRF_ESB_PACKET_RSSI_GET(p) (p[p[0]+2])
220 #define RF_NRF_SB_PACKET_PAYLOAD_LENGTH_GET(p) (p[0] - 10)
221 #define RF_NRF_SB_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x01) == 0x00)
222 #define RF_NRF_SB_PACKET_CRC_GET(p) ((p[p[0]-8]<<8) + p[p[0]-7]) //Note: here assume that the MSByte of CRC is received first
223 #define RF_NRF_SB_PACKET_RSSI_GET(p) (p[p[0]+2])
224 #define RF_NRF_ESB_PACKET_TIMESTAMP_GET(p) (p[p[0]-4] | (p[p[0]-3]<<8) | (p[p[0]-2]<<16) | (p[p[0]-1]<<24))
225 #define RF_NRF_SB_PACKET_TIMESTAMP_GET(p) (p[p[0]-4] | (p[p[0]-3]<<8) | (p[p[0]-2]<<16) | (p[p[0]-1]<<24))
226 
227 
228 
229 
230 /******************************* General APIs **************************/
231 
237 static inline void reset_baseband(void)
238 {
239  REG_ADDR8(0x61) = BIT(0); //reset_baseband
240  REG_ADDR8(0x61) = 0; //release reset signal
241 }
242 
249 extern void rf_drv_init (RF_ModeTypeDef rf_mode);
250 
256 extern void rf_set_power_level_index (RF_PowerTypeDef level);
257 
263 extern void rf_set_power_level_index_zgb (int level_idx);
264 
270 extern signed char rf_get_tx_power_level(void);
276 extern void rf_acc_len_set(unsigned char len);
283 static inline unsigned char rf_acc_len_get(unsigned char len)
284 {
285  return (read_reg8(0x405) & 0x07);
286 }
293 extern void rf_acc_code_set(unsigned char pipe_id, const unsigned char *addr);
300 extern void rf_acc_code_get(unsigned char pipe_id, unsigned char *addr);
307 extern void rf_set_channel (signed char chn, unsigned short set);
308 
309 
315 static inline void rf_access_code_comm (unsigned int acc)
316 {
317  write_reg32 (0x800408, acc);
318  //notice: This state will be reset after reset baseband
319  write_reg8 (0x800405, read_reg8(0x405)|0x80);//setting acess code needs to writ 0x405 access code trigger bit 1 to enable in long range mode,,and the mode of BLE1M and BLE2M need not.
320 }
321 
327 static inline void rf_longrange_access_code_comm (unsigned int acc)
328 {
329  write_reg32 (0x800408, acc);
330  write_reg8 (0x800405, read_reg8(0x405)|0x80);//setting acess code needs to writ 0x405 access code trigger bit to enable in long range mode,,and the mode of BLE1M and BLE2M need not.
331 }
332 
333 
343 static inline void rf_rx_acc_code_enable(unsigned char pipe)
344 {
345  write_reg8(0x407, (read_reg8(0x407)&0xc0) | pipe); //rx_access_code_chn_en
346 }
347 
356 static inline void rf_tx_acc_code_select(unsigned char pipe)
357 {
358  write_reg8(0xf15, (read_reg8(0xf15)&0xf8) | pipe); //Tx_Channel_man[2:0]
359 }
360 
367 static inline void rf_set_tx_rx_off(void)
368 {
369  write_reg8 (0x800f16, 0x29);
370  write_reg8 (0x800428, RF_TRX_MODE); // rx disable
371  write_reg8 (0x800f02, RF_TRX_OFF); // reset tx/rx state machine
372 }
378 static inline void rf_set_tx_rx_off_auto_mode(void)
379 {
380  write_reg8 (0xf00, 0x80);
381 }
389 extern int rf_trx_state_set(RF_StatusTypeDef rf_status, signed char rf_channel);
396 
402 static inline void rf_set_txmode (void)
403 {
404  write_reg8 (0x800f02, RF_TRX_OFF | BIT(4)); //TX enable
405 }
406 
412 static inline void tx_settle_adjust(unsigned short txstl_us)
413 {
414  REG_ADDR16(0xf04) = txstl_us;
415 }
416 
422 static inline void rf_set_tx_pipe (unsigned char pipe)
423 {
424  write_reg8 (0x800f15, 0xf0 | pipe);
425 }
431 extern void rf_tx_pkt(unsigned char * addr);
437 extern void rf_tx_pkt_auto (void* addr);
438 
444 static inline unsigned char rf_tx_finish(void)
445 {
446  return ((read_reg8(0xf20) & BIT(1))==0x02);
447 }
448 
458 static inline void rf_tx_finish_clear_flag(void)
459 {
460  write_reg8(0xf20, read_reg8(0xf20) | 0x02);
461 }
462 
463 
464 
471 static inline unsigned char rf_is_rx_finish(void)
472 {
473  return (unsigned char)((read_reg8(0xf20) & BIT(0))==0x01);
474 }
475 
494 extern void rf_rx_buffer_set(unsigned char * RF_RxAddr, int size, unsigned char PingpongEn);
495 
503 static inline void rf_rx_buffer_reconfig(unsigned short RF_RxAddr)
504 {
505  reg_dma2_addr = (unsigned short)(RF_RxAddr);
506 }
507 
513 static inline unsigned char rf_is_rx_right(void)
514 {
515  return ((REG_ADDR8(0x44f)&0x0f)==0);
516 }
517 
527 static inline void rf_rx_finish_clear_flag(void)
528 {
529  write_reg8(0xf20, read_reg8(0xf20) | 0x01);
530 }
531 
537 static inline void rf_set_rxmode (void)
538 {
539  write_reg8 (0x800428, RF_TRX_MODE | BIT(0)); //rx enable
540  write_reg8 (0x800f02, RF_TRX_OFF | BIT(5)); // RX enable
541 }
542 
550 extern void rf_start_btx (void* addr, unsigned int tick);
551 
561 extern void rf_start_brx (void* addr, unsigned int tick);
562 
570 extern void rf_start_stx (void* addr, unsigned int tick);
571 
577 extern void rf_start_srx (unsigned int tick);
578 
579 
598 extern void rf_start_stx2rx (void* addr, unsigned int tick);
599 
600 
601 
622 extern void rf_start_srx2tx (void* addr, unsigned int tick);
623 
624 
625 /******************************* Private APIs **************************/
626 
632 void rf_set_ble_channel (signed char chn_num);
633 
639 static inline void rf_ble_tx_on ()
640 {
641  write_reg8 (0x800f02, 0x45 | BIT(4)); // TX enable
642 }
643 
649 static inline void rf_ble_tx_done ()
650 {
651  write_reg8 (0x800f02, 0x45);
652 }
653 
659 static inline void reset_sn_nesn(void)
660 {
661  REG_ADDR8(0xf01) = 0x01;
662 }
663 
669 static inline void rf_reset_sn (void)
670 {
671  write_reg8 (0x800f01, 0x3f);
672  write_reg8 (0x800f01, 0x00);
673 }
674 
680 static inline void rf_set_ble_crc (unsigned char *p)
681 {
682  write_reg32 (0x800424, p[0] | (p[1]<<8) | (p[2]<<16));
683 }
684 
690 static inline void rf_set_ble_crc_value (unsigned int crc)
691 {
692  write_reg32 (0x800424, crc);
693 }
694 
700 static inline void rf_set_ble_crc_adv ()
701 {
702  write_reg32 (0x800424, 0x555555);
703 }
704 
710 static inline void rf_set_ble_access_code (unsigned char *p)
711 {
712  write_reg32 (0x800408, p[3] | (p[2]<<8) | (p[1]<<16) | (p[0]<<24));
713 }
714 
720 static inline void rf_set_ble_access_code_value (unsigned int ac)
721 {
722  write_reg32 (0x800408, ac);
723 }
724 
730 static inline void rf_set_ble_access_code_adv (void)
731 {
732  write_reg32 (0x800408, 0xd6be898e);
733 }
734 
740 static inline unsigned int rf_access_code_16to32 (unsigned short code)
741 {
742  unsigned int r = 0;
743  for (int i=0; i<16; i++) {
744  r = r << 2;
745  r |= code & BIT(i) ? 1 : 2;
746  }
747  return r;
748 }
749 
755 static inline unsigned short rf_access_code_32to16 (unsigned int code)
756 {
757  unsigned short r = 0;
758  for (int i=0; i<16; i++) {
759  r = r << 1;
760 
761  r |= (code & BIT(i*2)) ? 1 : 0;
762 
763  }
764  return r;
765 }
766 
767 
773 static inline unsigned char is_rf_receiving_pkt(void)
774 {
775  //if the value of [5:4] of the reg_0x448 is 0b10 or 0b11, it means that the RF is in the receiving packet phase.(confirmed by junwen)
776  return (((read_reg8(0x448)>>5)& 1) == 1);
777 }
778 
784 extern void rf_set_channel_500k(signed short chn, unsigned short set);
790 static inline void rf_fix_payload_len_set(int len)
791 {
792  write_reg8(0x404, read_reg8(0x404)|0x03); //select shockburst header mode
793  write_reg8(0x406, len);
794 }
795 
796 
803 extern void rf_rx_cfg(int size, unsigned char PingpongEn);
804 
812 extern unsigned short crc16_ccitt_cal(unsigned char *input, unsigned int len, unsigned short init_val);
813 
827 extern void rf_tx_500k_simulate_100k(unsigned char *preamble, unsigned char preamble_len,
828  unsigned char *acc_code, unsigned char acc_len,
829  unsigned char *payload, unsigned char pld_len,
830  unsigned char *tx_buf, unsigned short crc_init);
837 extern void rf_ed_detecct_154(void);
846 extern unsigned char rf_stop_ed_154(void);
847 
855 extern void rf_rffe_set_pin(RF_PATxPinDef tx_pin, RF_LNARxPinDef rx_pin);
856 
866 unsigned char rx_packet_process_1mbps(unsigned char *rx_buf, unsigned int len);
875 void tx_packet_process_1mbps(unsigned char *tx_buf, unsigned char *payload, unsigned int len);
876 
877 #endif
878 
879 
880  //end of GP11
Definition: rf_drv.h:107
Definition: rf_drv.h:129
Definition: rf_drv.h:121
Definition: rf_drv.h:113
Definition: rf_drv.h:118
static void rf_rx_acc_code_enable(unsigned char pipe)
this function is to enable/disable each access_code channel for RF Rx terminal.
Definition: rf_drv.h:343
Definition: gpio_8258.h:58
void rf_set_channel(signed char chn, unsigned short set)
This function serves to set RF&#39;s channel.
Definition: rf_drv.h:124
static void rf_rx_finish_clear_flag(void)
This function serves to clear the Rx finish flag bit. After all packet data are resive, corresponding Rx finish flag bit will be set as 1.By reading this flag bit, it can check whether packet transmission is finished. After the check, it¡¯s needed to manually clear this flag bit so as to avoid misjudgment.
Definition: rf_drv.h:527
Definition: gpio_8258.h:70
static unsigned char rf_tx_finish(void)
This function serves to determine whether sending a packet of data is finished.
Definition: rf_drv.h:444
RF_StatusTypeDef rf_trx_state_get(void)
This function serves to get RF status.
static void rf_access_code_comm(unsigned int acc)
This function serves to set RF access command.
Definition: rf_drv.h:315
Definition: rf_drv.h:117
Definition: rf_drv.h:142
Definition: rf_drv.h:48
void rf_rx_cfg(int size, unsigned char PingpongEn)
This function.
Definition: rf_drv.h:60
Definition: gpio_8258.h:73
Definition: rf_drv.h:83
static void rf_rx_buffer_reconfig(unsigned short RF_RxAddr)
This function serves to reconfigure the buffer.
Definition: rf_drv.h:503
static unsigned char rf_acc_len_get(unsigned char len)
this function performs to get access_code length.
Definition: rf_drv.h:283
RF_ModeTypeDef
Define RF mode.
Definition: rf_drv.h:39
void rf_set_ble_channel(signed char chn_num)
This function serves to set the ble channel.
Definition: rf_drv.h:137
#define RF_TRX_MODE
Definition: rf_drv.h:202
static unsigned short rf_access_code_32to16(unsigned int code)
This function serves to set RF access code 6bit to 32bit.
Definition: rf_drv.h:755
#define write_reg32(addr, v)
Definition: bsp.h:108
Definition: rf_drv.h:40
void rf_acc_len_set(unsigned char len)
this function is to Set byte length for access_code.
Definition: rf_drv.h:92
static void rf_set_tx_rx_off(void)
This function serves to reset RF Tx/Rx mode.
Definition: rf_drv.h:367
Definition: rf_drv.h:84
void tx_packet_process_1mbps(unsigned char *tx_buf, unsigned char *payload, unsigned int len)
This function process the tx packet in 1mbps shockburst mode only for hanshow for the compatiblity wi...
Definition: rf_drv.h:136
Definition: rf_drv.h:46
RF_LNARxPinDef
Define RX pin of RF for RFFE.
Definition: rf_drv.h:71
Definition: rf_drv.h:94
Definition: rf_drv.h:101
static void rf_set_tx_rx_off_auto_mode(void)
This function serves to turn off RF auto mode.
Definition: rf_drv.h:378
static void rf_set_ble_crc_adv()
This function serves to set CRC advantage.
Definition: rf_drv.h:700
Definition: rf_drv.h:120
static unsigned char rf_is_rx_finish(void)
This function serves to determine whether sending a packet of rf_tx_acc_code_select is finished...
Definition: rf_drv.h:471
RF_StatusTypeDef
Define RF Tx/Rx/Auto mode.
Definition: rf_drv.h:59
static void rf_set_ble_crc(unsigned char *p)
This function serves to set pipe for RF Tx.
Definition: rf_drv.h:680
static void rf_set_ble_access_code(unsigned char *p)
This function serves to set RF access code.
Definition: rf_drv.h:710
Definition: rf_drv.h:128
Definition: rf_drv.h:141
#define write_reg8(addr, v)
Definition: bsp.h:106
Definition: rf_drv.h:139
void rf_acc_code_set(unsigned char pipe_id, const unsigned char *addr)
this function is to set access code.
Definition: rf_drv.h:108
signed char rf_get_tx_power_level(void)
This function serves to get RF TX power level .
void rf_start_stx2rx(void *addr, unsigned int tick)
This function serves to start stx2rx mode of auto_mode. In this mode, a packet is sent first...
Definition: rf_drv.h:134
static void rf_set_txmode(void)
This function serves to set RF Tx mode.
Definition: rf_drv.h:402
static unsigned int rf_access_code_16to32(unsigned short code)
This function serves to set RF access code 6bit to 32bit.
Definition: rf_drv.h:740
Definition: rf_drv.h:106
const RF_PowerTypeDef rf_power_Level_list[60]
Definition: rf_drv.h:140
static void rf_reset_sn(void)
This function serves to reset the RF sn.
Definition: rf_drv.h:669
void rf_acc_code_get(unsigned char pipe_id, unsigned char *addr)
this function is to set access code.
Definition: rf_drv.h:44
void rf_tx_pkt_auto(void *addr)
This function serves to send packet for RF.
Definition: rf_drv.h:99
Definition: rf_drv.h:109
#define BIT(n)
Definition: bsp.h:33
unsigned char rx_packet_process_1mbps(unsigned char *rx_buf, unsigned int len)
This function process the received packet in 1mbps shockburst mode only for hanshow for the compatibl...
Definition: rf_drv.h:100
void rf_start_srx2tx(void *addr, unsigned int tick)
This function serves to start srx2tx mode of auto_mode. In this mode,RF module stays in Rx status unt...
void rf_drv_init(RF_ModeTypeDef rf_mode)
This function serves to initiate the mode of RF.
static void tx_settle_adjust(unsigned short txstl_us)
This function serves to settle adjust for RF Tx.
Definition: rf_drv.h:412
unsigned char rf_stop_ed_154(void)
This function is to stop energy detect and get energy detect value of the current channel for zigbee ...
Definition: rf_drv.h:62
static void reset_baseband(void)
This function serves to reset RF BaseBand.
Definition: rf_drv.h:237
Definition: rf_drv.h:96
Definition: gpio_8258.h:71
#define REG_ADDR8(a)
Definition: bsp.h:102
Definition: rf_drv.h:110
unsigned short crc16_ccitt_cal(unsigned char *input, unsigned int len, unsigned short init_val)
This function serves to get CRC.
Definition: rf_drv.h:95
Definition: rf_drv.h:74
static void rf_set_ble_crc_value(unsigned int crc)
This function serves to set CRC value for RF.
Definition: rf_drv.h:690
static void rf_set_tx_pipe(unsigned char pipe)
This function serves to set pipe for RF Tx.
Definition: rf_drv.h:422
void rf_rx_buffer_set(unsigned char *RF_RxAddr, int size, unsigned char PingpongEn)
This function is to set rx buffer.
void rf_set_channel_500k(signed short chn, unsigned short set)
This function serves to set The channel .
#define reg_dma2_addr
Definition: register_8258.h:1112
Definition: rf_drv.h:42
Definition: rf_drv.h:145
Definition: rf_drv.h:144
Definition: rf_drv.h:72
void rf_tx_500k_simulate_100k(unsigned char *preamble, unsigned char preamble_len, unsigned char *acc_code, unsigned char acc_len, unsigned char *payload, unsigned char pld_len, unsigned char *tx_buf, unsigned short crc_init)
This function serves to simulate 100k Tx by 500k Tx.
Definition: rf_drv.h:123
Definition: rf_drv.h:82
Definition: rf_drv.h:49
void rf_set_power_level_index_zgb(int level_idx)
This function serves to set RF power level index.
Definition: rf_drv.h:119
static void rf_longrange_access_code_comm(unsigned int acc)
This function serves to set RF access command.
Definition: rf_drv.h:327
Definition: rf_drv.h:97
void rf_tx_pkt(unsigned char *addr)
This function serves to set RF Tx packet.
Definition: rf_drv.h:122
Definition: rf_drv.h:125
Definition: rf_drv.h:132
void rf_start_brx(void *addr, unsigned int tick)
This function serves to start Rx of auto mode. In this mode, RF module stays in Rx status until a pac...
Definition: rf_drv.h:103
Definition: rf_drv.h:133
Definition: rf_drv.h:41
Definition: rf_drv.h:50
static unsigned char rf_is_rx_right(void)
This function serves to determine whether a packet of data received is right.
Definition: rf_drv.h:513
static void rf_ble_tx_done()
This function performs to done RF Tx.
Definition: rf_drv.h:649
Definition: gpio_8258.h:57
Definition: rf_drv.h:116
Definition: rf_drv.h:131
#define REG_ADDR16(a)
Definition: bsp.h:103
Definition: rf_drv.h:93
Definition: rf_drv.h:61
Definition: rf_drv.h:47
void rf_set_power_level_index(RF_PowerTypeDef level)
This function serves to set RF power level index.
static void rf_set_rxmode(void)
This function serves to set RF Tx mode.
Definition: rf_drv.h:537
static void rf_set_ble_access_code_value(unsigned int ac)
This function serves to set RF access code value.
Definition: rf_drv.h:720
#define read_reg8(addr)
Definition: bsp.h:110
Definition: rf_drv.h:115
Definition: rf_drv.h:111
void rf_start_btx(void *addr, unsigned int tick)
This function serves to start Tx of ble_mode.
Definition: rf_drv.h:104
Definition: rf_drv.h:51
Definition: rf_drv.h:138
RF_PATxPinDef
Define TX pin of RF for RFFE.
Definition: rf_drv.h:81
static void rf_fix_payload_len_set(int len)
this function is to set shock burst for RF.
Definition: rf_drv.h:790
Definition: rf_drv.h:135
Definition: rf_drv.h:105
Definition: rf_drv.h:73
static void rf_ble_tx_on()
This function performs to enable RF Tx.
Definition: rf_drv.h:639
Definition: rf_drv.h:114
void rf_start_stx(void *addr, unsigned int tick)
This function serves to start Tx.
Definition: rf_drv.h:127
int rf_trx_state_set(RF_StatusTypeDef rf_status, signed char rf_channel)
This function serves to judge RF Tx/Rx state.
static void rf_tx_acc_code_select(unsigned char pipe)
this function is to select access_code channel for RF Rx terminal.
Definition: rf_drv.h:356
Definition: rf_drv.h:43
RF_PowerTypeDef
Define power list of RF.
Definition: rf_drv.h:90
Definition: rf_drv.h:130
#define RF_TRX_OFF
Definition: rf_drv.h:203
void rf_rffe_set_pin(RF_PATxPinDef tx_pin, RF_LNARxPinDef rx_pin)
This function serves to set pin for RFFE of RF.
Definition: rf_drv.h:102
static void rf_tx_finish_clear_flag(void)
This function serves to clear the Tx finish flag bit. After all packet data are sent, corresponding Tx finish flag bit will be set as 1.By reading this flag bit, it can check whether packet transmission is finished. After the check, it¡¯s needed to manually clear this flag bit so as to avoid misjudgment.
Definition: rf_drv.h:458
Definition: rf_drv.h:45
Definition: rf_drv.h:126
static unsigned char is_rf_receiving_pkt(void)
This function serves to judge the statue of RF receive.
Definition: rf_drv.h:773
Definition: rf_drv.h:98
void rf_start_srx(unsigned int tick)
This function serves to start Rx.
Definition: gpio_8258.h:74
void rf_ed_detecct_154(void)
This function is to start energy detect of the current channel for zigbee mode Before using it...
static void reset_sn_nesn(void)
This function serves to reset function for RF.
Definition: rf_drv.h:659
static void rf_set_ble_access_code_adv(void)
This function serves to set RF access code advantage.
Definition: rf_drv.h:730