From bf01a3b43429fe2db400ca89ba186795004a4fd2 Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Tue, 22 Mar 2016 17:11:18 -0700 Subject: [PATCH] Misc post-merge fixups --- core/esp_spi.c | 6 +++--- include/espressif/spi_flash.h | 21 +++------------------ open_esplibs/libmain/timers.c | 1 + 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/core/esp_spi.c b/core/esp_spi.c index c6c0546..7a8704c 100644 --- a/core/esp_spi.c +++ b/core/esp_spi.c @@ -178,7 +178,7 @@ static void _spi_buf_prepare(uint8_t bus, size_t len, spi_endianness_t e, spi_wo if (e == SPI_LITTLE_ENDIAN || word_size == SPI_32BIT) return; size_t count = word_size == SPI_16BIT ? (len + 1) / 2 : (len + 3) / 4; - uint32_t *data = (uint32_t *)&SPI(bus).W0; + uint32_t *data = (uint32_t *)SPI(bus).W; for (size_t i = 0; i < count; i ++) { data[i] = word_size == SPI_16BIT @@ -193,14 +193,14 @@ static void _spi_buf_transfer(uint8_t bus, const void *out_data, void *in_data, _wait(bus); size_t bytes = len * (uint8_t)word_size; _set_size(bus, bytes); - memcpy((void *)&SPI(bus).W0, out_data, bytes); + memcpy((void *)SPI(bus).W, out_data, bytes); _spi_buf_prepare(bus, len, e, word_size); _start(bus); _wait(bus); if (in_data) { _spi_buf_prepare(bus, len, e, word_size); - memcpy(in_data, (void *)&SPI(bus).W0, bytes); + memcpy(in_data, (void *)SPI(bus).W, bytes); } } diff --git a/include/espressif/spi_flash.h b/include/espressif/spi_flash.h index 491de2e..0b79e22 100644 --- a/include/espressif/spi_flash.h +++ b/include/espressif/spi_flash.h @@ -36,7 +36,7 @@ sdk_SpiFlashOpResult sdk_spi_flash_erase_sector(uint16_t sec); src is pointer to a buffer to read bytes from. size is length of buffer in bytes. Should be a multiple of 4. */ -sdk_SpiFlashOpResult sdk_spi_flash_write(uint32_t des_addr, const void *src, uint32_t size); +sdk_SpiFlashOpResult sdk_spi_flash_write(uint32_t des_addr, uint32_t *src, uint32_t size); /* Read data from flash. @@ -44,28 +44,13 @@ sdk_SpiFlashOpResult sdk_spi_flash_write(uint32_t des_addr, const void *src, uin des is pointer to a buffer to read bytes into. size is number of bytes to read. Should be a multiple of 4. */ -sdk_SpiFlashOpResult sdk_spi_flash_read(uint32_t src_addr, void *des, uint32_t size); +sdk_SpiFlashOpResult sdk_spi_flash_read(uint32_t src_addr, uint32_t *des, uint32_t size); /* SDK uses this structure internally to account for flash size. - chip_size field is initialised during startup from the flash size - saved in the image header (on the first 8 bytes of SPI flash). - - Other field are initialised to hardcoded values by the SDK. - - Based on RE work by @foogod at - http://esp8266-re.foogod.com/wiki/Flashchip_%28IoT_RTOS_SDK_0.9.9%29 + See flashchip.h for more info. */ -typedef struct { - uint32_t device_id; - uint32_t chip_size; /* in bytes */ - uint32_t block_size; /* in bytes */ - uint32_t sector_size; /* in bytes */ - uint32_t page_size; /* in bytes */ - uint32_t status_mask; -} sdk_flashchip_t; - extern sdk_flashchip_t sdk_flashchip; #ifdef __cplusplus diff --git a/open_esplibs/libmain/timers.c b/open_esplibs/libmain/timers.c index 1359fc1..1e2a920 100644 --- a/open_esplibs/libmain/timers.c +++ b/open_esplibs/libmain/timers.c @@ -1,4 +1,5 @@ #include "etstimer.h" +#include "stdio.h" struct timer_list_st { struct timer_list_st *next;