OSDN Git Service

Added the special register definition.
authorShinichiro Nakamura <shinta.main.jp@gmail.com>
Fri, 13 Jul 2012 13:10:54 +0000 (22:10 +0900)
committerShinichiro Nakamura <shinta.main.jp@gmail.com>
Fri, 13 Jul 2012 13:10:54 +0000 (22:10 +0900)
firm/sample1/bootload/dram.c
firm/sample1/bootload/lcd.c
firm/sample1/bootload/portconf.h
firm/sample1/bootload/re.c
firm/sample1/bootload/spreg.h [new file with mode: 0644]

index 59464b3..dceb674 100644 (file)
@@ -1,21 +1,9 @@
+
 #include "defines.h"
 #include "lib.h"
 #include "dram.h"
-
-#define H8_3069F_ABWCR  ((volatile uint8 *)0xfee020)
-#define H8_3069F_ASTCR  ((volatile uint8 *)0xfee021)
-#define H8_3069F_RTCOR  ((volatile uint8 *)0xfee02a)
-#define H8_3069F_RTMCSR ((volatile uint8 *)0xfee028)
-#define H8_3069F_DRCRB  ((volatile uint8 *)0xfee027)
-#define H8_3069F_DRCRA  ((volatile uint8 *)0xfee026)
-
-#define H8_3069F_P1DDR  ((volatile uint8 *)0xfee000)
-#define H8_3069F_P2DDR  ((volatile uint8 *)0xfee001)
-#define H8_3069F_P8DDR  ((volatile uint8 *)0xfee007)
-#define H8_3069F_PBDDR  ((volatile uint8 *)0xfee00a)
-
-#define H8_3069F_WCRH   ((volatile uint8 *)0xfee022)
-#define H8_3069F_WCRL   ((volatile uint8 *)0xfee023)
+#include "portconf.h"
+#include "spreg.h"
 
 typedef struct {
   union {
@@ -29,16 +17,16 @@ int dram_init()
 {
   int i, j;
 
-  *H8_3069F_ABWCR  = 0xff;
-  *H8_3069F_RTCOR  = 0x03; /* ¥ê¥Õ¥ì¥Ã¥·¥å¼þ´ü¤òû¤á¤ËÀßÄê */
-  *H8_3069F_RTMCSR = 0x37;
-  *H8_3069F_DRCRB  = 0x8f; /* ¥¦¥¨¥¤¥ÈÁÞÆþ */
-  *H8_3069F_DRCRA  = 0x20;
+  *SPREG_ABWCR  = 0xff;
+  *SPREG_RTCOR  = 0x03; /* ¥ê¥Õ¥ì¥Ã¥·¥å¼þ´ü¤òû¤á¤ËÀßÄê */
+  *SPREG_RTMCSR = 0x37;
+  *SPREG_DRCRB  = 0x8f; /* ¥¦¥¨¥¤¥ÈÁÞÆþ */
+  *SPREG_DRCRA  = 0x20;
 
-  *H8_3069F_P1DDR  = 0xff;
-  *H8_3069F_P2DDR  = 0x07;
-  *H8_3069F_P8DDR  = 0xee;
-  *H8_3069F_PBDDR  = 0x6c;
+  *PORTCONF_P1DDR  = 0xff;
+  *PORTCONF_P2DDR  = 0x07;
+  *PORTCONF_P8DDR  = 0xee;
+  *PORTCONF_PBDDR  = 0x6c;
 
   for (i = 0; i < 200; i++) {
     for (j = 0; j < 200; j++) {
@@ -49,13 +37,13 @@ int dram_init()
   /*
    * 3¥¹¥Æ¡¼¥È¥¢¥¯¥»¥¹
    */
-  *H8_3069F_WCRH = 0xff;
-  *H8_3069F_WCRL = 0xff;
+  *SPREG_WCRH = 0xff;
+  *SPREG_WCRL = 0xff;
 
   /*
    * 3¥¹¥Æ¡¼¥È¥¢¥¯¥»¥¹
    */
-  *H8_3069F_ASTCR = 0xff;
+  *SPREG_ASTCR = 0xff;
 
   return 0;
 }
index 3ff17ce..ec2dc62 100644 (file)
@@ -1,6 +1,7 @@
 #include "lcd.h"
 #include "defines.h"
 #include "portconf.h"
+#include "spreg.h"
 
 static const uint8 FONT_X = 5;
 static const uint8 FONT_Y = 7;
@@ -152,7 +153,7 @@ void lcd_init(void)
   asm volatile ("nop");
   *PORTCONF_P4DR |= PORTCONF_P4BIT_LCD_RES;
 
-  *PORTCONF_CSCR = 0x3F;
+  *SPREG_CSCR = 0x3F;
 
   LCD1_CMD(0xE2);   // Reset
   LCD1_CMD(0xA4);   // Static Drive Off
index 14d169a..c1b7d0e 100644 (file)
@@ -6,8 +6,12 @@
  * Data Direction Register
  */
 
+#define PORTCONF_P1DDR  ((volatile uint8 *)0xfee000)
+#define PORTCONF_P2DDR  ((volatile uint8 *)0xfee001)
 #define PORTCONF_P4DDR  ((volatile uint8 *)0xFEE003)
+#define PORTCONF_P8DDR  ((volatile uint8 *)0xfee007)
 #define PORTCONF_PADDR  ((volatile uint8 *)0xFEE009)
+#define PORTCONF_PBDDR  ((volatile uint8 *)0xfee00a)
 
 /*
  * Port Data Register
 #define PORTCONF_PBDR   ((volatile uint8 *)0xFFFFDA)
 
 /*
- * Special Register
- */
-
-#define PORTCONF_CSCR       ((volatile uint8 *)0xFEE01F)
-#define PORTCONF_TMDR       ((volatile uint8 *)0xFFFF62)
-#define PORTCONF_TSTR       ((volatile uint8 *)0xFFFF60)
-#define PORTCONF_16TCNT2H   ((volatile uint8 *)0xFFFF7A)
-#define PORTCONF_16TCNT2L   ((volatile uint8 *)0xFFFF7B)
-
-/*
  * Bit
  */
 
-#define PORTCONF_TMDRBIT_MDF    (1 << 6)
-#define PORTCONF_TSTRBIT_STR2   (1 << 2)
-
 #define PORTCONF_PABIT_LEDG     (1 << 2)
 #define PORTCONF_PABIT_LEDR     (1 << 3)
 #define PORTCONF_PABIT_SWRE     (1 << 4)
index 50f6432..a29f77d 100644 (file)
@@ -1,16 +1,16 @@
 #include "re.h"
-#include "portconf.h"
+#include "spreg.h"
 
 int re_init(void)
 {
-  *PORTCONF_TMDR = PORTCONF_TMDRBIT_MDF;
-  *PORTCONF_TSTR = PORTCONF_TSTRBIT_STR2;
+  *SPREG_TMDR = SPREG_TMDR_BIT_MDF;
+  *SPREG_TSTR = SPREG_TSTR_BIT_STR2;
 
   return 0;
 }
 
 uint16 re_read(void)
 {
-  return ((*PORTCONF_16TCNT2H) << 8) | (*PORTCONF_16TCNT2L << 0);
+  return ((*SPREG_16TCNT2H) << 8) | (*SPREG_16TCNT2L << 0);
 }
 
diff --git a/firm/sample1/bootload/spreg.h b/firm/sample1/bootload/spreg.h
new file mode 100644 (file)
index 0000000..852c2b0
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef SPREG_H
+#define SPREG_H
+
+#define SPREG_CSCR       ((volatile uint8 *)0xFEE01F)
+
+/*
+ * Special Register
+ */
+#define SPREG_TMDR       ((volatile uint8 *)0xFFFF62)
+#define SPREG_TSTR       ((volatile uint8 *)0xFFFF60)
+#define SPREG_16TCNT2H   ((volatile uint8 *)0xFFFF7A)
+#define SPREG_16TCNT2L   ((volatile uint8 *)0xFFFF7B)
+
+#define SPREG_TMDR_BIT_MDF    (1 << 6)
+#define SPREG_TSTR_BIT_STR2   (1 << 2)
+
+/*
+ * DRAM
+ */
+#define SPREG_ABWCR  ((volatile uint8 *)0xfee020)
+#define SPREG_ASTCR  ((volatile uint8 *)0xfee021)
+#define SPREG_RTCOR  ((volatile uint8 *)0xfee02a)
+#define SPREG_RTMCSR ((volatile uint8 *)0xfee028)
+#define SPREG_DRCRB  ((volatile uint8 *)0xfee027)
+#define SPREG_DRCRA  ((volatile uint8 *)0xfee026)
+
+#define SPREG_WCRH   ((volatile uint8 *)0xfee022)
+#define SPREG_WCRL   ((volatile uint8 *)0xfee023)
+
+#endif
+