📄 system.h
字号:
/*==============================================================================*/
/* file name : system.h (define the ecr and board hardware res) */
/* compiler : SPARC-RTEMS-GCC */
/* author : mr.zhou */
/* copyright : ORBITA Co.,Ltd. All Right Reserved.At 2005-9-2 */
/*==============================================================================*/#ifndef H_SYSTEM
#define H_SYSTEM
#include"gpio.h"
#include"irq.h"
/******************** SYSTEM MODULE DEFINE ********/#define INLUCDE_LCD ENABLE#define INLUCDE_IC_CARD ENABLE#define IC_CARD0_ENABLE ENABLE#define IC_CARD1_ENABLE ENABLE#define INLUCDE_VFD ENABLE#define INCLUDE_PRINT ENABLE#define INCLUDE_IRQ ENABLE#define INCLUDE_KEY ENABLE
#define INLUCDE_USB ENABLE#define USE_INT ENABLE//#define USE_POOL ENABLE#define CPUSYSCLK 20000000#define BAUDRATE 38400
#define KEY_SCAN_FREQ 480000 //4ms :(1/20000000)*4*20000 /******************** typedef DEFINE *****************************/
typedef unsigned char Uchar; /* 8-bit value */typedef unsigned int Uint; /* 16-bit value */typedef unsigned long Ulong; /* 32-bit value */typedef unsigned char BOOL;
typedef unsigned char BYTE; /* 8-bit value */typedef unsigned short WORD; /* 16-bit value */typedef unsigned long DWORD; /* 32-bit value */
typedef unsigned char FLAG;
/******************** MACRO DEFINE *****************************/
#define ON 1
#define OFF 0
#define UP 1
#define DOWN 0
#define HIGH 1
#define LOW 0
#define TRUE 1#define FALSE 0 #define true 1#define false 0 #define ENABLE 1#define DISABLE 0 #define OK 1#define ERROR 0#define ORDER 1#define UNORDER 0
#define INPUT 0
#define OUTPUT 1
#define CLOSE 0
#define OPEN 1
#define EVEN 0
#define ODD 1
#define WORD_WIDTH 32
#define CHAR_WIDTH 16
#define MAX_GRIM 10#define CLOCK_INT_VEC 5
#define PRINT_TIME_STRAT 7
#define PRINT_TIME_STOP 0
/******************** STRUCT DEFINE *****************************/typedef struct data_struct{ BYTE grid_num; //grid number BYTE data; //data display in this grid BYTE dot_flag; //dot flag BYTE tag_flag; //tag flag}VFD_STRUCT;typedef struct { BYTE x_addr; BYTE y_acct; BYTE cursor_num; }LCD_CURSOR;typedef struct { BYTE num_data; BYTE data_flag;
}LCD_PRINT_STRUCT;LCD_PRINT_STRUCT lcd_print_buf[24];BYTE lcd_digit_buff_cursor;BYTE key_input_flag;BYTE key_data;BYTE not_display_time ;BYTE permit_printf;/*********************UC' SYSTEM REGISTER DEFINE ***********************///-------memory register -------
#define MEM_CONFIG1_REG *(volatile unsigned int *)(0x80000000)
#define MEM_CONFIG2_REG *(volatile unsigned int *)(0x80000004)
#define WATCHDOG_REG *(volatile unsigned int *)(0x8000004c) /* system watch dog register */
//-------timer1 & timer2 register-------
#define TIME1_COUNT_REG *(volatile unsigned int *)(0x80000040)
#define TIME1_RELOAD_REG *(volatile unsigned int *)(0x80000044)
#define TIME1_CTRL_REG *(volatile unsigned int *)(0x80000048)
#define TIME2_COUNT_REG *(volatile unsigned int *)(0x80000050)
#define TIME2_RELOAD_REG *(volatile unsigned int *)(0x80000054)
#define TIME2_CTRL_REG *(volatile unsigned int *)(0x80000058)
#define PRE_COUNT1_REG *(volatile unsigned int *)(0x80000060)
#define PRE_RELOAD1_REG *(volatile unsigned int *)(0x80000064)
//-------uart1 & uart2 register-------
/*#define UART1DATA *(volatile unsigned int *)(0x80000070)
#define UART1STATUS *(volatile unsigned int *)(0x80000074)
#define UART1CONTROL *(volatile unsigned int *)(0x80000078)
#define UART1SCALER *(volatile unsigned int *)(0x8000007C)
#define UART2DATA *(volatile unsigned int *)(0x80000080)
#define UART2STATUS *(volatile unsigned int *)(0x80000084)
#define UART2CONTROL *(volatile unsigned int *)(0x80000088)
#define UART2SCALER *(volatile unsigned int *)(0x8000008C)
*/
#define UART0_DATA_REG *(volatile unsigned int *)(0x80000070)
#define UART0_STATUS_REG *(volatile unsigned int *)(0x80000074)
#define UART0_CONTROL_REG *(volatile unsigned int *)(0x80000078)
#define UART0_SCALER_REG *(volatile unsigned int *)(0x8000007C)
#define UART1_DATA_REG *(volatile unsigned int *)(0x80000080)
#define UART1_STATUS_REG *(volatile unsigned int *)(0x80000084)
#define UART1_CONTROL_REG *(volatile unsigned int *)(0x80000088)
#define UART1_SCALER_REG *(volatile unsigned int *)(0x8000008C)
//-------interrupt register-------
#define INT_MASK_REG *(volatile unsigned int *)(0x80000090)
#define INT_PEND_REG *(volatile unsigned int *)(0x80000094)
#define INT_CLEAR_REG *(volatile unsigned int *)(0x8000009c)
#define SEC_INT_MASK_REG *(volatile unsigned int *)(0x800000d0)
#define SEC_INT_PEND_REG *(volatile unsigned int *)(0x800000d4)
#define SEC_INT_CLEAR_REG *(volatile unsigned int *)(0x800000d8)
//-------gpio register-------#define GPI0_DATA_REG *(volatile unsigned int *)(0x800000a0)
#define GPI0_DIR_REG *(volatile unsigned int *)(0x800000a4)
#define GPI1_DATA_REG *(volatile unsigned int *)(0x800000a8)#define GPI1_DIR_REG *(volatile unsigned int *)(0x800000ac)#define GPI2_DATA_REG *(volatile unsigned int *)(0x800000b0)
#define GPI2_DIR_REG *(volatile unsigned int *)(0x800000b4)
//-------timer3 & timer4 register-------
#define TIME3_COUNT_REG *(volatile unsigned int *)(0x8000013c)
#define TIME3_RELOAD_REG *(volatile unsigned int *)(0x80000140)
#define TIME3_CTRL_REG *(volatile unsigned int *)(0x80000144)
#define TIME4_COUNT_REG *(volatile unsigned int *)(0x80000148)
#define TIME4_RELOAD_REG *(volatile unsigned int *)(0x8000014c)
#define TIME4_CTRL_REG *(volatile unsigned int *)(0x80000150)
#define PRE_COUNT2_REG *(volatile unsigned int *)(0x80000154)
#define PRE_RELOAD2_REG *(volatile unsigned int *)(0x80000158)
//-------IC card0 register-------
#define IC0_ENABLE_REG *(volatile unsigned int *)(0x80000240)
// Control ISO7816 enable/disable
// EN = 0 : Can Operate PRSCL_CPS ETU TCI CWT BWT CTP_RXSCL register
// EN = 1 : Can do anything for register
#define IC0_CPS_PRSCL_REG *(volatile unsigned int *)(0x80000244)
// CPS = 0 : PRESC low is value
// CPS = 1 : PRESC high is value
// PIV = Fm/2/Fc -1
#define IC0_ATR_REG *(volatile unsigned int *)(0x80000248)
// ATR = 1 ISO7816 is waiting for IC card reset answer info
// ATR = 0 When reset info was finished
#define IC0_ETU_REG *(volatile unsigned int *)(0x8000024c)
// Element Time Unit
// EIV = element_time_unit_value/2 -1
// Default EIV = 185
#define IC0_TC1_REG *(volatile unsigned int *)(0x80000250)
// Guard Time
// N = TC1 + 11
#define IC0_WWT_REG *(volatile unsigned int *)(0x80000254)
// WWT Work wait time integer value
// default value is 9600
#define IC0_CWT_REG *(volatile unsigned int *)(0x80000258)
// CWT character wait time integer value. when it reset
// Default value is 40
#define IC0_BWT_REG *(volatile unsigned int *)(0x8000025c)
// Default value is 971
#define IC0_T1BE_REG *(volatile unsigned int *)(0x80000260)
// T1 block send End
// It Identified controller had finished send a command block to IC card.
#define IC0_CTP_RXSCL_REG *(volatile unsigned int *)(0x80000264)
// Card type and rx scaler
// RSIV = ((PIV+1)/EIV +PIV)/2
#define IC0_TXDB_REG *(volatile unsigned int *)(0x80000268)
// iso7816 SEND data to IC Card
#define IC0_RXDB_REG *(volatile unsigned int *)(0x8000026c)
// iso7816 RECV data from IC card
#define IC0_STATE_REG *(volatile unsigned int *)(0x80000270)
// Current status of iso7816
#define IC0_WARM_RST_REG *(volatile unsigned int *)(0x80000274)
// 1 execute warm reset
#define IC0_COLD_RST_REG *(volatile unsigned int *)(0x80000278)
#define IC0_STATE_MASK_REG *(volatile unsigned int *)(0x8000027c)
//-------IC card1 register-------
#define IC1_ENABLE_REG *(volatile unsigned int *)(0x80000200)
#define IC1_CPS_PRSCL_REG *(volatile unsigned int *)(0x80000204)
#define IC1_ATR_REG *(volatile unsigned int *)(0x80000208)
#define IC1_ETU_REG *(volatile unsigned int *)(0x8000020c)
#define IC1_TC1_REG *(volatile unsigned int *)(0x80000210)
#define IC1_WWT_REG *(volatile unsigned int *)(0x80000214)
#define IC1_CWT_REG *(volatile unsigned int *)(0x80000218)
#define IC1_BWT_REG *(volatile unsigned int *)(0x8000021c)
#define IC1_T1BE_REG *(volatile unsigned int *)(0x80000220)
#define IC1_CTP_RXSCL_REG *(volatile unsigned int *)(0x80000224)
#define IC1_TXDB_REG *(volatile unsigned int *)(0x80000228)
#define IC1_RXDB_REG *(volatile unsigned int *)(0x8000022c)
#define IC1_STATE_REG *(volatile unsigned int *)(0x80000230)
#define IC1_WARM_RST_REG *(volatile unsigned int *)(0x80000234)
#define IC1_COLD_RST_REG *(volatile unsigned int *)(0x80000238)
#define IC1_STATE_MASK_REG *(volatile unsigned int *)(0x8000023c)
//-------IC card2 register-------
#define IC2_ENABLE_REG *(volatile unsigned int *)(0x80000100)
#define IC2_CPS_PRSCL_REG *(volatile unsigned int *)(0x80000104)
#define IC2_ATR_REG *(volatile unsigned int *)(0x80000108)
#define IC2_ETU_REG *(volatile unsigned int *)(0x8000010C)
#define IC2_TC1_REG *(volatile unsigned int *)(0x80000110)
#define IC2_WWT_REG *(volatile unsigned int *)(0x80000114)
#define IC2_CWT_REG *(volatile unsigned int *)(0x80000118)
#define IC2_BWT_REG *(volatile unsigned int *)(0x8000011C)
#define IC2_T1BE_REG *(volatile unsigned int *)(0x80000120)
#define IC2_CTP_RXSCL_REG *(volatile unsigned int *)(0x80000124)
#define IC2_TXDB_REG *(volatile unsigned int *)(0x80000128)
#define IC2_RXDB_REG *(volatile unsigned int *)(0x8000012c)
#define IC2_STATE_REG *(volatile unsigned int *)(0x80000130)
#define IC2_WARM_RST_REG *(volatile unsigned int *)(0x80000134)
#define IC2_COLD_RST_REG *(volatile unsigned int *)(0x80000138)
#define IC2_STATE_MASK_REG *(volatile unsigned int *)(0x800000FC)
//-------VFD register register-------
#define VFD_RX0_REG *(volatile unsigned int *)(0x80000190) /* VFD receive register0 */
#define VFD_RX1_REG *(volatile unsigned int *)(0x80000194) /* VFD receive register1 */
#define VFD_RX2_REG *(volatile unsigned int *)(0x80000198) /* VFD receive register2 */
#define VFD_RX3_REG *(volatile unsigned int *)(0x8000019c) /* VFD receive register3 */
#define VFD_TX0_REG *(volatile unsigned int *)(0x80000190) /* VFD transmit register0 */
#define VFD_TX1_REG *(volatile unsigned int *)(0x80000194) /* VFD transmit register1 */
#define VFD_TX2_REG *(volatile unsigned int *)(0x80000198) /* VFD transmit register2 */
#define VFD_TX3_REG *(volatile unsigned int *)(0x8000019c) /* VFD transmit register3 */
#define VFD_CTRL_REG *(volatile unsigned int *)(0x800001a0) /* VFD control and status register */
#define VFD_DIVIDER_REG *(volatile unsigned int *)(0x800001a4) /* VFD clock divider register */
#define VFD_ENABLE_REG *(volatile unsigned int *)(0x800001ac) /* VFD enable register */
/*********************ORTHER MEMADDR DEFINE ***********************/
#define sdram_in_addr (volatile unsigned int *)(0x60000000)
//-------Key board IO space-------
#define KEY_REG *(volatile BYTE*) (0x20000002)
#define KEY_WRITE_REG *(volatile BYTE*) (0x20000002)
#define KEY_READ_REG *(volatile BYTE*) (0x20000003)
//-------lcd IO space-------
#define LCD_STLIN_REG *(volatile BYTE*)(0x20000006) //0x20000000
#define LCD_STATUS_REG *(volatile BYTE*)(0x20000006) //0x20000000
#define LCD_DATA_REG *(volatile BYTE*)(0x20000007) //0x20000004
//-------print device IO space----
#define PRINT_BLACK ((*(volatile unsigned char *)(0x20000000)>>2)&0x1)
#define PRINT_PEAR ((*(volatile unsigned char *)(0x20000000)>>1)&0x1)
#define PRINT_TEMP ((*(volatile unsigned char *)(0x20000000)&0x1)
#define PRINT_HEAD *(volatile unsigned char *)(0x20000004)
//-------usb IO space-------
#define USB_ADDR_REG *(volatile BYTE *)0x20000008
#define USB_DATA_REG *(volatile BYTE *)0x20000009
/******************** REGISTER PARAMETER DEFINE **********************/
#define _Get_Reg_Value(result,_register) result = _register
#define _Set_Reg_Value(_register,data) _register = data
#define TIMER1_COUNTER_VAL 0xfff
#define TIMER2_COUNTER_VAL 0xfff
#define SCALER_COUNTER_VAL 0Xff
#define TIMER_EN 0x01
#define TIMER_RL 0x02
#define TEMER_LD 0x04
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -