From f57f106c7fa9fb9548cd2ed2dda12031588ca815 Mon Sep 17 00:00:00 2001 From: bugobliterator Date: Mon, 8 Nov 2021 19:50:47 +0530 Subject: [PATCH] AP_HAL_Linux: add get_storage_ptr method --- libraries/AP_HAL_Linux/Storage.cpp | 13 +++++++++++++ libraries/AP_HAL_Linux/Storage.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/libraries/AP_HAL_Linux/Storage.cpp b/libraries/AP_HAL_Linux/Storage.cpp index 9d779051cd..4f9fc133a2 100644 --- a/libraries/AP_HAL_Linux/Storage.cpp +++ b/libraries/AP_HAL_Linux/Storage.cpp @@ -266,3 +266,16 @@ void Storage::_timer_tick(void) } } } + +/* + get storage size and ptr + */ +bool Storage::get_storage_ptr(void *&ptr, size_t &size) +{ + if (!_initialised) { + return false; + } + ptr = _buffer; + size = sizeof(_buffer); + return true; +} diff --git a/libraries/AP_HAL_Linux/Storage.h b/libraries/AP_HAL_Linux/Storage.h index a397e8def8..fb41515254 100644 --- a/libraries/AP_HAL_Linux/Storage.h +++ b/libraries/AP_HAL_Linux/Storage.h @@ -32,6 +32,8 @@ public: void write_dword(uint16_t loc, uint32_t value); void write_block(uint16_t dst, const void* src, size_t n) override; + bool get_storage_ptr(void *&ptr, size_t &size) override; + virtual void _timer_tick(void) override; protected: