mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-13 23:46:40 +00:00
uart: transmit string and hex
This commit is contained in:
parent
71b76c153d
commit
a290932034
2 changed files with 15 additions and 0 deletions
|
@ -31,3 +31,16 @@ void uart_transmit_char(char ch) {
|
||||||
|
|
||||||
UART_THR_DLAB_0_0 = ch;
|
UART_THR_DLAB_0_0 = ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uart_transmit_str(const char *str) {
|
||||||
|
while (*str) {
|
||||||
|
uart_transmit_char(*str++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_transmit_hex(uint32_t value) {
|
||||||
|
for (unsigned int i = 0; i < 8; i++) {
|
||||||
|
uint32_t nibble = (value >> (28 - i * 4)) & 0xF;
|
||||||
|
uart_transmit_char("0123456789ABCDEF"[nibble]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,5 +16,7 @@ void *get_uart_address(void); /* This is inlined in uart.c */
|
||||||
|
|
||||||
void uart_initialize(uint16_t divider);
|
void uart_initialize(uint16_t divider);
|
||||||
void uart_transmit_char(char ch);
|
void uart_transmit_char(char ch);
|
||||||
|
void uart_transmit_str(const char *str);
|
||||||
|
void uart_transmit_hex(uint32_t value);
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue