Files
kunlun/dtest/dtest3/mac_phy/common/rf_mac_common.c
2024-09-28 14:24:04 +08:00

54 lines
1.8 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.
****************************************************************************/
/* os shim includes */
#include "os_types.h"
#include "rf_mac_common.h"
#include "hw_reg_api.h"
#include "rfplc_reg_base.h"
#include "rfplc_general_reg.h"
#include "rf_mac_reg.h"
#include "mac_sys_reg.h"
/* rf mac free ntb replace mac ntb.
* to save time when generating images.
*/
#define RF_MAC_FREE_NTB_ENABLE 1
void rf_mac_sigtap_enable()
{
uint32_t tmp = RFPLC_GENERAL_READ_REG(CFG_RFPLC_DBG_CTRL_ADDR);
REG_FIELD_SET(CFG_RFPLC_SIGTAP_CTRL, tmp, 1);
RFPLC_GENERAL_WRITE_REG(CFG_RFPLC_DBG_CTRL_ADDR, tmp);
}
void rf_mac_free_ntb_enable()
{
#if RF_MAC_FREE_NTB_ENABLE
uint32_t tmp = RFPLC_GENERAL_READ_REG(CFG_RFPLC_DBG_CTRL_ADDR);
REG_FIELD_SET(CFG_NTB_SOURCE_SEL, tmp, 1);
RFPLC_GENERAL_WRITE_REG(CFG_RFPLC_DBG_CTRL_ADDR, tmp);
#endif
}
uint32_t rf_mac_get_ntb()
{
#if RF_MAC_FREE_NTB_ENABLE
return RFPLC_GENERAL_READ_REG(CFG_RFPLC_NTB_STS_ADDR);
#else
return RGF_MAC_READ_REG(CFG_RD_NTB_ADDR);
#endif
}