auto-sync

This commit is contained in:
rusEfi 2015-03-08 16:04:54 -05:00
parent 1a1a210bca
commit 727e0a4245
5 changed files with 33 additions and 21 deletions

View File

@ -1,6 +1,7 @@
CONSOLESRC = $(PROJECT_DIR)/console/console_io.c
CONSOLESRC =
CONSOLE_SRC_CPP = $(PROJECT_DIR)/console/status_loop.cpp \
$(PROJECT_DIR)/console/console_io.cpp \
$(PROJECT_DIR)/console/eficonsole.cpp

View File

@ -194,7 +194,14 @@ void consoleOutputBuffer(const uint8_t *buf, int size) {
#endif /* EFI_UART_ECHO_TEST_MODE */
}
void startConsole(void (*console_line_callback_p)(char *)) {
static Logging *logger;
static void switchToBinaryProtocol(void) {
scheduleMsg(logger, "switching to binary protocol");
}
void startConsole(Logging *sharedLogger, void (*console_line_callback_p)(char *)) {
logger = sharedLogger;
console_line_callback = console_line_callback_p;
#if (defined(EFI_CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR) || defined(__DOXYGEN__)
@ -223,6 +230,7 @@ void startConsole(void (*console_line_callback_p)(char *)) {
#endif /* EFI_PROD_CODE */
chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), NORMALPRIO, consoleThreadThreadEntryPoint, NULL);
addConsoleAction("~", switchToBinaryProtocol);
}
/**

View File

@ -19,6 +19,7 @@
#endif
#include "efifeatures.h"
#include "datalogging.h"
#define GET_CONSOLE_MODE_VALUE() palReadPad(CONSOLE_MODE_SWITCH_PORT, CONSOLE_MODE_SWITCH_PIN)
#define SHOULD_INGORE_FLASH() (palReadPad(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN) == 0)
@ -32,7 +33,7 @@ SerialDriver * getConsoleChannel(void);
void consolePutChar(int x);
void consoleOutputBuffer(const uint8_t *buf, int size);
void startConsole(void (*console_line_callback_p)(char *));
void startConsole(Logging *sharedLogger, void (*console_line_callback_p)(char *));
bool isSerialOverUart(void);
#if EFI_PROD_CODE || EFI_SIMULATOR || EFI_EGT

View File

@ -83,7 +83,6 @@ static void sayHello(void) {
printMsg(&logger, "STM32_PCLK2=%d", STM32_PCLK2);
#endif
printMsg(&logger, "PORT_IDLE_THREAD_STACK_SIZE=%d", PORT_IDLE_THREAD_STACK_SIZE);
printMsg(&logger, "CH_DBG_ENABLE_ASSERTS=%d", CH_DBG_ENABLE_ASSERTS);
@ -118,7 +117,6 @@ static void sayHello(void) {
// printSimpleMsg(&logger, "", );
// printSimpleMsg(&logger, "", );
/**
* Time to finish output. This is needed to avoid mix-up of this methods output and console command confirmation
*/
@ -136,11 +134,10 @@ static void cmd_threads(void) {
print(" addr stack prio refs state time\r\n");
tp = chRegFirstThread();
do {
print("%.8lx [%.8lx] %4lu %4lu %9s %lu %s\r\n", (uint32_t) tp, 0,
(uint32_t) tp->p_prio, (uint32_t) (tp->p_refs - 1),
states[tp->p_state], (uint32_t) tp->p_time, tp->p_name);
print("%.8lx [%.8lx] %4lu %4lu %9s %lu %s\r\n", (uint32_t) tp, 0, (uint32_t) tp->p_prio,
(uint32_t) (tp->p_refs - 1), states[tp->p_state], (uint32_t) tp->p_time, tp->p_name);
tp = chRegNextThread(tp);
} while (tp != NULL );
} while (tp != NULL);
#endif
}
@ -149,12 +146,12 @@ static void cmd_threads(void) {
*/
void print(const char *format, ...) {
#if !EFI_UART_ECHO_TEST_MODE
if (!isConsoleReady()) {
if (!isConsoleReady()) {
return;
}
}
va_list ap;
va_start(ap, format);
chvprintf((BaseSequentialStream*)getConsoleChannel(), format, ap);
chvprintf((BaseSequentialStream*) getConsoleChannel(), format, ap);
va_end(ap);
#endif /* EFI_UART_ECHO_TEST_MODE */
}
@ -163,7 +160,7 @@ void initializeConsole(Logging *sharedLogger) {
initIntermediateLoggingBuffer();
initConsoleLogic(sharedLogger);
startConsole(&handleConsoleLine);
startConsole(sharedLogger, &handleConsoleLine);
sayHello();
addConsoleAction("test", sayNothing);

View File

@ -363,14 +363,7 @@ static bool isKnownCommand(char command) {
static uint8_t firstByte;
static uint8_t secondByte;
static msg_t tsThreadEntryPoint(void *arg) {
(void) arg;
chRegSetThreadName("tunerstudio thread");
#if EFI_PROD_CODE || defined(__DOXYGEN__)
startTsPort();
#endif
void runBinaryProtocolLoop(void) {
int wasReady = false;
while (true) {
int isReady = ts_serial_ready();
@ -461,6 +454,18 @@ static msg_t tsThreadEntryPoint(void *arg) {
print("got unexpected TunerStudio command %x:%c\r\n", command, command);
}
}
static msg_t tsThreadEntryPoint(void *arg) {
(void) arg;
chRegSetThreadName("tunerstudio thread");
#if EFI_PROD_CODE || defined(__DOXYGEN__)
startTsPort();
#endif
runBinaryProtocolLoop();
#if defined __GNUC__
return 0;
#endif