auto-sync
This commit is contained in:
parent
8ba7e03fca
commit
18dac7890c
|
@ -118,7 +118,7 @@ ts_channel_s tsChannel;
|
||||||
|
|
||||||
static int ts_serial_ready(bool isConsoleRedirect) {
|
static int ts_serial_ready(bool isConsoleRedirect) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
if (isSerialOverUart() ^ isConsoleRedirect) {
|
if (isCommandLineConsoleOverTTL() ^ isConsoleRedirect) {
|
||||||
// TS uses USB when console uses serial
|
// TS uses USB when console uses serial
|
||||||
return is_usb_serial_ready();
|
return is_usb_serial_ready();
|
||||||
} else {
|
} else {
|
||||||
|
@ -154,7 +154,7 @@ static void printErrorCounters(void) {
|
||||||
|
|
||||||
void printTsStats(void) {
|
void printTsStats(void) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
if (!isSerialOverUart()) {
|
if (!isCommandLineConsoleOverTTL()) {
|
||||||
scheduleMsg(&tsLogger, "TS RX on %s", hwPortname(engineConfiguration->binarySerialRxPin));
|
scheduleMsg(&tsLogger, "TS RX on %s", hwPortname(engineConfiguration->binarySerialRxPin));
|
||||||
|
|
||||||
scheduleMsg(&tsLogger, "TS TX on %s @%d", hwPortname(engineConfiguration->binarySerialTxPin),
|
scheduleMsg(&tsLogger, "TS TX on %s @%d", hwPortname(engineConfiguration->binarySerialTxPin),
|
||||||
|
|
|
@ -30,7 +30,7 @@ static SerialConfig tsSerialConfig = { 0, 0, USART_CR2_STOP1_BITS | USART_CR2_LI
|
||||||
|
|
||||||
void startTsPort(void) {
|
void startTsPort(void) {
|
||||||
#if EFI_USB_SERIAL || defined(__DOXYGEN__)
|
#if EFI_USB_SERIAL || defined(__DOXYGEN__)
|
||||||
if (isSerialOverUart()) {
|
if (isCommandLineConsoleOverTTL()) {
|
||||||
print("TunerStudio over USB serial");
|
print("TunerStudio over USB serial");
|
||||||
/**
|
/**
|
||||||
* This method contains a long delay, that's the reason why this is not done on the main thread
|
* This method contains a long delay, that's the reason why this is not done on the main thread
|
||||||
|
@ -56,7 +56,7 @@ void startTsPort(void) {
|
||||||
|
|
||||||
BaseChannel * getTsSerialDevice(void) {
|
BaseChannel * getTsSerialDevice(void) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
if (isSerialOverUart()) {
|
if (isCommandLineConsoleOverTTL()) {
|
||||||
// if console uses UART then TS uses USB
|
// if console uses UART then TS uses USB
|
||||||
return (BaseChannel *) &SDU1;
|
return (BaseChannel *) &SDU1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -72,7 +72,7 @@ static bool getConsoleLine(BaseSequentialStream *chp, char *line, unsigned size)
|
||||||
short c = (short) chSequentialStreamGet(chp);
|
short c = (short) chSequentialStreamGet(chp);
|
||||||
onDataArrived();
|
onDataArrived();
|
||||||
|
|
||||||
if (isSerialOverUart()) {
|
if (isCommandLineConsoleOverTTL()) {
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
chSysLock()
|
chSysLock()
|
||||||
;
|
;
|
||||||
|
@ -131,10 +131,10 @@ static bool getConsoleLine(BaseSequentialStream *chp, char *line, unsigned size)
|
||||||
|
|
||||||
CommandHandler console_line_callback;
|
CommandHandler console_line_callback;
|
||||||
|
|
||||||
static bool isCommandLineConsoleOverTTL;
|
static bool b_isCommandLineConsoleOverTTL;
|
||||||
|
|
||||||
bool isSerialOverUart(void) {
|
bool isCommandLineConsoleOverTTL(void) {
|
||||||
return isCommandLineConsoleOverTTL;
|
return b_isCommandLineConsoleOverTTL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined(EFI_CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR ) || defined(__DOXYGEN__)
|
#if (defined(EFI_CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR ) || defined(__DOXYGEN__)
|
||||||
|
@ -178,7 +178,7 @@ void runConsoleLoop(ts_channel_s *console) {
|
||||||
|
|
||||||
SerialDriver * getConsoleChannel(void) {
|
SerialDriver * getConsoleChannel(void) {
|
||||||
#if defined(EFI_CONSOLE_UART_DEVICE) || defined(__DOXYGEN__)
|
#if defined(EFI_CONSOLE_UART_DEVICE) || defined(__DOXYGEN__)
|
||||||
if (isSerialOverUart()) {
|
if (isCommandLineConsoleOverTTL()) {
|
||||||
return (SerialDriver *) EFI_CONSOLE_UART_DEVICE;
|
return (SerialDriver *) EFI_CONSOLE_UART_DEVICE;
|
||||||
}
|
}
|
||||||
#endif /* EFI_CONSOLE_UART_DEVICE */
|
#endif /* EFI_CONSOLE_UART_DEVICE */
|
||||||
|
@ -191,7 +191,7 @@ SerialDriver * getConsoleChannel(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isCommandLineConsoleReady(void) {
|
bool isCommandLineConsoleReady(void) {
|
||||||
if (isSerialOverUart()) {
|
if (isCommandLineConsoleOverTTL()) {
|
||||||
return isSerialConsoleStarted;
|
return isSerialConsoleStarted;
|
||||||
} else {
|
} else {
|
||||||
return is_usb_serial_ready();
|
return is_usb_serial_ready();
|
||||||
|
@ -207,7 +207,7 @@ static THD_FUNCTION(consoleThreadThreadEntryPoint, arg) {
|
||||||
chRegSetThreadName("console thread");
|
chRegSetThreadName("console thread");
|
||||||
|
|
||||||
#if (EFI_PROD_CODE && EFI_USB_SERIAL) || defined(__DOXYGEN__)
|
#if (EFI_PROD_CODE && EFI_USB_SERIAL) || defined(__DOXYGEN__)
|
||||||
if (!isSerialOverUart()) {
|
if (!isCommandLineConsoleOverTTL()) {
|
||||||
/**
|
/**
|
||||||
* This method contains a long delay, that's the reason why this is not done on the main thread
|
* This method contains a long delay, that's the reason why this is not done on the main thread
|
||||||
*/
|
*/
|
||||||
|
@ -252,9 +252,9 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p)
|
||||||
|
|
||||||
palSetPadMode(CONSOLE_MODE_SWITCH_PORT, CONSOLE_MODE_SWITCH_PIN, PAL_MODE_INPUT_PULLUP);
|
palSetPadMode(CONSOLE_MODE_SWITCH_PORT, CONSOLE_MODE_SWITCH_PIN, PAL_MODE_INPUT_PULLUP);
|
||||||
|
|
||||||
isCommandLineConsoleOverTTL = GET_CONSOLE_MODE_VALUE() == EFI_USE_UART_FOR_CONSOLE;
|
b_isCommandLineConsoleOverTTL = GET_CONSOLE_MODE_VALUE() == EFI_USE_UART_FOR_CONSOLE;
|
||||||
|
|
||||||
if (isSerialOverUart()) {
|
if (isCommandLineConsoleOverTTL()) {
|
||||||
/*
|
/*
|
||||||
* Activates the serial using the driver default configuration (that's 38400)
|
* Activates the serial using the driver default configuration (that's 38400)
|
||||||
* it is important to set 'NONE' as flow control! in terminal application on the PC
|
* it is important to set 'NONE' as flow control! in terminal application on the PC
|
||||||
|
@ -270,7 +270,7 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p)
|
||||||
chEvtRegisterMask((event_source_t *) chnGetEventSource(EFI_CONSOLE_UART_DEVICE), &consoleEventListener, 1);
|
chEvtRegisterMask((event_source_t *) chnGetEventSource(EFI_CONSOLE_UART_DEVICE), &consoleEventListener, 1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
isCommandLineConsoleOverTTL = false;
|
b_isCommandLineConsoleOverTTL = false;
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), NORMALPRIO, (tfunc_t)consoleThreadThreadEntryPoint, NULL);
|
chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), NORMALPRIO, (tfunc_t)consoleThreadThreadEntryPoint, NULL);
|
||||||
|
|
|
@ -25,7 +25,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(Logging *sharedLogger, CommandHandler console_line_callback_p);
|
void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p);
|
||||||
bool isSerialOverUart(void);
|
bool isCommandLineConsoleOverTTL(void);
|
||||||
void onDataArrived(void);
|
void onDataArrived(void);
|
||||||
|
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR || EFI_EGT
|
#if EFI_PROD_CODE || EFI_SIMULATOR || EFI_EGT
|
||||||
|
|
Loading…
Reference in New Issue