1 /*******************************************************************
2 Components for embedded applications builded for
3 laboratory and medical instruments firmware
5 system_def_edk2638.h - definition of hardware adresses and registers
6 for EDK2638 development board
8 Copyright (C) 2002 by Pavel Pisa pisa@cmp.felk.cvut.cz
9 (C) 2002 by PiKRON Ltd. http://www.pikron.com
11 *******************************************************************/
13 #ifndef _SYSTEM_DEF_HW01_H_
14 #define _SYSTEM_DEF_HW01_H_
16 //#define CPU_REF_HZ 11059200l /* reference clock frequency */
17 //#define CPU_SYS_HZ 11059200l /* default system clock frequency */
19 #define CPU_REF_HZ 18423000l /* reference clock frequency */
20 //#define CPU_SYS_HZ 24000000l /* default system clock frequency */
21 #define CPU_SYS_HZ 18423000l /* default system clock frequency */
24 unsigned long cpu_ref_hz; /* actual external XTAL reference */
25 unsigned long cpu_sys_hz; /* actual system clock frequency */
27 volatile unsigned long msec_time;
29 /* Keyboard KL41 (CS6) */
30 #define KL41_LCD_INST (volatile __u8 * const)(0xc00000)
31 #define KL41_LCD_STAT (volatile __u8 * const)(0xc00001)
32 #define KL41_LCD_WDATA (volatile __u8 * const)(0xc00002)
33 #define KL41_LCD_RDATA (volatile __u8 * const)(0xc00003)
34 #define KL41_LED_WR (volatile __u8 * const)(0xc00001)
35 #define KL41_KBD_WR (volatile __u8 * const)(0xc00003)
36 #define KL41_KBD_RD (volatile __u8 * const)(0xc00004)
38 #define KL41_SUPPORT_ENABLED
42 /* SGM Small graphics module (CS2) */
43 #define SGM_LCD_DATA (volatile __u8 * const)(0x400000)
44 #define SGM_LCD_CMD (volatile __u8 * const)(0x400001)
45 #define SGM_LCD_STAT (volatile __u8 * const)(0x400001)
47 #define SGM_SUPPORT_ENABLED
52 #define XRAM_START (volatile __u8 * const)(0x200000)
54 #define XRAM_SUPPORT_ENABLED
58 /* LED color mask LED1 msb .. LED2 lsb*/
59 #define SGM_LED_G_MASK 0x9249
60 #define SGM_LED_Y_MASK 0x4924
61 #define SGM_LED_R_MASK 0x2492
63 /* Peripherals (CS3) decoded from A13 to A15 */
64 #define SGM_LED (volatile __u8 * const)(0x600000)
65 #define SGM_LED1 (volatile __u8 * const)(0x600000)
66 #define SGM_LED2 (volatile __u8 * const)(0x602000)
67 #define SGM_KBDI (volatile __u8 * const)(0x604000)
68 #define SGM_KBDO (volatile __u8 * const)(0x606000)
69 #define STPM_OUT STPM_OUT_not_defined
70 /* 2x 4 bit current, SGN P1.0, P1.1 */
71 /* DA2 current multiplier, P1.3 enable */
72 /* TCLKC and TCLKD for incremental encoder */
73 /* PWM outputs P1.0=TIOCA0, P1.1=TIOCB0 */
74 /* End of motion PF.7 */
75 /*#define PWRCTRL_OUT (volatile __u8 * const)(0x???) */
76 #define PWRCTRL_SYROPm 0x01 /* 1 - open syringe by selenoid */
77 #define PWRCTRL_SYROPLm 0x02 /* 1 - open syringe by selenoid */
78 #define PWRCTRL_BEEPENm 0x04 /* 1 - switch beep on */
79 /*#define PWRCTRL_BEEPVOLm 0x0c*/ /* beep volume */
80 #define PWRCTRL_BACKLm 0x10 /* 1 - enable backlight */
81 /* DA3 - brightness */
83 #define PWRCTRL_STMOFFm 0x40 /* 1 - switch off motor */
84 #define PWRCTRL_BATLEDm 0x80 /* 1 - switch on battery LED */
85 /*#define PWRCTRL_THUMBPWRm P1.7*/ /* 1 - power for thumb sensors */
87 /* Mechanical limit reached - P1.4 */
88 #define MECH_LIMT_SW_a DIO_PORT1
89 #define MECH_LIMT_SW_m 0x10
91 /* Buffer stransferred to second board power control register */
92 volatile short scch_pwrctrl_buf;
94 /* SRAM 32 kB (CS3) */
95 #define SRAM_START (volatile __u8 * const)(0x610000)
99 #define ISR_USB_INTV EXCPTVEC_IRQ6 /* pin IRQ6 on PG.0 */
100 #define PDIUSB_READ_DATA_ADDR (volatile __u8 * const)(0x600000)
101 #define PDIUSB_WRITE_DATA_ADDR (volatile __u8 * const)(0x600000)
102 #define PDIUSB_COMMAND_ADDR (volatile __u8 * const)(0x600001)
104 /* P1.0 .. DACK_N/DMACK0, P7.0 .. DMREQ/DREQ0, P7.2 .. EOT_N/TEND0 */
105 #undef PDIUSB_WITH_ADD_IRQ_HANDLER
106 #define PDIUSB_WITH_EXCPTVECT_SET
107 #define PDIUSB_SUPPORT_ENABLED
112 /* IDE (CS4) (CS5) powered by PF2 */
113 #define SIDE_START1 (volatile __u8 * const)(0x800000)
114 #define SIDE_START2 (volatile __u8 * const)(0xA00000)
115 #define IDE0_DATA (volatile __u16 * const)(SIDE_START1+0) /* DATA */
116 #define IDE0_ERROR (SIDE_START1+2) /* Error/Features RO/WO */
117 #define IDE0_NSECTOR (SIDE_START1+4) /* Sector Count R/W */
118 #define IDE0_SECTOR (SIDE_START1+6) /* SN, LBA 0-7 */
119 #define IDE0_LCYL (SIDE_START1+8) /* CL, LBA 8-15 */
120 #define IDE0_HCYL (SIDE_START1+10) /* CH, LBA 16-23 */
121 #define IDE0_CURRENT (SIDE_START1+12) /* 1L1DHHHH , LBA 24-27 */
122 #define IDE0_STATUS (SIDE_START1+14) /* Status */
123 #define IDE0_SELECT IDE0_CURRENT
124 #define IDE0_FEATURE IDE0_ERROR
125 #define IDE0_COMMAND IDE0_STATUS /* Command */
127 #define IDE0_DEVCTRL (SIDE_START2+12) /* used for resets */
128 #define IDE0_ALTSTATUS (SIDE_START2+14) /* IDE0_STATUS - no clear irq */
130 #define IDE0_SETPWR(pwr) do{ \
131 if(pwr) atomic_clear_mask_b1(4,DIO_PFDR); \
132 else atomic_set_mask_b1(4,DIO_PFDR); \
135 #define IDE0_PRESENT_M() ((*DIO_PORT9)&0x20)
137 #if (HW_VER_MAJOR == 0) && (HW_VER_MINOR == 2)
138 #define IDE_SWAP_BYTES
141 #define IDE0_SUPPORT_ENABLED
145 /* IRAM 16 kB of on-chip memory */
146 /* 0xffb000-0xffcfff .. 8 kB free */
147 /* 0xffd000-0xffdfff .. 4 kB for Flash emulation */
148 /* 0xffe000-0xffffc0 .. 4 kB - 64 B free*/
149 /* 0xffffc0-0xffffff .. 64 B free*/
150 #define IRAM_START (volatile __u8 * const)(0xffb000)
151 #define IRAM_START1 (volatile __u8 * const)(0xffe000)
152 #define FRAM_START (volatile __u8 * const)(0xffffc0)
155 /* SCI1 - IIC0 (P34, P35) */
158 /* SCI4 - RS232/485 */
161 /* IRQ1 - Index mark */
164 /* Some registers are read only on H8S processors */
165 /* We use shaddow registers for some of them */
166 #define SHADDOW_REG_ALT(_reg,_mask,_xor) \
167 (*(_reg)=_reg##_shaddow=(_reg##_shaddow&~(_mask))^(_xor))
169 #define SHADDOW_REG_SET(_reg,_mask) \
170 (*(_reg)=_reg##_shaddow|=(_mask))
172 #define SHADDOW_REG_CLR(_reg,_mask) \
173 (*(_reg)=_reg##_shaddow&=~(_mask))
175 #define SHADDOW_REG_RD(_reg) \
178 #define SHADDOW_REG_WR(_reg,_val) \
179 (*(_reg)=_reg##_shaddow=(_val))
181 __u8 DIO_P1DDR_shaddow;
182 __u8 DIO_P3DDR_shaddow;
183 __u8 DIO_PFDDR_shaddow;
184 __u8 PWRCTRL_OUT_shaddow;
186 #endif /* _SYSTEM_DEF_HW01_H_ */