LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
xenon_uart.c
Go to the documentation of this file.
1#include <stdint.h>
2
3#define BASE 0xea001000
4
5void putch(unsigned char c)
6{
7 if (c=='\n') putch('\r');
8
9 while (!((*(volatile uint32_t*)(BASE + 0x18))&0x02000000));
10 *(volatile uint32_t*)(BASE + 0x14) = (c << 24) & 0xFF000000;
11}
12
13int kbhit(void)
14{
16
17 do
18 status = *(volatile uint32_t*)(BASE + 0x18);
19 while (status & ~0x03000000);
20
21 return !!(status & 0x01000000);
22}
23
24int getch(void)
25{
26 while (!kbhit());
27 return (*(volatile uint32_t*)(BASE + 0x10)) >> 24;
28}
29
30void uart_puts(unsigned char *s)
31{
32 while(*s) putch(*s++);
33}
u32 status
Definition: ehci_defs.h:15
u32 uint32_t
Definition: libfdt_env.h:11
void putch(unsigned char c)
Definition: xenon_uart.c:5
#define BASE
Definition: xenon_uart.c:3
void uart_puts(unsigned char *s)
Definition: xenon_uart.c:30
int kbhit(void)
Definition: xenon_uart.c:13
int getch(void)
Definition: xenon_uart.c:24
u8 c
Definition: xenos_edid.h:7