diff options
Diffstat (limited to 'src/arm64/arm64-uart.c')
| -rw-r--r-- | src/arm64/arm64-uart.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/src/arm64/arm64-uart.c b/src/arm64/arm64-uart.c index 7455626..d587346 100644 --- a/src/arm64/arm64-uart.c +++ b/src/arm64/arm64-uart.c @@ -1,6 +1,6 @@ /* ------------------------------------------- - Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved. + Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved. ------------------------------------------- */ @@ -9,47 +9,40 @@ /// BUGS: 0 -#define ARM64_MMIO_REG(addr) (*(volatile uint32_t*)(cb_uart_ptr + addr)) +#define ARM64_MMIO_REG(addr) (*(volatile uint32_t*) (cb_uart_ptr + addr)) /* this file handles the UART */ -static uint32_t* cb_uart_ptr = (uint32_t*)CB_UART_BASE; +static uint32_t* cb_uart_ptr = (uint32_t*) CB_UART_BASE; // we need that one, to avoid sending mutliple chars to UART. static boolean cb_locked_put_char = no; /// @brief Retrieve character from cb_uart_ptr -utf_char_t cb_get_char(void) -{ - while ((ARM64_MMIO_REG(0x018) & (1 << 4))) - { - } +utf_char_t cb_get_char(void) { + while ((ARM64_MMIO_REG(0x018) & (1 << 4))) { + } - return (utf_char_t)ARM64_MMIO_REG(0x0) & 0xFF; + return (utf_char_t) ARM64_MMIO_REG(0x0) & 0xFF; } -void cb_put_char(utf_char_t ch) -{ - while ((ARM64_MMIO_REG(0x018) & (1 << 5))) - { - } +void cb_put_char(utf_char_t ch) { + while ((ARM64_MMIO_REG(0x018) & (1 << 5))) { + } - ARM64_MMIO_REG(0x0) = ch; + ARM64_MMIO_REG(0x0) = ch; } /// @brief UART put string /// @param text the input text. -size_t cb_put_string(const char* text) -{ - if (text == nil) - return 0; +size_t cb_put_string(const char* text) { + if (text == nil) return 0; - size_t i = 0; + size_t i = 0; - for (; i < strlen(text); i++) - { - cb_put_char(text[i]); - } + for (; i < strlen(text); i++) { + cb_put_char(text[i]); + } - return i; + return i; } |
