73 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			73 lines
		
	
	
		
			2.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_H
							 | 
						||
| 
								 | 
							
								#define MAC_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* os shim includes */
							 | 
						||
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								#include "os_task.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* common includes */
							 | 
						||
| 
								 | 
							
								#include "iot_mem_pool.h"
							 | 
						||
| 
								 | 
							
								#include "iot_queue.h"
							 | 
						||
| 
								 | 
							
								#include "iot_utils.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* mac module internal includes */
							 | 
						||
| 
								 | 
							
								#include "mac_dsr.h"
							 | 
						||
| 
								 | 
							
								#include "mac_msg.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the mac message queue count and priorities, the higer the priority
							 | 
						||
| 
								 | 
							
								 * the lower the queue number.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								#define MAC_MSG_QUEUE_HP            0
							 | 
						||
| 
								 | 
							
								#define MAC_MSG_QUEUE_MP            1
							 | 
						||
| 
								 | 
							
								#define MAC_MSG_QUEUE_LP            2
							 | 
						||
| 
								 | 
							
								#define MAC_MSG_QUEUE_MAX_PRIO      3
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* mac layer global descriptor */
							 | 
						||
| 
								 | 
							
								typedef struct _mac_global {
							 | 
						||
| 
								 | 
							
								    /* mac task handle */
							 | 
						||
| 
								 | 
							
								    os_task_h       task_h;
							 | 
						||
| 
								 | 
							
								    /* mac message queues */
							 | 
						||
| 
								 | 
							
								    mac_msg_queue_t msg_q[MAC_MSG_QUEUE_MAX_PRIO];
							 | 
						||
| 
								 | 
							
								    /* mac messages pool */
							 | 
						||
| 
								 | 
							
								    iot_mem_pool_t  *msg_p;
							 | 
						||
| 
								 | 
							
								    /* mac sync messages pool */
							 | 
						||
| 
								 | 
							
								    iot_mem_pool_t  *msg_sync_p;
							 | 
						||
| 
								 | 
							
								    /* mac dsr handler table */
							 | 
						||
| 
								 | 
							
								    mac_dsr_table_t dsr_table;
							 | 
						||
| 
								 | 
							
								} mac_global_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* CPU0 & CPU1 mac layer share data context */
							 | 
						||
| 
								 | 
							
								typedef struct _mac_cpu_share_ctxt {
							 | 
						||
| 
								 | 
							
								    uint32_t is_need_cpu1_mac_reinit : 1,
							 | 
						||
| 
								 | 
							
								        resv : 31;
							 | 
						||
| 
								 | 
							
								} mac_cpu_share_ctxt_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* mac layer global data */
							 | 
						||
| 
								 | 
							
								extern mac_global_t* p_mac_glb;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* MAC_H */
							 |