From 519ed7163ca4d71d5cf3b36e5ce62f63ceb003fe Mon Sep 17 00:00:00 2001 From: Simon Gene Gottlieb Date: Wed, 25 Jun 2014 20:50:43 +0200 Subject: [PATCH] board/flash: changing flashrom_write signature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit → changing all flashrom_write() function to the same signature → adding const keyword to signature --- boards/msb-430-common/board_config.c | 2 +- boards/msba2-common/board_config.c | 2 +- boards/wsn430-common/board_config.c | 2 +- cpu/cc430/flashrom.c | 3 ++- cpu/lpc_common/iap.c | 2 +- cpu/msp430x16x/flashrom.c | 3 ++- drivers/include/flashrom.h | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/boards/msb-430-common/board_config.c b/boards/msb-430-common/board_config.c index 3efa513baf..3a09101cb7 100644 --- a/boards/msb-430-common/board_config.c +++ b/boards/msb-430-common/board_config.c @@ -37,5 +37,5 @@ void config_load(void) uint8_t config_save(void) { configmem_t mem = { CONFIG_KEY, sysconfig }; - return (flashrom_erase((uint8_t *) INFOMEM) && flashrom_write((uint8_t *) INFOMEM, (char *) &mem, sizeof(mem))); + return (flashrom_erase((uint8_t *) INFOMEM) && flashrom_write((uint8_t *) INFOMEM, (uint8_t *) &mem, sizeof(mem))); } diff --git a/boards/msba2-common/board_config.c b/boards/msba2-common/board_config.c index 4649b8bf73..9065bff79d 100644 --- a/boards/msba2-common/board_config.c +++ b/boards/msba2-common/board_config.c @@ -38,5 +38,5 @@ void config_load(void) { uint8_t config_save(void) { configmem_t mem = { CONFIG_KEY, sysconfig }; - return (flashrom_erase((uint8_t*) &configmem) && flashrom_write((uint8_t*) &configmem, (char*) &mem, sizeof(mem))); + return (flashrom_erase((uint8_t*) &configmem) && flashrom_write((uint8_t*) &configmem, (uint8_t*) &mem, sizeof(mem))); } diff --git a/boards/wsn430-common/board_config.c b/boards/wsn430-common/board_config.c index a48589d408..d6734b9fd9 100644 --- a/boards/wsn430-common/board_config.c +++ b/boards/wsn430-common/board_config.c @@ -22,5 +22,5 @@ void config_load(void) { uint8_t config_save(void) { configmem_t mem = { CONFIG_KEY, sysconfig }; - return (flashrom_erase((uint8_t*) INFOMEM) && flashrom_write((uint8_t*) INFOMEM, (char*) &mem, sizeof(mem))); + return (flashrom_erase((uint8_t*) INFOMEM) && flashrom_write((uint8_t*) INFOMEM, (uint8_t*) &mem, sizeof(mem))); } diff --git a/cpu/cc430/flashrom.c b/cpu/cc430/flashrom.c index 7aa03c2cc0..a90a5500ba 100644 --- a/cpu/cc430/flashrom.c +++ b/cpu/cc430/flashrom.c @@ -34,9 +34,10 @@ uint8_t flashrom_erase(uint8_t *addr) return 0; } /*---------------------------------------------------------------------------*/ -void flashrom_write(uint8_t *dst, uint8_t *src, size_t size) +uint8_t flashrom_write(uint8_t *dst, const uint8_t *src, size_t size) { // TODO implement this function + return 0; } /*---------------------------------------------------------------------------*/ diff --git a/cpu/lpc_common/iap.c b/cpu/lpc_common/iap.c index 44ad34cd85..56f7622c5e 100644 --- a/cpu/lpc_common/iap.c +++ b/cpu/lpc_common/iap.c @@ -53,7 +53,7 @@ static uint32_t iap(uint32_t code, uint32_t p1, uint32_t p2, uint32_t p3, uint32 /****************************************************************************** * P U B L I C F U N C T I O N S *****************************************************************************/ -uint8_t flashrom_write(uint8_t *dst, char *src, size_t size) +uint8_t flashrom_write(uint8_t *dst, const uint8_t *src, size_t size) { (void) size; /* unused */ diff --git a/cpu/msp430x16x/flashrom.c b/cpu/msp430x16x/flashrom.c index 1d8200add0..17400072a9 100644 --- a/cpu/msp430x16x/flashrom.c +++ b/cpu/msp430x16x/flashrom.c @@ -46,7 +46,7 @@ uint8_t flashrom_erase(uint8_t *addr) return 1; } -void flashrom_write(uint8_t *dst, uint8_t *src, size_t size) +uint8_t flashrom_write(uint8_t *dst, const uint8_t *src, size_t size) { unsigned int i; FCTL3 = FWKEY; /* Lock = 0 */ @@ -64,6 +64,7 @@ void flashrom_write(uint8_t *dst, uint8_t *src, size_t size) busy_wait(); FCTL1 = FWKEY; /* WRT = 0 */ FCTL3 = FWKEY | LOCK; /* Lock = 1 */ + return 1; } /*---------------------------------------------------------------------------*/ diff --git a/drivers/include/flashrom.h b/drivers/include/flashrom.h index 59ce1ee528..4d48ddeb27 100644 --- a/drivers/include/flashrom.h +++ b/drivers/include/flashrom.h @@ -32,7 +32,7 @@ uint8_t flashrom_erase(uint8_t *addr); * * @return 1 on success, 0 otherwise */ -uint8_t flashrom_write(uint8_t *dst, char *src, size_t size); +uint8_t flashrom_write(uint8_t *dst, const uint8_t *src, size_t size); /** @} */ #endif /* FLASHROM_H */