📄 s2440.h
字号:
struct EP3DTMBits EP3DTM; // 0x250
BYTE rsvd261; // 0x251
BYTE rsvd262; // 0x252
BYTE rsvd263; // 0x253
struct EP3DTHBits EP3DTH; // 0x254
BYTE rsvd264; // 0x255
BYTE rsvd265; // 0x256
BYTE rsvd266; // 0x257
struct EP4DCBits EP4DC; // 0x258
BYTE rsvd267; // 0x259
BYTE rsvd268; // 0x25a
BYTE rsvd269; // 0x25b
struct EP4DUBits EP4DU; // 0x25C
BYTE rsvd270; // 0x25d
BYTE rsvd271; // 0x25e
BYTE rsvd272; // 0x25f
struct EP4DFBits EP4DF; // 0x260
BYTE rsvd273; // 0x261
BYTE rsvd274; // 0x262
BYTE rsvd275; // 0x263
struct EP4DTLBits EP4DTL; // 0x264
BYTE rsvd276; // 0x265
BYTE rsvd277; // 0x266
BYTE rsvd278; // 0x267
struct EP4DTMBits EP4DTM; // 0x268
BYTE rsvd279; // 0x269
BYTE rsvd280; // 0x26a
BYTE rsvd281; // 0x26b
struct EP4DTHBits EP4DTH; // 0x26C
};
//
// Registers : Interrupt Controller
//
#define INT_BASE 0xB0A00000 // 0x4A000000 0xB0A00000
typedef struct {
unsigned int rSRCPND;
unsigned int rINTMOD;
unsigned int rINTMSK;
unsigned int rPRIORITY;
unsigned int rINTPND;
unsigned int rINTOFFSET;
unsigned int rSUBSRCPND;
unsigned int rINTSUBMSK;
}INTreg ;
// S3C2440X01 Interrupt controller bit positions
#define BIT_EINT0 (0x1)
#define BIT_EINT1 (0x1<<1)
#define BIT_EINT2 (0x1<<2)
#define BIT_EINT3 (0x1<<3)
#define BIT_EINT4_7 (0x1<<4)
#define BIT_EINT8_23 (0x1<<5)
#define BIT_CAM (0x1<<6)
#define BIT_BAT_FLT (0x1<<7)
#define BIT_TICK (0x1<<8)
#define BIT_WDT_AC97 (0x1<<9)
#define BIT_TIMER0 (0x1<<10)
#define BIT_TIMER1 (0x1<<11)
#define BIT_TIMER2 (0x1<<12)
#define BIT_TIMER3 (0x1<<13)
#define BIT_TIMER4 (0x1<<14)
#define BIT_UART2 (0x1<<15)
#define BIT_LCD (0x1<<16)
#define BIT_DMA0 (0x1<<17)
#define BIT_DMA1 (0x1<<18)
#define BIT_DMA2 (0x1<<19)
#define BIT_DMA3 (0x1<<20)
#define BIT_MMC (0x1<<21)
#define BIT_SPI0 (0x1<<22)
#define BIT_UART1 (0x1<<23)
#define BIT_RSV2 (0x1<<24)
#define BIT_USBD (0x1<<25)
#define BIT_USBH (0x1<<26)
#define BIT_IIC (0x1<<27)
#define BIT_UART0 (0x1<<28)
#define BIT_SPI1 (0x1<<29)
#define BIT_RTC (0x1<<30)
#define BIT_ADC (0x1<<31)
#define BIT_ALLMSK (0xffffffff)
#define BIT_SUB_AC97 (0x1<<14)
#define BIT_SUB_WDT (0x1<<13)
#define BIT_SUB_CAM_P (0x1<<12)
#define BIT_SUB_CAM_C (0x1<<11)
#define BIT_SUB_ADC_S (0x1<<10)
//#define BIT_SUB_ADC (0x1<<10)
#define BIT_SUB_TC (0x1<<9)
#define BIT_SUB_ERR2 (0x1<<8)
#define BIT_SUB_TXD2 (0x1<<7)
#define BIT_SUB_RXD2 (0x1<<6)
#define BIT_SUB_ERR1 (0x1<<5)
#define BIT_SUB_TXD1 (0x1<<4)
#define BIT_SUB_RXD1 (0x1<<3)
#define BIT_SUB_ERR0 (0x1<<2)
#define BIT_SUB_TXD0 (0x1<<1)
#define BIT_SUB_RXD0 (0x1<<0)
#define BIT_SUB_ALLMSK (0x7ff)
// S3C2440X01 Interrupt controller source number OEMInterruptHandler的case 语句的值
#define INTSRC_EINT0 0
#define INTSRC_EINT1 1
#define INTSRC_EINT2 2
#define INTSRC_EINT3 3
#define INTSRC_EINT4_7 4
#define INTSRC_EINT8_23 5
#define INTSRC_CAM 6
#define INTSRC_BAT_FLT 7
#define INTSRC_TICK 8
#define INTSRC_WDT_AC97 9
#define INTSRC_TIMER0 10
#define INTSRC_TIMER1 11
#define INTSRC_TIMER2 12
#define INTSRC_TIMER3 13
#define INTSRC_TIMER4 14
#define INTSRC_UART2 15
#define INTSRC_LCD 16
#define INTSRC_DMA0 17
#define INTSRC_DMA1 18
#define INTSRC_DMA2 19
#define INTSRC_DMA3 20
#define INTSRC_MMC 21
#define INTSRC_SPI0 22
#define INTSRC_UART1 23
#define INTSRC_RSV2 24
#define INTSRC_USBD 25
#define INTSRC_USBH 26
#define INTSRC_IIC 27
#define INTSRC_UART0 28
#define INTSRC_SPI1 29
#define INTSRC_RTC 30
#define INTSRC_ADC 31
#define INTSRC_ALLMSK (0xffffffff)
// S3C2440X01 Interrupt controller bit positions
// For SUB source pending bit.
#define INTSUB_RXD0 (0x1 << 0)
#define INTSUB_TXD0 (0x1 << 1)
#define INTSUB_ERR0 (0x1 << 2)
#define INTSUB_RXD1 (0x1 << 3)
#define INTSUB_TXD1 (0x1 << 4)
#define INTSUB_ERR1 (0x1 << 5)
#define INTSUB_RXD2 (0x1 << 6)
#define INTSUB_TXD2 (0x1 << 7)
#define INTSUB_ERR2 (0x1 << 8)
#define INTSUB_TC (0x1 << 9)
#define INTSUB_ADC (0x1 << 10)
#define INTSUB_CAM_C (0x1 << 11) // 030610
#define INTSUB_CAM_P (0x1 << 12) // 040218, INTSUB_CAM_S - 030610
#define INTSUB_WDT (0x1 << 13) // 040218
#define INTSUB_AC97 (0x1 << 14) // 040218
#define INTSUB_SLLMSK (0xFFFFFFFF)
#define INTSUB_BASE 0xB0A00018 // 0x4A000018 // serial
#define INTSUB_MSK 0xB0A0001C // 0x4A00001C // serial
#define BIT_SUB_ALLMSK (0x7ff)
//
// Registers : LCD Controller
//
#define LCD_BASE 0xB0D00000 // 0x4D000000
typedef struct {
unsigned int rLCDCON1; // 00
unsigned int rLCDCON2; // 04
unsigned int rLCDCON3; // 08
unsigned int rLCDCON4; // 0C
unsigned int rLCDCON5; // 10
unsigned int rLCDSADDR1; // 14
unsigned int rLCDSADDR2; // 18
unsigned int rLCDSADDR3; // 1C
unsigned int rREDLUT; // 20
unsigned int rGREENLUT; // 24
unsigned int rBLUELUT; // 28
unsigned int rPAD[8]; // 2C - 48
unsigned int rDITHMODE; // 4C
unsigned int rTPAL; // 50
unsigned int rLCDINTPND; // 54
unsigned int rLCDSRCPND; // 58
unsigned int rLCDINTMSK; // 5C
unsigned int rTCONSEL; // 60 ;;; SHL
}LCDreg ;
// LCD register value...
#define MODE_STN_1BIT (1)
#define MODE_STN_2BIT (2)
#define MODE_STN_4BIT (4)
#define MODE_CSTN_8BIT (108)
#define MODE_CSTN_12BIT (112)
#define MODE_TFT_1BIT (201)
//#define MODE_TFT_2BIT (202)
//#define MODE_TFT_4BIT (204)
#define MODE_TFT_8BIT (208)
#define MODE_TFT_16BIT (216)
#define SCR_XSIZE (640) //for virtual screen
#define SCR_YSIZE (480)
//#define SCR_XSIZE_TFT (1280) //for virtual screen
//#define SCR_YSIZE_TFT (960)
#define LCD_XSIZE_STN (320)
#define LCD_YSIZE_STN (240)
#define LCD_XSIZE_CSTN (320)
#define LCD_YSIZE_CSTN (240)
//#define LCD_XSIZE_STN (240)
//#define LCD_YSIZE_STN (320)
//#define LCD_XSIZE_CSTN (240)
//#define LCD_YSIZE_CSTN (320)
#if (LCD_TYPE == TFT640_480)
#define LCD_XSIZE_TFT (640)
#define LCD_YSIZE_TFT (480)
#elif (LCD_TYPE == TFT240_320)
#define LCD_XSIZE_TFT (240)
#define LCD_YSIZE_TFT (320)
#elif (LCD_TYPE == TFT320_240)
#define LCD_XSIZE_TFT (320)
#define LCD_YSIZE_TFT (240)
#endif
#if (LCD_TYPE == TFT640_480)
#define SCR_XSIZE_TFT (LCD_XSIZE_TFT*2)
#define SCR_YSIZE_TFT (LCD_YSIZE_TFT*2)
#elif (LCD_TYPE == TFT240_320)
#define SCR_XSIZE_TFT (480) //for virtual screen
#define SCR_YSIZE_TFT (640)
#elif (LCD_TYPE == TFT320_240)
#define SCR_XSIZE_TFT (640) //for virtual screen
#define SCR_YSIZE_TFT (480)
#endif
#define ARRAY_SIZE_STN_1BIT (SCR_XSIZE/8*SCR_YSIZE)
#define ARRAY_SIZE_STN_2BIT (SCR_XSIZE/4*SCR_YSIZE)
#define ARRAY_SIZE_STN_4BIT (SCR_XSIZE/2*SCR_YSIZE)
#define ARRAY_SIZE_CSTN_8BIT (SCR_XSIZE/1*SCR_YSIZE)
#define ARRAY_SIZE_CSTN_12BIT (SCR_XSIZE*2*SCR_YSIZE)
#define ARRAY_SIZE_TFT_8BIT (SCR_XSIZE/1*SCR_YSIZE)
//#define ARRAY_SIZE_TFT_16BIT (SCR_XSIZE*2*SCR_YSIZE)
#define ARRAY_SIZE_TFT_16BIT (LCD_XSIZE_TFT*2*LCD_YSIZE_TFT)
#define HOZVAL_STN (LCD_XSIZE_STN/4-1)
#define LINEVAL_STN (LCD_YSIZE_STN-1)
#define HOZVAL_CSTN (LCD_XSIZE_CSTN*3/8-1)
#define LINEVAL_CSTN (LCD_YSIZE_CSTN-1)
#if (LCD_TYPE == TFT640_480)
#define HOZVAL_TFT (LCD_XSIZE_TFT-1)
#define LINEVAL_TFT (LCD_YSIZE_TFT-1)
#elif (LCD_TYPE == TFT240_320)
#define HOZVAL_TFT (LCD_XSIZE_TFT-1)
#define LINEVAL_TFT (LCD_YSIZE_TFT-1)
#elif (LCD_TYPE == TFT320_240)
#define HOZVAL_TFT (LCD_XSIZE_TFT-1)
#define LINEVAL_TFT (LCD_YSIZE_TFT-1)
#endif
//STN/CSTN timing parameter for LCBHBT161M(NANYA)
#define WLH (3)
#define WDLY (3)
#define LINEBLANK (1 &0xff)
//TFT timing parameter for V16C6448AB(PRIME VIEW)
#if (LCD_TYPE == TFT640_480)
#define MVAL (13)
#define MVAL_USED (0)
#define VBPD ((3)&0xff)
#define VFPD ((3)&0xff)
#define VSPW ((2) &0x3f)
#define HBPD ((12)&0x7f)
#define HFPD ((12)&0xff)
#define HSPW ((30)&0xff)
#elif (LCD_TYPE == TFT240_320)
#define MVAL (13)
#define MVAL_USED (12) //wujiarui
#define VBPD ((3)&0xff)
#define VFPD ((3)&0xff)
#define VSPW ((2) &0x3f)
#define HBPD ((12)&0x7f)
#define HFPD ((12)&0xff)
#define HSPW ((30)&0xff)
#elif (LCD_TYPE == TFT320_240)
#define MVAL (13)
#define MVAL_USED (0) //wujiarui
#define VBPD ((3)&0xff)
#define VFPD ((5)&0xff)
#define VSPW ((15) &0x3f)
#define HBPD ((5)&0x7f)
#define HFPD ((15)&0xff)
#define HSPW ((8)&0xff)
#endif
#define CLKVAL_STN_MONO (22)
//69.14hz @60Mhz,WLH=16clk,WDLY=16clk,LINEBLANK=1*8,VD=4
#define CLKVAL_STN_GRAY (12)
//124hz @60Mhz,WLH=16clk,WDLY=16clk,LINEBLANK=1*8,VD=4
#define CLKVAL_CSTN (8)
//135hz @60Mhz,WLH=16clk,WDLY=16clk,LINEBLANK=1*8,VD=8
//#define CLKVAL_TFT (1)
#define CLKVAL_TFT (7)
//#define CLKVAL_TFT (7)
//NOTE: 1)SDRAM should have 32-bit bus width.
// 2)HBPD,HFPD,HSPW should be optimized.
//44.6hz @75Mhz
//VSYNC,HSYNC should be inverted
//HBPD=48VCLK,HFPD=16VCLK,HSPW=96VCLK
//VBPD=33HSYNC,VFPD=10HSYNC,VSPW=2HSYNC
#define M5D(n) ((n) & 0x1fffff)
//
// ADC
//
#define ADC_BASE 0xB1800000 // 0x58000000
typedef struct {
unsigned int rADCCON;
unsigned int rADCTSC;
unsigned int rADCDLY;
unsigned int rADCDAT0;
unsigned int rADCDAT1;
unsigned int rADCUPDN; // fwood 030830
}ADCreg ;
//
// Registers : RTC
//
#define RTC_BASE 0xB1700000 // 0x57000000
typedef struct {
unsigned int rPAD1[16]; // 00 - 3C
unsigned int rRTCCON; // 40
unsigned int rTICINT;
unsigned int rPAD2[2];
unsigned int rRTCALM;
unsigned int rALMSEC;
unsigned int rALMMIN;
unsigned int rALMHOUR;
unsigned int rALMDAY;
unsigned int rALMMON;
unsigned int rALMYEAR;
unsigned int rRTCRST;
unsigned int rBCDSEC;
unsigned int rBCDMIN;
unsigned int rBCDHOUR;
unsigned int rBCDDAY;
unsigned int rBCDDATE;
unsigned int rBCDMON;
unsigned int rBCDYEAR;
} RTCreg;
#if 0 // _BIG_ENDIAN
#define rRTCCON (*(volatile unsigned char *)0xB1700043)
#define rRTCALM (*(volatile unsigned char *)0xB1700053)
#define rALMSEC (*(volatile unsigned char *)0xB1700057)
#define rALMMIN (*(volatile unsigned char *)0xB170005b)
#define rALMHOUR (*(volatile unsigned char *)0xB170005f)
#define rALMDAY (*(volatile unsigned char *)0xB1700063)
#define rALMMON (*(volatile unsigned char *)0xB1700067)
#define rALMYEAR (*(volatile unsigned char *)0xB170006b)
#define rRTCRST (*(volatile unsigned char *)0xB170006f)
#define rBCDSEC (*(volatile unsigned char *)0xB1700073)
#define rBCDMIN (*(volatile unsigned char *)0xB1700077)
#define rBCDHOUR (*(volatile unsigned char *)0xB170007b)
#define rBCDDAY (*(volatile unsigned char *)0xB170007f)
#define rBCDDATE (*(volatile unsigned char *)0xB1700083)
#define rBCDMON (*(volatile unsigned char *)0xB1700087)
#define rBCDYEAR (*(volatile unsigned char *)0xB170008b)
#define rTICINT (*(volatile unsigned char *)0xB1700047)
#endif
//
// Watch-Dog Timver
//
#define WATCH_BASE 0xB1300000 // 0x53000000
typedef struct {
unsigned long rWTCON;
unsigned long rWTDAT;
unsigned long rWTCNT;
} WATCHreg;
//
// SD / MMC
//
#define MMC_BACE 0xB1A00000 // 0x5A000000
#define MMC_BASE 0xB1A00000 // 0x5A000000
typedef struct {
unsigned int rSDICON;
unsigned int rSDIPRE;
unsigned int rSDICMDARG;
unsigned int rSDICMDCON;
unsigned int rSDICMDSTA;
unsigned int rSDIRSP0;
unsigned int rSDIRSP1;
unsigned int rSDIRSP2;
unsigned int rSDIRSP3;
unsigned int rSDIDTIMER;
unsigned int rSDIBSIZE;
unsigned int rSDIDATCON;
unsigned int rSDIDATCNT;
unsigned int rSDIDATSTA;
unsigned int rSDIFSTA;
unsigned int rSDIDAT;
unsigned int rSDIINTMSK;
} MMCreg;
//
// IIC
//
#define IIC_BASE 0xB1400000 // 54000000
#define IICFIF_PHYS 0x54000000 // physical address of IIC
typedef struct {
unsigned int rIICCON;
unsigned int rIICSTAT;
unsigned int rIICADD;
unsigned int rIICDS;
unsigned int rIICLC;
}IICreg;
//
// IIS
//
#define IIS_BASE 0xB1500000
#define IISFIF_PHYS 0x55000010 // physical address of IISFIF for DMA
typedef struct {
unsigned int rIISCON;
unsigned int rIISMOD;
unsigned int rIISPSR;
unsigned int rIISFCON;
unsigned int rIISFIF;
}IISreg;
//
// SPI
//
#define SSP_BASE 0xB1900000 // 0x59000000
typedef struct {
unsigned int rSPCON0; // 00
unsigned int rSPSTA0;
unsigned int rSPPIN0;
unsigned int rSPPRE0;
unsigned int rSPTDAT0; // 10
unsigned int rSPRDAT0;
unsigned int rPAD[2];
unsigned int rSPCON1; // 20
unsigned int rSPSTA1;
unsigned int rSPPIN1;
unsigned int rSPPRE1;
unsigned int rSPTDAT1; // 30
unsigned int rSPRDAT1;
}SSPreg ;
//
// AC97
//
#define AC97_BASE 0xB1B00000 // 0x5B000000
#define AC_PCMDATA_PHYS 0x5B000018 // For PCM In and Out - Stereo
#define AC_MICDATA_PHYS 0x5B00001C // For MIC In - Mono
typedef struct {
unsigned int rAC_GLBCTRL; // 0x00
unsigned int rAC_GLBSTAT; // 0x04
unsigned int rAC_CODEC_CMD; // 0x08
unsigned int rAC_CODEC_STAT; // 0x0c
unsigned int rAC_PCMADDR; // 0x10
unsigned int rAC_MICADDR; // 0x14
unsigned int rAC_PCMDATA; // 0x18
unsigned int rAC_MICDATA; // 0x1c
} AC97reg;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -