419 lines
8.7 KiB
C
Executable File
419 lines
8.7 KiB
C
Executable File
/****************************************************************************
|
|
|
|
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 RX_DESC_REG_API
|
|
#define RX_DESC_REG_API
|
|
|
|
#include "os_types.h"
|
|
#include "rgf_mac_rx_desc.h"
|
|
#include "rx_mpdu_start.h"
|
|
#include "rx_mpdu_end.h"
|
|
#include "rx_pb_start.h"
|
|
#include "rx_pb_end.h"
|
|
#include "mac_desc_api.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* TODO: need use macro(RX_DESC_REG_API_INLINE) choose whether to use inline or
|
|
* macro.
|
|
*/
|
|
/* this file for kunlun1 chip */
|
|
#if 1 //#ifdef RX_DESC_REG_API_INLINE
|
|
/* Get desc value start */
|
|
|
|
/* rx_attention desc */
|
|
static inline \
|
|
uint8_t mac_rx_att_get_rx_mpdu_done(rx_attention *base)
|
|
{
|
|
return (uint8_t)(base->rx_mpdu_done);
|
|
}
|
|
|
|
static inline \
|
|
void mac_rx_att_set_rx_mpdu_done(rx_attention *base, uint8_t value)
|
|
{
|
|
base->rx_mpdu_done = value;
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_att_get_is_overflow(rx_attention *base)
|
|
{
|
|
return (uint8_t)(base->is_overflow);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_att_get_is_fcserr(rx_attention *base)
|
|
{
|
|
return (uint8_t)(base->is_fcserr);
|
|
}
|
|
|
|
static inline \
|
|
void mac_rx_att_set_is_fcserr(rx_attention *base, uint8_t value)
|
|
{
|
|
base->is_fcserr = value;
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_att_get_pb_num(rx_attention *base)
|
|
{
|
|
return (uint8_t)(base->pb_num);
|
|
}
|
|
static inline \
|
|
uint8_t mac_rx_att_get_rx_phase(rx_attention *base)
|
|
{
|
|
return (uint8_t)(base->rx_phase);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_att_get_rx_band_sel(rx_attention *base)
|
|
{
|
|
return (uint8_t)(base->rx_band_sel);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_att_get_rx_abort(rx_attention *base)
|
|
{
|
|
return (uint8_t)(base->rx_abort);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_att_get_rx_rate_mode(rx_attention *base)
|
|
{
|
|
return (uint8_t)(base->resv);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_att_get_rx_proto(rx_attention *base)
|
|
{
|
|
return (uint8_t)(base->rx_proto);
|
|
}
|
|
|
|
/* rx_mpdu_start desc */
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_adc_power(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->phy.adc_power);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_agc_gain_entry(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->phy.agc_tbl_entry);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_estimated_dc(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->phy.est_dc);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_estimated_ppm(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->phy.est_ppm);
|
|
}
|
|
|
|
static inline \
|
|
int8_t mac_rx_mpdu_st_get_avg_snr(rx_mpdu_start *base)
|
|
{
|
|
return (int8_t)(base->phy.avg_snr);
|
|
}
|
|
|
|
static inline \
|
|
void mac_rx_mpdu_st_set_avg_snr(rx_mpdu_start *base, int8_t value)
|
|
{
|
|
base->phy.avg_snr = (uint8_t)value;
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_preamble_symb_for_detect(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->phy.pream_sym_detect);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_max_spur_id(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->phy.max_spur_id);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_ring_id(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->ring_id);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_rx_pb_num(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->pb_num);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_rx_proto(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->rx_proto);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_rx_port(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->rx_port);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_rx_phase(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->rx_phase);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_rx_band_sel(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->rx_band_sel);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_st_get_rx_rate_mode(rx_mpdu_start *base)
|
|
{
|
|
return (uint8_t)(base->rate_mode);
|
|
}
|
|
|
|
/* rx_mpdu_end desc */
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_end_get_rx_mpdu_done(rx_mpdu_end *base)
|
|
{
|
|
return (uint8_t)(base->rx_mpdu_done);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_end_get_rx_abnormal_id(rx_mpdu_end *base)
|
|
{
|
|
return (uint8_t)(base->rx_abnormal_id);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_end_get_pb_bitmap(rx_mpdu_end *base)
|
|
{
|
|
return (uint8_t)(base->pb_bitmap);
|
|
}
|
|
|
|
#if 0
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_end_snr(rx_mpdu_end *base)
|
|
{
|
|
return (uint8_t)(base->snr);
|
|
}
|
|
#endif
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_end_get_rx_is_phyerr(rx_mpdu_end *base)
|
|
{
|
|
return (uint8_t)(base->is_phyerr);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_end_get_rx_phyerr_id(rx_mpdu_end *base)
|
|
{
|
|
return (uint8_t)(base->phyerr_id);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_end_get_is_overflow(rx_mpdu_end * base)
|
|
{
|
|
return (uint8_t)(base->is_overflow);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_mpdu_end_get_is_fcserr(rx_mpdu_end * base)
|
|
{
|
|
return (uint8_t)(base->is_fcserr);
|
|
}
|
|
|
|
static inline \
|
|
uint32_t mac_rx_mpdu_end_get_ntb_timestamp(rx_mpdu_end * base)
|
|
{
|
|
return (uint32_t)(base->ntb_ts);
|
|
}
|
|
|
|
static inline \
|
|
void mac_rx_mpdu_end_set_ntb_timestamp(rx_mpdu_end * base, uint32_t value)
|
|
{
|
|
base->ntb_ts = value;
|
|
}
|
|
|
|
static inline \
|
|
uint32_t mac_rx_mpdu_end_get_local_timestamp(rx_mpdu_end * base)
|
|
{
|
|
return (uint32_t)(base->local_ts);
|
|
}
|
|
|
|
static inline \
|
|
void mac_rx_mpdu_end_set_local_timestamp(rx_mpdu_end * base, uint32_t value)
|
|
{
|
|
base->local_ts = value;
|
|
}
|
|
|
|
static inline \
|
|
uint32_t mac_rx_mpdu_end_get_rx_buf_num(rx_mpdu_end * base)
|
|
{
|
|
return (uint32_t)(base->rx_buf_num);
|
|
}
|
|
|
|
static inline \
|
|
uint32_t mac_rx_mpdu_end_get_rx_ntb_ts_cycle(rx_mpdu_end * base)
|
|
{
|
|
return (uint32_t)(base->rx_ntb_timestamp_cycle);
|
|
}
|
|
|
|
static inline \
|
|
uint32_t mac_rx_mpdu_end_get_rx_abort(rx_mpdu_end * base)
|
|
{
|
|
return (uint32_t)(base->rx_abort);
|
|
}
|
|
|
|
static inline \
|
|
uint32_t mac_rx_mpdu_end_get_rx_bb_len(rx_mpdu_end * base)
|
|
{
|
|
return (uint32_t)(base->rx_bb_len);
|
|
}
|
|
|
|
/* rx_pb_start desc */
|
|
static inline \
|
|
uint8_t mac_rx_pb_st_get_last_pb(rx_pb_start *base)
|
|
{
|
|
return (uint8_t)(base->last_pb);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_pb_st_get_first_pb(rx_pb_start *base)
|
|
{
|
|
return (uint8_t)(base->first_pb);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_pb_st_get_ssn(rx_pb_start *base)
|
|
{
|
|
return (uint8_t)(base->ssn);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_pb_st_get_msdu_start(rx_pb_start *base)
|
|
{
|
|
return (uint8_t)(base->msdu_start);
|
|
}
|
|
|
|
static inline \
|
|
void mac_rx_pb_st_set_msdu_start(rx_pb_start *base, uint8_t value)
|
|
{
|
|
base->msdu_start = !!value;
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_pb_st_get_msdu_end(rx_pb_start *base)
|
|
{
|
|
return (uint8_t)(base->msdu_end);
|
|
}
|
|
|
|
static inline \
|
|
void mac_rx_pb_st_set_msdu_end(rx_pb_start *base, uint8_t value)
|
|
{
|
|
base->msdu_end = !!value;
|
|
}
|
|
|
|
/* rx_pb_end desc */
|
|
static inline \
|
|
uint8_t mac_rx_pb_end_get_rx_beacon_pld_crc_err(rx_pb_end *base)
|
|
{
|
|
return (uint8_t)(base->rx_beacon_pld_crc_err);
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_pb_end_get_rx_pb_done(rx_pb_end *base)
|
|
{
|
|
return (uint8_t)(base->rx_pb_done);
|
|
}
|
|
|
|
static inline \
|
|
void mac_rx_pb_end_set_rx_pb_done(rx_pb_end *base, uint8_t value)
|
|
{
|
|
base->rx_pb_done = value;
|
|
}
|
|
|
|
static inline \
|
|
uint8_t mac_rx_pb_end_get_rx_pb_crc_err(rx_pb_end *base)
|
|
{
|
|
return (uint8_t)(base->rx_pb_crc_err);
|
|
}
|
|
|
|
static inline \
|
|
uint32_t mac_rx_pb_end_get_pb_crc(rx_pb_end *base)
|
|
{
|
|
return (uint32_t)(base->crc);
|
|
}
|
|
|
|
static inline \
|
|
void mac_rx_pb_end_set_pb_crc(rx_pb_end *base, uint32_t value)
|
|
{
|
|
base->crc = value;
|
|
}
|
|
|
|
/* Get desc value end */
|
|
|
|
/* Get desc address start */
|
|
/* rx_mpdu_start desc */
|
|
static inline \
|
|
void *mac_rx_mpdu_st_get_fc_addr(rx_mpdu_start *base)
|
|
{
|
|
return (void *)(&(base->fc));
|
|
}
|
|
|
|
static inline \
|
|
void *mac_rx_mpdu_st_get_phy_info_addr(rx_mpdu_start *base)
|
|
{
|
|
return (void *)(&base->phy);
|
|
}
|
|
|
|
/* check fc whether all 0 */
|
|
static inline \
|
|
uint32_t mac_rx_hw_check_fc_valid(uint32_t *fc)
|
|
{
|
|
if (*(fc) | *((fc)+1) | *((fc)+2) | *((fc)+3)) {
|
|
return true;
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/* Get desc address end */
|
|
|
|
#else /* DESC_REG_API_INLINE */
|
|
/* TODO: if the compiler does not support inline, use the macro implementation.
|
|
* as the following example.
|
|
*/
|
|
//#define CFG_RX_ATTEN_ADDR, 0x0000
|
|
/* atten rx mpdu done */
|
|
#define get_rx_atten_mpdu_done(base) \
|
|
REG_FIELD_GET(ATTEN_RX_MPDU_DONE, \
|
|
DESC_READ_REG(CFG_RX_ATTEN_ADDR, base))
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // RX_DESC_REG_API
|