Refactoring: OS access should be explicit #867

This commit is contained in:
rusefi 2019-07-03 21:01:48 -04:00
parent 97fd982374
commit c21e4c2efa
11 changed files with 70 additions and 4 deletions

View File

@ -16,6 +16,10 @@
#include "maf2map.h"
#include "config_engine_specs.h"
#if defined(HAS_OS_ACCESS)
#error "Unexpected OS ACCESS HERE"
#endif
#define rpmMin 500
#define rpmMax 8000

View File

@ -27,8 +27,7 @@
#include "global.h"
#if EFI_CAN_SUPPORT
#include "os_access.h"
#include "engine.h"
#include "obd2.h"
#include "can_hw.h"
@ -39,7 +38,6 @@
#include "engine_math.h"
#include "fuel_math.h"
extern CANTxFrame txmsg;
EXTERN_ENGINE

View File

@ -20,6 +20,7 @@ extern "C"
{
#endif /* __cplusplus */
// todo: remove these two from here and rely on os_access.h
#include <ch.h>
#include <hal.h>

View File

@ -3,10 +3,11 @@
* @brief MCP3208 external ADC chip implementation. Not really used right now.
*
* @date Aug 12, 2013
* @author Andrey Belomutskiy, (c) 2012-2018
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#include "global.h"
#include "os_access.h"
#if EFI_MCP_3208
#include "mcp3208.h"

View File

@ -8,6 +8,7 @@
*/
#include "global.h"
#include "os_access.h"
#if EFI_INTERNAL_FLASH

View File

@ -15,6 +15,7 @@
*/
#include "global.h"
#include "os_access.h"
#if HAL_USE_SERIAL_USB

View File

@ -7,6 +7,7 @@
*/
#include "global.h"
#include "os_access.h"
#if EFI_USB_SERIAL

27
firmware/os_access.h Normal file
View File

@ -0,0 +1,27 @@
/*
* os_access.h
*
* OS access is not part of global.h in order to help separate synchronous code from asynchronous
*
* Created on: Jul 3, 2019
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef OS_ACCESS_H_
#define OS_ACCESS_H_
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include <ch.h>
#include <hal.h>
#ifdef __cplusplus
}
#endif /* __cplusplus */
#define HAS_OS_ACCESS
#endif /* OS_ACCESS_H_ */

View File

@ -13,6 +13,10 @@
#include "histogram.h"
#include "global.h"
#if defined(HAS_OS_ACCESS)
#error "Unexpected OS ACCESS HERE"
#endif
#if EFI_HISTOGRAMS || EFI_UNIT_TEST
#define H_ACCURACY 0.05

View File

@ -56,6 +56,7 @@
*/
#if !EFI_UNIT_TEST
#include "os_access.h"
void chVTSetAny(virtual_timer_t *vtp, systime_t time, vtfunc_t vtfunc, void *par) {
bool wasLocked = lockAnyContext();

View File

@ -0,0 +1,27 @@
/*
* os_access.h
*
* OS access is not part of global.h in order to help separate synchronous code from asynchronous
*
* Created on: Jul 3, 2019
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef OS_ACCESS_H_
#define OS_ACCESS_H_
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include <ch.h>
#include <hal.h>
#ifdef __cplusplus
}
#endif /* __cplusplus */
#define HAS_OS_ACCESS
#endif /* OS_ACCESS_H_ */