]> git.donarmstrong.com Git - kiibohd-controller.git/blob - Lib/aliased_bitband.h
Cleanup.
[kiibohd-controller.git] / Lib / aliased_bitband.h
1
2 #ifndef __aliased_bitband_h
3 #define __aliased_bitband_h
4
5
6 // Aliased Regions for single bit (0th) register access
7
8 // Chapter 4: Memory Map (Table 4-1)
9
10
11
12 // TODO
13 // - Not all tested, and not all sections added
14
15
16
17 // 0x2200 0000 - 0x23FF FFFF - Aliased to SRAM_U bitband
18 // TODO
19
20
21
22 // 0x4200 0000 - 0x43FF FFFF - Aliased to AIPS and GPIO bitband
23 #define GPIO_BITBAND_ADDR(reg, bit) (((uint32_t)&(reg) - 0x40000000) * 32 + (bit) * 4 + 0x42000000)
24 #define GPIO_BITBAND_PTR(reg, bit) ((uint32_t *)GPIO_BITBAND_ADDR((reg), (bit)))
25
26 // XXX - Only MODREG is tested to work...
27 #define GPIO_BITBAND_OUTREG(reg, bit) *((uint32_t *)GPIO_BITBAND_ADDR((reg), (bit)) +   0)
28 #define GPIO_BITBAND_SETREG(reg, bit) *((uint32_t *)GPIO_BITBAND_ADDR((reg), (bit)) +  32)
29 #define GPIO_BITBAND_CLRREG(reg, bit) *((uint32_t *)GPIO_BITBAND_ADDR((reg), (bit)) +  64)
30 #define GPIO_BITBAND_TOGREG(reg, bit) *((uint32_t *)GPIO_BITBAND_ADDR((reg), (bit)) +  96)
31 #define GPIO_BITBAND_INPREG(reg, bit) *((uint32_t *)GPIO_BITBAND_ADDR((reg), (bit)) + 128)
32 #define GPIO_BITBAND_MODREG(reg, bit) *((uint32_t *)GPIO_BITBAND_ADDR((reg), (bit)) + 160)
33
34
35
36 #endif
37