]>
git.zerfleddert.de Git - linexec-j720/blob - uart.cpp
98451fa889a7f55ae19cd80413e4d07658d7bf25
4 //#include <aygshell.h>
9 //#define FUART 0x40100000
12 void UART_puts(char *s
)
14 UINT32
*base
=(UINT32
*)VirtualAlloc((void*)0x0,sizeof(void*)*0xffff, MEM_RESERVE
,PAGE_READWRITE
);
15 int ret
=VirtualCopy(base
,(void *) ((UARTBASE
)/256),sizeof(void*)*0xffff , PAGE_READWRITE
|PAGE_NOCACHE
|PAGE_PHYSICAL
);
19 while((base
[UARTSTATUS
/4]&1<<UARTTXRDY
) == UARTTXBIT
) {}
20 base
[UARTDATA
/4]=(char)(s
[a
]);
27 UINT32
*base
=(UINT32
*)VirtualAlloc((void*)0x0,sizeof(void*)*0xffff, MEM_RESERVE
,PAGE_READWRITE
);
28 int ret
=VirtualCopy(base
,(void *) ((UARTBASE
)/256),sizeof(void*)*0xffff , PAGE_READWRITE
|PAGE_NOCACHE
|PAGE_PHYSICAL
);
31 // Apparently there is something we don't know. This is needed.
32 HANDLE hSerial
= CreateFile(L
"COM1:", GENERIC_READ
| GENERIC_WRITE
, FILE_SHARE_READ
| FILE_SHARE_WRITE
, NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, 0);
37 // set 8 bit no parity 1 stopbit
48 base
[0]=8; // 115200 bps
52 // UART enable & no FIFO
57 char test
[]="LinExec: UART Initialized.\n\r";
61 while((base
[UARTSTATUS
/4]&1<<UARTTXRDY
) == UARTTXBIT
) {}
62 base
[UARTDATA
/4]=(char)(test
[a
]);