148 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			148 lines
		
	
	
		
			4.9 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_SCHED_H
							 | 
						||
| 
								 | 
							
								#define MAC_RF_SCHED_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* os shim includes */
							 | 
						||
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* mac module internal includes */
							 | 
						||
| 
								 | 
							
								#include "mac_rf_vdev.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* public api includes */
							 | 
						||
| 
								 | 
							
								#include "mac_bcm_api.h"
							 | 
						||
| 
								 | 
							
								#include "plc_beacon.h"
							 | 
						||
| 
								 | 
							
								#include "iot_pkt_api.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if HPLC_RF_DEV_SUPPORT
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief mac_sched_cco_set() - set schedule of next beacon period cco verison
							 | 
						||
| 
								 | 
							
								 * @param rf_vdev:            - pointer to mac rf 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:   - next start NTB for cmd list.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @return void:              - void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void mac_rf_sched_cco_set(mac_rf_vdev_t *rf_vdev, mac_bc_time_slot_t *ts,
							 | 
						||
| 
								 | 
							
								    uint64_t start_ntb64, uint64_t next_start_ntb64);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief mac_rf_sched_cco_bc_alert() - rf sched cco alert.
							 | 
						||
| 
								 | 
							
								 * @param rf_vdev:                    - pointer to mac rf vdev.
							 | 
						||
| 
								 | 
							
								 * @param cco_started:                - cco started or not.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @return void:                      - void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void mac_rf_sched_cco_bc_alert(mac_rf_vdev_t *rf_vdev, uint8_t cco_started);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief mac_rf_sched_sta_set() - set schedule of next beacon period sta version.
							 | 
						||
| 
								 | 
							
								 * @param rf_vdev:            - pointer to mac rf 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 need_early_stop:    - flag to mark cmd early stop or not.
							 | 
						||
| 
								 | 
							
								 * @return tx_flag:           - sta tx flag. see BEACON_TX_xx_xx.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t mac_rf_sched_sta_set(mac_rf_vdev_t *rf_vdev, mac_bc_time_slot_t *ts,
							 | 
						||
| 
								 | 
							
								    uint32_t start_ntb, uint8_t need_early_stop);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief mac_sched_sta_bc_alert()    - rf sched sta alert.
							 | 
						||
| 
								 | 
							
								 * @param rf_vdev:                    - pointer to mac rf vdev.
							 | 
						||
| 
								 | 
							
								 * @param ts:                         - timeslot.
							 | 
						||
| 
								 | 
							
								 * @param start_ntb:                  - start ntb.
							 | 
						||
| 
								 | 
							
								 * @param ts_reuse:                   - timeslot reuse or not.
							 | 
						||
| 
								 | 
							
								 * @param tx_resus:                   - tx reuse or not.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @return void:                      - void.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void mac_rf_sched_sta_bc_alert(mac_rf_vdev_t *rf_vdev, mac_bc_time_slot_t *ts,
							 | 
						||
| 
								 | 
							
								    uint64_t start_ntb, uint8_t ts_reuse, uint32_t tx_resus);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief mac_rf_sched_stop() - stop scheduler
							 | 
						||
| 
								 | 
							
								 * @param rf_vdev:            - pointer to mac rf vdev
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void mac_rf_sched_stop(mac_rf_vdev_t *rf_vdev);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @biref   mac_rf_sched_set_csma_only  - set scheduler to work in csma only mode
							 | 
						||
| 
								 | 
							
								 * @param   rf_vdev:                    - mac rf vdev pointer
							 | 
						||
| 
								 | 
							
								 * @param   start_ntb:                  - start NTB of the rx only mode
							 | 
						||
| 
								 | 
							
								 * @param   enable_tx:                  - set 0 if tx should be disabled
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void mac_rf_sched_set_csma_only(mac_rf_vdev_t *rf_vdev, uint64_t start_ntb,
							 | 
						||
| 
								 | 
							
								    uint8_t enable_tx);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief mac_rf_sched_init()      - init mac scheduler context
							 | 
						||
| 
								 | 
							
								 * @param rf_vdev:                 - mac rf vdev pointer
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void mac_rf_sched_init(mac_rf_vdev_t *rf_vdev);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define mac_rf_sched_cco_set(rf_vdev, ts, start_ntb64, next_start_ntb64) \
							 | 
						||
| 
								 | 
							
								    do { \
							 | 
						||
| 
								 | 
							
								        (void)rf_vdev;(void)ts;(void)start_ntb64;(void)next_start_ntb64; \
							 | 
						||
| 
								 | 
							
								    } while(0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define mac_rf_sched_cco_bc_alert(rf_vdev, cco_started); \
							 | 
						||
| 
								 | 
							
								    do { \
							 | 
						||
| 
								 | 
							
								        (void)rf_vdev;(void)cco_started; \
							 | 
						||
| 
								 | 
							
								    } while(0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define mac_rf_sched_sta_set(rf_vdev, ts, start_ntb, need_early_stop)    \
							 | 
						||
| 
								 | 
							
								    BEACON_TX_ONLY_HPLC; \
							 | 
						||
| 
								 | 
							
								    do { \
							 | 
						||
| 
								 | 
							
								        (void)rf_vdev;(void)ts;(void)start_ntb; \
							 | 
						||
| 
								 | 
							
								    } while(0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define mac_rf_sched_sta_bc_alert(rf_vdev, ts, start_ntb, ts_reuse, tx_resus); \
							 | 
						||
| 
								 | 
							
								    do { \
							 | 
						||
| 
								 | 
							
								        (void)rf_vdev;(void)ts_reuse;(void)tx_resus;(void)ts;(void)start_ntb; \
							 | 
						||
| 
								 | 
							
								    } while(0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define mac_rf_sched_stop(rf_vdev); \
							 | 
						||
| 
								 | 
							
								    do { \
							 | 
						||
| 
								 | 
							
								        (void)rf_vdev; \
							 | 
						||
| 
								 | 
							
								    } while(0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define mac_rf_sched_set_csma_only(rf_vdev, start_ntb, enable_tx); \
							 | 
						||
| 
								 | 
							
								    do { \
							 | 
						||
| 
								 | 
							
								        (void)rf_vdev;(void)start_ntb;(void)enable_tx; \
							 | 
						||
| 
								 | 
							
								    } while(0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define mac_rf_sched_init(rf_vdev); \
							 | 
						||
| 
								 | 
							
								    do { \
							 | 
						||
| 
								 | 
							
								        (void)rf_vdev; \
							 | 
						||
| 
								 | 
							
								    } while(0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* MAC_RF_SCHED_H */
							 |