78 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			78 lines
		
	
	
		
			2.8 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_NWM_CTRL_PROTO_SG_H
							 | 
						||
| 
								 | 
							
								#define __CVG_NWM_CTRL_PROTO_SG_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* os shim includes */
							 | 
						||
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								#include "os_utils.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* public includes */
							 | 
						||
| 
								 | 
							
								#include "plc_fr.h"
							 | 
						||
| 
								 | 
							
								#include "plc_utils.h"
							 | 
						||
| 
								 | 
							
								#include "plc_mpdu_header.h"
							 | 
						||
| 
								 | 
							
								#include "iot_pkt_api.h"
							 | 
						||
| 
								 | 
							
								#include "iot_errno.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* cvg module internal includes */
							 | 
						||
| 
								 | 
							
								#include "cvg_nwm_internal.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if (PLC_SUPPORT_EXT_PROTO && SUPPORT_SMART_GRID)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief cvg_nwm_ctrl_proto_rx_check_sg() - sanity check for controller
							 | 
						||
| 
								 | 
							
								 *        protocol extension frame.
							 | 
						||
| 
								 | 
							
								 * @param: nwm  - nwm vdev pointer
							 | 
						||
| 
								 | 
							
								 * @param: fc   - pointer to frame control of the frame
							 | 
						||
| 
								 | 
							
								 * @param: data - it will point to pointer to data area of extension frame
							 | 
						||
| 
								 | 
							
								 *                for return, unused at present.
							 | 
						||
| 
								 | 
							
								 * @param: len  - it will point to data length extension frame for return,
							 | 
						||
| 
								 | 
							
								 *                unused at present.
							 | 
						||
| 
								 | 
							
								 * @retval: ERR_OK    -  for success case
							 | 
						||
| 
								 | 
							
								 *          otherwise -  for failure case, see error code.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint8_t cvg_nwm_ctrl_proto_rx_check_sg(cvg_nwm_vdev_t *nwm,
							 | 
						||
| 
								 | 
							
								    frame_control_t *fc, uint8_t **data, uint32_t *len);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * @brief cvg_nwm_ctrl_proto_sof_rx_handle_sg() - check if the sof frame from
							 | 
						||
| 
								 | 
							
								 *        controller link, if so, handling.
							 | 
						||
| 
								 | 
							
								 * @param: nwm  -  nwm vdev pointer
							 | 
						||
| 
								 | 
							
								 * @param: fc   -  pointer frame control.
							 | 
						||
| 
								 | 
							
								 * @param: buf  -  pointer to iot_pkt containing sof frame.
							 | 
						||
| 
								 | 
							
								 * @retuval: 1  -  this frame comes from the controller link, and iot_pkt is
							 | 
						||
| 
								 | 
							
								 *                 consumed.
							 | 
						||
| 
								 | 
							
								 *           0  -  non controller link frame, iot_pkt is not consumed.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint8_t cvg_nwm_ctrl_proto_sof_rx_handle_sg(cvg_nwm_vdev_t *nwm,
							 | 
						||
| 
								 | 
							
								    frame_control_t *fc, iot_pkt_t *buf);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#else /* (PLC_SUPPORT_EXT_PROTO && SUPPORT_SMART_GRID) */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define cvg_nwm_ctrl_proto_rx_check_sg(nwm, fc, data, len) (ERR_NOSUPP)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define cvg_nwm_ctrl_proto_sof_rx_handle_sg(nwm, fc, buf) (0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* (PLC_SUPPORT_EXT_PROTO && SUPPORT_SMART_GRID) */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* __CVG_NWM_CTRL_PROTO_SG_H */
							 |