]> rtime.felk.cvut.cz Git - sysless.git/blobdiff - board/h8300/edk2638/defines/system_def_edk2638.h
It is 12 years after C99 standardization - switch to stdint.h and its types.
[sysless.git] / board / h8300 / edk2638 / defines / system_def_edk2638.h
index 6a1a3d9529ae513211e65a035f7961769ac11ab5..32dffffbdf0e5781c5272e75708a5aa6dc6127e5 100644 (file)
@@ -26,173 +26,63 @@ unsigned long cpu_sys_hz;  /* actual system clock frequency  */
 
 volatile unsigned long msec_time;
 
-/* Keyboard KL41 (CS6) */
-#define KL41_LCD_INST  (volatile __u8 * const)(0xc00000)
-#define KL41_LCD_STAT  (volatile __u8 * const)(0xc00001)
-#define KL41_LCD_WDATA (volatile __u8 * const)(0xc00002)
-#define KL41_LCD_RDATA (volatile __u8 * const)(0xc00003)
-#define KL41_LED_WR    (volatile __u8 * const)(0xc00001)
-#define KL41_KBD_WR    (volatile __u8 * const)(0xc00003)
-#define KL41_KBD_RD    (volatile __u8 * const)(0xc00004)
+#define SCI_RS232_CHAN_DEFAULT 1
 
-#define KL41_SUPPORT_ENABLED
-
-
-
-/* SGM Small graphics module (CS2) */
-#define SGM_LCD_DATA  (volatile __u8 * const)(0x400000)
-#define SGM_LCD_CMD   (volatile __u8 * const)(0x400001)
-#define SGM_LCD_STAT  (volatile __u8 * const)(0x400001)
-
-#define SGM_SUPPORT_ENABLED
-
-
-
-/* XRAM 1 MB (CS1) */
-#define XRAM_START    (volatile __u8 * const)(0x200000)
+/* XRAM 0.5 MB (CS0) */
+#define XRAM_START    (volatile uint8_t * const)(0x040000)
 
 #define XRAM_SUPPORT_ENABLED
 
-
-
-/* LED color mask         LED1 msb .. LED2 lsb*/
-#define   SGM_LED_G_MASK       0x9249
-#define   SGM_LED_Y_MASK       0x4924
-#define   SGM_LED_R_MASK       0x2492
-
-/* Peripherals (CS3) decoded from A13 to A15 */
-#define SGM_LED       (volatile __u8 * const)(0x600000)
-#define SGM_LED1      (volatile __u8 * const)(0x600000)
-#define SGM_LED2      (volatile __u8 * const)(0x602000)
-#define SGM_KBDI      (volatile __u8 * const)(0x604000)
-#define SGM_KBDO      (volatile __u8 * const)(0x606000)
-#define STPM_OUT      STPM_OUT_not_defined      
-                       /* 2x 4 bit current, SGN P1.0, P1.1 */
-                       /* DA2 current multiplier, P1.3 enable */
-                       /* TCLKC and TCLKD for incremental encoder */
-                       /* PWM outputs P1.0=TIOCA0, P1.1=TIOCB0 */
-                       /* End of motion PF.7 */
-/*#define PWRCTRL_OUT   (volatile __u8 * const)(0x???) */
-#define   PWRCTRL_SYROPm    0x01       /* 1 - open syringe by selenoid */
-#define   PWRCTRL_SYROPLm   0x02       /* 1 - open syringe by selenoid */
-#define   PWRCTRL_BEEPENm   0x04       /* 1 - switch beep on */
-/*#define   PWRCTRL_BEEPVOLm  0x0c*/   /* beep volume */
-#define   PWRCTRL_BACKLm    0x10       /* 1 - enable backlight */
-                                       /*     DA3 - brightness */
-                                       /*     DA0 - contrast */
-#define   PWRCTRL_STMOFFm   0x40       /* 1 - switch off motor */
-#define   PWRCTRL_BATLEDm   0x80       /* 1 - switch on battery LED */
-/*#define   PWRCTRL_THUMBPWRm  P1.7*/  /* 1 - power for thumb sensors */
-
-/* Mechanical limit reached  - P1.4 */
-#define MECH_LIMT_SW_a        DIO_PORT1
-#define MECH_LIMT_SW_m        0x10
-
-/* Buffer stransferred to second board power control register */
-volatile short scch_pwrctrl_buf;
-
-/* SRAM 32 kB (CS3) */
-#define SRAM_START    (volatile __u8 * const)(0x610000)
-
-
-#if 1
-#define ISR_USB_INTV           EXCPTVEC_IRQ6   /* pin IRQ6 on PG.0 */
-#define PDIUSB_READ_DATA_ADDR   (volatile __u8 * const)(0x600000)
-#define PDIUSB_WRITE_DATA_ADDR  (volatile __u8 * const)(0x600000)
-#define PDIUSB_COMMAND_ADDR     (volatile __u8 * const)(0x600001)
-
-/* P1.0 .. DACK_N/DMACK0, P7.0 .. DMREQ/DREQ0, P7.2 .. EOT_N/TEND0 */
-#undef  PDIUSB_WITH_ADD_IRQ_HANDLER
-#define PDIUSB_WITH_EXCPTVECT_SET
-#define PDIUSB_SUPPORT_ENABLED
-#endif 
-
-
-
-/* IDE (CS4) (CS5) powered by PF2 */
-#define SIDE_START1   (volatile __u8 * const)(0x800000)
-#define SIDE_START2   (volatile __u8 * const)(0xA00000)
-#define IDE0_DATA     (volatile __u16 * const)(SIDE_START1+0) /* DATA */
-#define IDE0_ERROR     (SIDE_START1+2) /* Error/Features RO/WO */
-#define IDE0_NSECTOR   (SIDE_START1+4) /* Sector Count R/W */
-#define IDE0_SECTOR    (SIDE_START1+6) /* SN, LBA 0-7 */
-#define IDE0_LCYL      (SIDE_START1+8) /* CL, LBA 8-15 */
-#define IDE0_HCYL      (SIDE_START1+10)        /* CH, LBA 16-23 */
-#define IDE0_CURRENT   (SIDE_START1+12)        /* 1L1DHHHH , LBA 24-27 */
-#define IDE0_STATUS    (SIDE_START1+14)        /* Status */
-#define IDE0_SELECT  IDE0_CURRENT
-#define IDE0_FEATURE IDE0_ERROR
-#define IDE0_COMMAND IDE0_STATUS       /* Command */
-
-#define IDE0_DEVCTRL   (SIDE_START2+12)        /* used for resets */
-#define IDE0_ALTSTATUS (SIDE_START2+14)        /* IDE0_STATUS - no clear irq */
-
-#define IDE0_SETPWR(pwr) do{ \
-                       if(pwr) atomic_clear_mask_b1(4,DIO_PFDR); \
-                       else atomic_set_mask_b1(4,DIO_PFDR); \
-               }while(0)
-
-#define IDE0_PRESENT_M() ((*DIO_PORT9)&0x20)
-
-#if (HW_VER_MAJOR == 0) && (HW_VER_MINOR == 2)
-  #define IDE_SWAP_BYTES
-#endif
-
-#define IDE0_SUPPORT_ENABLED
-
-
-
 /* IRAM 16 kB of on-chip memory */
 /* 0xffb000-0xffcfff .. 8 kB free */
 /* 0xffd000-0xffdfff .. 4 kB for Flash emulation */
 /* 0xffe000-0xffffc0 .. 4 kB - 64 B free*/
 /* 0xffffc0-0xffffff .. 64 B free*/
-#define IRAM_START    (volatile __u8 * const)(0xffb000)
-#define IRAM_START1   (volatile __u8 * const)(0xffe000)
-#define FRAM_START    (volatile __u8 * const)(0xffffc0)
+#define IRAM_START    (volatile uint8_t * const)(0xffb000)
+#define IRAM_START1   (volatile uint8_t * const)(0xffe000)
+#define FRAM_START    (volatile uint8_t * const)(0xffffc0)
 
-/* SCI0 - IrDA */
-/* SCI1 - IIC0 (P34, P35) */
-/* SCI2 - Boot */
-/* SCI3 - SPI */
-/* SCI4 - RS232/485 */
+/* SCI0 - RS232 */
+/* SCI1 - RS232 / Boot */
+/* SCI2 - x */
+/* SCI3 - x */
+/* SCI4 - x */
 
-/* IRQ0 - RTC */
-/* IRQ1 - Index mark */
-/* IRQ6 - IDE */
+/* IRQ0 - x */
+/* IRQ1 - x */
+/* IRQ6 - x */
 
 /* Some registers are read only on H8S processors */
-/* We use shaddow registers for some of them */
-#define SHADDOW_REG_ALT(_reg,_mask,_xor) \
-    (*(_reg)=_reg##_shaddow=(_reg##_shaddow&~(_mask))^(_xor))
+/* We use shadow registers for some of them */
+#define SHADOW_REG_ALT(_reg,_mask,_xor) \
+    (*(_reg)=_reg##_shadow=(_reg##_shadow&~(_mask))^(_xor))
 
-#define SHADDOW_REG_SET(_reg,_mask) \
-    (*(_reg)=_reg##_shaddow|=(_mask))
+#define SHADOW_REG_SET(_reg,_mask) \
+    (*(_reg)=_reg##_shadow|=(_mask))
 
-#define SHADDOW_REG_CLR(_reg,_mask) \
-    (*(_reg)=_reg##_shaddow&=~(_mask))
+#define SHADOW_REG_CLR(_reg,_mask) \
+    (*(_reg)=_reg##_shadow&=~(_mask))
 
-#define SHADDOW_REG_RD(_reg) \
-    (_reg##_shaddow)
+#define SHADOW_REG_RD(_reg) \
+    (_reg##_shadow)
 
-#define SHADDOW_REG_WR(_reg,_val) \
-    (*(_reg)=_reg##_shaddow=(_val))
+#define SHADOW_REG_WR(_reg,_val) \
+    (*(_reg)=_reg##_shadow=(_val))
 
-__u8 DIO_P1DDR_shaddow;
-__u8 DIO_P3DDR_shaddow;
-__u8 DIO_PFDDR_shaddow;
-__u8 DIO_PJDDR_shaddow;
-__u8 PWRCTRL_OUT_shaddow;
+uint8_t DIO_P1DDR_shadow;
+uint8_t DIO_P3DDR_shadow;
+uint8_t DIO_PFDDR_shadow;
+uint8_t DIO_PJDDR_shadow;
 
 #define DEB_LED_INIT() \
-        do {\
-           *DIO_P1DR &= ~(P1DR_P14DRm | P1DR_P15DRm);\
-           SHADDOW_REG_SET(DIO_P1DDR,0x30); /* set P1.4, P1.5 LED output */ \
+         do {\
+       *DIO_P1DR &= ~(P1DR_P14DRm | P1DR_P15DRm);\
+           SHADOW_REG_SET(DIO_P1DDR,(P1DDR_P15DDRm|P1DDR_P14DDRm)); /* set P1.5 and P1.4 as output */ \
        } while (0)
        
-#define DEB_LED_OFF(num) \
-        (*DIO_P1DR |= (P1DR_P14DRm << (num)) & (P1DR_P14DRm | P1DR_P15DRm))
 #define DEB_LED_ON(num) \
-       (*DIO_P1DR &=~(P1DR_P14DRm << (num)) | ~(P1DR_P14DRm | P1DR_P15DRm))
+  (*DIO_P1DR |= (P1DR_P14DRm << (num)) & (P1DR_P14DRm | P1DR_P15DRm))
+#define DEB_LED_OFF(num) \
+  (*DIO_P1DR &=~(P1DR_P14DRm << (num)) | ~(P1DR_P14DRm | P1DR_P15DRm))
 
 #endif /* _SYSTEM_DEF_HW01_H_ */