100 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			100 lines
		
	
	
		
			3.2 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 CVG_BEACON_SPG_H
							 | 
						||
| 
								 | 
							
								#define CVG_BEACON_SPG_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "iot_config.h"
							 | 
						||
| 
								 | 
							
								/* os shim includes */
							 | 
						||
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* public api includes */
							 | 
						||
| 
								 | 
							
								#include "mac_bcm_api.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* transform tei to sg13 format */
							 | 
						||
| 
								 | 
							
								typedef struct _trans_2_real_tei {
							 | 
						||
| 
								 | 
							
								    uint16_t tei_l : 8,
							 | 
						||
| 
								 | 
							
								             tei_h : 4,
							 | 
						||
| 
								 | 
							
								             resv0 : 4;
							 | 
						||
| 
								 | 
							
								} trans_2_real_tei_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _trans_2_bc_tei {
							 | 
						||
| 
								 | 
							
								    uint16_t tei_l : 4,
							 | 
						||
| 
								 | 
							
								             tei_h : 8,
							 | 
						||
| 
								 | 
							
								             resv0 : 4;
							 | 
						||
| 
								 | 
							
								} trans_2_bc_tei_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* rx beacon descriptor */
							 | 
						||
| 
								 | 
							
								typedef struct _mac_bc_rx_desc_spg {
							 | 
						||
| 
								 | 
							
								    /* flag to mark if it is a freq band detection beacon */
							 | 
						||
| 
								 | 
							
								    uint32_t                detect_bc_flag    :1,
							 | 
						||
| 
								 | 
							
								    /* valid bcn entry count in entry_sort */
							 | 
						||
| 
								 | 
							
								                            entry_sort_cnt    :7,
							 | 
						||
| 
								 | 
							
								    /* beacon entries of the received beacon */
							 | 
						||
| 
								 | 
							
								                            field_flag        :24;
							 | 
						||
| 
								 | 
							
								    iot_pkt_t               *unknown_entry;
							 | 
						||
| 
								 | 
							
								    mac_bc_fc_t             fc;
							 | 
						||
| 
								 | 
							
								    mac_bc_fp_spg_t         fp;
							 | 
						||
| 
								 | 
							
								    mac_bc_sta_cap_spg_t    sta_cap;
							 | 
						||
| 
								 | 
							
								    mac_bc_rt_param_spg_t   rt_param;
							 | 
						||
| 
								 | 
							
								    mac_bc_freq_chg_t       freq_chg;
							 | 
						||
| 
								 | 
							
								    mac_bc_time_slot_t      time_slot;
							 | 
						||
| 
								 | 
							
								    mac_bc_meter_t          meter;
							 | 
						||
| 
								 | 
							
								    mac_bc_vendor_spec_t    vendor;
							 | 
						||
| 
								 | 
							
								    mac_bc_fb_detect_t      fb_detect;
							 | 
						||
| 
								 | 
							
								    mac_bc_rtc_t            rtc;
							 | 
						||
| 
								 | 
							
								    mac_bc_rf_channel_chg_t rf_chg;
							 | 
						||
| 
								 | 
							
								    mac_bc_rf_route_t       rf_route;
							 | 
						||
| 
								 | 
							
								    mac_bc_simple_param_spg_t rf_simple;
							 | 
						||
| 
								 | 
							
								    uint8_t                 entry_sort[MAC_BCN_SORT_MAX_CNT];
							 | 
						||
| 
								 | 
							
								} mac_bc_rx_desc_spg_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if SUPPORT_SOUTHERN_POWER_GRID
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief cvg_get_bc_entry_spg() -  get pointer to beacon entry field specified
							 | 
						||
| 
								 | 
							
								 *                                  by entry_id
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @param bc:         the beacon descriptor
							 | 
						||
| 
								 | 
							
								 * @param entry_id:   entry id of beacon field
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @retval:     NULL        -- if the field is invalid
							 | 
						||
| 
								 | 
							
								 * @retval:     otherwise   -- pointer to specific field
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void* cvg_get_bc_entry_spg(mac_bc_rx_desc_spg_t *bc, uint8_t entry_id);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief cvg_parse_beacon_spg() -  parse a iot_pkt to get beacon info
							 | 
						||
| 
								 | 
							
								 *                                  in a mac_bc_rx_desc_t
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @param pbuf:     pointer to a iot_pkt with beacon raw data
							 | 
						||
| 
								 | 
							
								 * @param bc_desc:  beacon descriptor with all beacon info
							 | 
						||
| 
								 | 
							
								 * @retval:         network id of the beacon
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t cvg_parse_beacon_spg(iot_pkt_t *pbuf, mac_bc_rx_desc_spg_t *bc_desc);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif // SUPPORT_SOUTHERN_POWER_GRID
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* CVG_BEACON_SPG_H */
							 |