First batch of opensdk additions

Replacements for:
    libmain/misc.o
    libmain/os_cpu_a.o
    libmain/spi_flash.o
    libmain/timers.o
    libmain/uart.o
    libmain/xtensa_context.o
This commit is contained in:
Alex Stewart 2015-10-10 21:56:11 -07:00 committed by Angus Gratton
parent 78c5b43a40
commit 2ecbf1d584
14 changed files with 642 additions and 44 deletions

View file

@ -6,6 +6,8 @@
#ifndef __SPI_FLASH_H__
#define __SPI_FLASH_H__
#include "flashchip.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -44,29 +46,8 @@ sdk_SpiFlashOpResult sdk_spi_flash_write(uint32_t des_addr, const void *src, uin
*/
sdk_SpiFlashOpResult sdk_spi_flash_read(uint32_t src_addr, void *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
*/
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
}
#endif

39
include/etstimer.h Normal file
View file

@ -0,0 +1,39 @@
/* Structures and constants used by some SDK routines
*
* Part of esp-open-rtos
* Copyright (C) 2015 Superhouse Automation Pty Ltd
* BSD Licensed as described in the file LICENSE
*/
/* Note: The following definitions are normally found (in the non-RTOS SDK) in
* the ets_sys.h distributed by Espressif. Unfortunately, they are not found
* anywhere in the RTOS SDK headers, and differ substantially from the non-RTOS
* versions, so the structures defined here had to be obtained by careful
* examination of the code found in the Espressif RTOS SDK.
*/
/* Note also: These cannot be included in esp8266/ets_sys.h, because it is
* included from FreeRTOS.h, creating an (unnecessary) circular dependency.
* They have therefore been put into their own header file instead.
*/
#ifndef _ETSTIMER_H
#define _ETSTIMER_H
#include "FreeRTOS.h"
#include "timers.h"
#include "esp/types.h"
typedef void ETSTimerFunc(void *);
typedef struct ETSTimer_st {
struct ETSTimer_st *timer_next;
xTimerHandle timer_handle;
uint32_t _unknown;
uint32_t timer_ms;
ETSTimerFunc *timer_func;
bool timer_repeat;
void *timer_arg;
} ETSTimer;
#endif /* _ETSTIMER_H */