X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/linexec-j720/blobdiff_plain/77a37381836de85306ad128def744d879c38f95a..c5f1f439f689ac322fc715b979e343c93e8b8ec3:/uart.cpp diff --git a/uart.cpp b/uart.cpp index 98451fa..020852f 100644 --- a/uart.cpp +++ b/uart.cpp @@ -5,9 +5,9 @@ #include #include "setup.h" -// moved to config.h +// moved to config.h //#define FUART 0x40100000 - + void UART_puts(char *s) { @@ -26,21 +26,21 @@ void UART_setup() { UINT32 *base=(UINT32*)VirtualAlloc((void*)0x0,sizeof(void*)*0xffff, MEM_RESERVE,PAGE_READWRITE); int ret=VirtualCopy(base,(void *) ((UARTBASE)/256),sizeof(void*)*0xffff , PAGE_READWRITE|PAGE_NOCACHE|PAGE_PHYSICAL); - -#ifdef STRONGARM -// Apparently there is something we don't know. This is needed. - HANDLE hSerial = CreateFile(L"COM1:", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); -// disable UART - base[0x0C/4] = 0; -// clear status - base[0x1C/4] = 0xFF; -// set 8 bit no parity 1 stopbit - base[0x00/4] = 9; -// set 115200 bps - base[0x04/4] = 0; - base[0x08/4] = 1; -// enable TX/RX - base[0x0C/4] = 3; + +#ifdef STRONGARM +// Apparently there is something we don't know. This is needed. + HANDLE hSerial = CreateFile(L"COM1:", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); +// disable UART + base[0x0C/4] = 0; +// clear status + base[0x1C/4] = 0xFF; +// set 8 bit no parity 1 stopbit + base[0x00/4] = 9; +// set 115200 bps + base[0x04/4] = 0; + base[0x08/4] = 1; +// enable TX/RX + base[0x0C/4] = 3; #else // set DLAB base[0x0C/4]=128+2+1; @@ -52,7 +52,7 @@ void UART_setup() // UART enable & no FIFO base[0x04/4]=64; base[0x08/4]=0; -#endif +#endif char test[]="LinExec: UART Initialized.\n\r"; int a=0;