📄 protocol.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 : protocol.h
//* Object : Flash Memory Upload protocol definition
//* 1.0 17/04/00 EL : Creation
//* 1.1 03/07/00 EL : Reset command
//*----------------------------------------------------------------------------
/*
*/
typedef __packed struct ATS_Command
{
u_char code;
u_char chip;
u_short manuf;
u_short flash;
u_short version;
u_short cd;
u_int addr;
} ATS_Command;
typedef __packed struct SPEED_Command
{
u_char code;
u_short cd;
} SPEED_Command;
typedef __packed struct ERASE_Command
{
u_char code;
u_int addr;
} ERASE_Command;
typedef __packed struct WRITE_Command
{
u_char code;
u_int addr;
u_char len;
} WRITE_Command;
typedef __packed struct READ_Command
{
u_char code;
u_int addr;
u_char len;
} READ_Command;
typedef __packed struct VERIFY_Command
{
u_char code;
u_int addr;
u_int len;
u_int checksum;
} VERIFY_Command;
typedef __packed struct ERROR_Command
{
u_char code;
u_char error_code;
} ERROR_Command;
#define COMMAND_CODE 0
#define COMMAND_MAX_SIZE 128
#define FREE 0
#define RESERVED 1
#define CHECKED 2
//* SYNC
#define LEN_SYNC_COMMAND 1
#define SYNC 0x80
//* ATS
#define LEN_ATS_COMMAND sizeof(ATS_Command)
#define ATS 'B'
#define ATS_CHIP 1
#define ATS_MANUFACTURER 2
#define ATS_FLASH 4
#define ATS_VERSION 6
#define ATS_CD 8
#define ATS_ADDR 10
//* SPEED
#define LEN_SPEED_COMMAND sizeof(SPEED_Command)
#define SPEED 'P'
#define SPEED_CD 1
//* ACK
#define LEN_ACK_COMMAND 1
#define ACK 'A'
//* NACK
#define LEN_NACK_COMMAND 1
#define NACK 'N'
//* ERASE
#define LEN_ERASE_COMMAND sizeof(ERASE_Command)
#define ERASE 'E'
#define ERASE_SECT 1
//* WRITE
#define LEN_WRITE_COMMAND sizeof(WRITE_Command)
#define WRITE 'W'
#define WRITE_ADDR 1
#define WRITE_LEN 5
//* READ
#define LEN_READ_COMMAND sizeof(READ_Command)
#define READ 'R'
#define READ_ADDR 1
#define READ_LEN 5
//* DATA
#define LEN_DATA_COMMAND 128
#define DATA 'D'
#define DATA_D0 1
//* VERIFY
#define LEN_VERIFY_COMMAND sizeof(VERIFY_Command)
#define VERIFY 'V'
#define VERIFY_ADDR 1
#define VERIFY_LEN 5
#define VERIFY_CHK 9
//* ERROR
#define LEN_ERROR_COMMAND sizeof(ERROR_Command)
#define ERROR 'F'
#define ERROR_CODE 1
#define WRITE_ERROR 1
#define READ_ERROR 2
#define ERASE_ERROR 3
#define COMM_ERROR 4
//* RESET
#define LEN_RESET_COMMAND 1
#define RESET 'Z'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -