From 57a173c1788cbb2c7fc45b381f391ee93be10872 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Fri, 5 Oct 2018 09:35:24 +0000 Subject: Some functions renamed, flash driver working somehow. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12321 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/hal/lib/complex/serial_nor/serial_nor.c | 10 ++++----- os/hal/lib/complex/serial_nor/serial_nor.h | 10 ++++----- testhal/STM32/STM32L4xx/WSPI-N25Q128/main.c | 32 ++++++++++++++--------------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/os/hal/lib/complex/serial_nor/serial_nor.c b/os/hal/lib/complex/serial_nor/serial_nor.c index 3c0b2cd28..db2a8c645 100644 --- a/os/hal/lib/complex/serial_nor/serial_nor.c +++ b/os/hal/lib/complex/serial_nor/serial_nor.c @@ -296,7 +296,7 @@ static flash_error_t snor_read_sfdp(void *instance, flash_offset_t offset, * * @init */ -void m25qObjectInit(SNORDriver *devp) { +void snorObjectInit(SNORDriver *devp) { osalDbgCheck(devp != NULL); @@ -313,7 +313,7 @@ void m25qObjectInit(SNORDriver *devp) { * * @api */ -void m25qStart(SNORDriver *devp, const SNORConfig *config) { +void snorStart(SNORDriver *devp, const SNORConfig *config) { osalDbgCheck((devp != NULL) && (config != NULL)); osalDbgAssert(devp->state != FLASH_UNINIT, "invalid state"); @@ -343,7 +343,7 @@ void m25qStart(SNORDriver *devp, const SNORConfig *config) { * * @api */ -void m25qStop(SNORDriver *devp) { +void snorStop(SNORDriver *devp) { osalDbgCheck(devp != NULL); osalDbgAssert(devp->state != FLASH_UNINIT, "invalid state"); @@ -381,7 +381,7 @@ void m25qStop(SNORDriver *devp) { * * @api */ -void m25qMemoryMap(SNORDriver *devp, uint8_t **addrp) { +void snorMemoryMap(SNORDriver *devp, uint8_t **addrp) { wspi_command_t cmd; /* Bus acquisition.*/ @@ -426,7 +426,7 @@ void m25qMemoryMap(SNORDriver *devp, uint8_t **addrp) { * * @api */ -void m25qMemoryUnmap(SNORDriver *devp) { +void snorMemoryUnmap(SNORDriver *devp) { /* Bus acquisition.*/ jesd216_bus_acquire(devp->config->busp, devp->config->buscfg); diff --git a/os/hal/lib/complex/serial_nor/serial_nor.h b/os/hal/lib/complex/serial_nor/serial_nor.h index 9882c9d54..32ac394a7 100644 --- a/os/hal/lib/complex/serial_nor/serial_nor.h +++ b/os/hal/lib/complex/serial_nor/serial_nor.h @@ -160,13 +160,13 @@ typedef struct { #ifdef __cplusplus extern "C" { #endif - void m25qObjectInit(SNORDriver *devp); - void m25qStart(SNORDriver *devp, const SNORConfig *config); - void m25qStop(SNORDriver *devp); + void snorObjectInit(SNORDriver *devp); + void snorStart(SNORDriver *devp, const SNORConfig *config); + void snorStop(SNORDriver *devp); #if (JESD216_BUS_MODE != JESD216_BUS_MODE_SPI) || defined(__DOXYGEN__) #if (WSPI_SUPPORTS_MEMMAP == TRUE) || defined(__DOXYGEN__) - void m25qMemoryMap(SNORDriver *devp, uint8_t ** addrp); - void m25qMemoryUnmap(SNORDriver *devp); + void snorMemoryMap(SNORDriver *devp, uint8_t ** addrp); + void snorMemoryUnmap(SNORDriver *devp); #endif /* QSPI_SUPPORTS_MEMMAP == TRUE */ #endif /* JESD216_BUS_MODE != JESD216_BUS_MODE_SPI */ #ifdef __cplusplus diff --git a/testhal/STM32/STM32L4xx/WSPI-N25Q128/main.c b/testhal/STM32/STM32L4xx/WSPI-N25Q128/main.c index 6e8a35436..ea3afb376 100644 --- a/testhal/STM32/STM32L4xx/WSPI-N25Q128/main.c +++ b/testhal/STM32/STM32L4xx/WSPI-N25Q128/main.c @@ -54,9 +54,9 @@ const uint8_t pattern[128] = { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; -SNORDriver m25q; +SNORDriver snor1; -const SNORConfig m25qcfg1 = { +const SNORConfig snorcfg1 = { &WSPID1, &wspicfg1 }; @@ -107,56 +107,56 @@ int main(void) { /* * Initializing and starting SNOR driver. */ - m25qObjectInit(&m25q); - m25qStart(&m25q, &m25qcfg1); + snorObjectInit(&snor1); + snorStart(&snor1, &snorcfg1); /* Reading.*/ - err = flashRead(&m25q, 0, 128, buffer); + err = flashRead(&snor1, 0, 128, buffer); if (err != FLASH_NO_ERROR) chSysHalt("read error"); /* Erasing the first sector and waiting for completion.*/ - (void) flashStartEraseSector(&m25q, 0); - err = flashWaitErase((BaseFlash *)&m25q); + (void) flashStartEraseSector(&snor1, 0); + err = flashWaitErase((BaseFlash *)&snor1); if (err != FLASH_NO_ERROR) chSysHalt("erase error"); /* Verifying the erase operation.*/ - err = flashVerifyErase(&m25q, 0); + err = flashVerifyErase(&snor1, 0); if (err != FLASH_NO_ERROR) chSysHalt("verify erase error"); /* Programming a pattern.*/ - err = flashProgram(&m25q, 0, 128, pattern); + err = flashProgram(&snor1, 0, 128, pattern); if (err != FLASH_NO_ERROR) chSysHalt("program error"); /* Verifying the erase operation.*/ - err = flashVerifyErase(&m25q, 0); + err = flashVerifyErase(&snor1, 0); if (err != FLASH_ERROR_VERIFY) chSysHalt("verify non-erase error"); /* Memory mapping the device.*/ - m25qMemoryMap(&m25q, &addr); + snorMemoryMap(&snor1, &addr); /* Unmapping the device.*/ - m25qMemoryUnmap(&m25q); + snorMemoryUnmap(&snor1); /* Reading it back.*/ memset(buffer, 0, 128); - err = flashRead(&m25q, 16, 128, buffer); + err = flashRead(&snor1, 16, 128, buffer); if (err != FLASH_NO_ERROR) chSysHalt("read error"); /* Reading it back.*/ memset(buffer, 0, 128); - err = flashRead(&m25q, 0, 128, buffer); + err = flashRead(&snor1, 0, 128, buffer); if (err != FLASH_NO_ERROR) chSysHalt("read error"); /* Erasing again.*/ - (void) flashStartEraseSector(&m25q, 0); - err = flashWaitErase((BaseFlash *)&m25q); + (void) flashStartEraseSector(&snor1, 0); + err = flashWaitErase((BaseFlash *)&snor1); if (err != FLASH_NO_ERROR) chSysHalt("erase error"); -- cgit v1.2.3