mirror of https://github.com/FOME-Tech/fome-fw.git
auto-sync
This commit is contained in:
parent
765bd5c819
commit
1ac0fd9f26
|
@ -120,26 +120,6 @@ bool isSerialOverUart(void) {
|
|||
return is_serial_over_uart;
|
||||
}
|
||||
|
||||
static THD_WORKING_AREA(consoleThreadStack, 2 * UTILITY_THREAD_STACK_SIZE);
|
||||
static msg_t consoleThreadThreadEntryPoint(void *arg) {
|
||||
(void) arg;
|
||||
chRegSetThreadName("console thread");
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
(console_line_callback)(consoleInput);
|
||||
}
|
||||
#if defined __GNUC__
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
|
||||
static SerialConfig serialConfig = { SERIAL_SPEED, 0, USART_CR2_STOP1_BITS | USART_CR2_LINEN, 0 };
|
||||
|
@ -162,6 +142,35 @@ bool isConsoleReady(void) {
|
|||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
static THD_WORKING_AREA(consoleThreadStack, 2 * UTILITY_THREAD_STACK_SIZE);
|
||||
static msg_t consoleThreadThreadEntryPoint(void *arg) {
|
||||
(void) arg;
|
||||
chRegSetThreadName("console thread");
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
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 */
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
(console_line_callback)(consoleInput);
|
||||
}
|
||||
#if defined __GNUC__
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void consolePutChar(int x) {
|
||||
chSequentialStreamPut(getConsoleChannel(), (uint8_t )(x));
|
||||
}
|
||||
|
@ -198,18 +207,15 @@ void startConsole(void (*console_line_callback_p)(char *)) {
|
|||
palSetPadMode(EFI_CONSOLE_RX_PORT, EFI_CONSOLE_RX_PIN, PAL_MODE_ALTERNATE(EFI_CONSOLE_AF));
|
||||
palSetPadMode(EFI_CONSOLE_TX_PORT, EFI_CONSOLE_TX_PIN, PAL_MODE_ALTERNATE(EFI_CONSOLE_AF));
|
||||
|
||||
isSerialConsoleStarted = TRUE;
|
||||
isSerialConsoleStarted = true;
|
||||
|
||||
chEvtRegisterMask((EventSource *) chnGetEventSource(EFI_CONSOLE_UART_DEVICE), &consoleEventListener, 1);
|
||||
} else {
|
||||
usb_serial_start();
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), NORMALPRIO, consoleThreadThreadEntryPoint, NULL);
|
||||
}
|
||||
|
||||
extern cnt_t dbg_isr_cnt;
|
||||
|
||||
/**
|
||||
* @return TRUE if already in locked context
|
||||
*/
|
||||
|
|
|
@ -345,6 +345,23 @@ static THD_WORKING_AREA(lcdThreadStack, UTILITY_THREAD_STACK_SIZE);
|
|||
*/
|
||||
static THD_WORKING_AREA(comBlinkingStack, UTILITY_THREAD_STACK_SIZE);
|
||||
|
||||
static io_pin_e leds[] = { LED_WARNING, LED_RUNNING, LED_ERROR, LED_COMMUNICATION_1, LED_DEBUG, LED_EXT_1,
|
||||
LED_CHECK_ENGINE };
|
||||
|
||||
/**
|
||||
* This method would blink all the LEDs just to test them
|
||||
*/
|
||||
static void initialLedsBlink(void) {
|
||||
int size = sizeof(leds) / sizeof(leds[0]);
|
||||
for (int i = 0; i < size; i++)
|
||||
setOutputPinValue(leds[i], 1);
|
||||
|
||||
chThdSleepMilliseconds(100);
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
setOutputPinValue(leds[i], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* error thread to show error condition (blinking LED means non-fatal error)
|
||||
*/
|
||||
|
@ -354,7 +371,10 @@ static THD_WORKING_AREA(errBlinkingStack, UTILITY_THREAD_STACK_SIZE);
|
|||
static void comBlinkingThread(void *arg) {
|
||||
(void) arg;
|
||||
chRegSetThreadName("communication blinking");
|
||||
while (TRUE) {
|
||||
|
||||
initialLedsBlink();
|
||||
|
||||
while (true) {
|
||||
int delay;
|
||||
|
||||
if (getNeedToWriteConfiguration()) {
|
||||
|
|
|
@ -372,13 +372,29 @@ static uint8_t secondByte;
|
|||
|
||||
static uint8_t crcIoBuffer[300];
|
||||
|
||||
|
||||
|
||||
|
||||
static msg_t tsThreadEntryPoint(void *arg) {
|
||||
(void) arg;
|
||||
chRegSetThreadName("tunerstudio thread");
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
if (isSerialOverUart()) {
|
||||
print("TunerStudio over USB serial");
|
||||
/**
|
||||
* This method contains a long delay, that's the reason why this is not done on the main thread
|
||||
*/
|
||||
usb_serial_start();
|
||||
} else {
|
||||
|
||||
print("TunerStudio over USART");
|
||||
mySetPadMode("tunerstudio rx", TS_SERIAL_RX_PORT, TS_SERIAL_RX_PIN, PAL_MODE_ALTERNATE(TS_SERIAL_AF));
|
||||
mySetPadMode("tunerstudio tx", TS_SERIAL_TX_PORT, TS_SERIAL_TX_PIN, PAL_MODE_ALTERNATE(TS_SERIAL_AF));
|
||||
|
||||
tsSerialConfig.speed = boardConfiguration->tunerStudioSerialSpeed;
|
||||
|
||||
sdStart(TS_SERIAL_UART_DEVICE, &tsSerialConfig);
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
int wasReady = false;
|
||||
while (true) {
|
||||
int isReady = ts_serial_ready();
|
||||
|
@ -506,21 +522,6 @@ void startTunerStudioConnectivity(void) {
|
|||
firmwareError("TS outputs size mismatch: %d/%d", sizeof(TunerStudioOutputChannels), TS_OUTPUT_SIZE);
|
||||
|
||||
memset(&tsState, 0, sizeof(tsState));
|
||||
#if EFI_PROD_CODE
|
||||
if (isSerialOverUart()) {
|
||||
print("TunerStudio over USB serial");
|
||||
usb_serial_start();
|
||||
} else {
|
||||
|
||||
print("TunerStudio over USART");
|
||||
mySetPadMode("tunerstudio rx", TS_SERIAL_RX_PORT, TS_SERIAL_RX_PIN, PAL_MODE_ALTERNATE(TS_SERIAL_AF));
|
||||
mySetPadMode("tunerstudio tx", TS_SERIAL_TX_PORT, TS_SERIAL_TX_PIN, PAL_MODE_ALTERNATE(TS_SERIAL_AF));
|
||||
|
||||
tsSerialConfig.speed = boardConfiguration->tunerStudioSerialSpeed;
|
||||
|
||||
sdStart(TS_SERIAL_UART_DEVICE, &tsSerialConfig);
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
syncTunerStudioCopy();
|
||||
|
||||
addConsoleAction("tsinfo", printStats);
|
||||
|
|
|
@ -27,8 +27,6 @@ static Logging logger;
|
|||
|
||||
extern pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
|
||||
extern OutputPin outputs[IO_PIN_COUNT];
|
||||
static io_pin_e leds[] = { LED_WARNING, LED_RUNNING, LED_ERROR, LED_COMMUNICATION_1, LED_DEBUG, LED_EXT_1,
|
||||
LED_CHECK_ENGINE };
|
||||
|
||||
static GPIO_TypeDef *PORTS[] = { GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH };
|
||||
|
||||
|
@ -96,20 +94,6 @@ void outputPinRegister(const char *msg, io_pin_e ioPin, GPIO_TypeDef *port, uint
|
|||
outputPinRegisterExt(msg, ioPin, port, pin, &DEFAULT_OUTPUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method would blink all the LEDs just to test them
|
||||
*/
|
||||
static void initialLedsBlink(void) {
|
||||
int size = sizeof(leds) / sizeof(leds[0]);
|
||||
for (int i = 0; i < size; i++)
|
||||
setOutputPinValue(leds[i], 1);
|
||||
|
||||
chThdSleepMilliseconds(100);
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
setOutputPinValue(leds[i], 0);
|
||||
}
|
||||
|
||||
void initPrimaryPins(void) {
|
||||
outputPinRegister("LED_ERROR", LED_ERROR, LED_ERROR_PORT, LED_ERROR_PIN);
|
||||
}
|
||||
|
@ -158,8 +142,6 @@ void initOutputPins(void) {
|
|||
outputPinRegisterExt2("trg_err", LED_TRIGGER_ERROR, boardConfiguration->triggerErrorPin, &boardConfiguration->triggerErrorPinMode);
|
||||
outputPinRegisterExt2("A/C relay", AC_RELAY, boardConfiguration->acRelayPin, &boardConfiguration->acRelayPinMode);
|
||||
|
||||
initialLedsBlink();
|
||||
|
||||
// digit 1
|
||||
/*
|
||||
ledRegister(LED_HUGE_0, GPIOB, 2);
|
||||
|
|
|
@ -127,7 +127,7 @@ void initPinRepository(void) {
|
|||
|
||||
for (int i = 0; i < PIN_REPO_SIZE; i++)
|
||||
PIN_USED[i] = 0;
|
||||
initialized = TRUE;
|
||||
initialized = true;
|
||||
addConsoleAction("pins", reportPins);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// This file was generated by Version2Header
|
||||
// Sat Nov 29 23:31:29 EST 2014
|
||||
// Sun Dec 07 18:26:23 EST 2014
|
||||
#ifndef VCS_VERSION
|
||||
#define VCS_VERSION "5638"
|
||||
#define VCS_VERSION "5721"
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue