📄 send.h
字号:
//*-----------------------------------------------------------------------------//* ATMEL Microcontroller Software Support - ROUSSET -//*-----------------------------------------------------------------------------//* The software is delivered "AS IS" without warranty or condition of any//* kind, either express, implied or statutory. This includes without//* limitation any warranty or condition with respect to merchantability or//* fitness for any particular purpose, or against the infringements of//* intellectual property rights of others.//*-----------------------------------------------------------------------------//* File Name : send.h//* Object ://*//* 1.0 17/04/99 JPP : Creation//*-----------------------------------------------------------------------------#ifndef send_h#define send_h/* Defines organization structure */#define ACK_REPLY 0x10#define NACK_REPLY 0x11#define ERROR_REPLY 0x12#define TIME_OUT_REPLY 0x13#define UNKNOWN_REPLY 0x14#define ERROR_NO_READ 0x15#define READ_OK 0x16/* Defines organization structure */typedef struct send_error{ int Consecutive_Repeat; int Cumulative_Repeat; int current_error; int Nak_Reply; int Unknown_Reply; int Error_Reply;} send_error ;typedef struct send_state{ int len; int curent_add; send_error error; BYTE chip; //* Type of chip WORD manufacturer; //* Manufacturer Code WORD type; //* flash type WORD version; //* Upload version WORD cd; //* Clock divisor unsigned int addr; //* Base address Chip select 0} send_state ;#define MAX_DATA_LEN 128#define SIZEOF_CMD 1#define SIZEOF_CHK 1#define MAX_MESS_LEN (MAX_DATA_LEN+SIZEOF_CMD+MAX_DATA_LEN)#define MAX_ATTEMPT_SYNC 10//* ----- Command Liste//* Synchronization command#define SYNCRO_CMD 0x80 //<SYNC> Synchronization//#define LEN_SYNC 1//* acknowledgement command#define ACK_CMD 'A' //<ACK> Acknowledge#define NACK_CMD 'N' //<NACK> Non acknowledge#define ERROR_CMD 'F' //<ERROR> Flash error#define LEN_ERROR 2//* Answer To Synchronization command#define ATS_CMD 'B' //<ATS> Acknowledge To synchronization#pragma pack(1)typedef struct send_ATS{ BYTE command; //* Command code BYTE chip; //* Type of chip WORD manufacturer; //* Manufacturer Code WORD type; //* flash type WORD version; //* Upload version WORD cd; //* Clock divisor unsigned int addr; //* Base address Chip select 0}send_ATS;#define LEN_ATS sizeof(send_ATS)//* Reset command#define RESET_CMD 'Z' //<RESET> Reset Command//* Speed command#define SPEED_CMD 'P' //<SPEED> Speed selection#pragma pack(1)typedef struct send_SPEED{ unsigned char command; //* Command code WORD cd; //* Clock divisor}send_SPEED;#define LEN_SPEED sizeof(send_SPEED)//* Erase command#define ERASE_CMD 'E' //<ERASE> Erase#pragma pack(1)typedef struct send_ERASE{ unsigned char command; //* Command code ERASE unsigned int add; //* Address Sector}send_ERASE;#define LEN_ERASE sizeof(send_ERASE)//* Write command#define WRITE_CMD 'W' //<WRITE> Write#pragma pack(1)typedef struct send_WRITE{ unsigned char command; //* Command code WRITE unsigned int add; //* Start address to write unsigned char len; //* Next Blocks Data length}send_WRITE;#define LEN_WRITE sizeof(send_WRITE)//* Read command#define READ_CMD 'R' //<READ> Read#pragma pack(1)typedef struct send_READ{ unsigned char command; //* Command code READ unsigned int add; //* Start address read unsigned char len; //* Next Blocks Data length}send_READ;#define LEN_READ sizeof(send_READ)//* Data Command#define DATA_CMD 'D' //<DATA> Data#define VERYFY_CMD 'V' //<VERIFY> Verify Host#pragma pack(1)typedef struct send_VERIFY{ unsigned char command; //* Command code VERIFY unsigned int add; //* Start address read unsigned int len; //* Next Blocks Data length unsigned int checksum; //* Checksum}send_VERIFY;#define LEN_VERIFY sizeof(send_VERIFY)#define UPLOAD_CMD 'U' //<UPLOAD> Upload#pragma pack(1)typedef struct send_UPLOAD{ unsigned char command; //* Command code UPLOAD unsigned int add; //* Start address to write unsigned char len; //* Next Blocks Data length}send_UPLOAD;#define LEN_UPLOAD sizeof(send_UPLOAD)#pragma pack(4)/* Function Prototyping File */extern int send_synchro ( void );extern int send_write ( BYTE len,unsigned int add );extern int send_erase ( unsigned int add );extern int send_read ( BYTE * buffer,BYTE len,unsigned int add );extern int send_speed ( WORD cd );extern int send_data ( BYTE * message ,int len);extern int send_verify ( unsigned int add, unsigned int checksum,unsigned int len );extern int send_upload ( BYTE len,unsigned int add );
extern unsigned int verifyChecksum(unsigned char* buffer,int size);
int send_Byte ( BYTE value);int get_Byte_status(void);#endif /* send_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -