61 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			61 lines
		
	
	
		
			2.0 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 _VC_PROTO_H_
							 | 
						||
| 
								 | 
							
								#define _VC_PROTO_H_
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								#include "vc_task.h"
							 | 
						||
| 
								 | 
							
								#include "vc_commands.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef enum _vc_proto_cmd_status_t {
							 | 
						||
| 
								 | 
							
								    VC_CMD_STATUS_IDLE          = 0x0,
							 | 
						||
| 
								 | 
							
								    VC_CMD_STATUS_WAIT_RESP,
							 | 
						||
| 
								 | 
							
								    VC_CMD_STATUS_WAIT_RESP_TIMEOUT,
							 | 
						||
| 
								 | 
							
								}vc_proto_status_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _vc_proto_stm32_config_t {
							 | 
						||
| 
								 | 
							
								    uint32_t            usb_ena;
							 | 
						||
| 
								 | 
							
								    uint32_t            dbg_ena;
							 | 
						||
| 
								 | 
							
								}vc_proto_stm32_cfg_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief VC_MAX_COMMANDS_PENDING - Max number of commands
							 | 
						||
| 
								 | 
							
								 * running at the same time.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								#define VC_PROTO_MAX_COMMANDS_PENDING       1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief VC_PROTO_MAX_TIME_RESPONSE_TIMEOUT - Max time(ms) to wait stm32
							 | 
						||
| 
								 | 
							
								 * to response a command.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								#define VC_PROTO_MAX_TIME_RESPONSE_TIMEOUT  1500
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief vc_proto_execute_command_from_vc_task - Execute command from vc-task.
							 | 
						||
| 
								 | 
							
								 * @param p_cmd: Command to execute.
							 | 
						||
| 
								 | 
							
								 * @return ERR_FAIL -- Operation failed.
							 | 
						||
| 
								 | 
							
								 * @return ERR_OK -- Operation Successful.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t vc_proto_execute_command_from_vc_task(vc_cmd_t *p_cmd);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief vc_proto_init - Protocal initialize.
							 | 
						||
| 
								 | 
							
								 * @return ERR_FAIL -- No command found.
							 | 
						||
| 
								 | 
							
								 * @return ERR_OK -- Command found and will be parsed to excute.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t vc_proto_init(void);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* _VC_PROTO_H_ */
							 |