FreeCalypso > hg > freecalypso-reveng
changeset 318:4e1d7ce0ee71
frbl/reconst/boot.c: perfect match to TCS211 boot.obj
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 05 Mar 2020 00:27:22 +0000 |
parents | c71e3156170a |
children | f9482000b838 |
files | frbl/reconst/boot.c |
diffstat | 1 files changed, 33 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/frbl/reconst/boot.c Wed Mar 04 23:58:05 2020 +0000 +++ b/frbl/reconst/boot.c Thu Mar 05 00:27:22 2020 +0000 @@ -74,11 +74,11 @@ * Main ******************************************************************************/ -uint32 uart; +uint32 uart_base; void jump(uint32, uint32); -void putchar(uint8 ch); +static void putchar(uint8 ch); uint8 getchar(void); void uart_init(UBYTE dlh, UBYTE dll); void hardware_init(uint16 *code); @@ -95,18 +95,18 @@ hardware_init(&chip_id_code); - uart = UART_BASE_MODEM; + uart_base = UART_BASE_MODEM; uart_init(0, 0x07); // baudrate = 115200kbps - uart = UART_BASE_IRDA; + uart_base = UART_BASE_IRDA; uart_init(0, 0x07); // baudrate = 115200kbps #ifdef TESTBOOT while (1) { - uart = UART_BASE_MODEM; - if ((REGISTER_8_READ(uart + UART_LSR) & STAT_RXRDY)) + uart_base = UART_BASE_MODEM; + if ((REGISTER_8_READ(uart_base + UART_LSR) & STAT_RXRDY)) break; - uart = UART_BASE_IRDA; - if ((REGISTER_8_READ(uart + UART_LSR) & STAT_RXRDY)) + uart_base = UART_BASE_IRDA; + if ((REGISTER_8_READ(uart_base + UART_LSR) & STAT_RXRDY)) break; } while (getchar() != 0xAA) @@ -118,13 +118,13 @@ #endif while (1) { - uart = UART_BASE_MODEM; + uart_base = UART_BASE_MODEM; putchar(PROTO_HELLO); - if ((REGISTER_8_READ(uart + UART_LSR) & STAT_RXRDY)) + if ((REGISTER_8_READ(uart_base + UART_LSR) & STAT_RXRDY)) break; - uart = UART_BASE_IRDA; + uart_base = UART_BASE_IRDA; putchar(PROTO_HELLO); - if ((REGISTER_8_READ(uart + UART_LSR) & STAT_RXRDY)) + if ((REGISTER_8_READ(uart_base + UART_LSR) & STAT_RXRDY)) break; } while (1) { @@ -133,6 +133,11 @@ case PROTO_VERSION: putchar(BOOTLOADER_VERSION); break; +/* FreeCalypso reconstruction of TCS211 boot.obj */ + case PROTO_HARDWARE: + putchar('0'); + break; +/* end FC reconstruction */ case PROTO_QUERY: ch = getchar(); if (ch == PROTO_QUERY_CHIP) { @@ -171,7 +176,7 @@ // Insert convenient tracing here... #endif // Start the program we loaded. - jump(uart, addr.i); + jump(uart_base, addr.i); break; default: putchar(PROTO_ERROR); @@ -187,14 +192,14 @@ asm("$jump:"); asm(" bx r1"); -void putchar(uint8 ch) +static void putchar(uint8 ch) { - PUTCHAR_FUNCTION_CODE(uart) + PUTCHAR_FUNCTION_CODE(uart_base) } uint8 getchar(void) { - GETCHAR_FUNCTION_CODE(uart) + GETCHAR_FUNCTION_CODE(uart_base) } @@ -315,38 +320,38 @@ /* * Set the UART in reset mode. */ - REGISTER_8_WRITE(uart + UART_MDR1, CMD_UART_RESET); + REGISTER_8_WRITE(uart_base + UART_MDR1, CMD_UART_RESET); /* * FIFO configuration */ - REGISTER_8_WRITE(uart + UART_LCR, CMD_EFR_EN); - BIT_SET (uart + UART_EFR, ENHANCED_EN); - REGISTER_8_WRITE(uart + UART_LCR, CMD_FCR_MCR_EN); - REGISTER_8_WRITE(uart + UART_FCR, CMD_FIFO_EN); + REGISTER_8_WRITE(uart_base + UART_LCR, CMD_EFR_EN); + BIT_SET (uart_base + UART_EFR, ENHANCED_EN); + REGISTER_8_WRITE(uart_base + UART_LCR, CMD_FCR_MCR_EN); + REGISTER_8_WRITE(uart_base + UART_FCR, CMD_FIFO_EN); /* * Speed configuration */ - REGISTER_8_WRITE(uart + UART_LCR, CMD_EFR_EN); - REGISTER_8_WRITE(uart + UART_DLL, my_dll); - REGISTER_8_WRITE(uart + UART_DLH, my_dlh); + REGISTER_8_WRITE(uart_base + UART_LCR, CMD_EFR_EN); + REGISTER_8_WRITE(uart_base + UART_DLL, my_dll); + REGISTER_8_WRITE(uart_base + UART_DLH, my_dlh); /* * Character format configuration */ - REGISTER_8_WRITE(uart + UART_LCR, CMD_CHAR8_STOP1_NOPAR); + REGISTER_8_WRITE(uart_base + UART_LCR, CMD_CHAR8_STOP1_NOPAR); /* * Modem configuration */ - REGISTER_8_WRITE(uart + UART_MDR1, CMD_UART_MODE); + REGISTER_8_WRITE(uart_base + UART_MDR1, CMD_UART_MODE); /* * Flush Rx buffer */ - while ((REGISTER_8_READ(uart + UART_LSR) & STAT_RXRDY)) - ch = (REGISTER_8_READ(uart + UART_RHR)); + while ((REGISTER_8_READ(uart_base + UART_LSR) & STAT_RXRDY)) + ch = (REGISTER_8_READ(uart_base + UART_RHR)); }