diff options
author | vetch <vetch97@gmail.com> | 2020-01-02 17:54:31 +0100 |
---|---|---|
committer | vetch <vetch97@gmail.com> | 2020-01-02 17:54:31 +0100 |
commit | ab7b754bb32022336527c1a2d5d710b95a589d0e (patch) | |
tree | 19f508f06c72efcbdd2cfad46949ed6f1ae45a3c /uart.h | |
parent | 5e1e6796109c892c4300c3da17c35e7874a40107 (diff) | |
parent | 6bf5a3b8c6e8a5d1cb3fb4880a5d9688ab094c62 (diff) | |
download | rpi-MMU-example-ab7b754bb32022336527c1a2d5d710b95a589d0e.tar.gz rpi-MMU-example-ab7b754bb32022336527c1a2d5d710b95a589d0e.zip |
Merge branch 'bob' of https://repo.or.cz/RPi-MMU-example into alice
# Conflicts:
# .gitignore
# PL0_test.ld
# demo_functionality.c
# interrupt_vector.S
# interrupts.c
# kernel.c
# memory.h
Diffstat (limited to 'uart.h')
-rw-r--r-- | uart.h | 61 |
1 files changed, 29 insertions, 32 deletions
@@ -4,43 +4,40 @@ #include <stddef.h> #include <stdint.h> #include <global.h> -enum - { - // The offsets for reach register. - // Controls actuation of pull up/down to ALL GPIO pins. - GPPUD = (GPIO_BASE + 0x94), +// The offsets for reach register. - // Controls actuation of pull up/down for specific GPIO pin. - GPPUDCLK0 = (GPIO_BASE + 0x98), +// Controls actuation of pull up/down to ALL GPIO pins. +#define GPPUD (GPIO_BASE + 0x94) - // The base address for UART. - UART0_BASE = 0x3F201000, // for raspi2 & 3, 0x20201000 for raspi1 +// Controls actuation of pull up/down for specific GPIO pin. +#define GPPUDCLK0 (GPIO_BASE + 0x98) - // The offsets for reach register for the UART. - UART0_DR = (UART0_BASE + 0x00), - UART0_RSRECR = (UART0_BASE + 0x04), - UART0_FR = (UART0_BASE + 0x18), - UART0_ILPR = (UART0_BASE + 0x20), - UART0_IBRD = (UART0_BASE + 0x24), - UART0_FBRD = (UART0_BASE + 0x28), - UART0_LCRH = (UART0_BASE + 0x2C), - UART0_CR = (UART0_BASE + 0x30), - UART0_IFLS = (UART0_BASE + 0x34), - UART0_IMSC = (UART0_BASE + 0x38), - UART0_RIS = (UART0_BASE + 0x3C), - UART0_MIS = (UART0_BASE + 0x40), - UART0_ICR = (UART0_BASE + 0x44), - UART0_DMACR = (UART0_BASE + 0x48), - UART0_ITCR = (UART0_BASE + 0x80), - UART0_ITIP = (UART0_BASE + 0x84), - UART0_ITOP = (UART0_BASE + 0x88), - UART0_TDR = (UART0_BASE + 0x8C), - }; +// The base address for UART. +#define UART0_BASE (GPIO_BASE + 0x1000) + +// The offsets for reach register for the UART. +#define UART0_DR (UART0_BASE + 0x00) +#define UART0_RSRECR (UART0_BASE + 0x04) +#define UART0_FR (UART0_BASE + 0x18) +#define UART0_ILPR (UART0_BASE + 0x20) +#define UART0_IBRD (UART0_BASE + 0x24) +#define UART0_FBRD (UART0_BASE + 0x28) +#define UART0_LCRH (UART0_BASE + 0x2C) +#define UART0_CR (UART0_BASE + 0x30) +#define UART0_IFLS (UART0_BASE + 0x34) +#define UART0_IMSC (UART0_BASE + 0x38) +#define UART0_RIS (UART0_BASE + 0x3C) +#define UART0_MIS (UART0_BASE + 0x40) +#define UART0_ICR (UART0_BASE + 0x44) +#define UART0_DMACR (UART0_BASE + 0x48) +#define UART0_ITCR (UART0_BASE + 0x80) +#define UART0_ITIP (UART0_BASE + 0x84) +#define UART0_ITOP (UART0_BASE + 0x88) +#define UART0_TDR (UART0_BASE + 0x8C) void uart_init(); -void uart_putc(unsigned char c); -unsigned char uart_getc(); -void uart_puts(const char* str); +void putchar(char c); +char getchar(void); #endif // UART_H |