1+ #ifndef BOOT_H
2+ #define BOOT_H
3+
4+ /* ==================== GPIO ==================== */
5+ #define MMIO_BASE 0x3F000000
6+
7+ #define GPFSEL0 ((volatile unsigned int *)(MMIO_BASE + 0x00200000))
8+ #define GPFSEL1 ((volatile unsigned int *)(MMIO_BASE + 0x00200004))
9+ #define GPFSEL2 ((volatile unsigned int *)(MMIO_BASE + 0x00200008))
10+ #define GPFSEL3 ((volatile unsigned int *)(MMIO_BASE + 0x0020000C))
11+ #define GPFSEL4 ((volatile unsigned int *)(MMIO_BASE + 0x00200010))
12+ #define GPFSEL5 ((volatile unsigned int *)(MMIO_BASE + 0x00200014))
13+ #define GPSET0 ((volatile unsigned int *)(MMIO_BASE + 0x0020001C))
14+ #define GPSET1 ((volatile unsigned int *)(MMIO_BASE + 0x00200020))
15+ #define GPCLR0 ((volatile unsigned int *)(MMIO_BASE + 0x00200028))
16+ #define GPCLR1 ((volatile unsigned int *)(MMIO_BASE + 0x0020002C))
17+ #define GPLEV0 ((volatile unsigned int *)(MMIO_BASE + 0x00200034))
18+ #define GPLEV1 ((volatile unsigned int *)(MMIO_BASE + 0x00200038))
19+ #define GPEDS0 ((volatile unsigned int *)(MMIO_BASE + 0x00200040))
20+ #define GPEDS1 ((volatile unsigned int *)(MMIO_BASE + 0x00200044))
21+ #define GPHEN0 ((volatile unsigned int *)(MMIO_BASE + 0x00200064))
22+ #define GPHEN1 ((volatile unsigned int *)(MMIO_BASE + 0x00200068))
23+ #define GPPUD ((volatile unsigned int *)(MMIO_BASE + 0x00200094))
24+ #define GPPUDCLK0 ((volatile unsigned int *)(MMIO_BASE + 0x00200098))
25+ #define GPPUDCLK1 ((volatile unsigned int *)(MMIO_BASE + 0x0020009C))
26+
27+ /* ==================== UART ==================== */
28+ #define AUX_ENABLE ((volatile unsigned int *)(MMIO_BASE + 0x00215004))
29+ #define AUX_MU_IO ((volatile unsigned int *)(MMIO_BASE + 0x00215040))
30+ #define AUX_MU_IER ((volatile unsigned int *)(MMIO_BASE + 0x00215044))
31+ #define AUX_MU_IIR ((volatile unsigned int *)(MMIO_BASE + 0x00215048))
32+ #define AUX_MU_LCR ((volatile unsigned int *)(MMIO_BASE + 0x0021504C))
33+ #define AUX_MU_MCR ((volatile unsigned int *)(MMIO_BASE + 0x00215050))
34+ #define AUX_MU_LSR ((volatile unsigned int *)(MMIO_BASE + 0x00215054))
35+ #define AUX_MU_MSR ((volatile unsigned int *)(MMIO_BASE + 0x00215058))
36+ #define AUX_MU_SCRATCH ((volatile unsigned int *)(MMIO_BASE + 0x0021505C))
37+ #define AUX_MU_CNTL ((volatile unsigned int *)(MMIO_BASE + 0x00215060))
38+ #define AUX_MU_STAT ((volatile unsigned int *)(MMIO_BASE + 0x00215064))
39+ #define AUX_MU_BAUD ((volatile unsigned int *)(MMIO_BASE + 0x00215068))
40+
41+ void init_uart ();
42+ char uart_recv ();
43+ void uart_putc (char c );
44+ void uart_puts (const char * s );
45+
46+ /* ==================== UTILS ==================== */
47+ int atoi (const char * s );
48+
49+ #endif // BOOT_H
0 commit comments