summaryrefslogtreecommitdiffhomepage
path: root/src/arm64
diff options
context:
space:
mode:
Diffstat (limited to 'src/arm64')
-rw-r--r--src/arm64/arm64-30pin.c4
-rw-r--r--src/arm64/arm64-err.c18
-rw-r--r--src/arm64/arm64-uart.c43
3 files changed, 28 insertions, 37 deletions
diff --git a/src/arm64/arm64-30pin.c b/src/arm64/arm64-30pin.c
index f347f0d..eb89c67 100644
--- a/src/arm64/arm64-30pin.c
+++ b/src/arm64/arm64-30pin.c
@@ -1,10 +1,10 @@
/* -------------------------------------------
- Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
+ Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
------------------------------------------- */
-#include <lib/partition-map.h>
#include <lib/30pin.h>
+#include <lib/partition-map.h>
extern size_t cb_read_30pin(voidptr_t blob, size_t* size, size_t* start_lba);
diff --git a/src/arm64/arm64-err.c b/src/arm64/arm64-err.c
index 052b302..c734ada 100644
--- a/src/arm64/arm64-err.c
+++ b/src/arm64/arm64-err.c
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
+ Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
------------------------------------------- */
@@ -10,14 +10,12 @@
/// @brief Goes into a panic state.
/// @param reason why?
-void cb_panic(const char* reason)
-{
- cb_put_string("panic: ");
- cb_put_string(reason);
- cb_put_char('\n');
+void cb_panic(const char* reason) {
+ cb_put_string("panic: ");
+ cb_put_string(reason);
+ cb_put_char('\n');
- while (yes)
- {
- asm volatile("hlt #0");
- }
+ while (yes) {
+ asm volatile("hlt #0");
+ }
}
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;
}