📄 sitsangbrdregs.h
字号:
#ifndef __SITSANG_BRD_REGS_H
#define __SITSANG_BRD_REGS_H
/*
************************************************************************************
* Register Physical Addresses
************************************************************************************
*/
#define PCR_IDX 0
#define BCR_IDX 1
#define BSR_IDX 2
#define BIPR_IDX 3
#define BIMR_IDX 4
#define AXHR_IDX 5
#define AXLR_IDX 6
#define AYHR_IDX 7
#define JSSR_IDX 8
#define LEDLR_IDX 9
#define LEDHR_IDX 10
#define EXBCR_IDX 11
#define EXBSR_IDX 12
#define EXBIPR_IDX 13
#define EXBIMR_IDX 14
#define BRD_CPLDREG_PHY_BASE_ADDR (0x08000000) // Board CPLD Base Register Location
#define BRD_PCR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x0)
#define BRD_BCR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x4)
#define BRD_BSR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x8)
#define BRD_BIPR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0xC)
#define BRD_BIMR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x10)
#define BRD_AXHR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x14)
#define BRD_AXLR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x18)
#define BRD_AYHR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x1C)
#define BRD_JSSR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x20)
#define BRD_LEDR_L_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x24)
#define BRD_LEDR_H_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x28)
#define BRD_EXBCR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x2C)
#define BRD_EXBSR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x30)
#define BRD_EXBIPR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x34)
#define BRD_EXBIMR_ADDR (BRD_CPLDREG_PHY_BASE_ADDR + 0x38)
#define BRD_REG_TYPE unsigned short
#define BRD_PCR (*(volatile BRD_REG_TYPE *)BRD_PCR_ADDR)
#define BRD_BCR (*(volatile BRD_REG_TYPE *)BRD_BCR_ADDR)
#define BRD_BSR (*(volatile BRD_REG_TYPE *)BRD_BSR_ADDR)
#define BRD_BIPR (*(volatile BRD_REG_TYPE *)BRD_BIPR_ADDR)
#define BRD_BIMR (*(volatile BRD_REG_TYPE *)BRD_BIMR_ADDR)
#define BRD_AXHR (*(volatile BRD_REG_TYPE *)BRD_AXHR_ADDR)
#define BRD_AXLR (*(volatile BRD_REG_TYPE *)BRD_AXLR_ADDR)
#define BRD_AYHR (*(volatile BRD_REG_TYPE *)BRD_AYHR_ADDR)
#define BRD_JSSR (*(volatile BRD_REG_TYPE *)BRD_JSSR_ADDR)
#define BRD_LEDR_L (*(volatile BRD_REG_TYPE *)BRD_LEDR_L_ADDR)
#define BRD_LEDR_H (*(volatile BRD_REG_TYPE *)BRD_LEDR_H_ADDR)
#define BRD_EXBCR (*(volatile BRD_REG_TYPE *)BRD_EXBCR_ADDR)
#define BRD_EXBSR (*(volatile BRD_REG_TYPE *)BRD_EXBSR_ADDR)
#define BRD_EXBIPR (*(volatile BRD_REG_TYPE *)BRD_EXBIPR_ADDR)
#define BRD_EXBIMR (*(volatile BRD_REG_TYPE *)BRD_EXBIMR_ADDR)
/*
************************************************************************************
* Bits and Length Definitions
************************************************************************************
*/
// Bits Definitions for PCR Reg.
// Note:
// - XX_OFS means the bit offset
// - XX_SZ means the field length
#define PCR_CF_ON_OFS (0)
#define PCR_USB_HOST_ON_OFS (1)
#define PCR_RS232_ON_OFS (2)
#define PCR_BTUART_ON_OFS (3)
#define PCR_SD_ON_OFS (4)
#define PCR_ACC_ON_OFS (5)
#define PCR_LCD_ON_OFS (6)
#define PCR_LIGHT_ON_OFS (7)
#define PCR_IRDA_ON_OFS (8)
#define PCR_AUDIO_ON_OFS (9)
#define PCR_LAN_ON_OFS (10)
#define PCR_VCC_CHANGE_OFS (11)
#define PCR_RSV1_OFS (12)
#define PCR_RSV2_OFS (13)
#define PCR_PER_ON_OFS (14)
#define PCR_SOFT_PWR_OFF_OFS (15)
// Bits Definitions for BCR Reg.
#define BCR_FLASH_B0_WP_OFS (0)
#define BCR_FLASH_B1_WP_OFS (1)
#define BCR_BUS_OPEN_OFS (2)
#define BCR_CF_RESET_OFS (3)
#define BCR_CF_CSEL_OFS (4)
#define BCR_USB_NDP_OFS (5)
#define BCR_USB_HC_RESET_OFS (6)
#define BCR_USB_HC_WAKE_OFS (7)
#define BCR_USB_DC_PULL_UP_OFS (8)
#define BCR_IR_MODE_OFS (9)
#define BCR_IR_MODE_SZ (2)
#define BCR_IR_FSEL_OFS (11)
#define BCR_LAN_RESET_OFS (12)
#define BCR_LAN_nEN16_OFS (13)
#define BCR_EXBD_USE_ECLK_OFS (14)
#define BCR_SYS_NRESET_OFS (15)
// Bits Definitions for BSR Reg.
#define BSR_CF_VS1_OFS (0)
#define BSR_SD_WP_OFS (1)
#define BSR_BOOT_FROM_0_OFS (2)
//#define BSR_USB_HC_SUSPEND_OFS(3)
#define BSR_USB_INT_STATUS (3)
#define BSR_TS_PEN_DOWN_OFS (4)
#define BSR_EXBD_INSERT_OFS (5)
#define BSR_USB_DC_INSERT_OFS (6)
//#define BSR_USB_HC1_INSERT_OFS(7)
#define BSR_CF_nIRQ_RDY_STATUS (7)
//#define BSR_USB_HC2_INSERT_OFS(8)
#define BSR_SMSC_nINT_STATUS (8)
#define BSR_USB_HC1_OC_OFS (9)
#define BSR_USB_HC2_OC_OFS (10)
#define BSR_BATT_CHARGING_OFS (11)
#define BSR_BTUART_INSERT_OFS (12)
#define BSR_RS232_INSERT_OFS (13)
#define BSR_CF_CARD_INSERT_OFS (14)
#define BSR_SD_INSERT_OFS (15)
// Bits Definitions for BIPR Reg.
#define BIPR_CF_CARD_DETECT_OFS (0)
#define BIPR_CF_OFS (1)
#define BIPR_USB_B_DETECT_OFS (2)
#define BIPR_USB_HC1_DETECT_OFS (3)
#define BIPR_USB_HC2_DETECT_OFS (4)
#define BIPR_USB_HC1_OC_OFS (5)
#define BIPR_USB_HC2_OC_OFS (6)
#define BIPR_USB_HC_OFS (7)
#define BIPR_RS232_DETECT_OFS (8)
#define BIPR_BTUART_DETECT_OFS (9)
#define BIPR_EXBD_DETECT_OFS (10)
#define BIPR_SD_DETECT_OFS (11)
#define BIPR_LAN_OFS (12)
#define BIPR_JOYSTICK_OFS (13)
#define BIPR_BATT_CHARGED_OFS (14)
#define BIPR_TOUCH_SCREEN_OFS (15)
// Bits Definitions for BIMR Reg.
#define BIMR_CF_CARD_DETECT_OFS (0)
#define BIMR_CF_OFS (1)
#define BIMR_USB_B_DETECT_OFS (2)
#define BIMR_USB_HC1_DETECT_OFS (3)
#define BIMR_USB_HC2_DETECT_OFS (4)
#define BIMR_USB_HC1_OC_OFS (5)
#define BIMR_USB_HC2_OC_OFS (6)
#define BIMR_USB_HC_OFS (7)
#define BIMR_RS232_DETECT_OFS (8)
#define BIMR_BTUART_DETECT_OFS (9)
#define BIMR_EXBD_DETECT_OFS (10)
#define BIMR_SD_DETECT_OFS (11)
#define BIMR_LAN_OFS (12)
#define BIMR_JOYSTICK_OFS (13)
#define BIMR_BATT_CHARGED_OFS (14)
#define BIMR_TOUCH_SCREEN_OFS (15)
// Bits Definitions for AXHR Reg.
#define AXHR_OFS (0)
#define AXHR_SZ (16)
// Bits Definitions for AYHR Reg.
#define AYHR_OFS (0)
#define AYHR_SZ (16)
// Bits Definitions for JSSR Reg.
#define JSSR_LEFT_OFS (0)
#define JSSR_RIGHT_OFS (1)
#define JSSR_TOP_OFS (2)
#define JSSR_BOTTOM_OFS (3)
#define JSSR_PUSH_OFS (4)
#define JSSR_SOFT_BTN0_OFS (5)
#define JSSR_SOFT_BTN1_OFS (6)
#define JSSR_RST_BTN_OFS (7)
#define JSSR_HEX_SW_OFS (8)
#define JSSR_HEX_SW_SZ (4)
// Bits Definitions for LEDLR/LEDHR Reg.
#define LED_L0_OFS (0)
#define LED_L1_OFS (1)
#define LED_L2_OFS (2)
#define LED_L3_OFS (3)
#define LED_L4_OFS (4)
#define LED_L5_OFS (5)
#define LED_L6_OFS (6)
#define LED_L7_OFS (7)
#define LED_L8_OFS (8)
#define LED_L9_OFS (9)
#define LED_L10_OFS (10)
#define LED_L11_OFS (11)
#define LED_L12_OFS (12)
#define LED_L13_OFS (13)
#define LED_L14_OFS (14)
#define LED_L15_OFS (15)
#define LED_H0_OFS (0)
#define LED_H1_OFS (1)
#define LED_H2_OFS (2)
#define LED_H3_OFS (3)
#define LED_H4_OFS (4)
#define LED_H5_OFS (5)
#define LED_H6_OFS (6)
#define LED_H7_OFS (7)
#define LED_H8_OFS (8)
#define LED_H9_OFS (9)
#define LED_H10_OFS (10)
#define LED_H11_OFS (11)
#define LED_H12_OFS (12)
#define LED_H13_OFS (13)
#define LED_H14_OFS (14)
#define LED_H15_OFS (15)
/*
************************************************************************************
* DATA TYPES
************************************************************************************
*/
// Board Level Registers
typedef struct BoardRegsS {
unsigned int PCR; // Power control register Read and write 0x0800,0000
unsigned int BCR; // Board control register Read and write 0x0800,0004
unsigned int BSR; // Board status register Read only 0x0800,0008
unsigned int BIPR; // Board interrupt pending register Read and write 0x0800,000C
unsigned int BIMR; // Board interrupt mask register Read and write 0x0800,0010
unsigned int AXHR; // Accelerometer x direction Low level counter register Read only, Reserved 0x0800,0014
unsigned int AXLR; // Accelerometer x direction High level counter register Read onlyReserved 0x0800,0018
unsigned int AYHR; // Accelerometer Y direction Low level counter register Read onlyReserved 0x0800,001C
unsigned int JSSR; // HEX switch, Joystick switch and soft button status register Read only 0x0800,0020
unsigned int LEDLR; // Low 16-bits LED matrix control register Read and write 0x0800,0024
unsigned int LEDHR; // High 16-bits LED matrix control register Read and write 0x0800,0028
unsigned int EXBCR; // Expansion card board control register Read and write 0x0800,002C
unsigned int EXBSR; // Expansion card board status register Read only 0x0800,0030
unsigned int EXBIPR; // Expansion card interrupt pending register Read and write 0x0800,0034
unsigned int EXBIMR; // Expansion card interrupt mark register Read and write 0x0800,0038
} BoardRegsT;
void UTIL_TestCpldLed(void);
void UTIL_Delay(int time);
#endif //__SITSANG_BRD_REGS_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -