From f71b639bbf5b1df767cc268c20844ee7dfd0ff0d Mon Sep 17 00:00:00 2001 From: rusEfi Date: Thu, 4 Feb 2016 15:01:45 -0500 Subject: [PATCH] auto-sync --- firmware/console/console_io.cpp | 13 +++++-------- firmware/console/eficonsole.cpp | 4 ++++ firmware/controllers/algo/rusefi_types.h | 1 + firmware/controllers/error_handling.cpp | 2 +- firmware/global.h | 3 +++ 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/firmware/console/console_io.cpp b/firmware/console/console_io.cpp index 938a6f2c55..8f54e19005 100644 --- a/firmware/console/console_io.cpp +++ b/firmware/console/console_io.cpp @@ -38,7 +38,7 @@ int lastWriteActual; static bool isSerialConsoleStarted = false; -static EventListener consoleEventListener; +static event_listener_t consoleEventListener; /** * @brief Reads a whole line from the input channel. @@ -164,7 +164,7 @@ bool consoleInBinaryMode = false; ts_channel_s binaryConsole; static THD_WORKING_AREA(consoleThreadStack, 3 * UTILITY_THREAD_STACK_SIZE); -static msg_t consoleThreadThreadEntryPoint(void *arg) { +static THD_FUNCTION(consoleThreadThreadEntryPoint, arg) { (void) arg; chRegSetThreadName("console thread"); @@ -180,7 +180,7 @@ static msg_t consoleThreadThreadEntryPoint(void *arg) { binaryConsole.channel = (BaseChannel *) getConsoleChannel(); while (true) { - efiAssert(getRemainingStack(chThdSelf()) > 256, "lowstck#9e", 0); + efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#9e"); bool end = getConsoleLine((BaseSequentialStream*) getConsoleChannel(), consoleInput, sizeof(consoleInput)); if (end) { // firmware simulator is the only case when this happens @@ -199,9 +199,6 @@ static msg_t consoleThreadThreadEntryPoint(void *arg) { runBinaryProtocolLoop(&binaryConsole, true); } } -#if defined __GNUC__ - return false; -#endif } void consolePutChar(int x) { @@ -250,13 +247,13 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p) isSerialConsoleStarted = true; - chEvtRegisterMask((EventSource *) chnGetEventSource(EFI_CONSOLE_UART_DEVICE), &consoleEventListener, 1); + chEvtRegisterMask((event_source_t *) chnGetEventSource(EFI_CONSOLE_UART_DEVICE), &consoleEventListener, 1); } #else is_serial_over_uart = false; #endif /* EFI_PROD_CODE */ - chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), NORMALPRIO, consoleThreadThreadEntryPoint, NULL); + chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), NORMALPRIO, (tfunc_t)consoleThreadThreadEntryPoint, NULL); addConsoleAction(SWITCH_TO_BINARY_COMMAND, switchToBinaryProtocol); } diff --git a/firmware/console/eficonsole.cpp b/firmware/console/eficonsole.cpp index 05af2828f7..9c170f922a 100644 --- a/firmware/console/eficonsole.cpp +++ b/firmware/console/eficonsole.cpp @@ -65,7 +65,9 @@ static void sayHello(void) { scheduleMsg(&logger, "*** Chibios Kernel: %s", CH_KERNEL_VERSION); scheduleMsg(&logger, "*** Compiled: " __DATE__ " - " __TIME__ ""); scheduleMsg(&logger, "COMPILER=%s", __VERSION__); +#ifdef CH_FREQUENCY scheduleMsg(&logger, "CH_FREQUENCY=%d", CH_FREQUENCY); +#endif #ifdef SERIAL_SPEED scheduleMsg(&logger, "SERIAL_SPEED=%d", SERIAL_SPEED); #endif @@ -87,7 +89,9 @@ static void sayHello(void) { scheduleMsg(&logger, "PORT_IDLE_THREAD_STACK_SIZE=%d", PORT_IDLE_THREAD_STACK_SIZE); scheduleMsg(&logger, "CH_DBG_ENABLE_ASSERTS=%d", CH_DBG_ENABLE_ASSERTS); +#ifdef CH_DBG_ENABLED scheduleMsg(&logger, "CH_DBG_ENABLED=%d", CH_DBG_ENABLED); +#endif scheduleMsg(&logger, "CH_DBG_SYSTEM_STATE_CHECK=%d", CH_DBG_SYSTEM_STATE_CHECK); scheduleMsg(&logger, "CH_DBG_ENABLE_STACK_CHECK=%d", CH_DBG_ENABLE_STACK_CHECK); diff --git a/firmware/controllers/algo/rusefi_types.h b/firmware/controllers/algo/rusefi_types.h index cd9446cdfe..54730d4fb6 100644 --- a/firmware/controllers/algo/rusefi_types.h +++ b/firmware/controllers/algo/rusefi_types.h @@ -16,6 +16,7 @@ * integer time in milliseconds * 32 bit 4B / 1000 = 4M seconds = 1111.11 hours = 46 days. * Please restart your ECU every 46 days? :) + * See getTimeNowUs() */ typedef uint32_t efitimems_t; diff --git a/firmware/controllers/error_handling.cpp b/firmware/controllers/error_handling.cpp index a6336eefe1..dc8fe30f08 100644 --- a/firmware/controllers/error_handling.cpp +++ b/firmware/controllers/error_handling.cpp @@ -113,7 +113,7 @@ void initErrorHandling(void) { msObjectInit(&warningStream, (uint8_t *) warningBuffer, WARNING_BUFFER_SIZE, 0); } -extern VTList vtlist; +extern virtual_timers_list_t vtlist; extern bool main_loop_started; int getVtSizeEstimate(void) { diff --git a/firmware/global.h b/firmware/global.h index 0e0c0a635a..dd350e8120 100644 --- a/firmware/global.h +++ b/firmware/global.h @@ -57,6 +57,9 @@ typedef unsigned int time_t; typedef VirtualTimer virtual_timer_t; typedef EventListener event_listener_t; typedef Thread thread_t; +typedef EventListener event_listener_t; +typedef EventSource event_source_t; +typedef VTList virtual_timers_list_t; #define THD_WORKING_AREA WORKING_AREA #define THD_FUNCTION(tname, arg) void tname(void *arg)