summaryrefslogtreecommitdiffhomepage
path: root/src/ppc64/ppc64-uart.c
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-04-25 13:28:08 +0200
committerAmlal <amlal@nekernel.org>2025-04-25 13:28:08 +0200
commit1c8414d3348c55fcf132839a04fdedec5efaacbe (patch)
tree5c7386fae0504a798801e0b34b588f4177ba67c1 /src/ppc64/ppc64-uart.c
parentd7e35959ebb6b1dd892a99f23c2a7f23c0f99041 (diff)
dev: refactor codebase.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'src/ppc64/ppc64-uart.c')
-rw-r--r--src/ppc64/ppc64-uart.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/ppc64/ppc64-uart.c b/src/ppc64/ppc64-uart.c
index c908eae..c16657d 100644
--- a/src/ppc64/ppc64-uart.c
+++ b/src/ppc64/ppc64-uart.c
@@ -1,48 +1,43 @@
/* -------------------------------------------
- Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
+ Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
------------------------------------------- */
-#include <lib/string.h>
#include <lib/boot.h>
+#include <lib/string.h>
/// BUGS: 0
#define CB_NS16550_COM1 (CB_UART_BASE + 0x4500)
#define CB_NS16550_COM2 (CB_UART_BASE + 0x4600)
-volatile ascii_char_t* const UART0DR = (ascii_char_t*)CB_NS16550_COM1;
+volatile ascii_char_t* const UART0DR = (ascii_char_t*) CB_NS16550_COM1;
/* this file handles the UART */
/// @brief Get character from UART.
/// @param
/// @return
-utf_char_t cb_get_char(void)
-{
- while (!(*(((volatile uint8_t*)UART0DR) + 0x05) & 0x01))
- ;
- return (utf_char_t)*UART0DR;
+utf_char_t cb_get_char(void) {
+ while (!(*(((volatile uint8_t*) UART0DR) + 0x05) & 0x01));
+ return (utf_char_t) *UART0DR;
}
/// @brief Put character into UART.
/// @param ch
-void cb_put_char(utf_char_t ch)
-{
- *UART0DR = (ascii_char_t)(ch);
+void cb_put_char(utf_char_t ch) {
+ *UART0DR = (ascii_char_t) (ch);
}
/// @brief Put string in UART.
/// @param text the input text.
-size_t cb_put_string(const char* text)
-{
- while (*text != '\0')
- { /* Loop until end of string */
+size_t cb_put_string(const char* text) {
+ while (*text != '\0') { /* Loop until end of string */
- cb_put_char(*text); /* Transmit char */
+ cb_put_char(*text); /* Transmit char */
- text++; /* Next char */
- }
- return 0;
+ text++; /* Next char */
+ }
+ return 0;
}