auto-sync
This commit is contained in:
parent
1a1a210bca
commit
727e0a4245
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
CONSOLESRC = $(PROJECT_DIR)/console/console_io.c
|
CONSOLESRC =
|
||||||
|
|
||||||
CONSOLE_SRC_CPP = $(PROJECT_DIR)/console/status_loop.cpp \
|
CONSOLE_SRC_CPP = $(PROJECT_DIR)/console/status_loop.cpp \
|
||||||
|
$(PROJECT_DIR)/console/console_io.cpp \
|
||||||
$(PROJECT_DIR)/console/eficonsole.cpp
|
$(PROJECT_DIR)/console/eficonsole.cpp
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,14 @@ void consoleOutputBuffer(const uint8_t *buf, int size) {
|
||||||
#endif /* EFI_UART_ECHO_TEST_MODE */
|
#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;
|
console_line_callback = console_line_callback_p;
|
||||||
|
|
||||||
#if (defined(EFI_CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR) || defined(__DOXYGEN__)
|
#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 */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), NORMALPRIO, consoleThreadThreadEntryPoint, NULL);
|
chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), NORMALPRIO, consoleThreadThreadEntryPoint, NULL);
|
||||||
|
addConsoleAction("~", switchToBinaryProtocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -19,6 +19,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "efifeatures.h"
|
#include "efifeatures.h"
|
||||||
|
#include "datalogging.h"
|
||||||
|
|
||||||
#define GET_CONSOLE_MODE_VALUE() palReadPad(CONSOLE_MODE_SWITCH_PORT, CONSOLE_MODE_SWITCH_PIN)
|
#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)
|
#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 consolePutChar(int x);
|
||||||
void consoleOutputBuffer(const uint8_t *buf, int size);
|
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);
|
bool isSerialOverUart(void);
|
||||||
|
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR || EFI_EGT
|
#if EFI_PROD_CODE || EFI_SIMULATOR || EFI_EGT
|
||||||
|
|
|
@ -83,7 +83,6 @@ static void sayHello(void) {
|
||||||
printMsg(&logger, "STM32_PCLK2=%d", STM32_PCLK2);
|
printMsg(&logger, "STM32_PCLK2=%d", STM32_PCLK2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
printMsg(&logger, "PORT_IDLE_THREAD_STACK_SIZE=%d", PORT_IDLE_THREAD_STACK_SIZE);
|
printMsg(&logger, "PORT_IDLE_THREAD_STACK_SIZE=%d", PORT_IDLE_THREAD_STACK_SIZE);
|
||||||
|
|
||||||
printMsg(&logger, "CH_DBG_ENABLE_ASSERTS=%d", CH_DBG_ENABLE_ASSERTS);
|
printMsg(&logger, "CH_DBG_ENABLE_ASSERTS=%d", CH_DBG_ENABLE_ASSERTS);
|
||||||
|
@ -118,7 +117,6 @@ static void sayHello(void) {
|
||||||
// printSimpleMsg(&logger, "", );
|
// printSimpleMsg(&logger, "", );
|
||||||
// printSimpleMsg(&logger, "", );
|
// printSimpleMsg(&logger, "", );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time to finish output. This is needed to avoid mix-up of this methods output and console command confirmation
|
* 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");
|
print(" addr stack prio refs state time\r\n");
|
||||||
tp = chRegFirstThread();
|
tp = chRegFirstThread();
|
||||||
do {
|
do {
|
||||||
print("%.8lx [%.8lx] %4lu %4lu %9s %lu %s\r\n", (uint32_t) tp, 0,
|
print("%.8lx [%.8lx] %4lu %4lu %9s %lu %s\r\n", (uint32_t) tp, 0, (uint32_t) tp->p_prio,
|
||||||
(uint32_t) tp->p_prio, (uint32_t) (tp->p_refs - 1),
|
(uint32_t) (tp->p_refs - 1), states[tp->p_state], (uint32_t) tp->p_time, tp->p_name);
|
||||||
states[tp->p_state], (uint32_t) tp->p_time, tp->p_name);
|
|
||||||
tp = chRegNextThread(tp);
|
tp = chRegNextThread(tp);
|
||||||
} while (tp != NULL );
|
} while (tp != NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,12 +146,12 @@ static void cmd_threads(void) {
|
||||||
*/
|
*/
|
||||||
void print(const char *format, ...) {
|
void print(const char *format, ...) {
|
||||||
#if !EFI_UART_ECHO_TEST_MODE
|
#if !EFI_UART_ECHO_TEST_MODE
|
||||||
if (!isConsoleReady()) {
|
if (!isConsoleReady()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
chvprintf((BaseSequentialStream*)getConsoleChannel(), format, ap);
|
chvprintf((BaseSequentialStream*) getConsoleChannel(), format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
#endif /* EFI_UART_ECHO_TEST_MODE */
|
#endif /* EFI_UART_ECHO_TEST_MODE */
|
||||||
}
|
}
|
||||||
|
@ -163,7 +160,7 @@ void initializeConsole(Logging *sharedLogger) {
|
||||||
initIntermediateLoggingBuffer();
|
initIntermediateLoggingBuffer();
|
||||||
initConsoleLogic(sharedLogger);
|
initConsoleLogic(sharedLogger);
|
||||||
|
|
||||||
startConsole(&handleConsoleLine);
|
startConsole(sharedLogger, &handleConsoleLine);
|
||||||
|
|
||||||
sayHello();
|
sayHello();
|
||||||
addConsoleAction("test", sayNothing);
|
addConsoleAction("test", sayNothing);
|
||||||
|
|
|
@ -363,14 +363,7 @@ static bool isKnownCommand(char command) {
|
||||||
static uint8_t firstByte;
|
static uint8_t firstByte;
|
||||||
static uint8_t secondByte;
|
static uint8_t secondByte;
|
||||||
|
|
||||||
static msg_t tsThreadEntryPoint(void *arg) {
|
void runBinaryProtocolLoop(void) {
|
||||||
(void) arg;
|
|
||||||
chRegSetThreadName("tunerstudio thread");
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
|
||||||
startTsPort();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int wasReady = false;
|
int wasReady = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
int isReady = ts_serial_ready();
|
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);
|
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__
|
#if defined __GNUC__
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue