Merge remote-tracking branch 'origin/master' into master
This commit is contained in:
commit
322ebe7fcd
|
@ -139,6 +139,7 @@ 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
|
||||
include $(CHIBIOS)/os/various/cpp_wrappers/chcpp.mk
|
||||
|
||||
include $(CONFIG)/boards/$(PROJECT_BOARD)/board.mk
|
||||
include $(PROJECT_DIR)/init/init.mk
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
* See also mlq_file_format.txt
|
||||
*/
|
||||
|
||||
|
||||
#include "binary_logging.h"
|
||||
#include "tunerstudio_outputs.h"
|
||||
#include "log_field.h"
|
||||
#include "efilib.h"
|
||||
#include "efitime.h"
|
||||
#include "crc.h"
|
||||
|
||||
#include "buffered_writer.h"
|
||||
|
||||
#define TIME_PRECISION 1000
|
||||
|
||||
|
@ -59,7 +59,8 @@ static const LogField fields[] = {
|
|||
{tsOutputChannels.massAirFlow, GAUGE_NAME_AIR_FLOW, "kg/h", 1},
|
||||
};
|
||||
|
||||
size_t writeHeader(char* buffer) {
|
||||
void writeHeader(Writer& outBuffer) {
|
||||
char buffer[MLQ_HEADER_SIZE];
|
||||
// File format: MLVLG\0
|
||||
strncpy(buffer, "MLVLG", 6);
|
||||
|
||||
|
@ -77,7 +78,13 @@ size_t writeHeader(char* buffer) {
|
|||
buffer[12] = 0;
|
||||
buffer[13] = 0;
|
||||
|
||||
// Index 14-17 are written at the end - header end offset
|
||||
size_t headerSize = MLQ_HEADER_SIZE + efi::size(fields) * 55;
|
||||
|
||||
// Data begin index: begins immediately after the header
|
||||
buffer[14] = 0;
|
||||
buffer[15] = 0;
|
||||
buffer[16] = (headerSize >> 8) & 0xFF;
|
||||
buffer[17] = headerSize & 0xFF;
|
||||
|
||||
// Record length - length of a single data record: sum size of all fields
|
||||
uint16_t recLength = 0;
|
||||
|
@ -92,23 +99,12 @@ size_t writeHeader(char* buffer) {
|
|||
buffer[20] = 0;
|
||||
buffer[21] = efi::size(fields);
|
||||
|
||||
size_t headerSize = MLQ_HEADER_SIZE;
|
||||
outBuffer.write(buffer, MLQ_HEADER_SIZE);
|
||||
|
||||
// Write the actual logger fields, offset 22
|
||||
char* entryHeaders = buffer + MLQ_HEADER_SIZE;
|
||||
for (size_t i = 0; i < efi::size(fields); i++) {
|
||||
size_t sz = fields[i].writeHeader(entryHeaders);
|
||||
entryHeaders += sz;
|
||||
headerSize += sz;
|
||||
fields[i].writeHeader(outBuffer);
|
||||
}
|
||||
|
||||
// Data begin index: begins immediately after the header
|
||||
buffer[14] = 0;
|
||||
buffer[15] = 0;
|
||||
buffer[16] = (headerSize >> 8) & 0xFF;
|
||||
buffer[17] = headerSize & 0xFF;
|
||||
|
||||
return headerSize;
|
||||
}
|
||||
|
||||
static uint8_t blockRollCounter = 0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <cstddef>
|
||||
|
||||
size_t writeHeader(char* buffer);
|
||||
struct Writer;
|
||||
void writeHeader(Writer& buffer);
|
||||
size_t writeBlock(char* buffer);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "log_field.h"
|
||||
#include "buffered_writer.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
|
@ -16,7 +17,9 @@ static void copyFloat(char* buffer, float value) {
|
|||
memcpy_swapend(buffer, reinterpret_cast<char*>(&value), sizeof(float));
|
||||
}
|
||||
|
||||
size_t LogField::writeHeader(char* buffer) const {
|
||||
void LogField::writeHeader(Writer& outBuffer) const {
|
||||
char buffer[MLQ_FIELD_HEADER_SIZE];
|
||||
|
||||
// Offset 0, length 1 = type
|
||||
buffer[0] = static_cast<char>(m_type);
|
||||
|
||||
|
@ -40,7 +43,7 @@ size_t LogField::writeHeader(char* buffer) const {
|
|||
buffer[54] = m_digits;
|
||||
|
||||
// Total size = 55
|
||||
return MLQ_FIELD_HEADER_SIZE;
|
||||
outBuffer.write(buffer, MLQ_FIELD_HEADER_SIZE);
|
||||
}
|
||||
|
||||
size_t LogField::writeData(char* buffer) const {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
struct Writer;
|
||||
class LogField {
|
||||
public:
|
||||
template <typename TValue, int TMult = 1>
|
||||
|
@ -34,8 +35,7 @@ public:
|
|||
}
|
||||
|
||||
// Write the header data describing this field.
|
||||
// Returns the number of bytes written.
|
||||
size_t writeHeader(char* buffer) const;
|
||||
void writeHeader(Writer& outBuffer) const;
|
||||
|
||||
// Write the field's data to the buffer.
|
||||
// Returns the number of bytes written.
|
||||
|
|
|
@ -120,15 +120,13 @@ static void setWarningEnabled(int value) {
|
|||
|
||||
#if EFI_FILE_LOGGING
|
||||
// this one needs to be in main ram so that SD card SPI DMA works fine
|
||||
static char sdLogBuffer[2200] MAIN_RAM;
|
||||
static char sdLogBuffer[100] MAIN_RAM;
|
||||
static uint64_t binaryLogCount = 0;
|
||||
|
||||
#endif /* EFI_FILE_LOGGING */
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
static char buf[6];
|
||||
|
||||
/**
|
||||
* This is useful if we are changing engine mode dynamically
|
||||
* For example http://rusefi.com/forum/viewtopic.php?f=5&t=1085
|
||||
|
@ -148,17 +146,14 @@ void writeLogLine(Writer& buffer) {
|
|||
if (!main_loop_started)
|
||||
return;
|
||||
|
||||
size_t length;
|
||||
if (binaryLogCount == 0) {
|
||||
length = writeHeader(sdLogBuffer);
|
||||
writeHeader(buffer);
|
||||
} else {
|
||||
updateTunerStudioState(&tsOutputChannels);
|
||||
length = writeBlock(sdLogBuffer);
|
||||
}
|
||||
|
||||
size_t length = writeBlock(sdLogBuffer);
|
||||
efiAssertVoid(OBD_PCM_Processor_Fault, length <= efi::size(sdLogBuffer), "SD log buffer overflow");
|
||||
|
||||
buffer.write(sdLogBuffer, length);
|
||||
}
|
||||
|
||||
binaryLogCount++;
|
||||
#endif /* EFI_FILE_LOGGING */
|
||||
|
@ -773,7 +768,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
case DBG_FSIO_ADC:
|
||||
// todo: implement a proper loop
|
||||
if (engineConfiguration->fsioAdc[0] != EFI_ADC_NONE) {
|
||||
strcpy(buf, "adcX");
|
||||
tsOutputChannels->debugFloatField1 = getVoltage("fsio", engineConfiguration->fsioAdc[0] PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "spark_logic.h"
|
||||
#include "aux_valves.h"
|
||||
#include "accelerometer.h"
|
||||
#include "counter64.h"
|
||||
#include "perf_trace.h"
|
||||
#include "boost_control.h"
|
||||
#include "launch_control.h"
|
||||
|
@ -220,8 +219,6 @@ static void doPeriodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||
efiAssertVoid(CUSTOM_ERR_6661, getCurrentRemainingStack() > 64, "lowStckOnEv");
|
||||
#if EFI_PROD_CODE
|
||||
touchTimeCounter();
|
||||
|
||||
slowStartStopButtonCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
|
@ -707,7 +704,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
|||
* UNUSED_SIZE constants.
|
||||
*/
|
||||
#ifndef RAM_UNUSED_SIZE
|
||||
#define RAM_UNUSED_SIZE 2350
|
||||
#define RAM_UNUSED_SIZE 4000
|
||||
#endif
|
||||
#ifndef CCM_UNUSED_SIZE
|
||||
#define CCM_UNUSED_SIZE 2900
|
||||
|
|
|
@ -17,7 +17,6 @@ void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S
|
|||
void initStartStopButton(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
void initDataStructures(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void touchTimeCounter();
|
||||
|
||||
void slowStartStopButtonCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "engine_controller.h"
|
||||
#include "perf_trace.h"
|
||||
#include "counter64.h"
|
||||
#include "os_access.h"
|
||||
#include "settings.h"
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
@ -84,8 +84,6 @@ void setMockState(brain_pin_e pin, bool state DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
static Overflow64Counter halTime;
|
||||
|
||||
/**
|
||||
* 64-bit result would not overflow, but that's complex stuff for our 32-bit MCU
|
||||
*/
|
||||
|
@ -95,34 +93,31 @@ efitimeus_t getTimeNowUs(void) {
|
|||
return getTimeNowNt() / (CORE_CLOCK / 1000000);
|
||||
}
|
||||
|
||||
//todo: macro to save method invocation
|
||||
efitick_t getTimeNowNt(void) {
|
||||
#if EFI_PROD_CODE
|
||||
/* Entering a reentrant critical zone.*/
|
||||
syssts_t sts = chSysGetStatusAndLockX();
|
||||
efitime_t localH = halTime.state.highBits;
|
||||
uint32_t localLow = halTime.state.lowBits;
|
||||
volatile uint32_t lastLowerNt = 0;
|
||||
volatile uint32_t upperTimeNt = 0;
|
||||
|
||||
uint32_t value = getTimeNowLowerNt();
|
||||
efitick_t getTimeNowNt() {
|
||||
chibios_rt::CriticalSectionLocker csl;
|
||||
|
||||
if (value < localLow) {
|
||||
// new value less than previous value means there was an overflow in that 32 bit counter
|
||||
localH += 0x100000000LL;
|
||||
uint32_t stamp = getTimeNowLowerNt();
|
||||
|
||||
// Lower 32 bits of the timer has wrapped - time to step upper bits
|
||||
if (stamp < lastLowerNt) {
|
||||
upperTimeNt++;
|
||||
}
|
||||
|
||||
efitime_t result = localH + value;
|
||||
lastLowerNt = stamp;
|
||||
|
||||
/* Leaving the critical zone.*/
|
||||
chSysRestoreStatusX(sts);
|
||||
return result;
|
||||
#else /* EFI_PROD_CODE */
|
||||
// todo: why is this implementation not used?
|
||||
/**
|
||||
* this method is lock-free and thread-safe, that's because the 'update' method
|
||||
* is atomic with a critical zone requirement.
|
||||
*
|
||||
* http://stackoverflow.com/questions/5162673/how-to-read-two-32bit-counters-as-a-64bit-integer-without-race-condition
|
||||
*/
|
||||
return ((int64_t)upperTimeNt << 32) | stamp;
|
||||
}
|
||||
|
||||
/* //Alternative lock free implementation (probably actually slower!)
|
||||
// this method is lock-free and thread-safe, that's because the 'update' method
|
||||
// is atomic with a critical zone requirement.
|
||||
//
|
||||
// http://stackoverflow.com/questions/5162673/how-to-read-two-32bit-counters-as-a-64bit-integer-without-race-condition
|
||||
|
||||
etitick_t getTimeNowNt() {
|
||||
efitime_t localH;
|
||||
efitime_t localH2;
|
||||
uint32_t localLow;
|
||||
|
@ -131,14 +126,11 @@ efitick_t getTimeNowNt(void) {
|
|||
localH = halTime.state.highBits;
|
||||
localLow = halTime.state.lowBits;
|
||||
localH2 = halTime.state.highBits;
|
||||
#if EFI_PROD_CODE
|
||||
if (counter++ == 10000)
|
||||
chDbgPanic("lock-free frozen");
|
||||
#endif /* EFI_PROD_CODE */
|
||||
} while (localH != localH2);
|
||||
/**
|
||||
* We need to take current counter after making a local 64 bit snapshot
|
||||
*/
|
||||
|
||||
// We need to take current counter after making a local 64 bit snapshot
|
||||
uint32_t value = getTimeNowLowerNt();
|
||||
|
||||
if (value < localLow) {
|
||||
|
@ -147,20 +139,8 @@ efitick_t getTimeNowNt(void) {
|
|||
}
|
||||
|
||||
return localH + value;
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
}
|
||||
|
||||
void touchTimeCounter() {
|
||||
/**
|
||||
* We need to push current value into the 64 bit counter often enough so that we do not miss an overflow
|
||||
*/
|
||||
/* Entering a reentrant critical zone.*/
|
||||
syssts_t sts = chSysGetStatusAndLockX();
|
||||
updateAndSet(&halTime.state, getTimeNowLowerNt());
|
||||
/* Leaving the critical zone.*/
|
||||
chSysRestoreStatusX(sts);
|
||||
}
|
||||
*/
|
||||
|
||||
static void onStartStopButtonToggle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
engine->startStopStateToggleCounter++;
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD frankenso_na6
|
||||
#define SIGNATURE_DATE 2020.10.15
|
||||
#define SIGNATURE_HASH 912264321
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.frankenso_na6.912264321"
|
||||
#define SIGNATURE_HASH 1874496581
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.frankenso_na6.1874496581"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD mre_f4
|
||||
#define SIGNATURE_DATE 2020.10.15
|
||||
#define SIGNATURE_HASH 2596085838
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.mre_f4.2596085838"
|
||||
#define SIGNATURE_HASH 640748912
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.mre_f4.640748912"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD mre_f7
|
||||
#define SIGNATURE_DATE 2020.10.15
|
||||
#define SIGNATURE_HASH 2596085838
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.mre_f7.2596085838"
|
||||
#define SIGNATURE_HASH 640748912
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.mre_f7.640748912"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD prometheus_405
|
||||
#define SIGNATURE_DATE 2020.10.15
|
||||
#define SIGNATURE_HASH 1925279141
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.prometheus_405.1925279141"
|
||||
#define SIGNATURE_HASH 1854343583
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.prometheus_405.1854343583"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD prometheus_469
|
||||
#define SIGNATURE_DATE 2020.10.15
|
||||
#define SIGNATURE_HASH 1925279141
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.prometheus_469.1925279141"
|
||||
#define SIGNATURE_HASH 1854343583
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.prometheus_469.1854343583"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD proteus_f4
|
||||
#define SIGNATURE_DATE 2020.10.15
|
||||
#define SIGNATURE_HASH 1345656303
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.proteus_f4.1345656303"
|
||||
#define SIGNATURE_HASH 1968121740
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.proteus_f4.1968121740"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD proteus_f7
|
||||
#define SIGNATURE_DATE 2020.10.15
|
||||
#define SIGNATURE_HASH 1345656303
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.proteus_f7.1345656303"
|
||||
#define SIGNATURE_HASH 1968121740
|
||||
#define TS_SIGNATURE "rusEFI 2020.10.15.proteus_f7.1968121740"
|
||||
|
|
|
@ -9,19 +9,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <ch.h>
|
||||
#include <hal.h>
|
||||
#include "chprintf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "io_pins.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
// ChibiOS c++ wrappers
|
||||
#include "ch.hpp"
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define HAS_OS_ACCESS
|
||||
|
|
Binary file not shown.
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.10.15.frankenso_na6.912264321"
|
||||
signature = "rusEFI 2020.10.15.frankenso_na6.1874496581"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.10.15.frankenso_na6.912264321" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.10.15.frankenso_na6.1874496581" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -74,7 +74,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 02:41:49 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 12:58:57 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.10.15.mre_f4.2596085838"
|
||||
signature = "rusEFI 2020.10.15.mre_f4.640748912"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.10.15.mre_f4.2596085838" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.10.15.mre_f4.640748912" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -74,7 +74,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 02:41:48 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 12:58:56 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.10.15.mre_f7.2596085838"
|
||||
signature = "rusEFI 2020.10.15.mre_f7.640748912"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.10.15.mre_f7.2596085838" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.10.15.mre_f7.640748912" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -74,7 +74,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 02:41:46 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 12:58:53 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.10.15.prometheus_405.1925279141"
|
||||
signature = "rusEFI 2020.10.15.prometheus_405.1854343583"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.10.15.prometheus_405.1925279141" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.10.15.prometheus_405.1854343583" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -74,7 +74,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 02:41:52 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 12:59:01 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.10.15.prometheus_469.1925279141"
|
||||
signature = "rusEFI 2020.10.15.prometheus_469.1854343583"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.10.15.prometheus_469.1925279141" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.10.15.prometheus_469.1854343583" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -74,7 +74,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 02:41:51 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 12:58:59 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.10.15.proteus_f4.1345656303"
|
||||
signature = "rusEFI 2020.10.15.proteus_f4.1968121740"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.10.15.proteus_f4.1345656303" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.10.15.proteus_f4.1968121740" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -74,7 +74,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 02:41:56 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 12:59:04 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.10.15.proteus_f7.1345656303"
|
||||
signature = "rusEFI 2020.10.15.proteus_f7.1968121740"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.10.15.proteus_f7.1345656303" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.10.15.proteus_f7.1968121740" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -74,7 +74,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 02:41:54 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Oct 15 12:59:03 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* counter64.cpp
|
||||
*
|
||||
* Created on: Mar 31, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "counter64.h"
|
||||
|
||||
/**
|
||||
* The main use-case of this class is to keep track of a 64-bit global number of CPU ticks from reset.
|
||||
*
|
||||
* stm32f4 hardware has a 32-bit Cycle Count Register (CYCCNT), which is incremented with every CPU cycle.
|
||||
* With 32 bits and 168MHz speed this counter overflows every 4B/168M = 23 seconds. The job of this class is to
|
||||
* keep track of the current CYCCNT value, detect these overflows, and provide a nice,
|
||||
* clean 64 bit global cycle counter.
|
||||
*
|
||||
* In order for this to function, it's your responsibility to invoke offer() method at least once a second.
|
||||
*/
|
||||
Overflow64Counter::Overflow64Counter() {
|
||||
state.highBits = 0;
|
||||
state.lowBits = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* in order to have atomic writes this should be invoked within a critical section
|
||||
*/
|
||||
void updateAndSet(State64 *state, uint32_t value) {
|
||||
if (value < state->lowBits) {
|
||||
// new value less than previous value means there was an overflow in that 32 bit counter
|
||||
state->highBits += 0x100000000LL;
|
||||
}
|
||||
state->lowBits = value;
|
||||
}
|
||||
|
||||
#if EFI_UNIT_TEST
|
||||
efitime_t Overflow64Counter::update(uint32_t value) {
|
||||
updateAndSet(&state, value);
|
||||
return state.highBits + state.lowBits;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* @file counter64.h
|
||||
*
|
||||
* Created on: Mar 31, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "global.h"
|
||||
|
||||
typedef struct {
|
||||
// todo: would probably be better to keep the high bits as 32 bit field to be sure
|
||||
volatile efitime_t highBits;
|
||||
volatile uint32_t lowBits;
|
||||
} State64;
|
||||
|
||||
void updateAndSet(State64 *state, uint32_t value);
|
||||
|
||||
class Overflow64Counter
|
||||
{
|
||||
public:
|
||||
Overflow64Counter();
|
||||
|
||||
efitime_t get();
|
||||
#if EFI_UNIT_TEST
|
||||
efitime_t update(uint32_t value);
|
||||
#endif
|
||||
|
||||
State64 state;
|
||||
};
|
|
@ -8,7 +8,6 @@ UTILSRC = \
|
|||
UTILSRC_CPP = \
|
||||
$(UTIL_DIR)/containers/cyclic_buffer.cpp \
|
||||
$(UTIL_DIR)/containers/listener_array.cpp \
|
||||
$(UTIL_DIR)/containers/counter64.cpp \
|
||||
$(UTIL_DIR)/containers/local_version_holder.cpp \
|
||||
$(UTIL_DIR)/containers/table_helper.cpp \
|
||||
$(UTIL_DIR)/math/biquad.cpp \
|
||||
|
|
|
@ -1,18 +1,32 @@
|
|||
#include "log_field.h"
|
||||
#include "buffered_writer.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::ElementsAre;
|
||||
using ::testing::StrictMock;
|
||||
|
||||
class MockWriter : public Writer {
|
||||
public:
|
||||
MOCK_METHOD(size_t, write, (const char* buffer, size_t count), (override));
|
||||
MOCK_METHOD(size_t, flush, (), (override));
|
||||
};
|
||||
|
||||
TEST(BinaryLogField, FieldHeader) {
|
||||
scaled_channel<int8_t, 10> channel;
|
||||
LogField field(channel, "name", "units", 2);
|
||||
|
||||
char buffer[56];
|
||||
memset(buffer, 0xAA, sizeof(buffer));
|
||||
char buffer[55];
|
||||
StrictMock<MockWriter> bufWriter;
|
||||
EXPECT_CALL(bufWriter, write(_, 55))
|
||||
.WillOnce([&] (const char* buf, size_t count) {
|
||||
memcpy(buffer, buf, count);
|
||||
return 0;
|
||||
});
|
||||
|
||||
// Should write 55 bytes
|
||||
EXPECT_EQ(55, field.writeHeader(buffer));
|
||||
field.writeHeader(bufWriter);
|
||||
|
||||
// Expect correctly written header
|
||||
EXPECT_THAT(buffer, ElementsAre(
|
||||
|
@ -28,10 +42,7 @@ TEST(BinaryLogField, FieldHeader) {
|
|||
// Transform - we always use 0
|
||||
0, 0, 0, 0,
|
||||
// Digits - 2, as configured
|
||||
2,
|
||||
|
||||
// After end should be 0xAA, not touched
|
||||
0xAA
|
||||
2
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "crc.h"
|
||||
#include "fl_stack.h"
|
||||
#include "io_pins.h"
|
||||
#include "counter64.h"
|
||||
#include "efi_gpio.h"
|
||||
#include "efilib.h"
|
||||
|
||||
|
@ -66,20 +65,6 @@ TEST(util, crc) {
|
|||
assertEqualsM("crc32 line inc", 0x4775a7b1, c);
|
||||
}
|
||||
|
||||
|
||||
TEST(util, Overflow64Counter) {
|
||||
print("*************************************** testOverflow64Counter\r\n");
|
||||
|
||||
Overflow64Counter o;
|
||||
ASSERT_EQ(0, o.update(0));
|
||||
ASSERT_EQ(10, o.update(10));
|
||||
|
||||
ASSERT_EQ(20, o.update(20));
|
||||
|
||||
// overflow
|
||||
ASSERT_EQ(4294967296, o.update(0));
|
||||
}
|
||||
|
||||
TEST(util, cyclicBufferContains) {
|
||||
cyclic_buffer<int> sb;
|
||||
sb.add(10);
|
||||
|
|
Loading…
Reference in New Issue