smol-gilbraltar/include/serial.h

30 lines
929 B
C
Raw Permalink Normal View History

2024-12-20 22:45:12 +00:00
#ifndef __GILBRALTAR_SERIAL__
#define __GILBRALTAR_SERIAL__
#include <bcm.h>
#include <stddef.h>
2024-12-23 00:46:17 +00:00
#include <stdint.h>
2024-12-20 22:45:12 +00:00
#define ARM_UART0_BASE (ARM_IO_BASE + 0x1001000)
2024-12-23 00:46:17 +00:00
#define ARM_UART0_DR (ARM_UART0_BASE + 0x00)
#define ARM_UART0_FR (ARM_UART0_BASE + 0x18)
2024-12-20 22:45:12 +00:00
#define ARM_UART0_IBRD (ARM_UART0_BASE + 0x24)
#define ARM_UART0_FBRD (ARM_UART0_BASE + 0x28)
#define ARM_UART0_LCRH (ARM_UART0_BASE + 0x2c)
2024-12-23 00:46:17 +00:00
#define ARM_UART0_CR (ARM_UART0_BASE + 0x30)
2024-12-20 22:45:12 +00:00
#define ARM_UART0_IFLS (ARM_UART0_BASE + 0x34)
#define ARM_UART0_IMSC (ARM_UART0_BASE + 0x38)
2024-12-23 00:46:17 +00:00
#define ARM_UART0_RIS (ARM_UART0_BASE + 0x3c)
#define ARM_UART0_MIS (ARM_UART0_BASE + 0x40)
#define ARM_UART0_ICR (ARM_UART0_BASE + 0x44)
2024-12-20 22:45:12 +00:00
void gilbraltar_serial_init(void);
void gilbraltar_serial_send(uint8_t);
uint8_t gilbraltar_serial_recv(void);
void gilbraltar_serial_puts(const char *);
void gilbraltar_serial_putchar(int);
void gilbraltar_serial_write(const char *, size_t);
#endif