68 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			68 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 SWC_LIB_INTERNAL_H
							 | 
						||
| 
								 | 
							
								#define SWC_LIB_INTERNAL_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* os shim includes */
							 | 
						||
| 
								 | 
							
								#include "os_types_api.h"
							 | 
						||
| 
								 | 
							
								#include "os_lock_api.h"
							 | 
						||
| 
								 | 
							
								#include "os_event_api.h"
							 | 
						||
| 
								 | 
							
								#include "os_task_api.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* common includes */
							 | 
						||
| 
								 | 
							
								#include "iot_queue_api.h"
							 | 
						||
| 
								 | 
							
								#include "iot_mem_pool_api.h"
							 | 
						||
| 
								 | 
							
								#include "iot_ipc_api.h"
							 | 
						||
| 
								 | 
							
								#include "iot_swc_msg_api.h"
							 | 
						||
| 
								 | 
							
								#include "iot_task_api.h"
							 | 
						||
| 
								 | 
							
								#include "iot_pkt_api.h"
							 | 
						||
| 
								 | 
							
								#include "iot_config_api.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* swc lib gobal variable */
							 | 
						||
| 
								 | 
							
								typedef struct _swc_lib_global {
							 | 
						||
| 
								 | 
							
								    /* ipc handler to communicate with swc stack */
							 | 
						||
| 
								 | 
							
								    iot_ipc_h           ipc_h;
							 | 
						||
| 
								 | 
							
								    /* lock to protect the app array */
							 | 
						||
| 
								 | 
							
								    os_mutex_h          lock;
							 | 
						||
| 
								 | 
							
								    /* callback method to send data to app. */
							 | 
						||
| 
								 | 
							
								    iot_swc_lib_cb_t    on_recv;
							 | 
						||
| 
								 | 
							
								} swc_lib_global_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								extern swc_lib_global_t *p_swc_lib;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								extern iot_ipc_addr_t swc_stack_addr;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief swc_lib_prep_msg() - prepare swc lib message header a iot pkt
							 | 
						||
| 
								 | 
							
								 * @param pkt:        pointer to the packet
							 | 
						||
| 
								 | 
							
								 * @param msg_id:     msg id of the packet
							 | 
						||
| 
								 | 
							
								 * @param req_id:     request id
							 | 
						||
| 
								 | 
							
								 * @return:
							 | 
						||
| 
								 | 
							
								 *  pointer to the buffer right after the swc lib message header
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint8_t *swc_lib_prep_msg(iot_pkt_t *pkt, uint8_t msg_id,
							 | 
						||
| 
								 | 
							
								    uint8_t req_id);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* SWC_LIB_INTERNAL_H */
							 |