From 41ad4c6268b0292464802d88ac6835d21e69cabb Mon Sep 17 00:00:00 2001 From: vetch Date: Thu, 3 Oct 2019 17:57:43 +0200 Subject: changes in Makefile, modularize kernel --- uart.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 uart.h (limited to 'uart.h') diff --git a/uart.h b/uart.h new file mode 100644 index 0000000..5872484 --- /dev/null +++ b/uart.h @@ -0,0 +1,42 @@ +#include +#include +#include +// board type, raspi2 +enum + { + // The offsets for reach register. + + // Controls actuation of pull up/down to ALL GPIO pins. + GPPUD = (GPIO_BASE + 0x94), + + // Controls actuation of pull up/down for specific GPIO pin. + GPPUDCLK0 = (GPIO_BASE + 0x98), + + // The base address for UART. + UART0_BASE = 0x3F201000, // for raspi2 & 3, 0x20201000 for raspi1 + + // 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), + }; + +void uart_init(); +void uart_putc(unsigned char c); +unsigned char uart_getc(); +void uart_puts(const char* str); -- cgit v1.2.3