refactoring connectivity
This commit is contained in:
parent
f104c76bdb
commit
dfe5bcd658
|
@ -175,6 +175,8 @@ int sr5ReadDataTimeout(ts_channel_s *tsChannel, uint8_t * buffer, int size, int
|
||||||
return 0;
|
return 0;
|
||||||
return chnReadTimeout(tsChannel->channel, (uint8_t * )buffer, size, timeout);
|
return chnReadTimeout(tsChannel->channel, (uint8_t * )buffer, size, timeout);
|
||||||
#endif /* TS_UART_DMA_MODE */
|
#endif /* TS_UART_DMA_MODE */
|
||||||
|
firmwareError(CUSTOM_ERR_6126, "Unexpected channel situation");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sr5ReadData(ts_channel_s *tsChannel, uint8_t * buffer, int size) {
|
int sr5ReadData(ts_channel_s *tsChannel, uint8_t * buffer, int size) {
|
||||||
|
|
|
@ -267,12 +267,18 @@ static THD_FUNCTION(consoleThreadEntryPoint, arg) {
|
||||||
#endif /* EFI_CONSOLE_NO_THREAD */
|
#endif /* EFI_CONSOLE_NO_THREAD */
|
||||||
|
|
||||||
void consolePutChar(int x) {
|
void consolePutChar(int x) {
|
||||||
chnWriteTimeout(getConsoleChannel(), (const uint8_t *)&x, 1, CONSOLE_WRITE_TIMEOUT);
|
BaseChannel * channel = getConsoleChannel();
|
||||||
|
if (channel != nullptr) {
|
||||||
|
chnWriteTimeout(channel, (const uint8_t *)&x, 1, CONSOLE_WRITE_TIMEOUT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void consoleOutputBuffer(const uint8_t *buf, int size) {
|
void consoleOutputBuffer(const uint8_t *buf, int size) {
|
||||||
#if !EFI_UART_ECHO_TEST_MODE
|
#if !EFI_UART_ECHO_TEST_MODE
|
||||||
chnWriteTimeout(getConsoleChannel(), buf, size, CONSOLE_WRITE_TIMEOUT);
|
BaseChannel * channel = getConsoleChannel();
|
||||||
|
if (channel != nullptr) {
|
||||||
|
chnWriteTimeout(channel, buf, size, CONSOLE_WRITE_TIMEOUT);
|
||||||
|
}
|
||||||
#endif /* EFI_UART_ECHO_TEST_MODE */
|
#endif /* EFI_UART_ECHO_TEST_MODE */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,17 +288,16 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p)
|
||||||
logger = sharedLogger;
|
logger = sharedLogger;
|
||||||
console_line_callback = console_line_callback_p;
|
console_line_callback = console_line_callback_p;
|
||||||
|
|
||||||
#if (defined(EFI_CONSOLE_SERIAL_DEVICE) || defined(EFI_CONSOLE_UART_DEVICE)) && ! EFI_SIMULATOR
|
#if (defined(CONSOLE_UART_DEVICE) || defined(EFI_CONSOLE_SERIAL_DEVICE) || defined(EFI_CONSOLE_UART_DEVICE)) && ! EFI_SIMULATOR
|
||||||
efiSetPadMode("console RX", EFI_CONSOLE_RX_BRAIN_PIN, PAL_MODE_ALTERNATE(EFI_CONSOLE_AF));
|
efiSetPadMode("console RX", EFI_CONSOLE_RX_BRAIN_PIN, PAL_MODE_ALTERNATE(EFI_CONSOLE_AF));
|
||||||
efiSetPadMode("console TX", EFI_CONSOLE_TX_BRAIN_PIN, PAL_MODE_ALTERNATE(EFI_CONSOLE_AF));
|
efiSetPadMode("console TX", EFI_CONSOLE_TX_BRAIN_PIN, PAL_MODE_ALTERNATE(EFI_CONSOLE_AF));
|
||||||
isSerialConsoleStarted = true;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (defined(CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR)
|
#if (defined(CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR)
|
||||||
primaryChannel.uartp = CONSOLE_UART_DEVICE;
|
primaryChannel.uartp = CONSOLE_UART_DEVICE;
|
||||||
startUartDmaConnector(primaryChannel.uartp PASS_CONFIG_PARAMETER_SUFFIX);
|
startUartDmaConnector(primaryChannel.uartp PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
|
isSerialConsoleStarted = true;
|
||||||
#elif (defined(EFI_CONSOLE_SERIAL_DEVICE) && ! EFI_SIMULATOR)
|
#elif (defined(EFI_CONSOLE_SERIAL_DEVICE) && ! EFI_SIMULATOR)
|
||||||
/*
|
/*
|
||||||
* Activates the serial
|
* Activates the serial
|
||||||
|
@ -302,9 +307,11 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p)
|
||||||
sdStart(EFI_CONSOLE_SERIAL_DEVICE, &serialConfig);
|
sdStart(EFI_CONSOLE_SERIAL_DEVICE, &serialConfig);
|
||||||
|
|
||||||
chEvtRegisterMask((event_source_t *) chnGetEventSource(EFI_CONSOLE_SERIAL_DEVICE), &consoleEventListener, 1);
|
chEvtRegisterMask((event_source_t *) chnGetEventSource(EFI_CONSOLE_SERIAL_DEVICE), &consoleEventListener, 1);
|
||||||
|
isSerialConsoleStarted = true;
|
||||||
#elif (defined(EFI_CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR)
|
#elif (defined(EFI_CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR)
|
||||||
uartConfig.speed = engineConfiguration->uartConsoleSerialSpeed;
|
uartConfig.speed = engineConfiguration->uartConsoleSerialSpeed;
|
||||||
uartStart(EFI_CONSOLE_UART_DEVICE, &uartConfig);
|
uartStart(EFI_CONSOLE_UART_DEVICE, &uartConfig);
|
||||||
|
isSerialConsoleStarted = true;
|
||||||
#endif /* EFI_CONSOLE_SERIAL_DEVICE || EFI_CONSOLE_UART_DEVICE */
|
#endif /* EFI_CONSOLE_SERIAL_DEVICE || EFI_CONSOLE_UART_DEVICE */
|
||||||
|
|
||||||
#if !defined(EFI_CONSOLE_NO_THREAD)
|
#if !defined(EFI_CONSOLE_NO_THREAD)
|
||||||
|
|
Loading…
Reference in New Issue