Refactoring: OS access should be explicit #867
This commit is contained in:
parent
b81c60cf3e
commit
0295c343b9
|
@ -6,13 +6,14 @@
|
||||||
* https://rusefi.com/wiki/index.php?title=Manual:Flexible_Logic
|
* https://rusefi.com/wiki/index.php?title=Manual:Flexible_Logic
|
||||||
*
|
*
|
||||||
* @date Oct 5, 2014
|
* @date Oct 5, 2014
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2018
|
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#if EFI_FSIO
|
#if EFI_FSIO
|
||||||
|
|
||||||
|
#include "os_access.h"
|
||||||
#include "fsio_impl.h"
|
#include "fsio_impl.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "allsensors.h"
|
#include "allsensors.h"
|
||||||
|
|
|
@ -23,9 +23,7 @@ extern "C"
|
||||||
// todo: remove these two from here and rely on os_access.h
|
// todo: remove these two from here and rely on os_access.h
|
||||||
#include <ch.h>
|
#include <ch.h>
|
||||||
#include <hal.h>
|
#include <hal.h>
|
||||||
#include "chprintf.h"
|
|
||||||
#include "common_headers.h"
|
#include "common_headers.h"
|
||||||
#include "io_pins.h"
|
|
||||||
|
|
||||||
// this is about MISRA not liking 'time.h'. todo: figure out something
|
// this is about MISRA not liking 'time.h'. todo: figure out something
|
||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
|
|
|
@ -8,14 +8,14 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#include "trigger_input.h"
|
|
||||||
#include "servo.h"
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
|
#include "os_access.h"
|
||||||
|
#include "trigger_input.h"
|
||||||
|
#include "servo.h"
|
||||||
#include "adc_inputs.h"
|
#include "adc_inputs.h"
|
||||||
#include "can_hw.h"
|
#include "can_hw.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#include "io_pins.h"
|
|
||||||
#include "rtc_helper.h"
|
#include "rtc_helper.h"
|
||||||
#include "rfiutil.h"
|
#include "rfiutil.h"
|
||||||
#include "injector_central.h"
|
#include "injector_central.h"
|
||||||
|
|
|
@ -55,13 +55,12 @@
|
||||||
EXTERNC void efiSetPadMode(const char *msg, brain_pin_e pin, iomode_t mode);
|
EXTERNC void efiSetPadMode(const char *msg, brain_pin_e pin, iomode_t mode);
|
||||||
EXTERNC void efiSetPadUnused(brain_pin_e brainPin);
|
EXTERNC void efiSetPadUnused(brain_pin_e brainPin);
|
||||||
|
|
||||||
bool efiReadPin(brain_pin_e pin);
|
EXTERNC bool efiReadPin(brain_pin_e pin);
|
||||||
|
|
||||||
iomode_t getInputMode(pin_input_mode_e mode);
|
EXTERNC iomode_t getInputMode(pin_input_mode_e mode);
|
||||||
#if HAL_USE_ICU
|
#if HAL_USE_ICU
|
||||||
void efiIcuStart(const char *msg, ICUDriver *icup, const ICUConfig *config);
|
EXTERNC void efiIcuStart(const char *msg, ICUDriver *icup, const ICUConfig *config);
|
||||||
#endif /* HAL_USE_ICU */
|
#endif /* HAL_USE_ICU */
|
||||||
#endif /* EFI_GPIO_HARDWARE */
|
#endif /* EFI_GPIO_HARDWARE */
|
||||||
|
|
||||||
|
|
||||||
#endif /* IO_PINS_H_ */
|
#endif /* IO_PINS_H_ */
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "eficonsole.h"
|
#include "eficonsole.h"
|
||||||
#include "memstreams.h"
|
#include "memstreams.h"
|
||||||
#include "drivers/gpio/gpio_ext.h"
|
#include "drivers/gpio/gpio_ext.h"
|
||||||
|
#include "os_access.h"
|
||||||
|
|
||||||
#ifndef BOARD_EXT_PINREPOPINS
|
#ifndef BOARD_EXT_PINREPOPINS
|
||||||
#define BOARD_EXT_PINREPOPINS 0
|
#define BOARD_EXT_PINREPOPINS 0
|
||||||
|
|
|
@ -47,8 +47,7 @@ int vvtEventFallCounter = 0;
|
||||||
/* static vars for PAL implementation */
|
/* static vars for PAL implementation */
|
||||||
static ioline_t primary_line;
|
static ioline_t primary_line;
|
||||||
|
|
||||||
static void shaft_callback(void *arg)
|
static void shaft_callback(void *arg) {
|
||||||
{
|
|
||||||
bool rise;
|
bool rise;
|
||||||
bool isPrimary;
|
bool isPrimary;
|
||||||
ioline_t pal_line;
|
ioline_t pal_line;
|
||||||
|
@ -81,8 +80,7 @@ static void shaft_callback(void *arg)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cam_callback(void *arg)
|
static void cam_callback(void *arg) {
|
||||||
{
|
|
||||||
bool rise;
|
bool rise;
|
||||||
ioline_t pal_line = (ioline_t)arg;
|
ioline_t pal_line = (ioline_t)arg;
|
||||||
|
|
||||||
|
@ -95,11 +93,9 @@ static void cam_callback(void *arg)
|
||||||
vvtEventFallCounter++;
|
vvtEventFallCounter++;
|
||||||
hwHandleVvtCamSignal(TV_FALL);
|
hwHandleVvtCamSignal(TV_FALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int turnOnTriggerInputPin(const char *msg, brain_pin_e brainPin, bool is_shaft)
|
static int turnOnTriggerInputPin(const char *msg, brain_pin_e brainPin, bool is_shaft) {
|
||||||
{
|
|
||||||
ioline_t pal_line;
|
ioline_t pal_line;
|
||||||
|
|
||||||
scheduleMsg(logger, "turnOnTriggerInputPin(PAL) %s %s", msg, hwPortname(brainPin));
|
scheduleMsg(logger, "turnOnTriggerInputPin(PAL) %s %s", msg, hwPortname(brainPin));
|
||||||
|
@ -111,13 +107,11 @@ static int turnOnTriggerInputPin(const char *msg, brain_pin_e brainPin, bool is_
|
||||||
return efiExtiEnablePin(msg, brainPin, PAL_EVENT_MODE_BOTH_EDGES, is_shaft ? shaft_callback : cam_callback, (void *)pal_line);
|
return efiExtiEnablePin(msg, brainPin, PAL_EVENT_MODE_BOTH_EDGES, is_shaft ? shaft_callback : cam_callback, (void *)pal_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void turnOffTriggerInputPin(brain_pin_e brainPin)
|
static void turnOffTriggerInputPin(brain_pin_e brainPin) {
|
||||||
{
|
|
||||||
efiExtiDisablePin(brainPin);
|
efiExtiDisablePin(brainPin);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setPrimaryChannel(brain_pin_e brainPin)
|
static void setPrimaryChannel(brain_pin_e brainPin) {
|
||||||
{
|
|
||||||
primary_line = PAL_LINE(getHwPort("trg", brainPin), getHwPin("trg", brainPin));
|
primary_line = PAL_LINE(getHwPort("trg", brainPin), getHwPin("trg", brainPin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue