59 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			59 lines
		
	
	
		
			1.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 __DTEST_FPGA_COMMUNICATION_H__
							 | 
						||
| 
								 | 
							
								#define __DTEST_FPGA_COMMUNICATION_H__
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef int status;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define DTST_OK     (0)
							 | 
						||
| 
								 | 
							
								#define DTST_ERR    (-1)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define bit(n)      (1 << (n))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#pragma pack(push)  /* save the pack status */
							 | 
						||
| 
								 | 
							
								#pragma pack(1)     /* 1 byte align */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief dtest_cmd_header_t - Header of frame.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								typedef struct _dtest_command_frame_header_t_ {
							 | 
						||
| 
								 | 
							
								    uint16_t pre_code;      /* Pre-code, fixed as 0xAAAA */
							 | 
						||
| 
								 | 
							
								    uint16_t data_length;   /* Length of data section. */
							 | 
						||
| 
								 | 
							
								    uint8_t  data[0];
							 | 
						||
| 
								 | 
							
								} dtest_cmd_header_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief dtest_cmd_tail_t - Tail of frame.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								typedef struct _dtest_command_frame_tail_t_ {
							 | 
						||
| 
								 | 
							
								    uint16_t crc16;         /* CRC16, from "data_length" to end of data. */
							 | 
						||
| 
								 | 
							
								    uint8_t  pst_code;      /* Post-code, fixed as 0xFF. */
							 | 
						||
| 
								 | 
							
								} dtest_cmd_tail_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#pragma pack(pop)   /* restore the pack status */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								int dtest_cmcn_send(void *dpntr, int len);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								int dtest_cmcn_receive(void *dpntr, int len);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								int dtest_cmcn_init(uint8_t rx_pin, uint8_t tx_pin);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 |