From 6ff9fd4af9df7d24d66f78ee7bba4088aaca4445 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Thu, 16 Nov 2017 14:45:38 +0000 Subject: Bug fixing. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11019 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/lib/complex/mfs/mfs.c | 8 +++++++- testhal/STM32/multi/QSPI-MFS/main.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/os/hal/lib/complex/mfs/mfs.c b/os/hal/lib/complex/mfs/mfs.c index 76178cc06..87ff1f365 100644 --- a/os/hal/lib/complex/mfs/mfs.c +++ b/os/hal/lib/complex/mfs/mfs.c @@ -934,7 +934,7 @@ mfs_error_t mfsReadRecord(MFSDriver *mfsp, mfs_id_t id, } /* Checking if the requested record actually exists.*/ - if (mfsp->descriptors[id - 1U].offset != 0U) { + if (mfsp->descriptors[id - 1U].offset == 0U) { return MFS_ERR_NOT_FOUND; } @@ -943,6 +943,12 @@ mfs_error_t mfsReadRecord(MFSDriver *mfsp, mfs_id_t id, return MFS_ERR_INV_SIZE; } + /* Header read from flash.*/ + RET_ON_ERROR(mfs_flash_read(mfsp, + mfsp->descriptors[id - 1U].offset, + *np, + mfsp->buffer.data8)); + /* Data read from flash.*/ *np = mfsp->descriptors[id - 1U].size; RET_ON_ERROR(mfs_flash_read(mfsp, diff --git a/testhal/STM32/multi/QSPI-MFS/main.c b/testhal/STM32/multi/QSPI-MFS/main.c index ed8db1f38..e468c39f3 100644 --- a/testhal/STM32/multi/QSPI-MFS/main.c +++ b/testhal/STM32/multi/QSPI-MFS/main.c @@ -42,7 +42,7 @@ const M25QConfig m25qcfg1 = { const MFSConfig mfscfg1 = { (BaseFlash *)&m25q, 0xFFFFFFFFU, - 131072U, + 4096U, 0, 2, 2, -- cgit v1.2.3