mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Merge remote-tracking branch 'origin/amorale/OP-997_revolution_settings_to_ext_flash' into next
This commit is contained in:
commit
2c0f7794a9
@ -53,6 +53,7 @@
|
||||
#include <watchdogstatus.h>
|
||||
#include <taskinfo.h>
|
||||
#include <hwsettings.h>
|
||||
#include <pios_flashfs.h>
|
||||
|
||||
// Flight Libraries
|
||||
#include <sanitycheck.h>
|
||||
@ -94,7 +95,7 @@ static xQueueHandle objectPersistenceQueue;
|
||||
static bool stackOverflow;
|
||||
static bool mallocFailed;
|
||||
static HwSettingsData bootHwSettings;
|
||||
|
||||
static struct PIOS_FLASHFS_Stats fsStats;
|
||||
// Private functions
|
||||
static void objectUpdatedCb(UAVObjEvent *ev);
|
||||
static void hwSettingsUpdatedCb(UAVObjEvent *ev);
|
||||
@ -108,6 +109,10 @@ static void systemTask(void *parameters);
|
||||
static void updateI2Cstats();
|
||||
static void updateWDGstats();
|
||||
#endif
|
||||
|
||||
extern uintptr_t pios_uavo_settings_fs_id;
|
||||
extern uintptr_t pios_user_fs_id;
|
||||
|
||||
/**
|
||||
* Create the module task.
|
||||
* \returns 0 on success or -1 if initialization failed
|
||||
@ -462,7 +467,18 @@ static void updateStats()
|
||||
if (idleCounterClear) {
|
||||
idleCounter = 0;
|
||||
}
|
||||
|
||||
#if !defined(ARCH_POSIX) && !defined(ARCH_WIN32)
|
||||
if(pios_uavo_settings_fs_id){
|
||||
PIOS_FLASHFS_GetStats(pios_uavo_settings_fs_id, &fsStats);
|
||||
stats.SysSlotsFree = fsStats.num_free_slots;
|
||||
stats.SysSlotsActive = fsStats.num_active_slots;
|
||||
}
|
||||
if(pios_user_fs_id){
|
||||
PIOS_FLASHFS_GetStats(pios_user_fs_id, &fsStats);
|
||||
stats.UsrSlotsFree = fsStats.num_free_slots;
|
||||
stats.UsrSlotsActive = fsStats.num_active_slots;
|
||||
}
|
||||
#endif
|
||||
portTickType now = xTaskGetTickCount();
|
||||
if (now > lastTickCount) {
|
||||
uint32_t dT = (xTaskGetTickCount() - lastTickCount) * portTICK_RATE_MS; // in ms
|
||||
|
@ -1158,7 +1158,23 @@ out_end_trans:
|
||||
out_exit:
|
||||
return rc;
|
||||
}
|
||||
/**
|
||||
* @brief Returs stats for the filesystems
|
||||
* @param[in] fs_id The filesystem to use for this action
|
||||
* @return 0 if success or error code
|
||||
* @retval -1 if fs_id is not a valid filesystem instance
|
||||
*/
|
||||
int32_t PIOS_FLASHFS_GetStats(uintptr_t fs_id, struct PIOS_FLASHFS_Stats *stats){
|
||||
PIOS_Assert(stats);
|
||||
struct logfs_state *logfs = (struct logfs_state *)fs_id;
|
||||
|
||||
if (!PIOS_FLASHFS_Logfs_validate(logfs)) {
|
||||
return -1;
|
||||
}
|
||||
stats->num_active_slots = logfs->num_active_slots;
|
||||
stats->num_free_slots = logfs->num_free_slots;
|
||||
return 0;
|
||||
}
|
||||
#endif /* PIOS_INCLUDE_FLASH */
|
||||
|
||||
/**
|
||||
|
@ -29,9 +29,14 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct PIOS_FLASHFS_Stats{
|
||||
uint16_t num_free_slots; /* slots in free state */
|
||||
uint16_t num_active_slots; /* slots in active state */
|
||||
};
|
||||
|
||||
int32_t PIOS_FLASHFS_Format(uintptr_t fs_id);
|
||||
int32_t PIOS_FLASHFS_ObjSave(uintptr_t fs_id, uint32_t obj_id, uint16_t obj_inst_id, uint8_t *obj_data, uint16_t obj_size);
|
||||
int32_t PIOS_FLASHFS_ObjLoad(uintptr_t fs_id, uint32_t obj_id, uint16_t obj_inst_id, uint8_t *obj_data, uint16_t obj_size);
|
||||
int32_t PIOS_FLASHFS_ObjDelete(uintptr_t fs_id, uint32_t obj_id, uint16_t obj_inst_id);
|
||||
|
||||
int32_t PIOS_FLASHFS_GetStats(uintptr_t fs_id, struct PIOS_FLASHFS_Stats *stats);
|
||||
#endif /* PIOS_FLASHFS_H */
|
||||
|
@ -77,7 +77,7 @@ uint32_t pios_com_hkosd_id;
|
||||
uint32_t pios_usb_rctx_id;
|
||||
|
||||
uintptr_t pios_uavo_settings_fs_id;
|
||||
|
||||
uintptr_t pios_user_fs_id = 0;
|
||||
/**
|
||||
* Configuration for MPU6000 chip
|
||||
*/
|
||||
|
@ -105,6 +105,7 @@ uint32_t pios_com_telem_usb_id;
|
||||
uint32_t pios_com_telem_rf_id;
|
||||
|
||||
uintptr_t pios_uavo_settings_fs_id;
|
||||
uintptr_t pios_user_fs_id = 0;
|
||||
|
||||
/**
|
||||
* TIM3 is triggered by the HSYNC signal into its ETR line and will divide the
|
||||
|
@ -677,9 +677,20 @@ const struct pios_rfm22b_cfg *PIOS_BOARD_HW_DEFS_GetRfm22Cfg(uint32_t board_revi
|
||||
#include "pios_flash_jedec_priv.h"
|
||||
#include "pios_flash_internal_priv.h"
|
||||
|
||||
static const struct flashfs_logfs_cfg flashfs_external_cfg = {
|
||||
.fs_magic = 0x99abceef,
|
||||
.total_fs_size = 0x00200000, /* 2M bytes (32 sectors = entire chip) */
|
||||
static const struct flashfs_logfs_cfg flashfs_external_user_cfg = {
|
||||
.fs_magic = 0x99abcdef,
|
||||
.total_fs_size = 0x001C0000, /* 2M bytes (32 sectors = entire chip) */
|
||||
.arena_size = 0x00010000, /* 256 * slot size */
|
||||
.slot_size = 0x00000100, /* 256 bytes */
|
||||
|
||||
.start_offset = 0x40000, /* start at the beginning of the chip */
|
||||
.sector_size = 0x00010000, /* 64K bytes */
|
||||
.page_size = 0x00000100, /* 256 bytes */
|
||||
};
|
||||
|
||||
static const struct flashfs_logfs_cfg flashfs_external_system_cfg = {
|
||||
.fs_magic = 0x99bbcdef,
|
||||
.total_fs_size = 0x00040000, /* 2M bytes (32 sectors = entire chip) */
|
||||
.arena_size = 0x00010000, /* 256 * slot size */
|
||||
.slot_size = 0x00000100, /* 256 bytes */
|
||||
|
||||
|
@ -350,21 +350,16 @@ void PIOS_Board_Init(void)
|
||||
/* Connect flash to the appropriate interface and configure it */
|
||||
uintptr_t flash_id;
|
||||
|
||||
// initialize the internal settings storage flash
|
||||
if (PIOS_Flash_Internal_Init(&flash_id, &flash_internal_cfg)) {
|
||||
PIOS_DEBUG_Assert(0);
|
||||
}
|
||||
|
||||
if (PIOS_FLASHFS_Logfs_Init(&pios_uavo_settings_fs_id, &flashfs_internal_cfg, &pios_internal_flash_driver, flash_id)) {
|
||||
PIOS_DEBUG_Assert(0);
|
||||
}
|
||||
|
||||
// Initialize the external USER flash
|
||||
if (PIOS_Flash_Jedec_Init(&flash_id, pios_spi_telem_flash_id, 1)) {
|
||||
PIOS_DEBUG_Assert(0);
|
||||
}
|
||||
|
||||
if (PIOS_FLASHFS_Logfs_Init(&pios_user_fs_id, &flashfs_external_cfg, &pios_jedec_flash_driver, flash_id)) {
|
||||
if (PIOS_FLASHFS_Logfs_Init(&pios_uavo_settings_fs_id, &flashfs_external_system_cfg, &pios_jedec_flash_driver, flash_id)) {
|
||||
PIOS_DEBUG_Assert(0);
|
||||
}
|
||||
|
||||
if (PIOS_FLASHFS_Logfs_Init(&pios_user_fs_id, &flashfs_external_user_cfg, &pios_jedec_flash_driver, flash_id)) {
|
||||
PIOS_DEBUG_Assert(0);
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,10 @@
|
||||
<field name="EventSystemWarningID" units="uavoid" type="uint32" elements="1"/>
|
||||
<field name="ObjectManagerCallbackID" units="uavoid" type="uint32" elements="1"/>
|
||||
<field name="ObjectManagerQueueID" units="uavoid" type="uint32" elements="1"/>
|
||||
<field name="SysSlotsFree" units="slots" type="uint16" elements="1"/>
|
||||
<field name="SysSlotsActive" units="slots" type="uint16" elements="1"/>
|
||||
<field name="UsrSlotsFree" units="slots" type="uint16" elements="1"/>
|
||||
<field name="UsrSlotsActive" units="slots" type="uint16" elements="1"/>
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
||||
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user