void consoleOutputBuffer(const uint8_t *buf, int size) { lastWriteSize = size; #if !EFI_UART_ECHO_TEST_MODE lastWriteActual = chnWriteTimeout(getConsoleChannel(), buf, size, CONSOLE_WRITE_TIMEOUT); // if (r != size) // firmwareError(OBD_PCM_Processor_Fault, "Partial console write"); #endif /* EFI_UART_ECHO_TEST_MODE */ }
/** * This methods prints the message to whatever is configured as our primary console */ void print(const char *format, ...) { #if !EFI_UART_ECHO_TEST_MODE if (!isCommandLineConsoleReady()) { return; } va_list ap; va_start(ap, format); chvprintf((BaseSequentialStream*) getConsoleChannel(), format, ap); va_end(ap); #endif /* EFI_UART_ECHO_TEST_MODE */ }
static msg_t consoleThreadThreadEntryPoint(void *arg) { (void) arg; chRegSetThreadName("console thread"); #if (EFI_PROD_CODE && EFI_USB_SERIAL) || defined(__DOXYGEN__) if (!isSerialOverUart()) { /** * This method contains a long delay, that's the reason why this is not done on the main thread */ usb_serial_start(); } #endif /* EFI_PROD_CODE */ binaryConsole.channel = (BaseChannel *) getConsoleChannel(); while (true) { efiAssert(getRemainingStack(chThdSelf()) > 256, "lowstck#9e", 0); bool end = getConsoleLine((BaseSequentialStream*) getConsoleChannel(), consoleInput, sizeof(consoleInput)); if (end) { // firmware simulator is the only case when this happens continue; } char *trimmed = efiTrim(consoleInput); (console_line_callback)(trimmed); if (consoleInBinaryMode) { #if EFI_SIMULATOR || defined(__DOXYGEN__) logMsg("Switching to binary mode\r\n"); #endif // switch to binary protocol runBinaryProtocolLoop(&binaryConsole, true); } } #if defined __GNUC__ return false; #endif }
static THD_FUNCTION(consoleThreadThreadEntryPoint, arg) { (void) arg; chRegSetThreadName("console thread"); #if (EFI_PROD_CODE && EFI_USB_SERIAL) || defined(__DOXYGEN__) if (!isCommandLineConsoleOverTTL()) { /** * This method contains a long delay, that's the reason why this is not done on the main thread */ usb_serial_start(); } #endif /* EFI_PROD_CODE */ binaryConsole.channel = (BaseChannel *) getConsoleChannel(); if (binaryConsole.channel != NULL) runConsoleLoop(&binaryConsole); }
static void runChibioTest(void) { print("EFI_SHAFT_POSITION_INPUT=%d\r\n", EFI_SHAFT_POSITION_INPUT); print("EFI_EMULATE_POSITION_SENSORS=%d\r\n", EFI_EMULATE_POSITION_SENSORS); print("EFI_ANALOG_SENSORS=%d\r\n", EFI_ANALOG_SENSORS); print("EFI_INTERNAL_ADC=%d\r\n", EFI_INTERNAL_ADC); print("EFI_HD44780_LCD=%d\r\n", EFI_HD44780_LCD); print("EFI_MAP_AVERAGING=%d\r\n", EFI_MAP_AVERAGING); print("EFI_WAVE_ANALYZER=%d\r\n", EFI_WAVE_ANALYZER); print("EFI_ENGINE_SNIFFER=%d\r\n", EFI_ENGINE_SNIFFER); print("EFI_SENSOR_CHART=%d\r\n", EFI_SENSOR_CHART); print("EFI_SHAFT_POSITION_INPUT=%d\r\n", EFI_SHAFT_POSITION_INPUT); print("EFI_ENGINE_CONTROL=%d\r\n", EFI_ENGINE_CONTROL); print("CH_DBG_SYSTEM_STATE_CHECK=%d\r\n", CH_DBG_SYSTEM_STATE_CHECK); print("CH_DBG_ENABLE_CHECKS=%d\r\n", CH_DBG_ENABLE_CHECKS); print("CH_DBG_ENABLE_ASSERTS=%d\r\n", CH_DBG_ENABLE_ASSERTS); print("CH_DBG_ENABLE_STACK_CHECK=%d\r\n", CH_DBG_ENABLE_STACK_CHECK); print("CH_DBG_THREADS_PROFILING=%d\r\n", CH_DBG_THREADS_PROFILING); TestThread(getConsoleChannel()); }
void consolePutChar(int x) { chnWriteTimeout(getConsoleChannel(), (const uint8_t *)&x, 1, CONSOLE_WRITE_TIMEOUT); }
void consolePutChar(int x) { chSequentialStreamPut(getConsoleChannel(), (uint8_t )(x)); }