mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-12-11 07:02:28 +00:00
b15be6bcd7
The M1 Pro/Max Macs use a different base address for the UART and the WDT than earlier models. Remove hardcoded base addresses constants and replace them with loads from the ADT. - The base address of the WDT is already retrieved in wdt_disable; also use this address when triggering a reboot. - Retrieve the base address of uart0 in uart_init. If the operation fails, the error will be signaled on the early uart (if not disabled). - The early debug UART can’t use the ADT (or shouldn’t) so it is now disabled by default. To enable it, add -DEARLY_UART -DEARLY_UART_BASE=0xuart_address to the CFLAGS. Signed-off-by: Vincent Duvert <vincent@duvert.net>
29 lines
503 B
C
29 lines
503 B
C
/* SPDX-License-Identifier: MIT */
|
|
|
|
#ifndef UART_H
|
|
#define UART_H
|
|
|
|
#include "types.h"
|
|
|
|
int uart_init(void);
|
|
|
|
void uart_putbyte(u8 c);
|
|
u8 uart_getbyte(void);
|
|
|
|
void uart_putchar(u8 c);
|
|
u8 uart_getchar(void);
|
|
|
|
void uart_write(const void *buf, size_t count);
|
|
size_t uart_read(void *buf, size_t count);
|
|
|
|
void uart_puts(const char *s);
|
|
|
|
void uart_setbaud(int baudrate);
|
|
|
|
void uart_flush(void);
|
|
|
|
void uart_clear_irqs(void);
|
|
|
|
int uart_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
|
|
|
#endif
|