m5200.h
来自「MPC5200 BSP 支持ATA,USB, I2C,扩展网口」· C头文件 代码 · 共 1,062 行 · 第 1/4 页
H
1,062 行
#define SLT1_CTRL ((volatile UINT32 *) (SLT0_BASE_ADRS + SLT1_CTRL_OFF))
#define SLT1_VALUE ((volatile UINT32 *) (SLT0_BASE_ADRS + SLT1_VALUE_OFF))
#define SLT1_STATUS ((volatile UINT32 *) (SLT0_BASE_ADRS + SLT1_STATUS_OFF))
#define SLT_TCNT(num) ((volatile UINT32 *) (SLT_BASE(num) + SLT0_TCNT_OFF))
#define SLT_CTRL(num) ((volatile UINT32 *) (SLT_BASE(num) + SLT0_CTRL_OFF))
#define SLT_VALUE(num) ((volatile UINT32 *) (SLT_BASE(num) + SLT0_VALUE_OFF))
#define SLT_STATUS(num) ((volatile UINT32 *) (SLT_BASE(num) + SLT0_STATUS_OFF))
/* Control Register */
#define SLT_CTRL_ENABLE 0x01000000 /* Timer enable bit */
#define SLT_CTRL_INT_ENABLE 0x02000000 /* Interrupt enable bit */
#define SLT_CTRL_RUN_WAIT 0x04000000 /* Run/Wait bit (continusly mode or not) */
/* Status Register */
#define SLT_STATUS_RESET 0x01000000 /* ST bit - Timer reached terminal count */
/*-----------------------------------------------------------*/
/* Real Time Clock (RTC) 0x0800 */
/*-----------------------------------------------------------*/
/* MBAR to GPT */
#define MBAR_RTC 0x0800 /* Real Time Clock base register */
#define RTC_BASE_ADRS (MBAR_VALUE + MBAR_RTC)
#define RTC_TS_OFF 0x0 /* RTC Time Set Register */
#define RTC_DS_OFF 0x4 /* RTC Date Set register */
#define RTC_NYS_OFF 0x8 /* RTC New Year Software Register */
#define RTC_AIE_OFF 0xc /* RTC Alarm/Interrupt Enable Register */
#define RTC_TS ((volatile UINT32 *) (RTC_BASE_ADRS + RTC_TS_OFF))
#define RTC_DS ((volatile UINT32 *) (RTC_BASE_ADRS + RTC_DS_OFF))
#define RTC_NYS ((volatile UINT32 *) (RTC_BASE_ADRS + RTC_NYS_OFF))
#define RTC_AIE ((volatile UINT32 *) (RTC_BASE_ADRS + RTC_AIE_OFF))
/*-----------------------------------------------------------*/
/* I 2 C controlers (I2C) 0x3d00 */
/*-----------------------------------------------------------*/
/* MBAR to I2C */
#define MBAR_I2C 0x3d00 /* I2C base register (I2C) */
#define I2C_NUM_MAX 2 /* number of I2C controllers */
#define I2C_ADRS_OFF 0x40 /* I2C2 register offset from I2C1 */
/* registers access definition */
#define I2C_ADR_OFF 0x00 /* I2C Address Register */
#define I2C_FDR_OFF 0x04 /* I2C Frequency Divider Register */
#define I2C_CR_OFF 0x08 /* I2C Control register */
#define I2C_SR_OFF 0x0C /* I2C Status register */
#define I2C_DIO_OFF 0x10 /* I2C data I/O register */
#define I2C_ICR_OFF 0x20 /* I2C Interrupt Control register */
#define I2C_BASE_ADRS (MBAR_VALUE + MBAR_I2C)
#define I2C_BASE(num) ((UINT32) (I2C_BASE_ADRS + (num*I2C_ADRS_OFF)))
#define I2C_ADR(num) ((volatile UINT32 *) (I2C_BASE(num) + I2C_ADR_OFF))
#define I2C_FDR(num) ((volatile UINT32 *) (I2C_BASE(num) + I2C_FDR_OFF))
#define I2C_CR(num) ((volatile UINT32 *) (I2C_BASE(num) + I2C_CR_OFF))
#define I2C_SR(num) ((volatile UINT32 *) (I2C_BASE(num) + I2C_SR_OFF))
#define I2C_DIO(num) ((volatile UINT32 *) (I2C_BASE(num) + I2C_DIO_OFF))
#define I2C_ICR ((volatile UINT32 *) (I2C_BASE_ADRS + I2C_ICR_OFF))
/*----------------------------------------------------------- */
/* GPIO_STD 0x0B00 */
/*----------------------------------------------------------- */
/* MBAR to GPIO_STD */
#define MBAR_GPIO_STD 0x0B00
#define GPIO_STD_BASE_ADRS (MBAR_VALUE + MBAR_GPIO_STD)
/* Offset GPIO_STD to register */
#define GPIO_STD_PORT_CONFIG 0x00 /* long */
#define GPIO_PCR_OFF 0x00 /* GPIO Port Configuration Register */
#define GPIO_SEN_OFF 0x04 /* GPIO Enable Register */
#define GPIO_SOD_OFF 0x08 /* GPIO Open Drain Type Register */
#define GPIO_SDD_OFF 0x0c /* GPIO Data Direction Register */
#define GPIO_SDO_OFF 0x10 /* GPIO Data Output Register */
#define GPIO_SDI_OFF 0x14 /* GPIO Data Input Register */
#define GPIO_OOE_OFF 0x18 /* GPIO Output Only Enable Register */
#define GPIO_ODO_OFF 0x1c /* GPIO Output Data Register Out Register */
#define GPIO_SIE_OFF 0x20 /* GPIO Simple Interrupt Enable Register */
#define GPIO_SIOD_OFF 0x24 /* GPIO Simple Interrupt Open Drain Emulation Register */
#define GPIO_SIDD_OFF 0x28 /* GPIO Simple Interrupt Data Direction Register */
#define GPIO_SIDO_OFF 0x2c /* GPIO Simple Interrupt Data Out Register */
#define GPIO_SIIE_OFF 0x30 /* GPIO Simple Interrupt Enable Register */
#define GPIO_SIIT_OFF 0x34 /* GPIO Simple Interrupt Type Register */
#define GPIO_SIME_OFF 0x38 /* GPIO Simple Interrupt Master Enable Register */
#define GPIO_SIST_OFF 0x3c /* GPIO Simple Interrupt Status Register */
#define GPIO_PCR ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_PCR_OFF))
#define GPIO_SEN ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SEN_OFF))
#define GPIO_SOD ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SOD_OFF))
#define GPIO_SDD ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SDD_OFF))
#define GPIO_SDO ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SDO_OFF))
#define GPIO_SDI ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SDI_OFF))
#define GPIO_OOE ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_OOE_OFF))
#define GPIO_ODO ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_ODO_OFF))
#define GPIO_SIE ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SIE_OFF))
#define GPIO_SIOD ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SIOD_OFF))
#define GPIO_SIDD ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SIDD_OFF))
#define GPIO_SIDO ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SIDO_OFF))
#define GPIO_SIIE ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SIIE_OFF))
#define GPIO_SIIT ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SIIT_OFF))
#define GPIO_SIME ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SIME_OFF))
#define GPIO_SIST ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_SIST_OFF))
#define GPIO_STD_PC_ETH_MASK 0x000F0000
#define GPIO_STD_PC_ETH_18WIRE 0x00050000
#define GPIO_STD_PC_PCI_MASK 0x00008000
#define GPIO_STD_PC_PCI_ENABLED 0x00000000
#define GPIO_STD_PC_PCI_DISABLED 0x00008000
#define GPIO_STD_PORTCFG ((volatile UINT32 *) (GPIO_STD_BASE_ADRS + GPIO_STD_PORT_CONFIG))
#define GPIO_STD_PC_USB_MASK 0x00007000
#define GPIO_STD_PC_USB_1_ONLY 0x00001000
#define GPIO_STD_PC_USB_2_ETH 0x00011000
#define GPIO_STD_PC_USB_2_PSC3 0x00010100
#define GPIO_STD_PC_USB_SE_MODE 0x00004000
#define GPIO_STD_PC_USB_DM_MODE 0x00000000
/* i=0: PSC1; i=1: PSC2, i=3: PSC2, i=7: PSC6 */
#define PSC1_PORT 0
#define PSC2_PORT 1
#define PSC3_PORT 2
#define PSC6_PORT 7
#define GPIO_STD_PC_PSC_SHIFT(i,v) ((v)<<(4*i))
#define GPIO_STD_PC_PSC_MASK(i) GPIO_STD_PC_PSC_SHIFT(i,0xF)
#define GPIO_STD_PC_PSC_UART(i) GPIO_STD_PC_PSC_SHIFT(i,0x4)
#define GPIO_STD_PC_PSC_UART_CD(i) GPIO_STD_PC_PSC_SHIFT(i,0x5)
#define GPIO_STD_PC_PSC6_MASK 0x00700000 /* bits 9-11 */
#define GPIO_STD_PC_PSC6_UART 0x00500000 /* 101b = IrDa/UART */
/*----------------------------------------------------------- */
/* GPIO_WKUP 0x0C00 */
/*----------------------------------------------------------- */
/* MBAR to GPIO_WKUP */
#define MBAR_GPIO_WKUP 0x0C00
#define GPIO_WKUP_BASE_ADRS (MBAR_VALUE + MBAR_GPIO_WKUP)
/* Offset GPIO_WKUP to register */
#define GPIO_WKUP_WE 0x00 /* long, write enable */
#define GPIO_WKUP_OD 0x04 /* long, open drain */
#define GPIO_WKUP_DD 0x08 /* long, data direction */
#define GPIO_WKUP_DO 0x0C /* long, data value out */
#define GPIO_WKUP_IE 0x10 /* long, interrupt enable */
#define GPIO_WKUP_SIE 0x14 /* long, simple interrupt enable */
#define GPIO_WKUP_IT 0x18 /* long, interrupt type */
#define GPIO_WKUP_ME 0x1C /* long, data value outmaster enable */
#define GPIO_WKUP_DI 0x20 /* long, data input */
#define GPIO_WKUP_SR 0x24 /* long, sataus register */
#define GPW_WE ((volatile UINT32 *) (GPIO_WKUP_BASE_ADRS + GPIO_WKUP_WE))
#define GPW_OD ((volatile UINT32 *) (GPIO_WKUP_BASE_ADRS + GPIO_WKUP_OD))
#define GPW_DD ((volatile UINT32 *) (GPIO_WKUP_BASE_ADRS + GPIO_WKUP_DD))
#define GPW_DO ((volatile UINT32 *) (GPIO_WKUP_BASE_ADRS + GPIO_WKUP_DO))
#define GPW_IE ((volatile UINT32 *) (GPIO_WKUP_BASE_ADRS + GPIO_WKUP_IE))
#define GPW_SIE ((volatile UINT32 *) (GPIO_WKUP_BASE_ADRS + GPIO_WKUP_SIE))
#define GPW_IT ((volatile UINT32 *) (GPIO_WKUP_BASE_ADRS + GPIO_WKUP_IT))
#define GPW_ME ((volatile UINT32 *) (GPIO_WKUP_BASE_ADRS + GPIO_WKUP_ME))
#define GPW_DI ((volatile UINT32 *) (GPIO_WKUP_BASE_ADRS + GPIO_WKUP_DI))
#define GPW_SR ((volatile UINT32 *) (GPIO_WKUP_BASE_ADRS + GPIO_WKUP_SR))
/*----------------------------------------------------------- */
/* PCI 0x0D00 */
/*----------------------------------------------------------- */
#define MBAR_PCI 0xD00
#define PCI_BASE_ADRS (MBAR_VALUE + MBAR_PCI)
/* Type 0 Configuration Header */
#define PCI_SCR_OFF 0x04 /* Status/Command register */
#define PCI_CR1_OFF 0x0c /* Configuration 1 register */
#define PCI_BAR0_OFF 0x10 /* Base address register 0 */
#define PCI_BAR1_OFF 0x14 /* Base address register 1 */
/* General Control/Status */
#define PCI_GSCR_OFF 0x60 /* Global Status/Control Register */
#define PCI_TBATR0_OFF 0x64 /* Target Base Address Translation Register 0 */
#define PCI_TBATR1_OFF 0x68 /* Target Base Address Translation Register 1 */
#define PCI_TCBR_OFF 0x6C /* Target Control Register */
#define PCI_IW0BTAR_OFF 0x70 /* Initiator Window 0 Base/Translation Addr Reg */
#define PCI_IW1BTAR_OFF 0x74 /* Initiator Window 1 Base/Translation Addr Reg */
#define PCI_IW2BTAR_OFF 0x78 /* Initiator Window 2 Base/Translation Addr Reg */
#define PCI_IWCR_OFF 0x80 /* Initiator Window Configuration Register */
#define PCI_ICR_OFF 0x84 /* Initiator Control Register */
#define PCI_ISR_OFF 0x88 /* Initiator Status Register */
#define PCI_ARB_OFF 0x8C /* PCI Arbiter Register */
#define PCI_CAR_OFF 0xF8 /* Configuration Address Register */
#define PCISCR ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_SCR_OFF))
#define PCICR1 ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_CR1_OFF))
#define PCIBAR0 ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_BAR0_OFF))
#define PCIBAR1 ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_BAR1_OFF))
#define PCIGSCR ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_GSCR_OFF))
#define PCITBATR0 ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_TBATR0_OFF))
#define PCITBATR1 ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_TBATR1_OFF))
#define PCITCBR ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_TCBR_OFF))
#define PCIIW0BTAR ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_IW0BTAR_OFF))
#define PCIIW1BTAR ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_IW1BTAR_OFF))
#define PCIIW2BTAR ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_IW2BTAR_OFF))
#define PCIIWCR ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_IWCR_OFF))
#define PCIICR ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_ICR_OFF))
#define PCIISR ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_ISR_OFF))
#define PCIARB ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_ARB_OFF))
#define PCICAR ((volatile UINT32 *)(PCI_BASE_ADRS + PCI_CAR_OFF))
/* Command/Status register */
#define PCISCR_B 0x00000004 /* bus master enable */
#define PCI_COMMAND_MEMORY 0x00000002 /* memory decoding enable */
#define PCISCR_S 0x00000100 /* SERR enable */
#define PCISCR_P 0x00000040 /* SERR enable */
/* Cconfiguration 1 register */
#define PCICR1_LAT_MASK 0x0000ff00
#define PCICR1_LAT_SHIFT 8
/* Global Status/Control Register */
#define PCIGSCR_BM 0x40000000
#define PCIGSCR_PE 0x20000000
#define PCIGSCR_SE 0x10000000
#define PCIGSCR_BME 0x00004000
#define PCIGSCR_PEE 0x00002000
#define PCIGSCR_SEE 0x00001000
/* IW Conf reg */
#define PCIIWCR_ENABLE 0x1
#define PCIIWCR_MEM 0x0
#define PCIIWCR_IO 0x8
#define PCIIWCR_READ_LINE 0x2
#define PCIIWCR_READ_MULTI 0x4
#define PCIIWCR_READ_SINGLE 0x0
/* Initiator Control Register */
#define PCIICR_REE 0x04000000
#define PCIICR_IAE 0x02000000
#define PCIICR_TAE 0x01000000
/* Initiator Status Register */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?