📄 var_io.h
字号:
#define AT91_EBI_CSR_TDF_4 (0x4 << 9)
#define AT91_EBI_CSR_TDF_5 (0x5 << 9)
#define AT91_EBI_CSR_TDF_6 (0x6 << 9)
#define AT91_EBI_CSR_TDF_7 (0x7 << 9) // Data float output time
#define AT91_EBI_CSR_BAT (0x1 << 12) // Byte access type
#define AT91_EBI_CSR_CSEN (0x1 << 13) // Chip select enable
#define AT91_EBI_CSR_BA (0xFFF << 20) // Base address
#define AT91_EBI_RCR 0x20 // Reset control
#define AT91_EBI_RCR_RCB 0x1 // Remap command bit
#define AT91_EBI_MCR 0x24 // Memory control
#define AT91_EBI_MCR_ALE_16M 0x0
#define AT91_EBI_MCR_ALE_8M 0x4
#define AT91_EBI_MCR_ALE_4M 0x5
#define AT91_EBI_MCR_ALE_2M 0x6
#define AT91_EBI_MCR_ALE_1M 0x7 // Address line enable
#define AT91_EBI_MCR_DRP (0x1 << 4) // Data read protocol
//=============================================================================
// Power Saving or Management
#if defined(CYGHWR_HAL_ARM_AT91_R40807) || \
defined(CYGHWR_HAL_ARM_AT91_R40008)
// Power Saving
#ifndef AT91_PS
#define AT91_PS 0xFFFF4000
#endif
#define AT91_PS_CR 0x000 // Control
#define AT91_PS_CR_CPU (1<<0) // Disable CPU clock (idle mode)
#define AT91_PS_PCER 0x004 // Peripheral clock enable
#define AT91_PS_PCDR 0x008 // Peripheral clock disable
#define AT91_PS_PCSR 0x00c // Peripheral clock status
#elif defined(CYGHWR_HAL_ARM_AT91_M42800A) || \
defined(CYGHWR_HAL_ARM_AT91_M55800A) || \
defined(CYGHWR_HAL_ARM_AT91SAM7)
// (Advanced) Power Management
#ifndef AT91_PMC
#define AT91_PMC 0xFFFF4000
#endif
#define AT91_PMC_SCER 0x00
#define AT91_PMC_SCDR 0x04
#define AT91_PMC_SCSR 0x08
#define AT91_PMC_PCER 0x10
#define AT91_PMC_PCDR 0x14
#define AT91_PMC_PCSR 0x18
#define AT91_PMC_CGMR 0x20
#ifndef AT91_PMC_SR
#define AT91_PMC_SR 0x30
#endif
#ifndef AT91_PMC_IER
#define AT91_PMC_IER 0x34
#endif
#ifndef AT91_PMC_IDR
#define AT91_PMC_IDR 0x38
#endif
#ifndef AT91_PMC_IMR
#define AT91_PMC_IMR 0x3c
#endif
#if defined(CYGHWR_HAL_ARM_AT91_M42800A)
#define AT91_PMC_PCER_US0 (1<<2)
#define AT91_PMC_PCER_US1 (1<<3)
#define AT91_PMC_PCER_SPIA (1<<4)
#define AT91_PMC_PCER_SPIB (1<<5)
#define AT91_PMC_PCER_TC0 (1<<6)
#define AT91_PMC_PCER_TC1 (1<<7)
#define AT91_PMC_PCER_TC2 (1<<8)
#define AT91_PMC_PCER_TC3 (1<<9)
#define AT91_PMC_PCER_TC4 (1<<10)
#define AT91_PMC_PCER_TC5 (1<<11)
#define AT91_PMC_PCER_PIOA (1<<13)
#define AT91_PMC_PCER_PIOB (1<<14)
#define AT91_PMC_CGMR_PRES_NONE 0
#define AT91_PMC_CGMR_PRES_DIV2 1
#define AT91_PMC_CGMR_PRES_DIV4 2
#define AT91_PMC_CGMR_PRES_DIV8 3
#define AT91_PMC_CGMR_PRES_DIV16 4
#define AT91_PMC_CGMR_PRES_DIV32 5
#define AT91_PMC_CGMR_PRES_DIV64 6
#define AT91_PMC_CGMR_PRES_RES 7
#define AT91_PMC_CGMR_PLLA 0x00
#define AT91_PMC_CGMR_PLLB 0x08
#define AT91_PMC_CGMR_MCK_SLCK (0<<4)
#define AT91_PMC_CGMR_MCK_MCK (1<<4)
#define AT91_PMC_CGMR_MCK_MCKINV (2<<4)
#define AT91_PMC_CGMR_MCK_MCKD2 (3<<4)
#define AT91_PMC_CGMR_MCKO_ENA (0<<6)
#define AT91_PMC_CGMR_MCKO_DIS (1<<6)
#define AT91_PMC_CGMR_CSS_SLCK (0<<7)
#define AT91_PMC_CGMR_CSS_PLL (1<<7)
#define AT91_PMC_CGMR_PLL_MUL(x) ((x)<<8)
#define AT91_PMC_CGMR_PLL_CNT(x) ((x)<<24)
#define AT91_PMC_SR_LOCK 0x01
#elif defined(CYGHWR_HAL_ARM_AT91_M55800A)
#define AT91_PMC_PCER_US0 (1<<2)
#define AT91_PMC_PCER_US1 (1<<3)
#define AT91_PMC_PCER_US2 (1<<4)
#define AT91_PMC_PCER_SPI (1<<5)
#define AT91_PMC_PCER_TC0 (1<<6)
#define AT91_PMC_PCER_TC1 (1<<7)
#define AT91_PMC_PCER_TC2 (1<<8)
#define AT91_PMC_PCER_TC3 (1<<9)
#define AT91_PMC_PCER_TC4 (1<<10)
#define AT91_PMC_PCER_TC5 (1<<11)
#define AT91_PMC_PCER_PIOA (1<<13)
#define AT91_PMC_PCER_PIOB (1<<14)
#define AT91_PMC_PCER_ADC0 (1<<15)
#define AT91_PMC_PCER_ADC1 (1<<16)
#define AT91_PMC_PCER_DAC0 (1<<17)
#define AT91_PMC_PCER_DAC1 (1<<18)
#define AT91_PMC_CGMR_MOSC_XTAL 0
#define AT91_PMC_CGMR_MOSC_BYP 1
#define AT91_PMC_CGMR_MOSC_DIS (0<<1)
#define AT91_PMC_CGMR_MOSC_ENA (1<<1)
#define AT91_PMC_CGMR_MCKO_ENA (0<<2)
#define AT91_PMC_CGMR_MCKO_DIS (1<<2)
#define AT91_PMC_CGMR_PRES_NONE (0<<4)
#define AT91_PMC_CGMR_PRES_DIV2 (1<<4)
#define AT91_PMC_CGMR_PRES_DIV4 (2<<4)
#define AT91_PMC_CGMR_PRES_DIV8 (3<<4)
#define AT91_PMC_CGMR_PRES_DIV16 (4<<4)
#define AT91_PMC_CGMR_PRES_DIV32 (5<<4)
#define AT91_PMC_CGMR_PRES_DIV64 (6<<4)
#define AT91_PMC_CGMR_PRES_RES (7<<4)
#define AT91_PMC_CGMR_CSS_LF (0<<14)
#define AT91_PMC_CGMR_CSS_MOSC (1<<14)
#define AT91_PMC_CGMR_CSS_PLL (2<<14)
#define AT91_PMC_CGMR_CSS_RES (3<<14)
#define AT91_PMC_CGMR_PLL_MUL(x) ((x)<<8)
#define AT91_PMC_CGMR_OSC_CNT(x) ((x)<<16)
#define AT91_PMC_CGMR_PLL_CNT(x) ((x)<<24)
#define AT91_PMC_PCR 0x28
#define AT91_PMC_PCR_SHDALC 1
#define AT91_PMC_PCR_WKACKC 2
#define AT91_PMC_PMR 0x2c
#define AT91_PMC_PMR_SHDALS_TRI 0
#define AT91_PMC_PMR_SHDALS_LEVEL0 1
#define AT91_PMC_PMR_SHDALS_LEVEL1 2
#define AT91_PMC_PMR_SHDALS_RES 3
#define AT91_PMC_PMR_WKACKS_TRI (0<<2)
#define AT91_PMC_PMR_WKACKS_LEVEL0 (1<<2)
#define AT91_PMC_PMR_WKACKS_LEVEL1 (2<<2)
#define AT91_PMC_PMR_WKACKS_RES (3<<2)
#define AT91_PMC_PMR_ALWKEN (1<<4)
#define AT91_PMC_PMR_ALSHEN (1<<5)
#define AT91_PMC_PMR_WKEDG_NONE (0<<6)
#define AT91_PMC_PMR_WKEDG_POS (1<<6)
#define AT91_PMC_PMR_WKEDG_NEG (2<<6)
#define AT91_PMC_PMR_WKEDG_BOTH (3<<6)
#define AT91_PMC_SR_MOSCS 0x01
#define AT91_PMC_SR_LOCK 0x02
#elif defined(CYGHWR_HAL_ARM_AT91_JTST)
// No power management control for the JTST
#elif defined(CYGHWR_HAL_ARM_AT91SAM7S)
#define AT91_PMC_SCER_PCK (1 << 0) // Processor Clock
#define AT91_PMC_SCER_UDP (1 << 7) // USB Device Clock
#define AT91_PMC_SCER_PCK0 (1 << 8) // Programmable Clock Output
#define AT91_PMC_SCER_PCK1 (1 << 9) // Programmable Clock Output
#define AT91_PMC_SCER_PCK2 (1 << 10) // Programmable Clock Output
#define AT91_PMC_SCER_PCK3 (1 << 11) // Programmable Clock Output
#define AT91_PMC_PCER_PIOA (1 << 2) // Parallel IO Controller
#define AT91_PMC_PCER_ADC (1 << 4) // Analog-to-Digital Conveter
#define AT91_PMC_PCER_SPI (1 << 5) // Serial Peripheral Interface
#define AT91_PMC_PCER_US0 (1 << 6) // USART 0
#define AT91_PMC_PCER_US1 (1 << 7) // USART 1
#define AT91_PMC_PCER_SSC (1 << 8) // Serial Synchronous Controller
#define AT91_PMC_PCER_TWI (1 << 9) // Two-Wire Interface
#define AT91_PMC_PCER_PWMC (1 <<10) // PWM Controller
#define AT91_PMC_PCER_UDP (1 <<11) // USB Device Port
#define AT91_PMC_PCER_TC0 (1 <<12) // Timer Counter 0
#define AT91_PMC_PCER_TC1 (1 <<13) // Timer Counter 1
#define AT91_PMC_PCER_TC2 (1 <<14) // Timer Counter 2
#elif defined(CYGHWR_HAL_ARM_AT91SAM7X)
#define AT91_PMC_SCER_PCK (1 << 0) // Processor Clock
#define AT91_PMC_SCER_UDP (1 << 7) // USB Device Clock
#define AT91_PMC_SCER_PCK0 (1 << 8) // Programmable Clock Output
#define AT91_PMC_SCER_PCK1 (1 << 9) // Programmable Clock Output
#define AT91_PMC_SCER_PCK2 (1 << 10) // Programmable Clock Output
#define AT91_PMC_SCER_PCK3 (1 << 11) // Programmable Clock Output
#define AT91_PMC_PCER_PIOA (1 << 2) // Parallel IO Controller
#define AT91_PMC_PCER_PIOB (1 << 3) // Parallel IO Controller
#define AT91_PMC_PCER_SPI (1 << 4) // Serial Peripheral Interface
#define AT91_PMC_PCER_SPI1 (1 << 5) // Serial Peripheral Interface
#define AT91_PMC_PCER_US0 (1 << 6) // USART 0
#define AT91_PMC_PCER_US1 (1 << 7) // USART 1
#define AT91_PMC_PCER_SSC (1 << 8) // Serial Synchronous Controller
#define AT91_PMC_PCER_TWI (1 << 9) // Two-Wire Interface
#define AT91_PMC_PCER_PWMC (1 <<10) // PWM Controller
#define AT91_PMC_PCER_UDP (1 <<11) // USB Device Port
#define AT91_PMC_PCER_TC0 (1 <<12) // Timer Counter 0
#define AT91_PMC_PCER_TC1 (1 <<13) // Timer Counter 1
#define AT91_PMC_PCER_TC2 (1 <<14) // Timer Counter 2
#define AT91_PMC_PCER_CAN (1 <<15) // Controller Area Network
#define AT91_PMC_PCER_EMAC (1 <<16) // Ethernet MAC
#define AT91_PMC_PCER_ADC (1 <<17) // Analog-to-Digital Conveter
#else // Something unknown
#error Unknown AT91 variant
#endif
#endif
//=============================================================================
// Watchdog
#ifndef AT91_WD
#define AT91_WD 0xFFFF8000
#endif
#define AT91_WD_OMR 0x00
#define AT91_WD_OMR_WDEN 0x00000001
#define AT91_WD_OMR_RSTEN 0x00000002
#define AT91_WD_OMR_IRQEN 0x00000004
#define AT91_WD_OMR_EXTEN 0x00000008
#define AT91_WD_OMR_OKEY (0x00000234 << 4)
#define AT91_WD_CMR 0x04
#define AT91_WD_CMR_WDCLKS 0x00000003
#define AT91_WD_CMR_HPCV 0x0000003C
#define AT91_WD_CMR_CKEY (0x0000006E << 7)
#define AT91_WD_CR 0x08
#define AT91_WD_CR_RSTKEY 0x0000C071
#define AT91_WD_SR 0x0C
#define AT91_WD_SR_WDOVF 0x00000001
//=============================================================================
// SPI
#ifndef AT91_SPI
#define AT91_SPI 0xFFFBC000
#endif
#define AT91_SPI_CR 0x00 // Control Register
#define AT91_SPI_CR_SPIEN 0x00000001 // SPI Enable
#define AT91_SPI_CR_SPIDIS 0x00000002 // SPI Disable
#define AT91_SPI_CR_SWRST 0x00000080 // SPI Software reset
#define AT91_SPI_MR 0x04 // Mode Register
#define AT91_SPI_MR_MSTR 0x00000001 // Master/Slave Mode
#define AT91_SPI_MR_PS 0x00000002 // Peripheral Select
#define AT91_SPI_MR_PCSDEC 0x00000004 // Chip Select Decode
#define AT91_SPI_MR_DIV32 0x000
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -