types.h

来自「基于ARM和uC/OS-II实现的串口控制台」· C头文件 代码 · 共 97 行

H
97
字号
/***************************************************************************************************
** Filename:    types.h
** Author:      yangfan
** Description: head file of global definition
** Data/Time:   2006-10-30
** Environment: LPC2214
***************************************************************************************************/
#ifndef __TYPES_H__
#define __TYPES_H__

#include "config.h"

#define MAKEUINT16(H, L)    (((uint16)H<<8) | ((uint16)L))
#define HIUINT16(X)         ((uint8)(X>>8))
#define LOUINT16(X)         ((uint8)(X))

#define MAKEUINT32(H, L)    (((uint32)H<<16) | ((uint32)L))
#define HIUINT32(X)         ((uint16)(X>>16))
#define LOUINT32(X)         ((uint16)(X))

#define CRCd_SIZE           2	
#define CRC_SIZE            2		
#define SN_SIZE             4
#define RND_SIZE            12
#define KEK_SIZE            16
#define DEK_SIZE            32
#define IV_SIZE             16
#define ADDR_SIZE           4
#define DE_SIZE             2048

#define LOG_NUM             (64+1)	/*  逻辑信道的数量*/
#define MSG_LENGTH          64		/*  消息队列的长度*/
#define PHYCHL_NUM          2		/*  物理信道的数量*/
#define PHYCHL_LEN          1024	/*  物理信道的长度*/
#define KEK_NUM             256
#define SK_LEN              1024
#define SBOX_LEN            512
#define KDMCADDR            0x22120000
#define ENCRYPT             0
#define DECRYPT             1

#define FPGABUF_LEN         4096
#define RECORD_NUM          0x09    /*  记录字数*/

#define FPGA_DOWNLOAD_FLAG   0
#define FPGA_LENGTH          1
#define FPGA_DOWNLOAD1_FLAG  2
#define FPGA_LENGTH1		 3
#define CFG_UPDATE_FLAG      4
#define DEK_UPDATE_FLAG      5
#define BLOCK_CFG_NUM        6
#define BLOCK_DEK_NUM        7
#define RECORD_CRC		8

#define FPGA_RIGHT          0x55555555
#define CFG_UPDATE          0x66666666
#define DEK_UPDATE          0x77777777

#define BLOCK_SIZE_OUT      4096
#define BLOCK_SIZE_IN       8192
#define FLASH_USE_NUM       90000
#define DOWN_OFFSET         0
#define BACKUP_OFFSET       0x80000

#define FPGA_RECORD         0x100000	/* fpga程序标志记录地址(4KBytes) */
#define CRC_RECORD          0x101000    /* CRC记录地址(4KBytes) */
#define LOG_RECORD          0x102000    /* 逻辑信道信息记录(4KBytes) */
#define CFG_RECORD          0x103000    /* 规则配置记录地址(4KBytes) */
#define DEK_RECORD          0x104000    /* DEK记录地址(4KBytes) */

#define ARM_MAIN            0x3DE000    /* ARM文件(128KBytes) */
#define CRC_BACKUP          0x3FE000    /* (4KBytes) */
#define CONF_ADDR           0x3FF000    /* 配置文件地址(4KBytes) */

#define FILE_LENGTH         (*((volatile unsigned int *)0x00000040))
#define FILE_CRC            (*((volatile unsigned int *)0x00000044))
#define CRC_ADDR            0x00000048

#define VER_LEN             19
#define VERSION             "V1.0.0(2007-03-30)"

#define LOG_LEN				(sizeof(LOGICCHANNEL))
#define CFG_LOG_NUM         16

typedef struct __logicchannel__ {
	uint8 statemachine;
	uint8 logchid;
	uint16 dlci;
	uint16 cfglen;
	uint16 cfgbuf[CFG_LOG_NUM];
	uint32 SN;
}LOGICCHANNEL;

typedef void (*LOGSTATEFUNC)(LOGICCHANNEL* plogch, mbuf* pbuf);

#endif  //__TYPES_H__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?