114 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			114 lines
		
	
	
		
			3.1 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_PDEV_H
 | 
						|
#define MAC_RF_PDEV_H
 | 
						|
 | 
						|
#include "plc_fr.h"
 | 
						|
 | 
						|
#if HW_PLATFORM == HW_PLATFORM_SIMU
 | 
						|
#include "simulator_txrx.h"
 | 
						|
#endif
 | 
						|
#include "mac_rf_vdev.h"
 | 
						|
#include "iot_mem_pool.h"
 | 
						|
#include "plc_mac_cfg.h"
 | 
						|
#include "mac_rf_hwq_mgr.h"
 | 
						|
#include "mac_rx_buf_ring.h"
 | 
						|
#include "iot_pkt.h"
 | 
						|
#include "mac_rf_scan.h"
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
typedef uint32_t(*mac_rf_tx_hw_comp_t)(uint32_t hwqid);
 | 
						|
typedef uint32_t(*mac_rf_rx_t)(void *pdev, uint32_t ring_id, uint32_t quota_ms);
 | 
						|
 | 
						|
typedef struct _mac_rf_pdev {
 | 
						|
    iot_mem_pool_t rf_vdev_pool;
 | 
						|
    uint32_t cur_rf_vdev_num : 3,
 | 
						|
             dbg_pkt_vdev_id : 8,
 | 
						|
             /* reserved for future */
 | 
						|
             resv : 21;
 | 
						|
    mac_rf_vdev_t *rf_vdev[MAX_RF_VDEV_NUM];
 | 
						|
#if HW_PLATFORM == HW_PLATFORM_SIMU
 | 
						|
    simulator_info_t simu;
 | 
						|
#endif
 | 
						|
    mac_rf_queue_ctxt_t hwq_hdl;
 | 
						|
    mac_rx_ring_ctxt_t ring_hdl;
 | 
						|
    /* current rf pdev id */
 | 
						|
    pdevid_t rf_pdev_id;
 | 
						|
    /* parent pdev id */
 | 
						|
    pdevid_t parent_pdev_id;
 | 
						|
    /* mac_tx_hw_comp handler */
 | 
						|
    mac_rf_tx_hw_comp_t tx_comp;
 | 
						|
    /* mac rx handler */
 | 
						|
    mac_rf_rx_t rx;
 | 
						|
    /* rf scan option/channel */
 | 
						|
    mac_rf_scan_ctxt_t rf_scan;
 | 
						|
} mac_rf_pdev_t;
 | 
						|
 | 
						|
#if HPLC_RF_DEV_SUPPORT
 | 
						|
 | 
						|
/*
 | 
						|
 * @brief  -  mac_rf_pdev_init()     rf pdev init
 | 
						|
 * @param  -  pdev_id                pdev id
 | 
						|
 * @return -  0
 | 
						|
 */
 | 
						|
uint32_t mac_rf_pdev_init(pdevid_t pdev_id);
 | 
						|
 | 
						|
/*
 | 
						|
 * @brief  -  get_rf_pdev_ptr()      get rf pdev
 | 
						|
 * @param  -  plc_pdev_id            plc pdev id
 | 
						|
 * @param  -  rf_pdev_id             rf pdev id
 | 
						|
 * @return -  rf pdev
 | 
						|
 */
 | 
						|
mac_rf_pdev_t *get_rf_pdev_ptr(uint32_t plc_pdev_id,
 | 
						|
    uint32_t rf_pdev_id);
 | 
						|
 | 
						|
/*
 | 
						|
 * @brief  -  mac_set_rf_pdev_rx_cb()    mac set rf pdev rx callback.
 | 
						|
 * @param  -  rf_pdev                    the point to rf pdev.
 | 
						|
 * @param  -  rx_cb                      callback
 | 
						|
 * @return -  void
 | 
						|
 */
 | 
						|
void mac_set_rf_pdev_rx_cb(mac_rf_pdev_t *rf_pdev,
 | 
						|
    mac_rf_rx_t rx_cb);
 | 
						|
 | 
						|
#else /* HPLC_RF_DEV_SUPPORT */
 | 
						|
 | 
						|
#define mac_rf_pdev_init(pdev_id) \
 | 
						|
    do { \
 | 
						|
        (void)pdev_id; \
 | 
						|
    } while(0)
 | 
						|
 | 
						|
#define get_rf_pdev_ptr(plc_pdev_id, rf_pdev_id)    NULL;\
 | 
						|
    do { \
 | 
						|
        (void)plc_pdev_id; (void)rf_pdev_id; \
 | 
						|
    } while(0)
 | 
						|
 | 
						|
#define mac_set_rf_pdev_rx_cb(rf_pdev, rx_cb) \
 | 
						|
    do { \
 | 
						|
        (void)rf_pdev; (void)rx_cb; \
 | 
						|
    } while (0)
 | 
						|
 | 
						|
#endif /* HPLC_RF_DEV_SUPPORT */
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
#endif // !MAC_PDEV_H
 |