⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 define.h

📁 arm7s3c44b0x0里ps2口和lcd口驱动编程实例
💻 H
📖 第 1 页 / 共 2 页
字号:

/* PENDING BIT */
//CAUTION:You must clear the pending bit as general special register.
#define BIT_ADC		(0x1)
#define BIT_RTC		(0x1<<1)
#define BIT_UTXD1	(0x1<<2)
#define BIT_UTXD0	(0x1<<3)
#define BIT_SIO		(0x1<<4)
#define BIT_IIC		(0x1<<5)
#define BIT_URXD1	(0x1<<6)
#define BIT_URXD0	(0x1<<7)
#define BIT_TIMER5	(0x1<<8)
#define BIT_TIMER4	(0x1<<9)
#define BIT_TIMER3	(0x1<<10)
#define BIT_TIMER2	(0x1<<11)
#define BIT_TIMER1	(0x1<<12)
#define BIT_TIMER0	(0x1<<13)
#define BIT_UERR01	(0x1<<14)
#define BIT_WDT		(0x1<<15)
#define BIT_BDMA1	(0x1<<16)
#define BIT_BDMA0	(0x1<<17)
#define BIT_ZDMA1	(0x1<<18)
#define BIT_ZDMA0	(0x1<<19)
#define BIT_TICK	(0x1<<20)
#define BIT_EINT4567	(0x1<<21)
#define BIT_EINT3	(0x1<<22)
#define BIT_EINT2	(0x1<<23)
#define BIT_EINT1	(0x1<<24)
#define BIT_EINT0	(0x1<<25)
#define BIT_GLOBAL	(0x1<<26)


#define SETBIT0  (0x1<<0)
#define SETBIT1  (0x1<<1)
#define SETBIT2  (0x1<<2)
#define SETBIT3  (0x1<<3)
#define SETBIT4  (0x1<<4)
#define SETBIT5  (0x1<<5)
#define SETBIT6  (0x1<<6)
#define SETBIT7  (0x1<<7)
#define SETBIT8  (0x1<<8)
#define SETBIT9  (0x1<<9)
#define SETBIT10 (0x1<<10)
#define SETBIT11 (0x1<<11)
#define SETBIT12 (0x1<<12)
#define SETBIT13 (0x1<<13)
#define SETBIT14 (0x1<<14)
#define SETBIT15 (0x1<<15)
#define SETBIT16 (0x1<<16)
#define SETBIT17 (0x1<<17)
#define SETBIT18 (0x1<<18)
#define SETBIT19 (0x1<<19)
#define SETBIT20 (0x1<<20)
#define SETBIT21 (0x1<<21)
#define SETBIT22 (0x1<<22)
#define SETBIT23 (0x1<<23)
#define SETBIT24 (0x1<<24)
#define SETBIT25 (0x1<<25)
#define SETBIT26 (0x1<<26)
#define SETBIT27 (0x1<<27)
#define SETBIT28 (0x1<<28)
#define SETBIT29 (0x1<<29)
#define SETBIT30 (0x1<<30)
#define SETBIT31 (0x1<<31)

#ifdef __cplusplus
}
#endif

#endif  /* __ARMSYS44b0_H__ */





/*===============================================================*/
//              System configuration define
/*===============================================================*/
#ifndef	__CONFIG_H__
#define	__CONFIG_H__

#include "\inc\define.h"

#define	A07S44B0P_BOARD            //???

#define	SET_SYSCLK_SUPPORT
#define	RTC_TIMER_SUPPORT
#define	HARDWARE_TIMER_SUPPORT
#define	NAND_FLASH_SUPPORT
#define	IIC_ROM_SUPPORT
#define	SERIAL_DOWNLOAD_SUPPORT
#define	XMODEM_DOWNLOAD_SUPPORT
#define	ETHERNET_SUPPORT
#ifdef	ETHERNET_SUPPORT
#define	TFTP_DOWNLOAD_SUPPORT
#endif

#ifdef  NAND_FLASH_SUPPORT 
#define	SAVE_ENV_SUPPORT
#endif

#define	TIMER_FREQ	1000

#define	CMD_SHELL_SUPPORT

#define	DEFAULT_IP_ADDR		((192<<24)|(168<<16)|(253<<8)|2)   //默认IP为192.168.253.2
#define	DEFAULT_IP_MASK		(0xffffff00)	                   //默认子网掩码255.255.255.0
#define	DEFAULT_IP_GATE		((192<<24)|(168<<16)|(253<<8)|1)   //默认网关是192.168.253.1

#define	SERIAL_PORTS		2
#define	DEFAULT_SERIAL_PORT	0
#define	DEFAULT_SERIAL_BAUD	115200

#define	ROM_BASE	0
#define	ROM_SIZE	SIZE_2M
#define	DRAM_BASE	0x0c000000
#define	DRAM_SIZE	SIZE_8M

#define	ROM_END			(ROM_BASE + ROM_SIZE)
#define	DRAM_END		(DRAM_BASE + DRAM_SIZE)
#define	BIOS_RUN_ADDR	(DRAM_END - SIZE_256K)

#define	BOOT_PARAMS_ADDR	(DRAM_BASE+0x100)
#define	BIOS_SIZE			(SIZE_64K)
#define	BIOS_BASE			(ROM_SIZE-BIOS_SIZE)
#define	BIOS_LOAD			(ROM_SIZE-4)
#define BIOS_ENV_ADDR		(ROM_SIZE-0x200)

#define	DFT_DOWNLOAD_ADDR	(DRAM_BASE + 0x8000)
#define	DFT_INITRD_ADDR		(DRAM_BASE + (DRAM_SIZE>>1))

#if (SERIAL_PORTS>1)
#define	SERIAL_PORTS_SWITCH
#endif

#endif	/* __CONFIG_H__ */





/*===============================================================*/
//              Data and Value Define
/*===============================================================*/
#ifndef __DEF_H__                         
#define __DEF_H__

#define U32 unsigned int                    //Data types
#define U16 unsigned short
#define U8  unsigned char
#define S32 int
#define S16 short
#define	S8  char

#define	BYTE	unsigned char
#define	WORD 	unsigned short
#define	DWORD	int
#define	UINT	U32
#define	LPSTR	(U8 *)
#define	BOOL	int
#define	USHORT	U16

#define TRUE 	1   
#define FALSE 	0
#define	NULL	0
#define FAIL    0
#define	OK		1

#define	SIZE_1K		0x00000400             //Space Capacity
#define	SIZE_2K		0x00000800
#define	SIZE_4K		0x00001000
#define	SIZE_8K		0x00002000
#define	SIZE_16K	0x00004000
#define	SIZE_32K	0x00008000
#define	SIZE_64K	0x00010000
#define	SIZE_128K	0x00020000
#define	SIZE_256K	0x00040000
#define	SIZE_512K	0x00080000
#define	SIZE_1M		0x00100000
#define	SIZE_2M		0x00200000
#define	SIZE_4M		0x00400000
#define	SIZE_8M		0x00800000
#define	SIZE_16M	0x01000000
#define	SIZE_32M	0x02000000
#define	SIZE_64M	0x04000000
#define	SIZE_128M	0x08000000
#define	SIZE_256M	0x10000000
#define	SIZE_512M	0x20000000
#define	SIZE_1G		0x40000000
#define	SIZE_2G		0x80000000

#define	ENTER_KEY	0x0d                   //Key Value
#define	BACK_KEY	0x08
#define BEEP_KEY	0x07
#define UP_KEY		0x41
#define DOWN_KEY	0x42
#define RIGHT_KEY	0x43		
#define LEFT_KEY	0x44
#define HOME_KEY	0x48
#define END_KEY		0x4b
#define	ESC_KEY		0x1b

typedef struct
{
	char *name;
	U32 freq;
}SysClock;                              //SysClock;

typedef struct
{
	unsigned short year;
	unsigned char month;
	unsigned char day;
	unsigned char weekday;
	unsigned char hour;
	unsigned char min;
	unsigned char sec;
}TIME_STRUC;                            //TIME_STRUC;

struct Partition                        //Partition
{
	U32 offset;
	U32 size;
	char *name;
};

typedef struct 
{
	unsigned char flag[8];				//系统参数标志"params"
	struct 
	{
		unsigned long ip;
		unsigned long mask;
		unsigned long gate;
	}nic_cfg;							
	unsigned long baud;					
	unsigned int  current_uart;			
	unsigned long clk_para[4];			
	unsigned long prog_s_addr;			
	unsigned long prog_r_addr;			
	unsigned char boot_params[256];		
	unsigned long boot_key;				
	unsigned long saved_in;				
	unsigned long initrd_addr;			
	unsigned long machine;				
}EnvParams;

#endif                                  /*__DEF_H__*/






/*=================================================================*/
//          System option define
/*=================================================================*/
#ifndef __OPTION_H__
#define __OPTION_H__

#define ADS120		           //项目编译环境定义

#define MCLK_D 64000000		   //系统主频设定
#define	EXT_OSC_CLK	8000000

//#define PLLON 1
//Fout = (8 + M_DIV) * Fin / [ (2+P_DIV) * (2^S_DIV) ]
#if   (MCLK_D==24000000)
	#define PLL_M (16)
	#define PLL_P (2)
	#define PLL_S (1)

#elif (MCLK_D==32000000)
	#define PLL_M (24)
	#define PLL_P (2)
	#define PLL_S (1)

#elif (MCLK_D==40000000)
	#define PLL_M (32)
	#define PLL_P (2)
	#define PLL_S (1)

#elif (MCLK_D==48000000)
	#define PLL_M (40)
	#define PLL_P (2)
	#define PLL_S (1)

#elif (MCLK_D==56000000)
	#define PLL_M (48)
	#define PLL_P (2)
	#define PLL_S (1)

#elif (MCLK_D==64000000)
	#define PLL_M (56)
	#define PLL_P (2)
	#define PLL_S (1)

#elif (MCLK_D==66000000)
	#define PLL_M (58)
	#define PLL_P (2)
	#define PLL_S (1)
#endif

#define WRBUFOPT (0x8)                  //写缓冲使能(Enabel write buffer operation)

#define SYSCFG_0KB (0x0|WRBUFOPT)		//迟延无效,数据异常结束有效
#define SYSCFG_4KB (0x2|WRBUFOPT)		//迟延无效,数据异常结束有效
#define SYSCFG_8KB (0x6|WRBUFOPT)		//迟延无效,数据异常结束有效

#define DRAM	    1		            //In case DRAM is used
#define SDRAM	    2		            //In case SDRAM is used
#define BDRAMTYPE   SDRAM	            //used in power.c,44blib.c

#define BUSWIDTH    (16)                //BUSWIDTH; 16,32

#define CACHECFG    SYSCFG_8KB

#define _RAM_STARTADDRESS 0x0c000000
//08M字节 SDRAM:0x0c000000-0x0c7fffff
//16M字节 SDRAM:0x0c000000-0x0cffffff
//32M字节 SDRAM:0x0c000000-0x0dffffff
//64M字节 SDRAM:0x0c000000-0x0fffffff

//#define _ISR_STARTADDRESS 0xc3fff00   //GCS6:32M bits(4M字节) DRAM/SDRAM
#define _ISR_STARTADDRESS 0xc7fff00     //GCS6:64M bits(8M字节) DRAM/SDRAM
#define _IRQ_BASEADDRESS  0xc000000 	//GCS6:64M bits(8MB) SDRAM

#define Non_Cache_Start	(0x2000000)     //(0)//(0x1c00000)
#define Non_Cache_End 	(0xc000000)

#endif                                  /*__OPTION_H__*/


⌨️ 快捷键说明

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