Add devices directory, and PL011 and PL110 basic (very!) device drivers
This commit is contained in:
13
devices/pl011.c
Normal file
13
devices/pl011.c
Normal file
@ -0,0 +1,13 @@
|
||||
#define PL011_SERIAL_BASE 0x16000000
|
||||
#define PL011_SERIAL_FLAG_REGISTER 0x18
|
||||
#define PL011_SERIAL_BUFFER_FULL (1 << 5)
|
||||
|
||||
void pl011_putc(char c)
|
||||
{
|
||||
/* Wait until the serial buffer is empty */
|
||||
while (*(volatile unsigned long*)(PL011_SERIAL_BASE + PL011_SERIAL_FLAG_REGISTER)
|
||||
& (PL011_SERIAL_BUFFER_FULL));
|
||||
|
||||
/* When it's empty, put our character at the base */
|
||||
*(volatile unsigned long*)PL011_SERIAL_BASE = c;
|
||||
}
|
Reference in New Issue
Block a user