auto-sync

This commit is contained in:
rusEfi 2016-02-04 15:01:45 -05:00
parent 7cb23afdef
commit f71b639bbf
5 changed files with 14 additions and 9 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -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) {

View File

@ -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)