1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/nvram: Add const to write source buffer declaration

This commit is contained in:
Joakim Nohlgård 2016-07-12 07:47:20 +02:00
parent 49e0ea7fa6
commit 4798cd66d9
2 changed files with 7 additions and 5 deletions

View File

@ -70,7 +70,7 @@ typedef struct nvram {
* @return Number of bytes written on success * @return Number of bytes written on success
* @return <0 on errors * @return <0 on errors
*/ */
int (*write)(struct nvram *dev, uint8_t *src, uint32_t dst, size_t size); int (*write)(struct nvram *dev, const uint8_t *src, uint32_t dst, size_t size);
/** @brief Device capacity */ /** @brief Device capacity */
size_t size; size_t size;

View File

@ -53,7 +53,7 @@ typedef enum {
* @return Number of bytes written on success * @return Number of bytes written on success
* @return <0 on errors * @return <0 on errors
*/ */
static int nvram_spi_write(nvram_t *dev, uint8_t *src, uint32_t dst, size_t len); static int nvram_spi_write(nvram_t *dev, const uint8_t *src, uint32_t dst, size_t len);
/** /**
* @brief Copy data from NVRAM to system memory. * @brief Copy data from NVRAM to system memory.
@ -83,7 +83,7 @@ static int nvram_spi_read(nvram_t *dev, uint8_t *dst, uint32_t src, size_t len);
* @return Number of bytes written on success * @return Number of bytes written on success
* @return <0 on errors * @return <0 on errors
*/ */
static int nvram_spi_write_9bit_addr(nvram_t *dev, uint8_t *src, uint32_t dst, size_t len); static int nvram_spi_write_9bit_addr(nvram_t *dev, const uint8_t *src, uint32_t dst, size_t len);
/** /**
* @brief Copy data from NVRAM to system memory. * @brief Copy data from NVRAM to system memory.
@ -120,7 +120,7 @@ int nvram_spi_init(nvram_t *dev, nvram_spi_params_t *spi_params, size_t size)
return 0; return 0;
} }
static int nvram_spi_write(nvram_t *dev, uint8_t *src, uint32_t dst, size_t len) static int nvram_spi_write(nvram_t *dev, const uint8_t *src, uint32_t dst, size_t len)
{ {
nvram_spi_params_t *spi_dev = (nvram_spi_params_t *) dev->extra; nvram_spi_params_t *spi_dev = (nvram_spi_params_t *) dev->extra;
int status; int status;
@ -205,7 +205,7 @@ static int nvram_spi_read(nvram_t *dev, uint8_t *dst, uint32_t src, size_t len)
} }
static int nvram_spi_write_9bit_addr(nvram_t *dev, uint8_t *src, uint32_t dst, size_t len) static int nvram_spi_write_9bit_addr(nvram_t *dev, const uint8_t *src, uint32_t dst, size_t len)
{ {
nvram_spi_params_t *spi_dev = (nvram_spi_params_t *) dev->extra; nvram_spi_params_t *spi_dev = (nvram_spi_params_t *) dev->extra;
int status; int status;
@ -281,3 +281,5 @@ static int nvram_spi_read_9bit_addr(nvram_t *dev, uint8_t *dst, uint32_t src, si
/* status contains the number of bytes actually read from the SPI bus. */ /* status contains the number of bytes actually read from the SPI bus. */
return status; return status;
} }
/** @} */