rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
tooth_logger.h
Go to the documentation of this file.
1/*
2 * @file tooth_logger.h
3 *
4 * @date Jul 7, 2019
5 * @author Matthew Kennedy
6 */
7
8#pragma once
9
10#include "rusefi_enums.h"
11#include <rusefi/expected.h>
12#include "trigger_structure.h"
13
14#if EFI_UNIT_TEST
15#include "logicdata.h"
16const std::vector<CompositeEvent>& getCompositeEvents();
17void jsonTraceEntry(const char* name, int pid, bool isEnter, efitick_t timestamp);
18#endif // EFI_UNIT_TEST
19
21
22// Enable the tooth logger - this clears the buffer starts logging
24
25// Stop logging - leave buffer intact
27
29
30// A new tooth has arrived! Log to the buffer if enabled.
31void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp);
32void LogTriggerCamTooth(bool isRising, efitick_t timestamp, int index);
33
34void LogTriggerTopDeadCenter(efitick_t timestamp);
35void LogTriggerSync(bool isSync, efitick_t timestamp);
36void LogTriggerCoilState(efitick_t timestamp, size_t index, bool state);
37
38void LogTriggerInjectorState(efitick_t timestamp, size_t index, bool state);
39
40typedef struct __attribute__ ((packed)) {
41 // the whole order of all packet bytes is reversed, not just the 'endian-swap' integers
42 uint32_t timestamp;
43 // unfortunately all these fields are required by TS...
44 bool priLevel : 1;
45 bool secLevel : 1;
46 bool trigger : 1;
47 bool sync : 1;
48 bool coil : 1;
49 bool injector : 1;
51
52static constexpr size_t toothLoggerEntriesPerBuffer = 250;
53
59
60// Get a reference to the buffer
61// Returns nullptr if no buffer is available
63// Blocks until a buffer is available
65
66// Return a buffer to the pool once its contents have been read
68
69#include "big_buffer.h"
typedef __attribute__
Ignition Mode.
static bool sync(void *instance)
@ LogTriggerTooth
Fundamental rusEFI enumerable types live here.
state("state", SensorCategory.SENSOR_INPUTS, FieldType.INT8, 1871, 1.0, -1.0, -1.0, "")
trigger_event_e
composite_logger_s buffer[toothLoggerEntriesPerBuffer]
void jsonTraceEntry(const char *name, int pid, bool isEnter, efitick_t timestamp)
void DisableToothLogger()
void LogTriggerTopDeadCenter(efitick_t timestamp)
void EnableToothLogger()
void LogTriggerInjectorState(efitick_t timestamp, size_t index, bool state)
void ReturnToothLoggerBuffer(CompositeBuffer *)
void LogTriggerCoilState(efitick_t timestamp, size_t index, bool state)
void LogTriggerCamTooth(bool isRising, efitick_t timestamp, int index)
const std::vector< CompositeEvent > & getCompositeEvents()
void LogTriggerSync(bool isSync, efitick_t timestamp)
CompositeBuffer * GetToothLoggerBufferNonblocking()
bool IsToothLoggerEnabled()
static constexpr size_t toothLoggerEntriesPerBuffer
composite_logger_s
CompositeBuffer * GetToothLoggerBufferBlocking()
void EnableToothLoggerIfNotEnabled()