put getTimeNowLowerNt in to mpu_util (#1950)

* put getTimeNowLowerNt in to mpu_util

* move GPTDEVICE to port_mpu_util

* and remove from efifeatures
This commit is contained in:
Matthew Kennedy 2020-11-18 11:17:00 -08:00 committed by GitHub
parent 9e38afcd9a
commit 5d3d85d644
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 41 additions and 20 deletions

View File

@ -384,8 +384,6 @@
#define EFI_BOSCH_YAW FALSE
#define GPTDEVICE GPTD1
#define EFI_BOARD_TEST FALSE
#define EFI_JOYSTICK FALSE
#define EFI_ENGINE_AUDI_AAN FALSE

View File

@ -353,8 +353,6 @@
#define EFI_BOSCH_YAW FALSE
#define GPTDEVICE GPTD1
#define EFI_BOARD_TEST FALSE
#define EFI_JOYSTICK FALSE
#define EFI_ENGINE_AUDI_AAN FALSE

View File

@ -20,6 +20,9 @@
// *** https://github.com/rusefi/rusefi/issues/1007 ***
#include "common_headers.h"
// for US_TO_NT_MULTIPLIER
#include "mpu_util.h"
// this is about MISRA not liking 'time.h'. todo: figure out something
#if defined __GNUC__
// GCC
@ -96,9 +99,6 @@ typedef unsigned int time_t;
#define CCM_OPTIONAL
#endif /* EFI_USE_CCM */
// 168 ticks in microsecond in case of 168MHz 407
#define US_TO_NT_MULTIPLIER (CORE_CLOCK / 1000000)
/**
* converts efitimeus_t to efitick_t
*/

View File

@ -39,11 +39,6 @@ EXTERN_ENGINE;
*/
uint32_t maxPrecisionCallbackDuration = 0;
// must be one of 32 bit times
#ifndef GPTDEVICE
#define GPTDEVICE GPTD5
#endif /* GPTDEVICE */
static volatile efitick_t lastSetTimerTimeNt;
static int lastSetTimerValue;
static volatile bool isTimerPending = false;

View File

@ -257,5 +257,9 @@ uintptr_t getFlashAddrSecondCopy() {
return FLASH_ADDR_SECOND_COPY;
}
uint32_t getTimeNowLowerNt() {
return port_rt_get_counter_value();
}
#endif /* EFI_PROD_CODE */

View File

@ -8,6 +8,12 @@
#pragma once
// 168 ticks in microsecond in case of 168MHz 407
#define US_TO_NT_MULTIPLIER (CORE_CLOCK / 1000000)
// Scheduler queue GPT device
#define GPTDEVICE GPTD1
typedef enum {
BOR_Level_None = 0,
BOR_Level_1 = 1,

View File

@ -262,5 +262,9 @@ uintptr_t getFlashAddrSecondCopy() {
return nullptr;
}
uint32_t getTimeNowLowerNt() {
return port_rt_get_counter_value();
}
#endif /* EFI_PROD_CODE */

View File

@ -8,6 +8,12 @@
#pragma once
// 168 ticks in microsecond in case of 168MHz 407
#define US_TO_NT_MULTIPLIER (CORE_CLOCK / 1000000)
// Scheduler queue GPT device
#define GPTDEVICE GPTD1
typedef enum {
BOR_Level_None = 0,
BOR_Level_1 = 1,

View File

@ -4,6 +4,8 @@
#include "port_mpu_util.h"
#ifdef __cplusplus
// Base MCU
void baseMCUInit(void);
void jump_to_bootloader();
@ -45,7 +47,6 @@ typedef enum {
BOR_Level_t BOR_Get(void);
BOR_Result_t BOR_Set(BOR_Level_t BORValue);
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */

View File

@ -10,6 +10,12 @@
#include "device_mpu_util.h"
// 168 ticks in microsecond in case of 168MHz 407
#define US_TO_NT_MULTIPLIER (CORE_CLOCK / 1000000)
// Scheduler queue GPT device - use TIM5
#define GPTDEVICE GPTD5
typedef enum {
BOR_Level_None = OB_BOR_OFF, // 0x0C=12 Supply voltage ranges from 1.62 to 2.10 V
BOR_Level_1 = OB_BOR_LEVEL1, // 0x08 Supply voltage ranges from 2.10 to 2.40 V

View File

@ -325,3 +325,7 @@ bool isValidSerialRxPin(brain_pin_e pin) {
}
#endif /*EFI_AUX_SERIAL*/
uint32_t getTimeNowLowerNt() {
return port_rt_get_counter_value();
}

View File

@ -69,12 +69,10 @@ efitimems_t currentTimeMillis(void);
*/
efitimesec_t getTimeNowSeconds(void);
// Get a monotonically increasing (but wrapping) 32-bit timer value
uint32_t getTimeNowLowerNt(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#if EFI_PROD_CODE || EFI_SIMULATOR
#define getTimeNowLowerNt() port_rt_get_counter_value()
#else
#define getTimeNowLowerNt() 0
#endif

View File

@ -36,5 +36,6 @@ void chDbgAssert(int c, char *msg, void *arg) {
}
}
uint32_t getTimeNowLowerNt(void) {
return 0;
}