189 lines
6.6 KiB
C
Executable File
189 lines
6.6 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_SCHED_H
|
|
#define MAC_SCHED_H
|
|
|
|
/* os shim includes */
|
|
#include "os_types.h"
|
|
|
|
/* mac module internal includes */
|
|
#include "mac_vdev.h"
|
|
#include "mac_pdev.h"
|
|
|
|
/* public api includes */
|
|
#include "mac_bcm_api.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
/* define the csma only peirod. ms. HPLC and RF must be the same */
|
|
#define MAC_CSMA_ONLY_PEIROD_MS (3000)
|
|
|
|
/* ieee1901 nncco duration unit */
|
|
#define MAC_I1901_NN_CCO_PER_DUR_MS (40)
|
|
|
|
/* define the time that early stop cmdlist. unit ms */
|
|
#define MAC_EARLY_STOP_CMDLIST_T_MS 2
|
|
|
|
/*
|
|
* @brief mac_sched_nn_rx() - shceduler module neighbor network negotiation
|
|
* frame rx handler.
|
|
* @param pdev: mac pdev pointer.
|
|
* @param fc: pointer to frame header.
|
|
* @param ntb: receive timestamp of the frame. unit is 1 ntb.
|
|
* @param snr: rx snr of the frame
|
|
* @param is_rf: flag to mark if come from rf link
|
|
* @param band_id: hplc band id come from rx desc
|
|
*/
|
|
void mac_sched_nn_rx(mac_pdev_t *pdev, void *fc, uint32_t ntb,
|
|
int8_t snr, uint8_t is_rf, uint8_t band_id);
|
|
|
|
/*
|
|
* @brief mac_sched_nn_report_nid() - shceduler module report nid and rf
|
|
* information.
|
|
* @param vdev: mac vdev pointer.
|
|
*/
|
|
void mac_sched_nn_report_nid(mac_vdev_t *vdev);
|
|
|
|
/*
|
|
* @brief mac_sched_cco_snr_rx() - shceduler module cco snr rx handler.
|
|
* @param vdev: mac vdev pointer
|
|
* @param nid: network id
|
|
* @param snr: rx snr of the frame
|
|
* @param rf_id: rf channel id of the neighbour network
|
|
* @param rf_option: rf option id of the neighbour network
|
|
* @param is_rf: flag to mark if come from rf link
|
|
* @param band_id: hplc band id come from rx desc
|
|
*/
|
|
void mac_sched_cco_snr_rx(mac_vdev_t *vdev, uint32_t nid, int8_t snr,
|
|
uint8_t rf_id, uint8_t rf_option, uint8_t is_rf, uint8_t band_id);
|
|
|
|
/*
|
|
* @brief mac_sched_nn_tx () - trigger shceduler module to send neighbor
|
|
* network negotiation frame.
|
|
* @param vdev: mac vdev pointer.
|
|
*/
|
|
void mac_sched_nn_tx(mac_vdev_t *vdev);
|
|
|
|
/*
|
|
* @brief mac_sched_cco_set() - set schedule of next beacon period cco verison
|
|
* @param vdev: pointer to mac vdev
|
|
* @param ts: pointer to time slot assignment of the next beacon
|
|
period
|
|
* @param start_ntb64: start NTB 64bit version of next beacon period
|
|
* @param next_start_ntb64: start NTB 64bit version of beacon period after
|
|
* next beacon period
|
|
*
|
|
* @retval real start NTB 64bit version of next beacon period. Note that
|
|
* scheduler may adjust the start NTB for neighbor network bandwidth
|
|
* negotiation.
|
|
*/
|
|
uint64_t mac_sched_cco_set(mac_vdev_t *vdev, mac_bc_time_slot_t *ts,
|
|
uint64_t start_ntb64, uint64_t *next_start_ntb64);
|
|
|
|
/*
|
|
* @brief mac_sched_sta_set() - set schedule of next beacon period sta version
|
|
* @param vdev: pointer to mac vdev
|
|
* @param ts: pointer to time slot assignment of the next beacon
|
|
period
|
|
* @param start_ntb: start NTB 32bit version of next beacon period
|
|
* @param phase_a_tx: flag to mark if phase a csma slot tx allowed
|
|
* @param phase_b_tx: flag to mark if phase b csma slot tx allowed
|
|
* @param phase_c_tx: flag to mark if phase c csma slot tx allowed
|
|
* @param need_early_stop: flag to mark cmd early stop or not.
|
|
*/
|
|
void mac_sched_sta_set(mac_vdev_t *vdev, mac_bc_time_slot_t *ts,
|
|
uint32_t start_ntb, uint8_t phase_a_tx, uint8_t phase_b_tx,
|
|
uint8_t phase_c_tx, uint8_t need_early_stop);
|
|
|
|
/*
|
|
* mac_sched_stop() - stop scheduler
|
|
* @vdev: pointer to mac vdev
|
|
*/
|
|
void mac_sched_stop(mac_vdev_t *vdev);
|
|
|
|
/*
|
|
* @biref set scheduler to work in csma only mode
|
|
* @param vdev: pointer to mac vdev
|
|
* @param start_ntb: start NTB of the rx only mode
|
|
* @param enable_tx: set 0 if tx should be disabled
|
|
*/
|
|
void mac_sched_set_csma_only(mac_vdev_t *vdev, uint64_t start_ntb,
|
|
uint8_t enable_tx);
|
|
|
|
/*
|
|
* @brief mac_sched_cco_bc_alert() - cco device command list end alert handler
|
|
* @param vdev: mac vdev pointer
|
|
*/
|
|
void mac_sched_cco_bc_alert(mac_vdev_t *vdev);
|
|
|
|
/*
|
|
* @brief mac_sched_cco_set_nw_nego() - cco device set network negotiation
|
|
* @param vdev: mac vdev pointer
|
|
* @param enable: 1 - enable, 0 - disable
|
|
*/
|
|
void mac_sched_cco_set_nw_nego(mac_vdev_t *vdev, uint8_t enable);
|
|
|
|
/*
|
|
* @brief mac_sched_sta_bc_alert() - sta device command list end alert handler
|
|
* @param vdev: mac vdev pointer
|
|
*/
|
|
void mac_sched_sta_bc_alert(mac_vdev_t *vdev);
|
|
|
|
/*
|
|
* @brief mac_sched_init() - init mac scheduler context
|
|
* @param vdev: mac vdev pointer
|
|
*/
|
|
void mac_sched_init(mac_vdev_t *vdev);
|
|
|
|
/*
|
|
* @brief mac_sched_get_nidmap() - get sched receive nid bitmap.
|
|
* @param vdev: mac vdev pointer
|
|
* return: nid bitmap
|
|
*/
|
|
uint32_t mac_sched_get_nidmap(mac_vdev_t *vdev);
|
|
|
|
/*
|
|
* @brief mac_dump_sched_dbg() - mac dump schedule cmd list.
|
|
* @param :
|
|
* return: void
|
|
*/
|
|
void mac_dump_sched_dbg();
|
|
|
|
/*
|
|
* @brief mac_sched_ntb_32_to_64() - change num from 32bit to 64bit.
|
|
* @param vdev: mac vdev pointer
|
|
* @param ntb32: need change num. 32bit
|
|
* return: changed num. 64bit
|
|
*/
|
|
uint64_t mac_sched_ntb_32_to_64(mac_vdev_t *vdev, uint32_t ntb32);
|
|
|
|
/*
|
|
* @brief mac_sched_get_saved_bp_start_ntb64()
|
|
* - mac get saved bp start in current cmd list, in 64 bits.
|
|
* @param vdev: mac vdev pointer
|
|
* return: return start ntb.
|
|
*/
|
|
uint64_t mac_sched_get_saved_bp_start_ntb64(mac_vdev_t *vdev);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* MAC_SCHED_H */
|