More portability & small fixes (#719)
* Use hw_stm32.mk * Fix bootloader * Use more common hw_ports.mk filename instead of hw_stm32.mk * More CPU compatibility for Makefile * TS_UART_MODE & rename TS_SERIAL_UART_DEVICE->TS_SERIAL_DEVICE * Move lockAnyContext()/unlockAnyContext() to rfiutil.c * USE_FATFS * EFI_LCD * Less compilation errors * STATUS_LOGGING_BUFFER_SIZE & SETTINGS_LOGGING_BUFFER_SIZE * EFI_ALTERNATOR_CONTROL, EFI_SERVO, EFI_DISABLE_CONSOLE_ACTIONS * #ifndef PWM_PHASE_MAX_COUNT & more flexible GPIO inside portname() * merge * EFI_ALTERNATOR_CONTROL, EFI_ELECTRONIC_THROTTLE_BODY
This commit is contained in:
parent
aff03cdbc5
commit
b80806182f
|
@ -7,6 +7,13 @@ CHIBIOS = ChibiOS
|
|||
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
|
||||
RULESFILE = $(RULESPATH)/rules.mk
|
||||
|
||||
# Define project name here
|
||||
PROJECT = rusefi
|
||||
PROJECT_DIR = .
|
||||
|
||||
# Imported source files and paths
|
||||
CHIBIOS_CONTRIB = ChibiOS-Contrib
|
||||
|
||||
include rusefi.mk
|
||||
|
||||
# by default EXTRA_PARAMS is empty and we create 'debug' version of the firmware with additional assertions and statistics
|
||||
|
@ -69,6 +76,10 @@ ifeq ($(USE_BOOTLOADER),)
|
|||
USE_BOOTLOADER = no
|
||||
endif
|
||||
|
||||
ifeq ($(USE_FATFS),)
|
||||
USE_FATFS = yes
|
||||
endif
|
||||
|
||||
#
|
||||
# Build global options
|
||||
##############################################################################
|
||||
|
@ -108,28 +119,25 @@ MAKEFLAGS += ${NUMJOBS}
|
|||
# Project, sources and paths
|
||||
#
|
||||
|
||||
# Define project name here
|
||||
PROJECT = rusefi
|
||||
PROJECT_DIR = .
|
||||
|
||||
# Imported source files and paths
|
||||
CHIBIOS_CONTRIB = ChibiOS-Contrib
|
||||
|
||||
# Startup files.
|
||||
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/$(CPU_STARTUP)
|
||||
include $(CPU_STARTUP_DIR)
|
||||
# HAL-OSAL files (optional).
|
||||
include $(CHIBIOS_CONTRIB)/os/hal/hal.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/$(CPU_PLATFORM)
|
||||
include $(CPU_PLATFORM_DIR)
|
||||
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
|
||||
# RTOS files (optional).
|
||||
include $(CHIBIOS)/os/rt/rt.mk
|
||||
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
|
||||
|
||||
ifeq ($(USE_FATFS),yes)
|
||||
include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk
|
||||
endif
|
||||
include $(CHIBIOS)/os/various/cpp_wrappers/chcpp.mk
|
||||
|
||||
include console/binary/tunerstudio.mk
|
||||
ifeq ($(USE_FATFS),yes)
|
||||
include $(PROJECT_DIR)/ext/fatfs.mk
|
||||
endif
|
||||
|
||||
include $(PROJECT_DIR)/hw_layer/hw_layer.mk
|
||||
include $(PROJECT_DIR)/hw_layer/drivers/drivers.mk
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
@echo off
|
||||
rm -rf .dep/
|
||||
|
||||
rm -rf build\rusefi.hex
|
||||
rm -rf build\rusefi.bin
|
||||
|
|
|
@ -229,18 +229,18 @@ void setBoardConfigurationOverrides(void) {
|
|||
boardConfiguration->is_enabled_spi_3 = true;
|
||||
|
||||
boardConfiguration->spi1mosiPin = GPIOB_5;
|
||||
engineConfiguration->spi1MosiMode = 0; // PAL_STM32_OTYPE_PUSHPULL
|
||||
engineConfiguration->spi1MosiMode = PO_DEFAULT; // PAL_STM32_OTYPE_PUSHPULL
|
||||
boardConfiguration->spi1misoPin = GPIOB_4;
|
||||
engineConfiguration->spi1MisoMode = 0; // PAL_STM32_OTYPE_PUSHPULL
|
||||
engineConfiguration->spi1MisoMode = PO_DEFAULT; // PAL_STM32_OTYPE_PUSHPULL
|
||||
boardConfiguration->spi1sckPin = GPIOB_3;
|
||||
engineConfiguration->spi1SckMode = 0; // PAL_STM32_OTYPE_PUSHPULL
|
||||
engineConfiguration->spi1SckMode = PO_DEFAULT; // PAL_STM32_OTYPE_PUSHPULL
|
||||
|
||||
boardConfiguration->spi3mosiPin = GPIOC_12;
|
||||
engineConfiguration->spi3MosiMode = PAL_STM32_OTYPE_OPENDRAIN; // 4
|
||||
engineConfiguration->spi3MosiMode = PO_OPENDRAIN; // 4
|
||||
boardConfiguration->spi3misoPin = GPIOC_11;
|
||||
engineConfiguration->spi3MisoMode = PAL_STM32_PUPDR_PULLUP; // 32
|
||||
engineConfiguration->spi3MisoMode = PO_PULLUP; // 32
|
||||
boardConfiguration->spi3sckPin = GPIOC_10;
|
||||
engineConfiguration->spi3SckMode = PAL_STM32_OTYPE_OPENDRAIN; // 4
|
||||
engineConfiguration->spi3SckMode = PO_OPENDRAIN; // 4
|
||||
|
||||
engineConfiguration->hip9011SpiDevice = SPI_DEVICE_3;
|
||||
boardConfiguration->hip9011CsPin = is469 ? GPIOD_1 : GPIOD_2;
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
#undef EFI_HD44780_LCD
|
||||
#define EFI_HD44780_LCD FALSE
|
||||
|
||||
#undef EFI_LCD
|
||||
#define EFI_LCD FALSE
|
||||
|
||||
#undef EFI_USB_SERIAL
|
||||
#define EFI_USB_SERIAL FALSE
|
||||
|
||||
|
@ -42,11 +45,11 @@
|
|||
#undef TS_UART_DMA_MODE
|
||||
#define TS_UART_DMA_MODE TRUE
|
||||
|
||||
#undef TS_DMA_UART_DEVICE
|
||||
#define TS_DMA_UART_DEVICE (&UARTD4)
|
||||
#undef TS_UART_DEVICE
|
||||
#define TS_UART_DEVICE (&UARTD4)
|
||||
|
||||
#undef TS_SERIAL_UART_DEVICE
|
||||
#define TS_SERIAL_UART_DEVICE (&SD4)
|
||||
#undef TS_SERIAL_DEVICE
|
||||
#define TS_SERIAL_DEVICE (&SD4)
|
||||
|
||||
#undef EFI_BLUETOOTH_SETUP
|
||||
#define EFI_BLUETOOTH_SETUP TRUE
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#define HAL_USE_SERIAL FALSE
|
||||
|
||||
#undef HAL_USE_UART
|
||||
#if TS_UART_DMA_MODE
|
||||
#if (TS_UART_DMA_MODE || TS_UART_MODE)
|
||||
#define HAL_USE_UART TRUE
|
||||
#else
|
||||
#define HAL_USE_UART FALSE
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#define STM32_SERIAL_USE_USART3 FALSE
|
||||
|
||||
#undef STM32_SERIAL_USE_UART4
|
||||
#if TS_UART_DMA_MODE
|
||||
#if (TS_UART_DMA_MODE || TS_UART_MODE)
|
||||
#define STM32_SERIAL_USE_UART4 FALSE
|
||||
#else
|
||||
#define STM32_SERIAL_USE_UART4 TRUE
|
||||
|
|
|
@ -283,12 +283,12 @@ void setEtbTestConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
CONFIGB(etb1.directionPin2) = GPIOC_9;
|
||||
CONFIGB(etb1.controlPin1) = GPIOE_14;
|
||||
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
|
||||
setDefaultEtbParameters(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
// values are above 100% since we have feedforward part of the total summation
|
||||
engineConfiguration->etb.minValue = -200;
|
||||
engineConfiguration->etb.maxValue = 200;
|
||||
#endif
|
||||
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
||||
|
||||
engineConfiguration->tpsAdcChannel = EFI_ADC_2; // PA2
|
||||
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_9; // PB1
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* @author Andrey Belomutskiy, (c) 2012-2018
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "fsio_impl.h"
|
||||
#include "mazda_miata.h"
|
||||
#include "engine_math.h"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
* @author Andrey Belomutskiy, (c) 2012-2018
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "fsio_impl.h"
|
||||
#include "mitsubishi.h"
|
||||
#include "allsensors.h"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#define EFI_CONSOLE_UART_DEVICE (&SD1)
|
||||
|
||||
#define TS_SERIAL_UART_DEVICE (&SD3)
|
||||
#define TS_SERIAL_DEVICE (&SD3)
|
||||
|
||||
#define EFI_CONSOLE_TX_PORT GPIOC
|
||||
#define EFI_CONSOLE_TX_PIN 10
|
||||
|
|
|
@ -163,6 +163,10 @@
|
|||
#define EFI_HD44780_LCD TRUE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_LCD
|
||||
#define EFI_LCD TRUE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_IDLE_CONTROL
|
||||
#define EFI_IDLE_CONTROL TRUE
|
||||
#endif
|
||||
|
@ -318,11 +322,11 @@
|
|||
*/
|
||||
#define TS_UART_DMA_MODE FALSE
|
||||
|
||||
#define TS_DMA_UART_DEVICE (&UARTD3)
|
||||
#define TS_SERIAL_UART_DEVICE (&SD3)
|
||||
#define TS_UART_DEVICE (&UARTD3)
|
||||
#define TS_SERIAL_DEVICE (&SD3)
|
||||
|
||||
// todo: add DMA-mode for Console?
|
||||
#if TS_UART_DMA_MODE
|
||||
#if (TS_UART_DMA_MODE || TS_UART_MODE)
|
||||
#undef EFI_CONSOLE_UART_DEVICE
|
||||
#endif
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@
|
|||
*/
|
||||
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
|
||||
/* Configured in efifeatures.h */
|
||||
#if TS_UART_DMA_MODE
|
||||
#if (TS_UART_DMA_MODE || TS_UART_MODE)
|
||||
#define HAL_USE_UART TRUE
|
||||
#else
|
||||
#define HAL_USE_UART FALSE
|
||||
|
@ -359,7 +359,7 @@
|
|||
*/
|
||||
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
|
||||
/* Configured in efifeatures.h */
|
||||
#if TS_UART_DMA_MODE
|
||||
#if (TS_UART_DMA_MODE || TS_UART_MODE)
|
||||
#define UART_USE_WAIT TRUE
|
||||
#else
|
||||
#define UART_USE_WAIT FALSE
|
||||
|
|
|
@ -52,6 +52,9 @@
|
|||
#undef EFI_HD44780_LCD
|
||||
#define EFI_HD44780_LCD FALSE
|
||||
|
||||
#undef EFI_LCD
|
||||
#define EFI_LCD FALSE
|
||||
|
||||
/**
|
||||
* Do we need file logging (like SD card) logic?
|
||||
*/
|
||||
|
@ -75,13 +78,13 @@
|
|||
#undef TS_UART_DMA_MODE
|
||||
#define TS_UART_DMA_MODE FALSE
|
||||
|
||||
#undef TS_DMA_UART_DEVICE
|
||||
#define TS_DMA_UART_DEVICE (&UARTD3)
|
||||
#undef TS_SERIAL_UART_DEVICE
|
||||
#define TS_SERIAL_UART_DEVICE (&SD3)
|
||||
#undef TS_UART_DEVICE
|
||||
#define TS_UART_DEVICE (&UARTD3)
|
||||
#undef TS_SERIAL_DEVICE
|
||||
#define TS_SERIAL_DEVICE (&SD3)
|
||||
|
||||
// todo: add DMA-mode for Console?
|
||||
#if TS_UART_DMA_MODE
|
||||
#if (TS_UART_DMA_MODE || TS_UART_MODE)
|
||||
#undef EFI_CONSOLE_UART_DEVICE
|
||||
#endif
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@
|
|||
*/
|
||||
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
|
||||
/* Configured in efifeatures.h */
|
||||
#if TS_UART_DMA_MODE
|
||||
#if (TS_UART_DMA_MODE || TS_UART_MODE)
|
||||
#define HAL_USE_UART TRUE
|
||||
#else
|
||||
#define HAL_USE_UART FALSE
|
||||
|
@ -366,7 +366,7 @@
|
|||
*/
|
||||
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
|
||||
/* Configured in efifeatures.h */
|
||||
#if TS_UART_DMA_MODE
|
||||
#if (TS_UART_DMA_MODE || TS_UART_MODE)
|
||||
#define UART_USE_WAIT TRUE
|
||||
#else
|
||||
#define UART_USE_WAIT FALSE
|
||||
|
|
|
@ -34,7 +34,7 @@ static uart_dma_s tsUartDma;
|
|||
static void tsCopyDataFromDMA() {
|
||||
chSysLockFromISR();
|
||||
// get 0-based DMA buffer position
|
||||
int dmaPos = TS_DMA_BUFFER_SIZE - dmaStreamGetTransactionSize(TS_DMA_UART_DEVICE->dmarx);
|
||||
int dmaPos = TS_DMA_BUFFER_SIZE - dmaStreamGetTransactionSize(TS_UART_DEVICE->dmarx);
|
||||
// if the position is wrapped (circular DMA-mode enabled)
|
||||
if (dmaPos < tsUartDma.readPos)
|
||||
dmaPos += TS_DMA_BUFFER_SIZE;
|
||||
|
@ -70,6 +70,12 @@ static UARTConfig tsDmaUartConfig = {
|
|||
0, 0, 0/*USART_CR2_STOP1_BITS*/ | USART_CR2_LINEN, 0,
|
||||
/*timeout_cb*/tsRxIRQIdleHandler, /*rxhalf_cb*/tsRxIRQHalfHandler
|
||||
};
|
||||
#elif TS_UART_MODE
|
||||
/* Note: This structure is modified from the default ChibiOS layout! */
|
||||
static UARTConfig tsUartConfig = {
|
||||
NULL, NULL, NULL, NULL, NULL,
|
||||
0, 0, 0/*USART_CR2_STOP1_BITS*/ | USART_CR2_LINEN, 0
|
||||
};
|
||||
#else
|
||||
static SerialConfig tsSerialConfig = { 0, 0, USART_CR2_STOP1_BITS | USART_CR2_LINEN, 0 };
|
||||
#endif /* TS_UART_DMA_MODE */
|
||||
|
@ -103,18 +109,23 @@ void startTsPort(ts_channel_s *tsChannel) {
|
|||
|
||||
// start DMA driver
|
||||
tsDmaUartConfig.speed = CONFIGB(tunerStudioSerialSpeed);
|
||||
uartStart(TS_DMA_UART_DEVICE, &tsDmaUartConfig);
|
||||
uartStart(TS_UART_DEVICE, &tsDmaUartConfig);
|
||||
|
||||
// start continuous DMA transfer using our circular buffer
|
||||
tsUartDma.readPos = 0;
|
||||
uartStartReceive(TS_DMA_UART_DEVICE, sizeof(tsUartDma.dmaBuffer), tsUartDma.dmaBuffer);
|
||||
uartStartReceive(TS_UART_DEVICE, sizeof(tsUartDma.dmaBuffer), tsUartDma.dmaBuffer);
|
||||
#elif TS_UART_MODE
|
||||
print("Using UART mode");
|
||||
// start DMA driver
|
||||
tsUartConfig.speed = CONFIGB(tunerStudioSerialSpeed);
|
||||
uartStart(TS_UART_DEVICE, &tsUartConfig);
|
||||
#else
|
||||
print("Using Serial mode");
|
||||
tsSerialConfig.speed = CONFIGB(tunerStudioSerialSpeed);
|
||||
|
||||
sdStart(TS_SERIAL_UART_DEVICE, &tsSerialConfig);
|
||||
sdStart(TS_SERIAL_DEVICE, &tsSerialConfig);
|
||||
|
||||
tsChannel->channel = (BaseChannel *) TS_SERIAL_UART_DEVICE;
|
||||
tsChannel->channel = (BaseChannel *) TS_SERIAL_DEVICE;
|
||||
#endif /* TS_UART_DMA_MODE */
|
||||
} else
|
||||
tsChannel->channel = (BaseChannel *) NULL; // actually not used
|
||||
|
@ -138,10 +149,10 @@ bool stopTsPort(ts_channel_s *tsChannel) {
|
|||
{
|
||||
if (CONFIGB(useSerialPort)) {
|
||||
// todo: disable Rx/Tx pads?
|
||||
#if TS_UART_DMA_MODE
|
||||
uartStop(TS_DMA_UART_DEVICE);
|
||||
#if (TS_UART_DMA_MODE || TS_UART_MODE)
|
||||
uartStop(TS_UART_DEVICE);
|
||||
#else
|
||||
sdStop(TS_SERIAL_UART_DEVICE);
|
||||
sdStop(TS_SERIAL_DEVICE);
|
||||
#endif /* TS_UART_DMA_MODE */
|
||||
}
|
||||
}
|
||||
|
@ -160,10 +171,10 @@ void sr5WriteData(ts_channel_s *tsChannel, const uint8_t * buffer, int size) {
|
|||
logMsg("chSequentialStreamWrite [%d]\r\n", size);
|
||||
#endif
|
||||
|
||||
#if TS_UART_DMA_MODE && EFI_PROD_CODE
|
||||
#if (TS_UART_DMA_MODE || TS_UART_MODE) && EFI_PROD_CODE
|
||||
UNUSED(tsChannel);
|
||||
int transferred = size;
|
||||
uartSendTimeout(TS_DMA_UART_DEVICE, (size_t *)&transferred, buffer, BINARY_IO_TIMEOUT);
|
||||
uartSendTimeout(TS_UART_DEVICE, (size_t *)&transferred, buffer, BINARY_IO_TIMEOUT);
|
||||
#else
|
||||
if (tsChannel->channel == NULL)
|
||||
return;
|
||||
|
@ -197,6 +208,11 @@ int sr5ReadDataTimeout(ts_channel_s *tsChannel, uint8_t * buffer, int size, int
|
|||
#if TS_UART_DMA_MODE || defined(__DOXYGEN__)
|
||||
UNUSED(tsChannel);
|
||||
return (int)iqReadTimeout(&tsUartDma.fifoRxQueue, (uint8_t * )buffer, (size_t)size, timeout);
|
||||
#elif TS_UART_MODE
|
||||
UNUSED(tsChannel);
|
||||
size_t received = (size_t)size;
|
||||
uartReceiveTimeout(TS_UART_DEVICE, &received, buffer, timeout);
|
||||
return (int)received;
|
||||
#else /* TS_UART_DMA_MODE */
|
||||
if (tsChannel->channel == NULL)
|
||||
return 0;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "engine.h"
|
||||
#include "console_io.h"
|
||||
#include "rfiutil.h"
|
||||
#include "tunerstudio.h"
|
||||
|
@ -293,37 +294,3 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p)
|
|||
addConsoleAction(SWITCH_TO_BINARY_COMMAND, switchToBinaryProtocol);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TRUE if already in locked context
|
||||
*/
|
||||
bool lockAnyContext(void) {
|
||||
int alreadyLocked = isLocked();
|
||||
if (alreadyLocked)
|
||||
return true;
|
||||
#if USE_PORT_LOCK
|
||||
port_lock();
|
||||
#else /* #if USE_PORT_LOCK */
|
||||
if (isIsrContext()) {
|
||||
chSysLockFromISR()
|
||||
;
|
||||
} else {
|
||||
chSysLock()
|
||||
;
|
||||
}
|
||||
#endif /* #if USE_PORT_LOCK */
|
||||
return false;
|
||||
}
|
||||
|
||||
void unlockAnyContext(void) {
|
||||
#if USE_PORT_LOCK
|
||||
port_unlock();
|
||||
#else /* #if USE_PORT_LOCK */
|
||||
if (isIsrContext()) {
|
||||
chSysUnlockFromISR()
|
||||
;
|
||||
} else {
|
||||
chSysUnlock()
|
||||
;
|
||||
}
|
||||
#endif /* #if USE_PORT_LOCK */
|
||||
}
|
||||
|
|
|
@ -102,8 +102,11 @@ extern int maxTriggerReentraint;
|
|||
extern uint32_t maxLockedDuration;
|
||||
#define FULL_LOGGING_KEY "fl"
|
||||
|
||||
#if !defined(STATUS_LOGGING_BUFFER_SIZE) || defined(__DOXYGEN__)
|
||||
#define STATUS_LOGGING_BUFFER_SIZE 1800
|
||||
#endif /* STATUS_LOGGING_BUFFER_SIZE */
|
||||
|
||||
static char LOGGING_BUFFER[1800] CCM_OPTIONAL;
|
||||
static char LOGGING_BUFFER[STATUS_LOGGING_BUFFER_SIZE] CCM_OPTIONAL;
|
||||
static Logging logger("status loop", LOGGING_BUFFER, sizeof(LOGGING_BUFFER));
|
||||
|
||||
static void setWarningEnabled(int value) {
|
||||
|
@ -650,6 +653,7 @@ static void blinkingThread(void *arg) {
|
|||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
#if EFI_LCD || defined(__DOXYGEN__)
|
||||
class LcdController : public PeriodicController<UTILITY_THREAD_STACK_SIZE> {
|
||||
public:
|
||||
LcdController() : PeriodicController("BenchThread") { }
|
||||
|
@ -666,6 +670,7 @@ private:
|
|||
};
|
||||
|
||||
static LcdController lcdInstance;
|
||||
#endif /* EFI_LCD */
|
||||
|
||||
#if EFI_HIP_9011 || defined(__DOXYGEN__)
|
||||
extern HIP9011 instance;
|
||||
|
@ -984,7 +989,9 @@ void startStatusThreads(void) {
|
|||
initStatusLeds();
|
||||
chThdCreateStatic(blinkingStack, sizeof(blinkingStack), NORMALPRIO, (tfunc_t) blinkingThread, NULL);
|
||||
#endif /* EFI_PROD_CODE */
|
||||
#if EFI_LCD || defined(__DOXYGEN__)
|
||||
lcdInstance.Start();
|
||||
#endif /* EFI_LCD */
|
||||
}
|
||||
|
||||
void setFullLog(int value) {
|
||||
|
|
|
@ -339,16 +339,16 @@ void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
|
|||
boardConfiguration->acRelayPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->acRelayPinMode = OM_DEFAULT;
|
||||
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
|
||||
setDefaultAlternatorParameters();
|
||||
#endif
|
||||
#endif /* EFI_ALTERNATOR_CONTROL */
|
||||
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
|
||||
setDefaultEtbParameters(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
setDefaultEtbBiasCurve(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
#endif
|
||||
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
||||
#if EFI_IDLE_CONTROL || defined(__DOXYGEN__)
|
||||
setDefaultIdleParameters();
|
||||
#endif
|
||||
#endif /* EFI_IDLE_CONTROL */
|
||||
boardConfiguration->wboHeaterPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->cj125CsPin = GPIO_UNASSIGNED;
|
||||
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
|
||||
#include "global.h"
|
||||
|
||||
#ifndef PWM_PHASE_MAX_COUNT
|
||||
#define PWM_PHASE_MAX_COUNT 252
|
||||
#endif /* PWM_PHASE_MAX_COUNT */
|
||||
#define PWM_PHASE_MAX_WAVE_PER_PWM 3
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,11 @@ extern int waveChartUsedSize;
|
|||
extern WaveChart waveChart;
|
||||
#endif /* EFI_ENGINE_SNIFFER */
|
||||
|
||||
static char LOGGING_BUFFER[1000];
|
||||
#if !defined(SETTINGS_LOGGING_BUFFER_SIZE) || defined(__DOXYGEN__)
|
||||
#define SETTINGS_LOGGING_BUFFER_SIZE 1000
|
||||
#endif /* SETTINGS_LOGGING_BUFFER_SIZE */
|
||||
|
||||
static char LOGGING_BUFFER[SETTINGS_LOGGING_BUFFER_SIZE];
|
||||
static Logging logger("settings control", LOGGING_BUFFER, sizeof(LOGGING_BUFFER));
|
||||
|
||||
extern int maxNesting;
|
||||
|
@ -1276,7 +1280,7 @@ static void setValue(const char *paramStr, const char *valueStr) {
|
|||
|
||||
if (strEqualCaseInsensitive(paramStr, "vsscoeff")) {
|
||||
engineConfiguration->vehicleSpeedCoef = valueF;
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
|
||||
} else if (strEqualCaseInsensitive(paramStr, "alt_t")) {
|
||||
if (valueI > 10) {
|
||||
engineConfiguration->alternatorControl.periodMs = valueI;
|
||||
|
@ -1286,7 +1290,7 @@ static void setValue(const char *paramStr, const char *valueStr) {
|
|||
engineConfiguration->alternatorControl.offset = valueI;
|
||||
} else if (strEqualCaseInsensitive(paramStr, "alt_p")) {
|
||||
setAltPFactor(valueF);
|
||||
#endif
|
||||
#endif /* EFI_ALTERNATOR_CONTROL */
|
||||
// } else if (strEqualCaseInsensitive(paramStr, "cranking_rpm")) {
|
||||
// } else if (strEqualCaseInsensitive(paramStr, "cranking_rpm")) {
|
||||
// } else if (strEqualCaseInsensitive(paramStr, "cranking_rpm")) {
|
||||
|
|
|
@ -452,16 +452,22 @@ const char *portname(ioportid_t GPIOx) {
|
|||
return "PC";
|
||||
if (GPIOx == GPIOD)
|
||||
return "PD";
|
||||
#if defined(STM32F4XX) || defined(STM32F7XX)
|
||||
#if STM32_HAS_GPIOE
|
||||
if (GPIOx == GPIOE)
|
||||
return "PE";
|
||||
if (GPIOx == GPIOG)
|
||||
return "PG";
|
||||
if (GPIOx == GPIOH)
|
||||
return "PH";
|
||||
#endif
|
||||
#endif /* STM32_HAS_GPIOE */
|
||||
#if STM32_HAS_GPIOF
|
||||
if (GPIOx == GPIOF)
|
||||
return "PF";
|
||||
#endif /* STM32_HAS_GPIOF */
|
||||
#if STM32_HAS_GPIOG
|
||||
if (GPIOx == GPIOG)
|
||||
return "PG";
|
||||
#endif /* STM32_HAS_GPIOG */
|
||||
#if STM32_HAS_GPIOH
|
||||
if (GPIOx == GPIOH)
|
||||
return "PH";
|
||||
#endif /* STM32_HAS_GPIOH */
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "global.h"
|
||||
#include "pwm_generator_logic.h"
|
||||
#include "pwm_generator.h"
|
||||
#include "error_handling.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -151,7 +151,7 @@ int gpiochip_register(const char *name, struct gpiochip_ops *ops, size_t size, v
|
|||
int gpiochips_init(void)
|
||||
{
|
||||
int i;
|
||||
int ret;
|
||||
int ret = -1;
|
||||
int pins_added = 0;
|
||||
|
||||
for (i = 0; i < BOARD_EXT_GPIOCHIPS; i++) {
|
||||
|
|
|
@ -36,16 +36,15 @@ HW_LAYER_EMS_CPP = $(HW_LAYER_EGT_CPP) \
|
|||
ifeq ($(PROJECT_CPU),ST_STM32F7)
|
||||
HW_LAYER_EMS += $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f7/stm32f7xx_hal_flash.c \
|
||||
$(PROJECT_DIR)/hw_layer/ports/stm32/stm32f7/stm32f7xx_hal_flash_ex.c
|
||||
include $(PROJECT_DIR)/hw_layer/$(CPU_HWLAYER)/hw_stm32.mk
|
||||
endif
|
||||
|
||||
ifeq ($(PROJECT_CPU),ST_STM32F4)
|
||||
HW_LAYER_EMS += $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/stm32f4xx_hal_flash.c \
|
||||
$(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/stm32f4xx_hal_flash_ex.c
|
||||
include $(PROJECT_DIR)/hw_layer/$(CPU_HWLAYER)/hw_stm32.mk
|
||||
endif
|
||||
|
||||
ifeq ($(PROJECT_CPU),ST_STM32F1)
|
||||
include $(PROJECT_DIR)/hw_layer/$(CPU_HWLAYER)/hw_stm32.mk
|
||||
endif
|
||||
|
||||
-include $(PROJECT_DIR)/hw_layer/$(CPU_HWLAYER)/hw_ports.mk
|
||||
|
|
@ -14,8 +14,7 @@
|
|||
|
||||
#include "engine.h"
|
||||
|
||||
// todo: EFI_SERVO macro
|
||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||
#if EFI_SERVO || EFI_SIMULATOR
|
||||
#include "servo.h"
|
||||
#include "pin_repository.h"
|
||||
|
||||
|
@ -84,5 +83,5 @@ void initServo(void) {
|
|||
|
||||
chThdCreateStatic(seThreadStack, sizeof(seThreadStack), NORMALPRIO, (tfunc_t)(void*) seThread, NULL);
|
||||
}
|
||||
#endif
|
||||
#endif /* EFI_SERVO */
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@ ifeq ($(PROJECT_CPU),)
|
|||
endif
|
||||
DDEFS += -D$(PROJECT_CPU)
|
||||
|
||||
-include $(PROJECT_DIR)/config/boards/$(PROJECT_BOARD)/config.mk
|
||||
|
||||
# CPU-dependent defs
|
||||
ifeq ($(PROJECT_CPU),ST_STM32F7)
|
||||
CPU_STARTUP = startup_stm32f7xx.mk
|
||||
|
@ -36,3 +38,11 @@ CPU_STARTUP = startup_stm32f1xx.mk
|
|||
CPU_PLATFORM = STM32F1xx/platform.mk
|
||||
CPU_HWLAYER = ports/stm32/stm32f1
|
||||
endif
|
||||
|
||||
ifeq ($(CPU_STARTUP_DIR),)
|
||||
CPU_STARTUP_DIR = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/$(CPU_STARTUP)
|
||||
endif
|
||||
|
||||
ifeq ($(CPU_PLATFORM_DIR),)
|
||||
CPU_PLATFORM_DIR = $(CHIBIOS)/os/hal/ports/STM32/$(CPU_PLATFORM)
|
||||
endif
|
||||
|
|
|
@ -43,6 +43,7 @@ void resetConsoleActions(void) {
|
|||
}
|
||||
|
||||
static void doAddAction(const char *token, action_type_e type, Void callback, void *param) {
|
||||
#if !defined(EFI_DISABLE_CONSOLE_ACTIONS) || defined(__DOXYGEN__)
|
||||
for (uint32_t i = 0; i < efiStrlen(token);i++) {
|
||||
char ch = token[i];
|
||||
if (ch != mytolower(ch)) {
|
||||
|
@ -61,6 +62,7 @@ static void doAddAction(const char *token, action_type_e type, Void callback, vo
|
|||
current->parameterType = type;
|
||||
current->callback = callback;
|
||||
current->param = param;
|
||||
#endif /* EFI_DISABLE_CONSOLE_ACTIONS */
|
||||
}
|
||||
|
||||
void addConsoleActionP(const char *token, VoidPtr callback, void *param) {
|
||||
|
|
|
@ -74,4 +74,40 @@ void chVTSetAny(virtual_timer_t *vtp, systime_t time, vtfunc_t vtfunc, void *par
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TRUE if already in locked context
|
||||
*/
|
||||
bool lockAnyContext(void) {
|
||||
int alreadyLocked = isLocked();
|
||||
if (alreadyLocked)
|
||||
return true;
|
||||
#if USE_PORT_LOCK
|
||||
port_lock();
|
||||
#else /* #if USE_PORT_LOCK */
|
||||
if (isIsrContext()) {
|
||||
chSysLockFromISR()
|
||||
;
|
||||
} else {
|
||||
chSysLock()
|
||||
;
|
||||
}
|
||||
#endif /* #if USE_PORT_LOCK */
|
||||
return false;
|
||||
}
|
||||
|
||||
void unlockAnyContext(void) {
|
||||
#if USE_PORT_LOCK
|
||||
port_unlock();
|
||||
#else /* #if USE_PORT_LOCK */
|
||||
if (isIsrContext()) {
|
||||
chSysUnlockFromISR()
|
||||
;
|
||||
} else {
|
||||
chSysUnlock()
|
||||
;
|
||||
}
|
||||
#endif /* #if USE_PORT_LOCK */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 90ac7b4eba79a4d7135c935f2ac14c0bac0efc97
|
||||
Subproject commit c965d87b0390c20a7d3be13c1d614f180bfb30c3
|
|
@ -177,10 +177,13 @@ INCDIR = . \
|
|||
#MCU = cortex-m4
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
ifeq ($(USE_MINGW32_I686),)
|
||||
#this one is 64 bit
|
||||
TRGT = x86_64-w64-mingw32-
|
||||
else
|
||||
#this one was 32 bit
|
||||
# TRGT = i686-w64-mingw32-
|
||||
TRGT = i686-w64-mingw32-
|
||||
endif
|
||||
else
|
||||
TRGT =
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue