From 278263528ca68a487715c38c1dbdba45c5d88cfd Mon Sep 17 00:00:00 2001 From: rusEfi Date: Thu, 5 Jan 2017 04:03:02 -0500 Subject: [PATCH] auto-sync --- firmware/console/console_io.cpp | 24 ++++++++++--------- firmware/console/console_io.h | 4 ++-- firmware/console/eficonsole.cpp | 2 +- firmware/console/status_loop.cpp | 4 ++-- firmware/util/datalogging.cpp | 2 +- .../simulator/rusEfiFunctionalTest.cpp | 2 +- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/firmware/console/console_io.cpp b/firmware/console/console_io.cpp index 7aca4d41b2..2d11ae5580 100644 --- a/firmware/console/console_io.cpp +++ b/firmware/console/console_io.cpp @@ -25,7 +25,7 @@ #if EFI_SIMULATOR || defined(__DOXYGEN__) #include "rusEfiFunctionalTest.h" -#endif +#endif /*EFI_SIMULATOR */ EXTERN_ENGINE; @@ -33,7 +33,7 @@ EXTERN_ENGINE; #include "usbcfg.h" #include "usbconsole.h" extern SerialUSBDriver SDU1; -#endif +#endif /* HAL_USE_SERIAL_USB */ int lastWriteSize; int lastWriteActual; @@ -63,7 +63,7 @@ static bool getConsoleLine(BaseSequentialStream *chp, char *line, unsigned size) char *p = line; while (true) { - if (!isConsoleReady()) { + if (!isCommandLineConsoleReady()) { // we better do not read from USB serial before it is ready chThdSleepMilliseconds(10); continue; @@ -131,18 +131,16 @@ static bool getConsoleLine(BaseSequentialStream *chp, char *line, unsigned size) CommandHandler console_line_callback; -static bool is_serial_over_uart; +static bool isCommandLineConsoleOverTTL; bool isSerialOverUart(void) { - return is_serial_over_uart; + return isCommandLineConsoleOverTTL; } #if (defined(EFI_CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR ) || defined(__DOXYGEN__) static SerialConfig serialConfig = { SERIAL_SPEED, 0, USART_CR2_STOP1_BITS | USART_CR2_LINEN, 0 }; #endif -#if EFI_PROD_CODE || EFI_EGT || defined(__DOXYGEN__) - bool consoleInBinaryMode = false; void runConsoleLoop(ts_channel_s *console) { @@ -174,6 +172,10 @@ void runConsoleLoop(ts_channel_s *console) { } } + +#if EFI_PROD_CODE || EFI_EGT || defined(__DOXYGEN__) + + SerialDriver * getConsoleChannel(void) { #if defined(EFI_CONSOLE_UART_DEVICE) || defined(__DOXYGEN__) if (isSerialOverUart()) { @@ -185,10 +187,10 @@ SerialDriver * getConsoleChannel(void) { return (SerialDriver *) &SDU1; #else return NULL; -#endif +#endif /* HAL_USE_SERIAL_USB */ } -bool isConsoleReady(void) { +bool isCommandLineConsoleReady(void) { if (isSerialOverUart()) { return isSerialConsoleStarted; } else { @@ -250,7 +252,7 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p) palSetPadMode(CONSOLE_MODE_SWITCH_PORT, CONSOLE_MODE_SWITCH_PIN, PAL_MODE_INPUT_PULLUP); - is_serial_over_uart = GET_CONSOLE_MODE_VALUE() == EFI_USE_UART_FOR_CONSOLE; + isCommandLineConsoleOverTTL = GET_CONSOLE_MODE_VALUE() == EFI_USE_UART_FOR_CONSOLE; if (isSerialOverUart()) { /* @@ -268,7 +270,7 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p) chEvtRegisterMask((event_source_t *) chnGetEventSource(EFI_CONSOLE_UART_DEVICE), &consoleEventListener, 1); } #else - is_serial_over_uart = false; + isCommandLineConsoleOverTTL = false; #endif /* EFI_PROD_CODE */ chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), NORMALPRIO, (tfunc_t)consoleThreadThreadEntryPoint, NULL); diff --git a/firmware/console/console_io.h b/firmware/console/console_io.h index 07817a5599..f01c341d68 100644 --- a/firmware/console/console_io.h +++ b/firmware/console/console_io.h @@ -29,9 +29,9 @@ bool isSerialOverUart(void); void onDataArrived(void); #if EFI_PROD_CODE || EFI_SIMULATOR || EFI_EGT -bool isConsoleReady(void); +bool isCommandLineConsoleReady(void); #else -#define isConsoleReady() true +#define isCommandLineConsoleReady() true #endif #endif /* CONSOLE_IO_H_ */ diff --git a/firmware/console/eficonsole.cpp b/firmware/console/eficonsole.cpp index 2bbcd1d46c..a061aaa326 100644 --- a/firmware/console/eficonsole.cpp +++ b/firmware/console/eficonsole.cpp @@ -142,7 +142,7 @@ static void cmd_threads(void) { */ void print(const char *format, ...) { #if !EFI_UART_ECHO_TEST_MODE - if (!isConsoleReady()) { + if (!isCommandLineConsoleReady()) { return; } va_list ap; diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 10338a6709..b27c0db763 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -412,7 +412,7 @@ extern fatal_msg_t errorMessageBuffer; * @brief Sends all pending data to dev console */ void updateDevConsoleState(Engine *engine) { - if (!isConsoleReady()) { + if (!isCommandLineConsoleReady()) { return; } // looks like this is not needed anymore @@ -596,7 +596,7 @@ static void blinkingThread(void *arg) { initialLedsBlink(); while (true) { - int delayMs = isConsoleReady() ? 3 * blinkingPeriod : blinkingPeriod; + int delayMs = is_usb_serial_ready() ? 3 * blinkingPeriod : blinkingPeriod; #if EFI_INTERNAL_FLASH || defined(__DOXYGEN__) if (getNeedToWriteConfiguration()) { diff --git a/firmware/util/datalogging.cpp b/firmware/util/datalogging.cpp index 339cc71b53..a657c3bb90 100644 --- a/firmware/util/datalogging.cpp +++ b/firmware/util/datalogging.cpp @@ -218,7 +218,7 @@ void printWithLength(char *line) { *p++ = '\r'; *p++ = '\n'; - if (!isConsoleReady()) + if (!isCommandLineConsoleReady()) return; consoleOutputBuffer((const uint8_t *) header, strlen(header)); consoleOutputBuffer((const uint8_t *) line, p - line); diff --git a/win32_functional_tests/simulator/rusEfiFunctionalTest.cpp b/win32_functional_tests/simulator/rusEfiFunctionalTest.cpp index 9ec258b4cb..3c8eb6f76c 100644 --- a/win32_functional_tests/simulator/rusEfiFunctionalTest.cpp +++ b/win32_functional_tests/simulator/rusEfiFunctionalTest.cpp @@ -109,7 +109,7 @@ int isSerialOverTcpReady; int maxNesting = 0; -bool isConsoleReady(void) { +bool isCommandLineConsoleReady(void) { return isSerialOverTcpReady; }