162 lines
5.2 KiB
C
Executable File
162 lines
5.2 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 __MAC_CHECK_SPUR_H__
|
|
#define __MAC_CHECK_SPUR_H__
|
|
|
|
/* os shim includes */
|
|
#include "os_types.h"
|
|
#include "os_timer_api.h"
|
|
#include "mac_sched_hw.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#if PHY_HW_SPIKE_OPTIMIZATION
|
|
/* PHY_BBAI_SLIDE_WINDOWS:
|
|
* 20ms * 3 = 60ms
|
|
* the phy_chn_nf_update function takes 118ms to execute twice.
|
|
* total time = 20*N + 118
|
|
*/
|
|
#define MAC_CHECK_SPUR_MS 178
|
|
#define MAC_CHECK_SPUR_MAGIN_MS 400
|
|
#else
|
|
/* PHY_BBAI_FIX_WINDOWS:
|
|
* 10ms * 6 = 60ms
|
|
* time = 10*N + 25
|
|
* PHY_BBAI_SLIDE_WINDOWS:
|
|
* 20ms * 3 = 60ms
|
|
* time = 30*N + 25
|
|
*/
|
|
#define MAC_CHECK_SPUR_MS 85
|
|
#define MAC_CHECK_SPUR_MAGIN_MS 200
|
|
#endif
|
|
|
|
/*
|
|
* totally check spur duration
|
|
* is compose of actual HW check spur time + margin time
|
|
* (200 + 10) = 210ms
|
|
*/
|
|
#define MAC_CHECK_SPUR_NTB MAC_MS_TO_NTB(MAC_CHECK_SPUR_MS + \
|
|
MAC_CHECK_SPUR_MAGIN_MS)
|
|
|
|
typedef enum {
|
|
/* mac start check spur initalization status */
|
|
MAC_CHECK_SPUR_INIT,
|
|
/* mac CCO start check spur period status */
|
|
MAC_CCO_CHECK_SPUR_WAIT_PERIOD_START,
|
|
/* mac CCO start check spur status */
|
|
MAC_CCO_CHECK_SPUR_WAIT_PERIOD_END,
|
|
/* mac sta start check spur status */
|
|
MAC_STA_CHECK_SPUR
|
|
} MAC_CHECK_SPUR_ENUM;
|
|
|
|
/* this is per pdev, for check spur */
|
|
typedef struct _mac_check_spur_ctxt {
|
|
uint8_t
|
|
/* cco check spur status
|
|
* 0: initalization status
|
|
* 1: start check spur period
|
|
* 2: start check spur
|
|
*/
|
|
is_check_spur_sts : 2,
|
|
/* check_spur_en = 0 : disable check spur
|
|
* check_spur_en = 1 : enable check spur
|
|
*/
|
|
check_spur_en : 1,
|
|
/* record the continuous spur check cnt */
|
|
con_spur_cnt : 3,
|
|
/* sta period check spur */
|
|
sta_period_spur_en : 1,
|
|
resv : 1;
|
|
|
|
#if CCO_CHECK_SPUR_SUPPORT
|
|
/* check spur timer */
|
|
timer_id_t cco_check_spur_timer;
|
|
#else
|
|
/*sta check spur timer*/
|
|
timer_id_t sta_check_spur_timer;
|
|
#endif
|
|
uint32_t check_spur_time_ntb;
|
|
uint64_t next_bcn_start_ntb;
|
|
|
|
/* record ratio */
|
|
uint32_t do_checkspur_cnt;
|
|
uint32_t do_checkspur_success_cnt;
|
|
} mac_check_spur_ctxt_t;
|
|
|
|
/**
|
|
*@brief mac_check_spur_init mac check spur init
|
|
*@param spur_ctxt point to mac_check_cpur_ctxt
|
|
*@param check_spur_en check spur enable/disable
|
|
*@param check_spur_time_ntb check spur time ntb
|
|
*@exception [none.]
|
|
*@return [0]
|
|
*/
|
|
uint32_t mac_check_spur_init(mac_check_spur_ctxt_t *spur_ctxt, \
|
|
uint32_t check_spur_time_ntb);
|
|
|
|
/**
|
|
*@brief mac_check_spur mac check spur.
|
|
*@param spur_ctxt point to mac_check_cpur_ctxt
|
|
*@param pdev point to pdev
|
|
*@param time_ms time ms
|
|
*@param is_check_slot whether need judge slot
|
|
*@exception [none.]
|
|
*@return [0]
|
|
*/
|
|
uint32_t mac_check_spur(mac_check_spur_ctxt_t *spur_ctxt, \
|
|
void *pdev, uint32_t time_ms, bool_t is_check_slot);
|
|
|
|
/**
|
|
*@brief mac_check_spur_for_txhang mac check spur for tx hang.
|
|
*@exception [none.]
|
|
*@return [0]
|
|
*/
|
|
uint32_t mac_check_spur_for_txhang();
|
|
|
|
/**
|
|
*@brief mac_check_spur_en mac check spur timer enable.
|
|
*@param spur_ctxt point to mac_check_cpur_ctxt
|
|
*@param enable enalbe/disable.
|
|
*@exception [none.]
|
|
*@return [0]
|
|
*/
|
|
uint32_t mac_check_spur_en(mac_check_spur_ctxt_t *spur_ctxt, uint32_t enable);
|
|
|
|
/**
|
|
*@brief mac_check_spur_cert mac check spur for cert mode.
|
|
*@param time_ms do bbai time ms
|
|
*@exception [none.]
|
|
*@return [0: success, or not fail]
|
|
*/
|
|
uint32_t mac_check_spur_cert(uint32_t time_ms);
|
|
|
|
/**
|
|
*@brief mac_phy_channel_est_msg mac phy channel estimed.
|
|
*@param time_ms do bbai time ms
|
|
*@exception [none.]
|
|
*@return [0: success, or not fail]
|
|
*/
|
|
uint32_t mac_phy_channel_est_msg(uint32_t time_ms);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|