OSDN Git Service

Step 10 added.
[kozos-expbrd/kozos_expbrd.git] / firm / junk / 09 / bootload / sw.c
1 #include "sw.h"
2
3 #define H8_3069F_P7DR   ((volatile uint8 *)0xFFFFD6)
4 #define H8_3069F_PADR   ((volatile uint8 *)0xFFFFD9)
5
6 #define SW_BIT_P7_SW1   (1 << 0)
7 #define SW_BIT_P7_SW2   (1 << 1)
8 #define SW_BIT_PA_SWRE  (1 << 4)
9
10 int sw_init(void)
11 {
12   return 0;
13 }
14
15 uint8 sw_read(sw_target_t target)
16 {
17   uint8 c = 0;
18   switch (target) {
19     case Sw1:
20       c = (*H8_3069F_P7DR & SW_BIT_P7_SW1) ? 0 : 1;
21       break;
22     case Sw2:
23       c = (*H8_3069F_P7DR & SW_BIT_P7_SW2) ? 0 : 1;
24       break;
25     case SwRe:
26       c = (*H8_3069F_PADR & SW_BIT_PA_SWRE) ? 0 : 1;
27       break;
28   }
29   return c;
30 }
31