From e3e350427ec1b1d6b9c5e7e1ce539bbfd8ec6a4b Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sat, 31 Aug 2024 08:05:41 +1000 Subject: [PATCH] AP_DAL: use enum class for DAL MemoryType --- libraries/AP_DAL/AP_DAL.cpp | 6 +++++- libraries/AP_DAL/AP_DAL.h | 9 +++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libraries/AP_DAL/AP_DAL.cpp b/libraries/AP_DAL/AP_DAL.cpp index 06be6c7c7e..4d6a1f9bd6 100644 --- a/libraries/AP_DAL/AP_DAL.cpp +++ b/libraries/AP_DAL/AP_DAL.cpp @@ -272,10 +272,14 @@ int AP_DAL::snprintf(char* str, size_t size, const char *format, ...) const return res; } -void *AP_DAL::malloc_type(size_t size, Memory_Type mem_type) const +void *AP_DAL::malloc_type(size_t size, MemoryType mem_type) const { return hal.util->malloc_type(size, AP_HAL::Util::Memory_Type(mem_type)); } +void AP_DAL::free_type(void *ptr, size_t size, MemoryType mem_type) const +{ + return hal.util->free_type(ptr, size, AP_HAL::Util::Memory_Type(mem_type)); +} // map core number for replay uint8_t AP_DAL::logging_core(uint8_t c) const diff --git a/libraries/AP_DAL/AP_DAL.h b/libraries/AP_DAL/AP_DAL.h index 14a348ea61..64a16fff45 100644 --- a/libraries/AP_DAL/AP_DAL.h +++ b/libraries/AP_DAL/AP_DAL.h @@ -121,11 +121,12 @@ public: int snprintf(char* str, size_t size, const char *format, ...) const; // copied in AP_HAL/Util.h - enum Memory_Type { - MEM_DMA_SAFE, - MEM_FAST + enum class MemoryType : uint8_t { + DMA_SAFE = 0, + FAST = 1, }; - void *malloc_type(size_t size, enum Memory_Type mem_type) const; + void *malloc_type(size_t size, MemoryType mem_type) const; + void free_type(void *ptr, size_t size, MemoryType memtype) const; AP_DAL_InertialSensor &ins() { return _ins; } AP_DAL_Baro &baro() { return _baro; }