544 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			544 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								/****************************************************************************
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
							 | 
						||
| 
								 | 
							
								be copied by any method or incorporated into another program without
							 | 
						||
| 
								 | 
							
								the express written consent of Aerospace C.Power. This Information or any portion
							 | 
						||
| 
								 | 
							
								thereof remains the property of Aerospace C.Power. The Information contained herein
							 | 
						||
| 
								 | 
							
								is believed to be accurate and Aerospace C.Power assumes no responsibility or
							 | 
						||
| 
								 | 
							
								liability for its use in any way and conveys no license or title under
							 | 
						||
| 
								 | 
							
								any patent or copyright and makes no representation or warranty that this
							 | 
						||
| 
								 | 
							
								Information is free from patent or copyright infringement.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								****************************************************************************/
							 | 
						||
| 
								 | 
							
								#ifndef __BB_RF_CFG_H__
							 | 
						||
| 
								 | 
							
								#define __BB_RF_CFG_H__
							 | 
						||
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								#include "rf_hw_tonemap.h"
							 | 
						||
| 
								 | 
							
								#include "plc_const.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* default channel frequecy hz */
							 | 
						||
| 
								 | 
							
								#define RF_CHANNEL_DEF_FREQ_HZ     490000000
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* rf rx default subtract frequecy 450k for option2 bpf mode */
							 | 
						||
| 
								 | 
							
								#define RF_OPT2_RX_BPF_CONSTANT_FREQ_HZ 450000
							 | 
						||
| 
								 | 
							
								/* rf rx default subtract frequecy 180k or option3 bpf mode */
							 | 
						||
| 
								 | 
							
								#define RF_OPT3_RX_BPF_CONSTANT_FREQ_HZ 180000
							 | 
						||
| 
								 | 
							
								/* rf rx default subtract frequecy 300k or option2 lpf mode */
							 | 
						||
| 
								 | 
							
								#define RF_OPT2_RX_LPF_CONSTANT_FREQ_HZ 300000
							 | 
						||
| 
								 | 
							
								/* rf rx default subtract frequecy 150k or option3 lpf mode */
							 | 
						||
| 
								 | 
							
								#define RF_OPT3_RX_LPF_CONSTANT_FREQ_HZ 150000
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* rf rate */
							 | 
						||
| 
								 | 
							
								#define RF_CODING_RATE_1_2         0
							 | 
						||
| 
								 | 
							
								#define RF_CODING_RATE_4_5         1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* interweave step */
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_STEP_4       4
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_STEP_5       5
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_STEP_12      12
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_STEP_13      13
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_STEP_16      16
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_STEP_17      17
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_STEP_18      18
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* interweave offset rate 1/2 */
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_OFFSET_16    16
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_OFFSET_40    40
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_OFFSET_72    72
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_OFFSET_136   136
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_OFFSET_264   264
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_OFFSET_520   520
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* interweave offset rate 4/5 */
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_OFFSET_4     4
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_OFFSET_10    10
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_OFFSET_18    18
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_OFFSET_34    34
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_OFFSET_66    66
							 | 
						||
| 
								 | 
							
								#define RF_INTERWEAVE_OFFSET_130   130
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* the max of option 0, 1, 2 */
							 | 
						||
| 
								 | 
							
								#define PHY_OPTION_MAX             3
							 | 
						||
| 
								 | 
							
								/* the max of mcs */
							 | 
						||
| 
								 | 
							
								#define PHY_MCS_MAX                7
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* rf bb hw info */
							 | 
						||
| 
								 | 
							
								typedef struct _bb_rf_hw_info {
							 | 
						||
| 
								 | 
							
								    /* option of bb, 1: option1; 2: option2; 3: option3 */
							 | 
						||
| 
								 | 
							
								    uint32_t    option              :   2,
							 | 
						||
| 
								 | 
							
								    /* block size, 0: PB16, 1: PB40, 2: PB72, 3: PB136, 4: PB264, 5: PB520 */
							 | 
						||
| 
								 | 
							
								                fec_blkz            :   3,
							 | 
						||
| 
								 | 
							
								    /* mcs id 0 - 6 */
							 | 
						||
| 
								 | 
							
								                mcs_id              :   5,
							 | 
						||
| 
								 | 
							
								    /* rate, 0:1/2 rate, 1:4/5 rate */
							 | 
						||
| 
								 | 
							
								                fec_rate            :   2,
							 | 
						||
| 
								 | 
							
								    /* copy num, 1, 2, 4 */
							 | 
						||
| 
								 | 
							
								                fec_ncopy           :   4,
							 | 
						||
| 
								 | 
							
								    /* modulation system, 1: BPSK, 2: QPSK, 4: 16QAM */
							 | 
						||
| 
								 | 
							
								                fec_modt            :   4,
							 | 
						||
| 
								 | 
							
								    /* symbol num */
							 | 
						||
| 
								 | 
							
								                fec_nsymb           :   12;
							 | 
						||
| 
								 | 
							
								    uint32_t codec_cfg;
							 | 
						||
| 
								 | 
							
								    uint32_t chan_intl;
							 | 
						||
| 
								 | 
							
								    uint32_t robo_intl0;
							 | 
						||
| 
								 | 
							
								    uint32_t robo_intl1;
							 | 
						||
| 
								 | 
							
								    uint32_t robo_intl2;
							 | 
						||
| 
								 | 
							
								    uint32_t modem_cfg;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								} bb_rf_hw_info_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_cfg_tx_phr_info()    bb rf config tx phy header info.
							 | 
						||
| 
								 | 
							
								 * @param - [rf_phr]                   phy header info.
							 | 
						||
| 
								 | 
							
								 * @return - void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_cfg_tx_phr_info(bb_rf_hw_info_t *rf_phr);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_cfg_rx_phr_info()    bb rf config rx phy header info.
							 | 
						||
| 
								 | 
							
								 * @param - [rf_phr]                   phy header info.
							 | 
						||
| 
								 | 
							
								 * @return - void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_cfg_rx_phr_info(bb_rf_hw_info_t *rf_phr);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_cfg_tx_pld_info()    bb rf config tx payload info.
							 | 
						||
| 
								 | 
							
								 * @param - [rf_pld]                   payload info.
							 | 
						||
| 
								 | 
							
								 * @param - [pb_num]                   pb num.
							 | 
						||
| 
								 | 
							
								 * @return - void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_cfg_tx_pld_info(bb_rf_hw_info_t *rf_pld, uint32_t pb_num);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_cfg_rx_pld_info()    bb rf config rx payload info.
							 | 
						||
| 
								 | 
							
								 * @param - [rf_pld]                   payload info.
							 | 
						||
| 
								 | 
							
								 * @param - [pb_num]                   pb num.
							 | 
						||
| 
								 | 
							
								 * @return - void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_cfg_rx_pld_info(bb_rf_hw_info_t *rf_pld, uint32_t pb_num);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_set_tx_phr()      bb rf set tx phy header.
							 | 
						||
| 
								 | 
							
								 * @param - [phr]                   phy header.
							 | 
						||
| 
								 | 
							
								 * @return - void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_set_tx_phr(uint32_t *phr);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_tx_phr()      bb rf get tx phy header.
							 | 
						||
| 
								 | 
							
								 * @param - [phr]                   phy header.
							 | 
						||
| 
								 | 
							
								 * @return - void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_get_tx_phr(uint32_t *phr);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_rx_phr()      bb rf get rx phy header.
							 | 
						||
| 
								 | 
							
								 * @param - [phr]                   phy header.
							 | 
						||
| 
								 | 
							
								 * @return - void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_get_rx_phr(uint32_t *phr);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_set_crc32_en()    bb rf set crc32 enable.
							 | 
						||
| 
								 | 
							
								 * @param - [enable]                enable.
							 | 
						||
| 
								 | 
							
								 * @return - void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_set_crc32_en(uint32_t enable);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_pld_crc32_err() get pld crc32.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                    void.
							 | 
						||
| 
								 | 
							
								 * @return - pld crc32
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_pld_crc32_err();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_pld_crc24_err() get pld crc24.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                    void.
							 | 
						||
| 
								 | 
							
								 * @return - pld crc24
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_pld_crc24_err();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_pld_crc_rdy()   get pld crc ready.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                    void.
							 | 
						||
| 
								 | 
							
								 * @return - uint32_t                 pld is ready or not.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_pld_crc_rdy();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_phr_crc24_err() get phr crc24.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                    void.
							 | 
						||
| 
								 | 
							
								 * @return - phr crc24
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_phr_crc24_err();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_phr_crc_rdy()   get phr crc ready.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                    void.
							 | 
						||
| 
								 | 
							
								 * @return - uint32_t                 phr is ready.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_phr_crc_rdy();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_rx_sig_info() bb rf get rx sig info.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                  void.
							 | 
						||
| 
								 | 
							
								 * @return - uint32_t               rx sig info
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_rx_sig_info();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_rx_sig_is_ready() bb rf get rx sig is ready.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                      void.
							 | 
						||
| 
								 | 
							
								 * @return - uint32_t                   rx sig is ready.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_rx_sig_is_ready();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_rx_sig_is_err()   bb rf get rx sig is error.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                      void.
							 | 
						||
| 
								 | 
							
								 * @return - uint32_t                   rx sig is error.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_rx_sig_is_err();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_set_rx_state_cont()  bb rf set rx state continue.
							 | 
						||
| 
								 | 
							
								 * @param - [state_cont]               state contine.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_set_rx_state_cont(uint32_t state_cont);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_set_dec_cont()       bb rf set rx dec continue.
							 | 
						||
| 
								 | 
							
								 * @param - [state_cont]               state contine.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_set_dec_cont(uint32_t state_cont);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_clear_tx_info()      bb rf clear tx info.
							 | 
						||
| 
								 | 
							
								 * @param - [state_cont]               state contine.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_clear_tx_info();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_clear_rx_info()      bb rf clear rx info.
							 | 
						||
| 
								 | 
							
								 * @param - [state_cont]               state contine.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_clear_rx_info();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* bb_rf_get_interweave_offset  - get rf interweave offset.
							 | 
						||
| 
								 | 
							
								 * @rate                        - 0: 1/2   1: 4/5.
							 | 
						||
| 
								 | 
							
								 * @blkz                        - 0, 1, 3, 4, 5.
							 | 
						||
| 
								 | 
							
								 * return offset                - interweave offset.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_interweave_offset(uint32_t rate, uint8_t blkz);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* bb_rf_get_interweave_step    - get rf interweave step.
							 | 
						||
| 
								 | 
							
								 * @rate                        - 0: 1/2   1: 4/5.
							 | 
						||
| 
								 | 
							
								 * @blkz                        - 0, 1, 3, 4, 5.
							 | 
						||
| 
								 | 
							
								 * return step                  - interweave step.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_interweave_step(uint32_t rate, uint8_t blkz);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_tx_timer_en()        bb rf tx by timer enable.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                     void.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_tx_timer_en();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_rx_timer_en()        bb rf rx by timer enable.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                     void.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_rx_timer_en();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_stop_listen_timer_en() bb rf stop listen timer enable.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                       void.
							 | 
						||
| 
								 | 
							
								 * @return - void                        void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_stop_listen_timer_en();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_debug_tx_immd()      bb rf debug tx immediately.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                     void.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_debug_tx_immd();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_debug_rx_immd()      bb rf debug rx immediately.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                     void.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_debug_rx_immd();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_debug_stop_listen_immd()  bb rf debug stop listen immediately.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                          void.
							 | 
						||
| 
								 | 
							
								 * @return - void                           void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_debug_stop_listen_immd();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_rx_is_busy()      bb rf get rx is busy or not.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                      void.
							 | 
						||
| 
								 | 
							
								 * @return - uint32_t                   rx busy or not.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_rx_is_busy();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_tx_is_busy()      bb rf get tx is busy or not.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                      void.
							 | 
						||
| 
								 | 
							
								 * @return - uint32_t                   tx busy or not.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_tx_is_busy();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_set_fchz()           bb rf set frequece hz.
							 | 
						||
| 
								 | 
							
								 * @param - [fchz]                     frequece, hz.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_set_fchz(uint32_t fchz);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_fchz()           bb rf get frequece hz.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                     void.
							 | 
						||
| 
								 | 
							
								 * @return - fchz                      frequece, hz.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_fchz(void);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_write_data_to_bb()   bb rf write data to bb.
							 | 
						||
| 
								 | 
							
								 * @param - [pb_size]                  pb size.
							 | 
						||
| 
								 | 
							
								 * @param - [buf]                      the buf of data.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_write_data_to_bb(uint32_t pb_size, uint8_t *buf);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_read_data_from_bb()  bb rf read data from bb.
							 | 
						||
| 
								 | 
							
								 * @param - [pb_size]                  pb size.
							 | 
						||
| 
								 | 
							
								 * @param - [buf]                      the buf of data.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_read_data_from_bb(uint32_t pb_size, uint8_t *buf);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_snr_rssi()       bb rf get snr and rssi.
							 | 
						||
| 
								 | 
							
								 * @param - [option]                   option.
							 | 
						||
| 
								 | 
							
								 * @param - [snr]                      snr.
							 | 
						||
| 
								 | 
							
								 * @param - [rssi]                     rssi.
							 | 
						||
| 
								 | 
							
								 * @param - [gain]                     gain 13-74.
							 | 
						||
| 
								 | 
							
								 * @param - [raw_snr]                  raw snr.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_get_snr_rssi(uint32_t option, int8_t *snr, int8_t *rssi,
							 | 
						||
| 
								 | 
							
								    uint8_t *gain, uint16_t *raw_snr);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_raw_snr_rssi_reg1()   bb rf get raw snr/rssi register 1.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                          void.
							 | 
						||
| 
								 | 
							
								 * @return - void                           void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_raw_snr_rssi_reg1();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_raw_snr_rssi_reg2()   bb rf get raw snr/rssi register 2.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                          void.
							 | 
						||
| 
								 | 
							
								 * @return - void                           void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_raw_snr_rssi_reg2();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_raw_snr_rssi_reg3()   bb rf get raw snr/rssi register 3.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                          void.
							 | 
						||
| 
								 | 
							
								 * @return - void                           void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_raw_snr_rssi_reg3();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_cur_gain()           bb rf get gain.
							 | 
						||
| 
								 | 
							
								 * @return - uint8_t                   gain 13-74.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint8_t bb_rf_get_cur_gain();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_evaluate_ppm_hz()     bb rf get evaluate ppm hz.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                     void.
							 | 
						||
| 
								 | 
							
								 * @return - int32_t                   ppm, unit hz.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								int32_t bb_rf_get_evaluate_ppm_hz();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_tx_switch_step1()    bb rf tx switch step1.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                     void.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_tx_switch_step1();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_tx_switch_step2()    bb rf tx swich step2.
							 | 
						||
| 
								 | 
							
								 * @param - [void]                     void.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_tx_switch_step2();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_tx_set_freq_and_filter() bb rf tx set freq and filter.
							 | 
						||
| 
								 | 
							
								 * @param - [option]                       option.
							 | 
						||
| 
								 | 
							
								 * @param - [fchz]                         frequency if
							 | 
						||
| 
								 | 
							
								 * @return - void                          void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_tx_set_freq_and_filter(uint32_t option, uint32_t fchz);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_tx_cfg()             bb rf tx config.
							 | 
						||
| 
								 | 
							
								 * @param - [option]                   option.
							 | 
						||
| 
								 | 
							
								 * @param - [fchz]                     frequency if
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_tx_cfg(uint32_t option, uint32_t fchz);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_rx_cfg()             bb rf rx config.
							 | 
						||
| 
								 | 
							
								 * @param - [option]                   option.
							 | 
						||
| 
								 | 
							
								 * @param - [fchz]                     frequency if
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_rx_cfg(uint32_t option, uint32_t fchz);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_pa()             bb rf get pa power.
							 | 
						||
| 
								 | 
							
								 * @param - [rf_outside]               rf outside or not.
							 | 
						||
| 
								 | 
							
								 * @return - int32_t                   dbm.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								int32_t bb_rf_get_pa(uint32_t rf_outside);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_set_pa()             bb rf set pa power.
							 | 
						||
| 
								 | 
							
								 * @param - [rf_outside]               rf outside or not.
							 | 
						||
| 
								 | 
							
								 * @param - [dbm]                      power dbm.
							 | 
						||
| 
								 | 
							
								 * @return - uint32_t                  success or not.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_set_pa(uint32_t rf_outside, int32_t dbm);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_set_tx_iq_mag()      set bb rf tx magnitude
							 | 
						||
| 
								 | 
							
								 *          calibration value.
							 | 
						||
| 
								 | 
							
								 * @param - [tx_i_m]  tx magnitude calibration value for I patch
							 | 
						||
| 
								 | 
							
								 * @param - [tx_q_m]  tx magnitude calibration value for Q patch
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_set_tx_iq_mag(uint8_t tx_i_m, uint8_t tx_q_m);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_set_tx_iq_mag()      set bb rf tx phase calibration value.
							 | 
						||
| 
								 | 
							
								 * @param - [tx_i_p]  tx phase calibration value for I patch
							 | 
						||
| 
								 | 
							
								 * @param - [tx_q_p]  tx phase calibration value for Q patch
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_set_tx_iq_phase(uint8_t tx_i_p, uint8_t tx_q_p);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_set_rx_iq_mag()      set bb rf rx mag calibration value.
							 | 
						||
| 
								 | 
							
								 * @param - [i_mag]  tx mag calibration value for I patch
							 | 
						||
| 
								 | 
							
								 * @param - [q_mag]  tx mag calibration value for Q patch
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_set_rx_iq_mag(uint8_t i_mag, uint8_t q_mag);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_set_tx_dc()      set bb rf tx dc offset calibration value.
							 | 
						||
| 
								 | 
							
								 * @param - [tx_i_dc]  tx dc offset calibration value for I patch
							 | 
						||
| 
								 | 
							
								 * @param - [tx_q_dc]  tx dc offset calibration value for Q patch
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_set_tx_dc(int8_t tx_i_dc, int8_t tx_q_dc);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_set_filter() - set filter value.
							 | 
						||
| 
								 | 
							
								 * @param - [value]  filter value.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_set_filter(uint16_t value);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_update_cali() - update tx calibration values
							 | 
						||
| 
								 | 
							
								 *          to RF register.
							 | 
						||
| 
								 | 
							
								 * @param - [option]  specified option.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_update_cali(uint8_t option);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_init_ver()           - init rf version
							 | 
						||
| 
								 | 
							
								 * @param - void.
							 | 
						||
| 
								 | 
							
								 * @return - uint32_t                  0: success, 1:fail.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_init_ver();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_get_ver()            - get rf version.
							 | 
						||
| 
								 | 
							
								 * @param - void.
							 | 
						||
| 
								 | 
							
								 * @return - uint32_t                  RF_VER_INVAILD: is invaild ver;
							 | 
						||
| 
								 | 
							
								 *                                     RF_VER_1: rf chip ver1.
							 | 
						||
| 
								 | 
							
								 *                                     RF_VER_2: rf chip ver2.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t bb_rf_get_ver();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_pll_cfg()            - bb rf pll config.
							 | 
						||
| 
								 | 
							
								 * @param - void.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_pll_cfg(void);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_standby_cfg()            - config rf to standby mode
							 | 
						||
| 
								 | 
							
								 * @param - void.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_standby_cfg(void);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_clibr_dc()          - bb rf calibration dc.
							 | 
						||
| 
								 | 
							
								 * @param - [option]                   option.
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_clibr_dc(uint32_t option);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_clibr_tx_dcoc()     - bb rf calibration tx dc loop.
							 | 
						||
| 
								 | 
							
								 * @param - [option]                  option.
							 | 
						||
| 
								 | 
							
								 * @param - [fchz]                    rf center frequency
							 | 
						||
| 
								 | 
							
								 * @param - [interval]                delay time for fetching ADC data, unit us.
							 | 
						||
| 
								 | 
							
								 * @param - [step]                    step value of traversing iq.
							 | 
						||
| 
								 | 
							
								 * @param - [ldovs]                   pa power set
							 | 
						||
| 
								 | 
							
								 * @param - [rf_att]                  tx rf_att
							 | 
						||
| 
								 | 
							
								 * @return - uint8_t           wheather or not supported tx dc loop calibration.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint8_t bb_rf_clibr_tx_dcoc(uint32_t option, uint32_t fchz, uint8_t interval,
							 | 
						||
| 
								 | 
							
								    uint8_t step, uint16_t* ldovs, uint8_t* rf_att);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief - bb_rf_fix_gain()           - bb_rf_fix_gain.
							 | 
						||
| 
								 | 
							
								 * @param - [en]                       enbale or disable fix gain.
							 | 
						||
| 
								 | 
							
								 * @param - [rf_gain]                  rf gain
							 | 
						||
| 
								 | 
							
								 * @param - [if_gain]                  if gain
							 | 
						||
| 
								 | 
							
								 * @return - void                      void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void bb_rf_fix_gain(uint8_t en, uint8_t rf_gain, uint8_t if_gain);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif // !__BB_RF_CFG_H__
							 | 
						||
| 
								 | 
							
								
							 |