aboutsummaryrefslogtreecommitdiffstats
path: root/testhal
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-11-14 12:43:44 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-11-14 12:43:44 +0000
commitbc113301c744fc311f0cd2f2af102218eac7bb44 (patch)
tree041d0a04b45cbdda2552f23553d23403fc2ca16c /testhal
parent172d281e84c6f095ea642e925424104aeec60702 (diff)
downloadChibiOS-bc113301c744fc311f0cd2f2af102218eac7bb44.tar.gz
ChibiOS-bc113301c744fc311f0cd2f2af102218eac7bb44.tar.bz2
ChibiOS-bc113301c744fc311f0cd2f2af102218eac7bb44.zip
Fixed few bugs, not fully tested yet.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10996 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal')
-rw-r--r--testhal/STM32/multi/QSPI-MFS/main.c70
1 files changed, 15 insertions, 55 deletions
diff --git a/testhal/STM32/multi/QSPI-MFS/main.c b/testhal/STM32/multi/QSPI-MFS/main.c
index c3c84a30a..9a874e47c 100644
--- a/testhal/STM32/multi/QSPI-MFS/main.c
+++ b/testhal/STM32/multi/QSPI-MFS/main.c
@@ -92,7 +92,7 @@ static THD_FUNCTION(Thread1, arg) {
* Application entry point.
*/
int main(void) {
- flash_error_t err;
+ mfs_error_t err;
uint8_t *addr;
/*
@@ -122,62 +122,22 @@ int main(void) {
/* Mounting the MFS volume defined in the configuration.*/
mfsObjectInit(&mfs);
mfsStart(&mfs, &mfscfg1);
- mfsMount(&mfs);
+
+ err = mfsUnmount(&mfs);
+ err = mfsErase(&mfs);
+ err = mfsMount(&mfs);
+
+ err = mfsWriteRecord(&mfs, 1, 64, pattern);
+ err = mfsWriteRecord(&mfs, 2, 64, pattern);
+ err = mfsWriteRecord(&mfs, 1, 128, pattern);
+ err = mfsWriteRecord(&mfs, 2, 128, pattern);
+
+ err = mfsPerformGarbageCollection(&mfs);
/* Reading.*/
- err = flashRead(&m25q, 0, 128, buffer);
- if (err != FLASH_NO_ERROR)
- chSysHalt("read error");
-
- mfsUnmount(&mfs);
- mfsErase(&mfs);
-
-#if 0
- /* Erasing the first sector and waiting for completion.*/
- (void) flashStartEraseSector(&m25q, 0);
- err = flashWaitErase((BaseFlash *)&m25q);
- if (err != FLASH_NO_ERROR)
- chSysHalt("erase error");
-
- /* Verifying the erase operation.*/
- err = flashVerifyErase(&m25q, 0);
- if (err != FLASH_NO_ERROR)
- chSysHalt("verify erase error");
-
- /* Programming a pattern.*/
- err = flashProgram(&m25q, 0, 128, pattern);
- if (err != FLASH_NO_ERROR)
- chSysHalt("program error");
-
- /* Verifying the erase operation.*/
- err = flashVerifyErase(&m25q, 0);
- if (err != FLASH_ERROR_VERIFY)
- chSysHalt("verify non-erase error");
-
- /* Memory mapping the device.*/
- m25qMemoryMap(&m25q, &addr);
-
- /* Unmapping the device.*/
- m25qMemoryUnmap(&m25q);
-
- /* Reading it back.*/
- memset(buffer, 0, 128);
- err = flashRead(&m25q, 16, 128, buffer);
- if (err != FLASH_NO_ERROR)
- chSysHalt("read error");
-
- /* Reading it back.*/
- memset(buffer, 0, 128);
- err = flashRead(&m25q, 0, 128, buffer);
- if (err != FLASH_NO_ERROR)
- chSysHalt("read error");
-
- /* Erasing again.*/
- (void) flashStartEraseSector(&m25q, 0);
- err = flashWaitErase((BaseFlash *)&m25q);
- if (err != FLASH_NO_ERROR)
- chSysHalt("erase error");
-#endif
+ flashRead(&m25q, 0, 128, buffer);
+
+ err = mfsUnmount(&mfs);
/*
* Normal main() thread activity, in this demo it does nothing.