Files
kunlun/plc/halmac/hw3/rf_inc/mac_rf_common_hw.h
2024-09-28 14:24:04 +08:00

972 lines
32 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 MAC_RF_COMMON_HW_H
#define MAC_RF_COMMON_HW_H
/* os shim includes */
#include "os_types.h"
/* public api includes */
#include "plc_fr.h"
#include "phy_rf_chn.h"
#ifdef __cplusplus
extern "C" {
#endif
#if (HW_PLATFORM >= HW_PLATFORM_FPGA)
/*
* @brief - mac_rf_set_rx_dc_loopback_clibr_en()
* - mac rf rx dc set loopback clibration enable.
* @param - [value] - need calibrated or not.
* @return - void
*/
void mac_rf_set_rx_dc_loopback_clibr_en(uint32_t enable);
/*
* @brief - mac_rf_get_rx_dc_loopback_clibr_en()
* - mac rf rx dc get loopback clibration enable.
* @param - [void] - void.
* @return - uint32_t - calibrate enable or not.
*/
uint32_t mac_rf_get_rx_dc_loopback_clibr_en();
/*
* @brief - mac_rf_set_tx_dc_loopback_clibr_en()
* - mac rf tx dc set loopback clibration enable.
* @param - [value] - need calibrated or not.
* @return - void
*/
void mac_rf_set_tx_dc_loopback_clibr_en(uint32_t enable);
/*
* @brief - mac_rf_get_tx_dc_loopback_clibr_en()
* - mac rf tx dc get loopback clibration enable.
* @param - [void] - void.
* @return - uint32_t - calibrate enable or not.
*/
uint32_t mac_rf_get_tx_dc_loopback_clibr_en();
/*
* @brief - mac_rf_set_rx_dc_loopback_clibr_flag()
* - mac rf rx dc set loopback clibration flag.
* @param - [value] - have been calibrated or not.
* @return - void
*/
void mac_rf_set_rx_dc_loopback_clibr_flag(uint32_t value);
/*
* @brief - mac_rf_get_rx_dc_loopback_clibr_flag()
* - mac rf rx dc get loopback clibration flag.
* @param - [void] - void.
* @return - uint32_t - have been calibrated or not.
*/
uint32_t mac_rf_get_rx_dc_loopback_clibr_flag();
/*
* @brief - mac_rf_set_option() - mac rf set option.
* @param - [option] - option.
* @return - void
*/
void mac_rf_set_option(uint32_t option);
/*
* @brief - mac_rf_set_tobe_channel_id() - mac rf set tobe channel id.
* @param - [channel id] - channel id.
* @return - void
*/
void mac_rf_set_tobe_channel_id(uint32_t channel_id);
/*
* @brief - mac_rf_set_option_success() - mac rf set option success.
* @param - [void] - void.
* @return - void
*/
void mac_rf_set_option_success();
/*
* @brief - mac_rf_set_channel_success() - mac rf set channel success.
* @param - [void] - void.
* @return - void
*/
void mac_rf_set_channel_success();
/*
* @brief - mac_rf_get_option_sts() - mac rf get set opton status.
* @param - [void] - void.
* @return - uint32_t - option status.
*/
uint32_t mac_rf_get_option_sts();
/*
* @brief - mac_rf_get_channel_sts() - mac rf get set channel status.
* @param - [void] - void.
* @return - uint32_t - channel status.
*/
uint32_t mac_rf_get_channel_sts();
/*
* @brief - mac_rf_get_option() - mac rf get option.
* @param - [void] - void.
* @return - uint32_t - option.
*/
uint32_t mac_rf_get_option();
/*
* @brief - mac_rf_get_tobe_set_channel_id() - mac rf get tobe set channel.
* @param - [void] - void.
* @return - uint32_t - tobe channel id.
*/
uint32_t mac_rf_get_tobe_set_channel_id();
/*
* @brief - mac_rf_get_bbcpu_sts() - mac rf get bbcpu status.
* @param - [void] - void.
* @return - uint32_t - bbcpu status.
*/
uint32_t mac_rf_get_bbcpu_sts();
/*
* @brief - mac_rf_set_bbcpu_sts() - mac rf set bbcpu status.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_set_bbcpu_sts();
/*
* @brief - mac_rf_set_stop_sched_sts_start() - mac rf set stop schedule start.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_set_stop_sched_sts_start();
/*
* @brief - mac_rf_set_stop_sched_sts_success() - mac rf set stop schedule success.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_set_stop_sched_sts_success();
/*
* @brief - mac_rf_get_stop_sched_sts() - mac rf get stop schedule status.
* @param - [void] - void.
* @return - void - void.
*/
uint32_t mac_rf_get_stop_sched_sts();
/*
* @brief - mac_rf_use_wmac_enable() - mac rf use wmac mac or not.
* @param - [enable] - 1: wmac, 0:rfmac.
* @return - void - void.
*/
void mac_rf_use_wmac_enable(uint32_t enable);
/*
* @brief - mac_rf_get_use_wmac_enable() - mac rf get use wmac mac or not.
* @param - [void] - void.
* @return - enable - 1: wmac, 0:rfmac.
*/
uint32_t mac_rf_get_use_wmac_enable();
/*
* @brief - mac_rf_reset_txrxfsm() - mac rf reset txrx fsm.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_reset_txrxfsm();
/*
* @brief - mac_rf_wmac_get_fsm() - mac rf wmac get fsm.
* @param - [void] - void
* @return - uint32_t - wmac fsm.
*/
uint32_t mac_rf_wmac_get_fsm();
/*
* @brief - mac_rf_to_wphy_interface_init() - mac rf to wphy interface init.
* @param - [power_reset] - reset pa power or not
* @return - void - void.
*/
void mac_rf_to_wphy_interface_init(uint8_t power_reset);
/*
* @brief - mac_rf_set_spi_gpio() - mac rf set spi gpio.
* @param - [clk_gpio] - clock gpio.
* @param - [cs_gpio] - cs gpio.
* @param - [mosi_gpio] - mosi gpio.
* @param - [miso_gpio] - miso gpio.
* @return - void - void.
*/
void mac_rf_set_spi_gpio(uint8_t clk_gpio, uint8_t cs_gpio, uint8_t mosi_gpio,
uint8_t miso_gpio);
/*
* @brief - mac_rf_get_spi_gpio() - mac rf get spi gpio.
* @param - [clk_gpio] - clock gpio.
* @param - [cs_gpio] - cs gpio.
* @param - [mosi_gpio] - mosi gpio.
* @param - [miso_gpio] - miso gpio.
* @return - void - void.
*/
void mac_rf_get_spi_gpio(uint8_t *clk_gpio, uint8_t *cs_gpio,
uint8_t *mosi_gpio, uint8_t *miso_gpio);
/*
* @brief - mac_rf_get_cur_channel_freq() - mac rf get current cahnnel frequency.
* @param - [void] - void.
* @return - uint32_t - channel frequency. unit hz.
*/
uint32_t mac_rf_get_cur_channel_freq();
/*
* @brief - mac_rf_set_cur_channel_freq() - mac rf set current cahnnel frequency.
* @param - [channel_freq] - channel frequency. unit hz.
* @return - void - void.
*/
void mac_rf_set_cur_channel_freq(uint32_t channel_freq);
/*
* @brief - mac_rf_get_cur_channel_id() - mac rf get current cahnnel id.
* @param - [void] - void.
* @return - uint32_t - channel id.
*/
uint32_t mac_rf_get_cur_channel_id();
/*
* @brief - mac_rf_set_cur_channel_id() - mac rf set current cahnnel id.
* @param - [channel_id] - channel id.
* @return - void - void.
*/
void mac_rf_set_cur_channel_id(uint32_t channel_id);
/*
* @brief - mac_rf_set_cert_mode() - mac rf set certification mode.
* @param - [cert_mode] - certification mode.
* @return - void - void.
*/
void mac_rf_set_cert_mode(uint32_t cert_mode);
/*
* @brief - mac_rf_get_cert_mode() - mac rf get certification mode.
* @param - [void] - void.
* @return - uint32_t - certification mode.
*/
uint32_t mac_rf_get_cert_mode();
/*
* @brief - mac_rf_set_cert_16qam_flag() - mac rf set certification 16qam flag.
* @param - [special_cfg] - special cfg for mcs5/6.
* @return - void - void.
*/
void mac_rf_set_cert_16qam_flag(uint32_t special_cfg);
/*
* @brief - mac_rf_get_cert_mode() - mac rf get certification 16qam mode.
* @param - [void] - void.
* @return - uint32_t - certification mode.
*/
uint32_t mac_rf_get_cert_16qam_flag();
/*
* @brief - mac_rf_set_cert_flag() - mac rf set certification flag.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_set_cert_flag();
/*
* @brief - mac_rf_get_cert_flag() - mac rf get certification flag.
* @param - [void] - void.
* @return - uint32_t - certification flag.
*/
uint32_t mac_rf_get_cert_flag();
/*
* @brief - mac_rf_set_user_type() - mac rf set user type.
* @param - [user_type] - user type.
* @return - void - void.
*/
void mac_rf_set_user_type(uint8_t user_type);
/*
* @brief - mac_rf_get_user_type() - mac rf get user type.
* @param - [void] - void.
* @return - uint8_t - user type.
*/
uint8_t mac_rf_get_user_type();
/*
* @brief - mac_rf_set_hplc_rf_async_tx() - mac rf set hplc rf async tx or not.
* @param - [async_tx] - 1:async tx, 0: not care.
* @return - void - void.
*/
void mac_rf_set_hplc_rf_async_tx(uint32_t async_tx);
/*
* @brief - mac_rf_get_hplc_rf_async_tx() - mac rf get hplc rf async tx or not.
* @param - [void] - void.
* @return - uint32_t - 1:async tx, 0: not care.
*/
uint32_t mac_rf_get_hplc_rf_async_tx();
/*
* @brief - mac_rf_set_hplc_pcs_reg() - mac rf set hplc pcs reg.
* @param - [is_busy] - is busy or not.
* @return - void - void.
*/
void mac_rf_set_hplc_pcs_reg(uint32_t is_busy);
/*
* @brief - mac_rf_get_hplc_pcs_reg() - mac rf get hplc pcs reg.
* @param - [void] - void.
* @return - uint32_t - hplc pcs is busy or not.
*/
uint32_t mac_rf_get_hplc_pcs_reg();
/*
* @brief - mac_rf_set_hplc_pcs_sts_reg() - mac rf set hplc pcs status reg.
* @param - [is_busy] - is busy or not.
* @return - void - void.
*/
void mac_rf_set_hplc_pcs_sts_reg(uint32_t is_busy);
/*
* @brief - mac_rf_get_hplc_pcs_sts_reg() - mac rf get hplc pcs status reg.
* @param - [void] - void.
* @return - uint32_t - hplc pcs status is busy or not.
*/
uint32_t mac_rf_get_hplc_pcs_sts_reg();
/*
* @brief - mac_rf_get_tx_start_cnt() - mac rf get tx start cnt.
* @param - [void] - void.
* @return - uint32_t - tx start cnt.
*/
uint32_t mac_rf_get_tx_start_cnt();
/*
* @brief - mac_rf_tx_start_cnt_inc() - mac rf tx start cnt increase.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_tx_start_cnt_inc();
/*
* @brief - mac_rf_get_tx_ok_with_pld_cnt() - mac rf get tx ok with pld cnt.
* @param - [void] - void.
* @return - uint32_t - tx ok with pld cnt.
*/
uint32_t mac_rf_get_tx_ok_with_pld_cnt();
/*
* @brief - mac_rf_tx_ok_with_pld_cnt_inc() - mac rf tx ok with pld cnt increase.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_tx_ok_with_pld_cnt_inc();
/*
* @brief - mac_rf_get_tx_ok_without_pld_cnt()- mac rf get tx ok without pld cnt.
* @param - [void] - void.
* @return - uint32_t - tx ok without pld cnt.
*/
uint32_t mac_rf_get_tx_ok_without_pld_cnt();
/*
* @brief - mac_rf_tx_ok_without_pld_cnt_inc()
* - mac rf tx ok without pld cnt increase.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_tx_ok_without_pld_cnt_inc();
/*
* @brief - mac_rf_get_rx_sig_ok_cnt() - mac rf get rx sig ok cnt.
* @param - [void] - void.
* @return - uint32_t - rx sig ok cnt.
*/
uint32_t mac_rf_get_rx_sig_ok_cnt();
/*
* @brief - mac_rf_rx_sig_ok_cnt_inc() - mac rf rx sig ok cnt increase.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_rx_sig_ok_cnt_inc();
/*
* @brief - mac_rf_get_rx_sig_err_cnt() - mac rf get rx sig error cnt.
* @param - [void] - void.
* @return - uint32_t - rx sig error cnt.
*/
uint32_t mac_rf_get_rx_sig_err_cnt();
/*
* @brief - mac_rf_rx_sig_err_cnt_inc() - mac rf rx sig error cnt increase.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_rx_sig_err_cnt_inc();
/*
* @brief - mac_rf_get_rx_phr_ok_with_pld_cnt()
* - mac rf get rx phr ok with pld cnt.
* @param - [void] - void.
* @return - uint32_t - rx phr ok with pld cnt.
*/
uint32_t mac_rf_get_rx_phr_ok_with_pld_cnt();
/*
* @brief - mac_rf_rx_phr_ok_with_pld_cnt_inc()
* - mac rf rx phr ok with pld cnt increase.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_rx_phr_ok_with_pld_cnt_inc();
/*
* @brief - mac_rf_get_rx_phr_ok_without_pld_cnt()
* - mac rf get rx phr ok without pld cnt.
* @param - [void] - void.
* @return - uint32_t - rx phr ok without pld cnt.
*/
uint32_t mac_rf_get_rx_phr_ok_without_pld_cnt();
/*
* @brief - mac_rf_rx_phr_ok_without_pld_cnt_inc()
* - mac rf rx phr ok without pld cnt increase.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_rx_phr_ok_without_pld_cnt_inc();
/*
* @brief - mac_rf_get_rx_phr_err_cnt() - mac rf get rx phr error cnt.
* @param - [void] - void.
* @return - uint32_t - rx phr error cnt.
*/
uint32_t mac_rf_get_rx_phr_err_cnt();
/*
* @brief - mac_rf_rx_phr_err_cnt_inc() - mac rf rx phr error cnt increase.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_rx_phr_err_cnt_inc();
/*
* @brief - mac_rf_get_rx_pld_ok_cnt() - mac rf get rx pld ok cnt.
* @param - [void] - void.
* @return - uint32_t - rx pld ok cnt.
*/
uint32_t mac_rf_get_rx_pld_ok_cnt();
/*
* @brief - mac_rf_rx_pld_ok_cnt_inc() - mac rf rx pld ok cnt increase.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_rx_pld_ok_cnt_inc();
/*
* @brief - mac_rf_get_rx_pld_err_cnt() - mac rf get rx pld error cnt.
* @param - [void] - void.
* @return - uint32_t - rx pld error cnt.
*/
uint32_t mac_rf_get_rx_pld_err_cnt();
/*
* @brief - mac_rf_rx_pld_err_cnt_inc() - mac rf rx pld error cnt increase.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_rx_pld_err_cnt_inc();
/*
* @brief - mac_rf_get_rx_stf_cnt() - mac rf get rx stf cnt.
* @param - [void] - void.
* @return - uint32_t - rx stf cnt.
*/
uint32_t mac_rf_get_rx_stf_cnt();
/*
* @brief - mac_rf_rx_stf_cnt_inc() - mac rf rx stf cnt increase.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_rx_stf_cnt_inc();
/*
* @brief - mac_rf_get_rx_stf_cnt() - mac rf get lost stf cnt.
* @param - [void] - void.
* @return - uint32_t - lost stf cnt.
*/
uint32_t mac_rf_get_lost_stf_cnt();
/*
* @brief - mac_rf_lost_stf_cnt_inc() - mac rf lost stf cnt increase.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_lost_stf_cnt_inc();
/*
* @brief - mac_rf_record_dbg_cnt() - mac rf record dbg cnt.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_record_dbg_cnt();
/*
* @brief - mac_rf_recover_dbg_cnt() - mac rf recover dbg cnt.
* @param - [void] - void.
* @return - void - void.
*/
void mac_rf_recover_dbg_cnt();
/*
* @brief - mac_rf_set_tx_special_ldovs() - mac rf set wphy special tx ldovs.
* @param - ldovs - special tx ldovs
* @return - void - void
*/
void mac_rf_set_tx_special_ldovs(uint16_t ldovs);
/*
* @brief - mac_rf_get_tx_special_ldovs() - mac rf get wphy special tx ldovs.
* @return - uint16_t - special tx ldovs
*/
uint16_t mac_rf_get_tx_special_ldovs();
/*
* @brief - mac_rf_set_tx_special_scale() - mac rf set wphy special tx scale.
* @param - scale - special tx scale
* @return - void - void
*/
void mac_rf_set_tx_special_scale(uint16_t scale);
/*
* @brief - mac_rf_get_tx_special_scale() - mac rf get wphy special tx scale.
* @return - uint16_t - special tx scale
*/
uint16_t mac_rf_get_tx_special_scale();
/*
* @brief - mac_rf_set_tx_dc_cali() - mac rf set IQ dc calibration
* value.
* @param - tx_i_dc - I-ch dc calibration value.
* @param - tx_q_dc - Q-ch dc calibration value.
* @return - void - void.
*/
void mac_rf_set_tx_dc_cali(uint8_t tx_i_dc, uint8_t tx_q_dc);
/*
* @brief - mac_rf_set_tx_iqm_cali() - mac rf set IQ mag calibration
* value.
* @param - tx_i_m - I-ch mag calibration value.
* @param - tx_q_m - Q-ch mag calibration value.
* @return - void - void.
*/
void mac_rf_set_tx_iqm_cali(uint8_t tx_i_m, uint8_t tx_q_m);
/*
* @brief - mac_rf_set_tx_iqp_cali() - mac rf set IQ phase calibration
* value.
* @param - tx_i_p - I-ch phase calibration value.
* @param - tx_q_p - Q-ch phase calibration value.
* @return - void - void.
*/
void mac_rf_set_tx_iqp_cali(uint8_t tx_i_p, uint8_t tx_q_p);
/*
* @brief - mac_rf_set_tx_filter_cali() - mac rf set tx filter calibration
* value.
* @param - option - specified option, see RF_OPTION_X.
* @param - en - enable calibration value.
* @param - sel - calibration value.
* @return - void - void.
*/
void mac_rf_set_tx_filter_cali(uint8_t option, uint8_t en, uint16_t sel);
/*
* @brief - mac_rf_get_tx_dc_cali() - mac rf get IQ dc calibration
* value.
* @param - tx_i_dc - return I-ch dc calibration value.
* @param - tx_i_dc - return Q-ch dc calibration value.
* @return - void - void.
*/
void mac_rf_get_tx_dc_cali(uint8_t *tx_i_dc, uint8_t *tx_q_dc);
/*
* @brief - mac_rf_get_tx_iqm_cali() - mac rf get IQ mag calibration
* value.
* @param - tx_i_m - return I-ch mag calibration value.
* @param - tx_q_m - return Q-ch mag calibration value.
* @return - void - void.
*/
void mac_rf_get_tx_iqm_cali(uint8_t *tx_i_m, uint8_t *tx_q_m);
/*
* @brief - mac_rf_get_tx_iqp_cali() - mac rf get IQ phase calibration
* value.
* @param - tx_i_p - return I-ch phase calibration value.
* @param - tx_q_p - return Q-ch phase calibration value.
* @return - void - void.
*/
void mac_rf_get_tx_iqp_cali(uint8_t *tx_i_p, uint8_t *tx_q_p);
/*
* @brief - mac_rf_get_tx_filter_cali() - mac rf get tx filter calibration
* value.
* @param - option - specified option, see RF_OPTION_X.
* @param - en - enable calibration value for return.
* @param - sel - calibration value for return.
* @return - void - void.
*/
void mac_rf_get_tx_filter_cali(uint8_t option, uint8_t *en, uint16_t *sel);
/*
* @brief - mac_rf_set_rf_spi() - mac rf set rf spi
* @param - addr - spi addr.
* @param - value - spi value.
* @return - void - void.
*/
void mac_rf_set_rf_spi(uint16_t addr, uint16_t value);
/*
* @brief - mac_rf_get_rf_spi() - mac rf get rf spi
* @param - addr - spi addr.
* @param - value - spi value.
* @return - void - void.
*/
void mac_rf_get_rf_spi(uint16_t *addr, uint16_t *value);
/*
* @brief - mac_rf_set_rf_spi_rw_cfg() - mac rf set rf spi read write config
* @param - value - value.
* @return - void - void.
*/
void mac_rf_set_rf_spi_rw_cfg(uint32_t value);
/*
* @brief - mac_rf_get_rf_spi_rw_cfg() - mac rf get rf spi read write config
* @param - void - void.
* @return - uint32_t - read or write.
*/
uint32_t mac_rf_get_rf_spi_rw_cfg();
/*
* @brief - mac_rf_set_rf_spi_status() - mac rf set rf spi status
* @param - value - success or not.
* @return - void - void.
*/
void mac_rf_set_rf_spi_status(uint32_t value);
/*
* @brief - mac_rf_get_rf_spi_status() - mac rf get rf spi status
* @param - void - void.
* @return - uint32_t - success or not.
*/
uint32_t mac_rf_get_rf_spi_status();
/*
* @brief - mac_rf_tx_dc() - mac rf tx dc
* @param - i_mag - dc i magnitude.
* @param - q_mag - dc q magnitude.
* @param - on_off - on or off.
* @return - void - void.
*/
void mac_rf_tx_dc(uint32_t i_mag, uint32_t q_mag, uint32_t on_off);
/*
* @brief - mac_rf_tx_tone() - mac rf tx tone
* @param - on_off - on or off.
* @param - tone_num - tone num.
* @param - tone_att - tone attenuation.
* @return - void - void.
*/
void mac_rf_tx_tone(uint32_t on_off, uint32_t tone_num, uint32_t tone_att);
/*
* @brief - mac_rf_set_tx_tone_para() - mac rf set tx tone parameter
* @param - on_off - on or off.
* @param - rf_option - on or off.
* @param - tone_num - tone num.
* @param - tone_att - tone attenuation.
* @return - void - void.
*/
void mac_rf_set_tx_tone_para(uint32_t on_off, uint32_t rf_option,
uint32_t tone_num, uint32_t tone_att);
/*
* @brief - mac_rf_get_tx_tone_para() - mac rf get tx tone parameter
* @param - on_off - on or off.
* @param - rf_option - on or off.
* @param - tone_num - tone num.
* @param - tone_num - tone attenuation.
* @return - void - void.
*/
void mac_rf_get_tx_tone_para(uint32_t *on_off, uint32_t *rf_option,
uint32_t *tone_num, uint32_t *tone_att);
/*
* @brief - mac_rf_set_tx_tone_freq() - mac rf set tx tone freq
* @param - freq - freq.
* @return - void - void.
*/
void mac_rf_set_tx_tone_freq(uint32_t freq);
/*
* @brief - mac_rf_get_tx_tone_freq() - mac rf get tx tone freq
* @param - void - void.
* @return - uint32_t - freq.
*/
uint32_t mac_rf_get_tx_tone_freq();
/*
* @brief - mac_rf_set_tx_tone_status() - mac rf set tx tone status
* @param - value - 0/1.
* @return - void - void.
*/
void mac_rf_set_tx_tone_status(uint32_t value);
/*
* @brief - mac_rf_get_tx_tone_status() - mac rf get tx tone status
* @param - void - void.
* @return - uint32_t - status.
*/
uint32_t mac_rf_get_tx_tone_status();
/*
* @brief - mac_rf_set_wphy_ppm() - mac rf set wphy ppm
* @param - ppm_err - ppm err, uint 1/64 ppm.
* @return - void - void.
*/
void mac_rf_set_wphy_ppm(int16_t ppm_err);
/*
* @brief - mac_rf_get_wphy_ppm() - mac rf get wphy ppm
* @param - void - void.
* @return - uint16_t - ppm err, uint 1/64 ppm.
*/
int16_t mac_rf_get_wphy_ppm();
/*
* @brief - mac_rf_set_pb_hdr_to_buf() - mac rf set pb hdr to buf
* @param - value - pb hdr to buf or not.
* @return - void - void.
*/
void mac_rf_set_pb_hdr_to_buf(uint32_t value);
/*
* @brief - mac_rf_get_pb_hdr_to_buf() - mac rf get pb hdr to buf
* @param - void - void.
* @return - uint32_t - pb hdr to buf or not.
*/
uint32_t mac_rf_get_pb_hdr_to_buf();
/*
* @brief - mac_rf_set_bb_ps_idle() - mac rf set bb power save idle or not
* @param - ps_on - set bb ps idle on or not.
* @return - void - void.
*/
void mac_rf_set_bb_ps_idle(uint32_t ps_on);
/*
* @brief - mac_rf_get_bb_ps_idle() - mac rf get bb power save idle or not
* @param - void - void.
* @return - uint32_t - set bb idle or not.
*/
uint32_t mac_rf_get_bb_ps_idle();
/*
* @brief - mac_rf_set_target_tx_power() - mac rf set wphy target tx power
* @param - dbm - target tx power, unit: dbm
* @return - void - void.
*/
void mac_rf_set_target_tx_power(int8_t dbm);
/*
* @brief - mac_rf_get_target_tx_power() - mac rf get wphy target tx power
* @return - pwr - return target tx power, unit: dbm.
* @return - uint32_t - error code, see ERR_XXX.
*/
uint32_t mac_rf_get_target_tx_power(int8_t *pwr);
/*
* @brief - mac_rf_disable_pa() - mac rf pa disable or not
* @return - is_disable - is disable or not.
* @return - void - void
*/
void mac_rf_disable_pa(uint32_t is_disable);
/*
* @brief - mac_rf_is_pa_disable() - mac rf pa is disable or not.
* @return - void - void.
* @return - uint32_t - is disable or not.
*/
uint32_t mac_rf_is_pa_disable();
/*
* @brief - mac_rf_set_tx_cal_update_status() - mac rf set rf tx cal
* update status
* @param - value - success or not.
* @return - void - void.
*/
void mac_rf_set_tx_cal_update_status(uint32_t value);
/*
* @brief - mac_rf_get_tx_cal_update_status() - mac rf get rf tx calibration
* update status
* @return - uint32_t - success or not.
*/
uint32_t mac_rf_get_tx_cal_update_status();
/*
* @brief - mac_rf_set_proto() - mac rf set proto.
* @return - proto - proto, see PLC_PROTO_TYPE_xx.
* @return - void - void
*/
void mac_rf_set_proto(uint32_t proto);
/*
* @brief - mac_rf_get_proto() - mac rf get proto.
* @return - void - void.
* @return - uint32_t - proto, see PLC_PROTO_TYPE_xx.
*/
uint32_t mac_rf_get_proto();
/*
* @brief - mac_rf_set_rf_ver() - mac rf set rf version.
* @param - value - rf version, see RF_VER_XXX.
* @return - void - void.
*/
void mac_rf_set_rf_ver(uint32_t value);
/*
* @brief - mac_rf_get_rf_ver() - mac rf get rf version
* @return - uint32_t - rf version, see RF_VER_XXX.
*/
uint32_t mac_rf_get_rf_ver();
/*
* @brief - mac_rf_set_auto_rxdc_iq_value() - mac rf set auto rx dc i/q.
* @param - i_value - rx dc i value.
* @param - i_value - rx dc q value.
* @return - void - void.
*/
void mac_rf_set_auto_rxdc_iq_value(uint8_t i_value, uint8_t q_value);
/*
* @brief - mac_rf_get_auto_rxdc_iq_value() - mac rf get auto rx dc i/q.
* @param - *i_value - rx dc i value.
* @param - *i_value - rx dc q value.
* @return - void - void.
*/
void mac_rf_get_auto_rxdc_iq_value(uint8_t *i_value, uint8_t *q_value);
/*
* @brief - mac_rf_set_rf_in() - set rf in flag
* @param - in - rf in flag.
*/
void mac_rf_set_rf_in(uint8_t in);
/*
* @brief - mac_rf_is_rf_in() - get rf in flag
* @return - rf in flag
*/
uint8_t mac_rf_is_rf_in(void);
/*
* @brief - mac_rf_set_sta_sel() - mac rf set sta STA mark.
* @param - sta_sel - 1:STA role, 0:non STA roles.
* @return - void - void.
*/
void mac_rf_set_sta_sel(uint8_t sta_sel);
/*
* @brief - mac_rf_is_sta() - mac rf check if it is a STA role
* @return - uint32_t - 1:STA role, 0:non STA roles.
*/
uint32_t mac_rf_is_sta();
/*
* @brief - mac_rf_set_band_sel() - mac rf set freq band
* @return - uint32_t - freq band sel code, see PHY_RF_BAND_XXX
*/
void mac_rf_set_band_sel(uint32_t band_sel);
/*
* @brief - mac_rf_get_band_sel() - mac rf get freq band
* @return - uint32_t - freq band sel code, see PHY_RF_BAND_XX
*/
uint32_t mac_rf_get_band_sel();
#else /* (HW_PLATFORM >= HW_PLATFORM_FPGA) */
#define mac_rf_get_option() (PHY_RF_OPTION2_500K)
#define mac_rf_get_tobe_set_channel_id() (1)
#define mac_rf_get_cur_channel_id() (1)
#define mac_rf_set_wphy_ppm(ppm_err) do { (void)ppm_err;} while(0);
#define mac_rf_get_wphy_ppm() (0)
#define mac_rf_set_pb_hdr_to_buf(value) do { (void)value;} while(0);
#define mac_rf_get_pb_hdr_to_buf() (0)
#define mac_rf_get_hplc_rf_async_tx() (0)
#define mac_rf_set_hplc_rf_async_tx(async_tx) do { (void)async_tx;} while(0);
#define mac_rf_set_target_tx_power(dbm) do { (void)dbm;} while(0);
#define mac_rf_get_rf_ver() (RF_VER_UNKNOWN)
#define mac_rf_get_target_tx_power(pwr) ERR_NOSUPP; \
do { \
(void)(pwr); \
} while(0);
#define mac_rf_set_auto_rxdc_iq_value(i_value, q_value) \
do { (void)i_value; (void)q_value;} while(0);
#define mac_rf_get_auto_rxdc_iq_value(i_value, q_value) \
do { (void)i_value; (void)q_value;} while(0);
#define mac_rf_set_rf_in(in)
#define mac_rf_is_rf_in() (0)
#define mac_rf_set_sta_sel(sta_sel)
#define mac_rf_is_sta() (1)
#define mac_rf_set_band_sel(band_sel)
#define mac_rf_get_band_sel() (0)
#endif /* (HW_PLATFORM >= HW_PLATFORM_FPGA) */
#ifdef __cplusplus
}
#endif
#endif /* MAC_RF_COMMON_HW_H */