📄 ipaq.h
字号:
)/* ASIC2 UART(s) Registers*/#define IPAQ_ASIC2_UART0_BASE 0x0a00#define IPAQ_ASIC2_UART1_BASE 0x0c00/* ASIC2 SPI Registers*/#define IPAQ_ASIC2_SPICR 0x0400 /* control */ #define IPAQ_ASIC2_SPICR_CPOL (1<<7) #define IPAQ_ASIC2_SPICR_SEL (1<<6) #define IPAQ_ASIC2_SPICR_SPIE (1<<5) #define IPAQ_ASIC2_SPICR_SPE (1<<4) #define IPAQ_ASIC2_SPICR_64KHZ (0x3)#define IPAQ_ASIC2_SPIDR 0x0404 /* data */#define IPAQ_ASIC2_SPIDCS 0x0408 /* chip select disable *//* ASIC2 ADC Registers*/#define IPAQ_ASIC2_ADMUX 0x1200 /* multiplexer select */ #define IPAQ_ASIC2_ADMUX_CLKEN (1<<3) #define IPAQ_ASIC2_ADMUX_AIN4 (0x4) #define IPAQ_ASIC2_ADMUX_AIN3 (0x3) #define IPAQ_ASIC2_ADMUX_AIN2 (0x2) #define IPAQ_ASIC2_ADMUX_AIN1 (0x1) #define IPAQ_ASIC2_ADMUX_AIN0 (0x0)#define IPAQ_ASIC2_ADCSR 0x1204 /* control and status */ #define IPAQ_ASIC2_ADCSR_ENABLE (1<<7) #define IPAQ_ASIC2_ADCSR_START (1<<6) #define IPAQ_ASIC2_ADCSR_INTEN (1<<5) #define IPAQ_ASIC2_ADCSR_FREERUN (1<<4)#define IPAQ_ASIC2_ADCDR 0x1208 /* data */#define IPAQ_ASIC2_ADC_LIGHTSENSOR IPAQ_ASIC2_ADMUX_AIN0#define IPAQ_ASIC2_ADC_IMIN IPAQ_ASIC2_ADMUX_AIN1#define IPAQ_ASIC2_ADC_VSMBAT IPAQ_ASIC2_ADMUX_AIN2#define IPAQ_ASIC2_ADC_TOUCHx IPAQ_ASIC2_ADMUX_AIN3#define IPAQ_ASIC2_ADC_TOUCHy IPAQ_ASIC2_ADMUX_AIN4/* ASIC2 PWM Registers*/#define IPAQ_ASIC2_PWM0_PWMTBS 0x0600 /* time base set */#define IPAQ_ASIC2_PWM0_PWMPTS 0x0604 /* period time set */#define IPAQ_ASIC2_PWM0_PWMDTS 0x0608 /* duty time set */#define IPAQ_ASIC2_PWM1_PWMTBS 0x0700 /* time base set */#define IPAQ_ASIC2_PWM1_PWMPTS 0x0704 /* period time set */#define IPAQ_ASIC2_PWM1_PWMDTS 0x0708 /* duty time set */#define IPAQ_ASIC2_PWMTBS_CLR (1<<5)#define IPAQ_ASIC2_PWMTBS_CLKEN (1<<4)#define IPAQ_ASIC2_PWMTBS_BASE(a) (a&0xf)/* ASIC2 LED Registers*/#define IPAQ_ASIC2_LED0_LEDTBS 0x0800 /* time base set */#define IPAQ_ASIC2_LED0_LEDPTS 0x0804 /* period time set */#define IPAQ_ASIC2_LED0_LEDDTS 0x0808 /* duty time set */#define IPAQ_ASIC2_LED0_LEDASTC 0x080C /* auto stop count */#define IPAQ_ASIC2_LED1_LEDTBS 0x0880 /* time base set */#define IPAQ_ASIC2_LED1_LEDPTS 0x0884 /* period time set */#define IPAQ_ASIC2_LED1_LEDDTS 0x0888 /* duty time set */#define IPAQ_ASIC2_LED1_LEDASTC 0x088C /* auto stop count */#define IPAQ_ASIC2_LED2_LEDTBS 0x0900 /* time base set */#define IPAQ_ASIC2_LED2_LEDPTS 0x0904 /* period time set */#define IPAQ_ASIC2_LED2_LEDDTS 0x0908 /* duty time set */#define IPAQ_ASIC2_LED2_LEDASTC 0x090C /* auto stop count */#define IPAQ_ASIC_LEDTBS_LEDALW (1<<6)#define IPAQ_ASIC_LEDTBS_LEDSTP (1<<5)#define IPAQ_ASIC_LEDTBS_LEDEN (1<<4)/* ASIC2 Interrupt Control Registers*/#define IPAQ_ASIC2_INTMASK 0x1600 /* interrupt mask control */ #define IPAQ_ASIC2_INTMASK_OWM (1<<7) #define IPAQ_ASIC2_INTMASK_TIMER (1<<6) #define IPAQ_ASIC2_INTMASK_UART1 (1<<5) #define IPAQ_ASIC2_INTMASK_UART0 (1<<4) #define IPAQ_ASIC2_INTMASK_EXTR (1<<2) #define IPAQ_ASIC2_INTMASK_POR (1<<1) #define IPAQ_ASIC2_INTMASK_GLOBAL (1<<0)#define IPAQ_ASIC2_INTCPS 0x1604 /* interrupt timer clock pre-scale */ #define IPAQ_ASIC2_INTCPS_ENABLE (1<<4) #define IPAQ_ASIC2_INTCPS_30us 0xE #define IPAQ_ASIC2_INTCPS_61us 0xD #define IPAQ_ASIC2_INTCPS_500ms 0x0#define IPAQ_ASIC2_INTTBS 0x1608 /* interrupt timer set *//* ASIC2 OWM Interface (one-wire bus)*/#define IPAQ_ASIC2_OWMCMD 0x1800 /* command register */#define IPAQ_ASIC2_OWMRXTX 0x1804 /* tx/rx buffer */#define IPAQ_ASIC2_OWMINT 0x1808 /* interrupt register */#define IPAQ_ASIC2_OWMINTEN 0x180C /* interrupt enable */#define IPAQ_ASIC2_OWMCLKDIV 0x1810 /* clock divisor *//* ASIC2 PIT (8254-esq)*/#define IPAQ_ASIC2_PIT 0x0E00 /* command *//* ASIC2 Flash Control*/#define IPAQ_ASIC2_FLASH_WP 0x1f00 /* Write Protect (0 WP, 1 R/W) *//* * * SA1110's GPIO to Interrupt mappings * */#define IPAQ_POWER_IRQ SA1100_GPIO_0 /* Main Power Button */#define IPAQ_MCU_IRQ SA1100_GPIO_1 /* Microcontroler Signal */#define IPAQ_CF_SLOT1_IRQ SA1100_GPIO_10 /* CF/PCMCIA Slot1 IRQ */#define IPAQ_CF_CARD1_IRQ SA1100_GPIO_11 /* CF/PCMCIA Card0 IRQ */#define IPAQ_CF_SLOT0_IRQ SA1100_GPIO_17 /* CF/PCMCIA Slot0 IRQ */#define IPAQ_CF_CARD0_IRQ SA1100_GPIO_21 /* CF/PCMCIA Card0 IRQ */#define IPAQ_JOY_CENTER_IRQ SA1100_GPIO_18 /* Joypad Center Pressed */#define IPAQ_BAT_FAULT_IRQ SA1100_GPIO_20 /* Battery Fault */#define IPAQ_EXP_LOCK_IRQ SA1100_GPIO_22 /* Expansion Pack Locked/Unlocked */#define IPAQ_EXP_SHARED_IRQ SA1100_GPIO_24 /* Expansion Pack Shared IRQ */ #define IPAQ_EXP_DETECT_IRQ SA1100_GPIO_27 /* Expansion Detected IRQ *//* * * iPaq 3100/3600/3700 MCU Input Macros * */#define IPAQ_MCU_INPUT_GET_X( a ) ( (uint32_t)a & 0x7FF )#define IPAQ_MCU_INPUT_GET_Y( a ) ( ( (uint32_t)a >> 11 ) & 0x7FF )#define IPAQ_MCU_INPUT_GET_BUTTONS( a ) ( ( (uint32_t)a >> 22 ) & 0x3FF )#define IPAQ_MCU_INPUT_X( a ) ( (uint32_t)a & 0x7FF )#define IPAQ_MCU_INPUT_Y( a ) ( ( (uint32_t)a & 0x7FF ) << 11 )#define IPAQ_MCU_INPUT_BUTTONS( a ) ( (uint32_t)( (uint32_t)a & 0x3FF ) << 22 )#define IPAQ_MCU_INPUT( x, y, z ) \(uint32_t)( (uint32_t)IPAQ_MCU_INPUT_X( x ) | \ (uint32_t)IPAQ_MCU_INPUT_Y( y ) | \ (uint32_t)IPAQ_MCU_INPUT_BUTTONS( z ) \ )#define IPAQ_MCU_INPUT_BUTTON_PEN 0x001#define IPAQ_MCU_INPUT_BUTTON_RECORD 0x002#define IPAQ_MCU_INPUT_BUTTON_CALENDER 0x004#define IPAQ_MCU_INPUT_BUTTON_PIM 0x008#define IPAQ_MCU_INPUT_BUTTON_Q 0x010#define IPAQ_MCU_INPUT_BUTTON_BACK 0x020#define IPAQ_MCU_INPUT_BUTTON_UP 0x040#define IPAQ_MCU_INPUT_BUTTON_RIGHT 0x080#define IPAQ_MCU_INPUT_BUTTON_LEFT 0x100#define IPAQ_MCU_INPUT_BUTTON_DOWN 0x200 /* * * HWI Structures and Functions for EGPIO and ASIC2 * */#define HWI_TAG_NAME_ipaq_egpio "IPAQ_EGPIO"#define HWI_TAG_ALIGN_ipaq_egpio (sizeof(unsigned))struct hwi_ipaq_egpio { struct hwi_item prefix; unsigned addr; unsigned value;};#define HWI_TAG_NAME_ipaq_asic2 "IPAQ_ASIC2"#define HWI_TAG_ALIGN_ipaq_asic2 (sizeof(unsigned))struct hwi_ipaq_asic2 { struct hwi_item prefix; unsigned addr; unsigned value;};/* * Locate EGPIO from syspage hwinfo structure */static __inline__ struct hwi_ipaq_egpio * __attribute__((__unused__))ipaq_egpio_attach(){ unsigned off; off = hwi_find_item(HWI_NULL_OFF, "ipaq_egpio", NULL); return hwi_off2tag(off);}/* * Set a bit in the EGPIO bank */static __inline__ void __attribute__((__unused__))ipaq_egpio_set(struct hwi_ipaq_egpio *egpio, unsigned bits){ InterruptDisable(); egpio->value |= bits; out32(egpio->addr, egpio->value); InterruptEnable();}/* * Clear a bit in the EGPIO bank */static __inline__ void __attribute__((__unused__))ipaq_egpio_clr(struct hwi_ipaq_egpio *egpio, unsigned bits){ InterruptDisable(); egpio->value &= ~bits; out32(egpio->addr, egpio->value); InterruptEnable();}/* * Read EGPIO value */static __inline__ unsigned __attribute__((__unused__))ipaq_egpio_get(struct hwi_ipaq_egpio *egpio){ return egpio->value;}/* * Locate ASIC2 from syspage hwinfo structure */static __inline__ struct hwi_ipaq_asic2 * __attribute__((__unused__))ipaq_asic2_attach(){ unsigned off; off = hwi_find_item(HWI_NULL_OFF, "ipaq_asic2", NULL); return hwi_off2tag(off);}/* * Set a bit in the ASIC2 GPIO */static __inline__ void __attribute__((__unused__))ipaq_asic2_set(struct hwi_ipaq_asic2 *asic2, unsigned bits){ InterruptDisable(); asic2->value |= bits; out32(asic2->addr, asic2->value); InterruptEnable();}/* * Clear a bit in the ASIC2 GPIO */static __inline__ void __attribute__((__unused__))ipaq_asic2_clr(struct hwi_ipaq_asic2 *asic2, unsigned bits){ InterruptDisable(); asic2->value &= ~bits; out32(asic2->addr, asic2->value); InterruptEnable();}/* * Read ASIC2 value */static __inline__ unsigned __attribute__((__unused__))ipaq_asic2_get(struct hwi_ipaq_asic2 *asic2){ return asic2->value;}#endif/* __SRCVERSION("ipaq.h $Rev: 169789 $"); */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -