24 lines
548 B
C
24 lines
548 B
C
|
#define SERIAL_BASE 0x16000000
|
||
|
#define SERIAL_FLAG_REGISTER 0x18
|
||
|
#define SERIAL_BUFFER_FULL (1 << 5)
|
||
|
|
||
|
void putc (char c)
|
||
|
{
|
||
|
/* Wait until the serial buffer is empty */
|
||
|
while (*(volatile unsigned long*)(SERIAL_BASE + SERIAL_FLAG_REGISTER)
|
||
|
& (SERIAL_BUFFER_FULL));
|
||
|
/* Put our character, c, into the serial buffer */
|
||
|
*(volatile unsigned long*)SERIAL_BASE = c;
|
||
|
}
|
||
|
|
||
|
void puts (const char * str)
|
||
|
{
|
||
|
while (*str) putc (*str++);
|
||
|
}
|
||
|
|
||
|
int main (void)
|
||
|
{
|
||
|
puts ("hello, world!\n");
|
||
|
return 0;
|
||
|
}
|