diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-06-04 08:28:16 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-06-04 08:28:16 +0000 |
commit | f8f2ea1763d1494c0f51fe941e4ee324eeb0a572 (patch) | |
tree | e3beda9939707b7510b005237b6faa98ec62df7e /testhal | |
parent | f558772bb8f099bdab54fa4f431a9536937d1e3d (diff) | |
download | ChibiOS-f8f2ea1763d1494c0f51fe941e4ee324eeb0a572.tar.gz ChibiOS-f8f2ea1763d1494c0f51fe941e4ee324eeb0a572.tar.bz2 ChibiOS-f8f2ea1763d1494c0f51fe941e4ee324eeb0a572.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9567 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal')
-rw-r--r-- | testhal/STM32/STM32L4xx/QSPI-N25Q128/main.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testhal/STM32/STM32L4xx/QSPI-N25Q128/main.c b/testhal/STM32/STM32L4xx/QSPI-N25Q128/main.c index 08e82a9ea..ffac546d2 100644 --- a/testhal/STM32/STM32L4xx/QSPI-N25Q128/main.c +++ b/testhal/STM32/STM32L4xx/QSPI-N25Q128/main.c @@ -14,6 +14,8 @@ limitations under the License.
*/
+#include <string.h>
+
#include "ch.h"
#include "hal.h"
@@ -107,6 +109,11 @@ int main(void) { m25qObjectInit(&m25q);
m25qStart(&m25q, &m25qcfg1);
+ /* Reading.*/
+ err = flashRead(&m25q, 0, buffer, 128);
+ if (err != FLASH_NO_ERROR)
+ chSysHalt("read error");
+
/* Erasing the first sector and waiting for completion.*/
(void) flashStartEraseSector(&m25q, 0);
err = flashWaitErase((BaseFlash *)&m25q);
@@ -135,6 +142,13 @@ int main(void) { m25qMemoryUnmap(&m25q);
/* Reading it back.*/
+ memset(buffer, 0, 128);
+ err = flashRead(&m25q, 16, buffer, 128);
+ if (err != FLASH_NO_ERROR)
+ chSysHalt("read error");
+
+ /* Reading it back.*/
+ memset(buffer, 0, 128);
err = flashRead(&m25q, 0, buffer, 128);
if (err != FLASH_NO_ERROR)
chSysHalt("read error");
|