Misc post-merge fixups
This commit is contained in:
parent
9848307587
commit
bf01a3b434
3 changed files with 7 additions and 21 deletions
|
@ -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;
|
if (e == SPI_LITTLE_ENDIAN || word_size == SPI_32BIT) return;
|
||||||
|
|
||||||
size_t count = word_size == SPI_16BIT ? (len + 1) / 2 : (len + 3) / 4;
|
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 ++)
|
for (size_t i = 0; i < count; i ++)
|
||||||
{
|
{
|
||||||
data[i] = word_size == SPI_16BIT
|
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);
|
_wait(bus);
|
||||||
size_t bytes = len * (uint8_t)word_size;
|
size_t bytes = len * (uint8_t)word_size;
|
||||||
_set_size(bus, bytes);
|
_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);
|
_spi_buf_prepare(bus, len, e, word_size);
|
||||||
_start(bus);
|
_start(bus);
|
||||||
_wait(bus);
|
_wait(bus);
|
||||||
if (in_data)
|
if (in_data)
|
||||||
{
|
{
|
||||||
_spi_buf_prepare(bus, len, e, word_size);
|
_spi_buf_prepare(bus, len, e, word_size);
|
||||||
memcpy(in_data, (void *)&SPI(bus).W0, bytes);
|
memcpy(in_data, (void *)SPI(bus).W, bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ sdk_SpiFlashOpResult sdk_spi_flash_erase_sector(uint16_t sec);
|
||||||
src is pointer to a buffer to read bytes from.
|
src is pointer to a buffer to read bytes from.
|
||||||
size is length of buffer in bytes. Should be a multiple of 4.
|
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.
|
/* 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.
|
des is pointer to a buffer to read bytes into.
|
||||||
size is number of bytes to read. Should be a multiple of 4.
|
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.
|
/* SDK uses this structure internally to account for flash size.
|
||||||
|
|
||||||
chip_size field is initialised during startup from the flash size
|
See flashchip.h for more info.
|
||||||
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
|
|
||||||
*/
|
*/
|
||||||
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;
|
extern sdk_flashchip_t sdk_flashchip;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "etstimer.h"
|
#include "etstimer.h"
|
||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
struct timer_list_st {
|
struct timer_list_st {
|
||||||
struct timer_list_st *next;
|
struct timer_list_st *next;
|
||||||
|
|
Loading…
Reference in a new issue