bigBuffer should be aligned (#5468)

* Tooth logger: set setToothLogReady(false) on last buffer returned

* Tooth logger: disable before releasing

* bigBuffer: should be aligned to 4 bytes

bigBuffer users cast it to something strange and expect it to be
aligned

* tooth_trigger: dead unused
This commit is contained in:
Andrey G 2023-07-26 03:10:52 +03:00 committed by GitHub
parent 7fb3f31c61
commit d31260c7fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 10 deletions

View File

@ -23,7 +23,7 @@
static_assert(sizeof(composite_logger_s) == COMPOSITE_PACKET_SIZE, "composite packet size");
static volatile bool ToothLoggerEnabled = false;
static uint32_t lastEdgeTimestamp = 0;
//static uint32_t lastEdgeTimestamp = 0;
static bool currentTrigger1 = false;
static bool currentTrigger2 = false;
@ -112,7 +112,7 @@ void EnableToothLogger() {
}
// Reset the last edge to now - this prevents the first edge logged from being bogus
lastEdgeTimestamp = getTimeNowUs();
//lastEdgeTimestamp = getTimeNowUs();
// Enable logging of edges as they come
ToothLoggerEnabled = true;
@ -123,12 +123,12 @@ void EnableToothLogger() {
void DisableToothLogger() {
chibios_rt::CriticalSectionLocker csl;
ToothLoggerEnabled = false;
setToothLogReady(false);
// Release the big buffer for another user
bufferHandle = {};
buffers = nullptr;
ToothLoggerEnabled = false;
setToothLogReady(false);
}
static CompositeBuffer* GetToothLoggerBufferImpl(sysinterval_t timeout) {
@ -145,6 +145,13 @@ static CompositeBuffer* GetToothLoggerBufferImpl(sysinterval_t timeout) {
return nullptr;
}
chibios_rt::CriticalSectionLocker csl;
// If the used list is empty, clear the ready flag
if (filledBuffers.getUsedCountI() == 0) {
setToothLogReady(false);
}
return buffer;
}
@ -161,11 +168,6 @@ void ReturnToothLoggerBuffer(CompositeBuffer* buffer) {
msg_t msg = freeBuffers.postI(buffer);
efiAssertVoid(ObdCode::OBD_PCM_Processor_Fault, msg == MSG_OK, "Composite logger post to free buffer fail");
// If the used list is empty, clear the ready flag
if (filledBuffers.getUsedCountI() == 0) {
setToothLogReady(false);
}
}
static CompositeBuffer* findBuffer(efitick_t timestamp) {