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:
parent
8bcec7eea1
commit
1da996ee10
16 changed files with 699 additions and 44 deletions
|
@ -5,7 +5,9 @@
|
|||
*/
|
||||
#ifndef _ESP_ROM_H
|
||||
#define _ESP_ROM_H
|
||||
#include <stdint.h>
|
||||
|
||||
#include "esp/types.h"
|
||||
#include "flashchip.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -21,8 +23,19 @@ void Cache_Read_Disable(void);
|
|||
*/
|
||||
void Cache_Read_Enable(uint32_t odd_even, uint32_t mb_count, uint32_t no_idea);
|
||||
|
||||
/* Low-level SPI flash read/write routines */
|
||||
int Enable_QMode(sdk_flashchip_t *chip);
|
||||
int Disable_QMode(sdk_flashchip_t *chip);
|
||||
int SPI_page_program(sdk_flashchip_t *chip, uint32_t dest_addr, uint32_t *src_addr, uint32_t size);
|
||||
int SPI_read_data(sdk_flashchip_t *chip, uint32_t src_addr, uint32_t *dest_addr, uint32_t size);
|
||||
int SPI_write_enable(sdk_flashchip_t *chip);
|
||||
int SPI_sector_erase(sdk_flashchip_t *chip, uint32_t addr);
|
||||
int SPI_read_status(sdk_flashchip_t *chip, uint32_t *status);
|
||||
int SPI_write_status(sdk_flashchip_t *chip, uint32_t status);
|
||||
int Wait_SPI_Idle(sdk_flashchip_t *chip);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* _ESP_ROM_H */
|
||||
|
|
56
core/include/esp/rtc_regs.h
Normal file
56
core/include/esp/rtc_regs.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/* esp/rtc_regs.h
|
||||
*
|
||||
* ESP8266 RTC register definitions
|
||||
*
|
||||
* Not compatible with ESP SDK register access code.
|
||||
*/
|
||||
|
||||
#ifndef _ESP_RTC_REGS_H
|
||||
#define _ESP_RTC_REGS_H
|
||||
|
||||
#include "esp/types.h"
|
||||
#include "common_macros.h"
|
||||
|
||||
#define RTC_BASE 0x60000700
|
||||
#define RTC (*(struct RTC_REGS *)(RTC_BASE))
|
||||
|
||||
//FIXME: need to understand/clarify distinction between GPIO_CONF and GPIO_CFG[]
|
||||
// Note: GPIO_CFG[3] is also known as PAD_XPD_DCDC_CONF in eagle_soc.h
|
||||
|
||||
struct RTC_REGS {
|
||||
uint32_t volatile _unknown0; // 0x00
|
||||
uint32_t volatile COUNTER_ALARM; // 0x04
|
||||
uint32_t volatile RESET_REASON0; // 0x08 //FIXME: need better name
|
||||
uint32_t volatile _unknownc[2]; // 0x0c - 0x10
|
||||
uint32_t volatile RESET_REASON1; // 0x14 //FIXME: need better name
|
||||
uint32_t volatile RESET_REASON2; // 0x18 //FIXME: need better name
|
||||
uint32_t volatile COUNTER; // 0x1c
|
||||
uint32_t volatile INT_SET; // 0x20
|
||||
uint32_t volatile INT_CLEAR; // 0x24
|
||||
uint32_t volatile INT_ENABLE; // 0x28
|
||||
uint32_t volatile _unknown2c; // 0x2c
|
||||
uint32_t volatile SCRATCH[4]; // 0x30 - 3c
|
||||
uint32_t volatile _unknown40[10]; // 0x40 - 0x64
|
||||
uint32_t volatile GPIO_OUT; // 0x68
|
||||
uint32_t volatile _unknown6c[2]; // 0x6c - 0x70
|
||||
uint32_t volatile GPIO_ENABLE; // 0x74
|
||||
uint32_t volatile _unknown80[5]; // 0x78 - 0x88
|
||||
uint32_t volatile GPIO_IN; // 0x8c
|
||||
uint32_t volatile GPIO_CONF; // 0x90
|
||||
uint32_t volatile GPIO_CFG[6]; // 0x94 - 0xa8
|
||||
};
|
||||
|
||||
_Static_assert(sizeof(struct RTC_REGS) == 0xac, "RTC_REGS is the wrong size");
|
||||
|
||||
/* The following are used in sdk_rtc_get_reset_reason(). Details are still a
|
||||
* bit sketchy regarding exactly what they mean/do.. */
|
||||
|
||||
#define RTC_RESET_REASON1_CODE_M 0x0000000f
|
||||
#define RTC_RESET_REASON1_CODE_S 0
|
||||
|
||||
#define RTC_RESET_REASON2_CODE_M 0x0000003f
|
||||
#define RTC_RESET_REASON2_CODE_S 8
|
||||
|
||||
#define RTC_RESET_REASON0_SOMETHING BIT(21)
|
||||
|
||||
#endif /* _ESP_RTC_REGS_H */
|
|
@ -46,22 +46,7 @@ struct SPI_REGS {
|
|||
uint32_t volatile SLAVE1; // 0x34
|
||||
uint32_t volatile SLAVE2; // 0x38
|
||||
uint32_t volatile SLAVE3; // 0x3c
|
||||
uint32_t volatile W0; // 0x40
|
||||
uint32_t volatile W1; // 0x44
|
||||
uint32_t volatile W2; // 0x48
|
||||
uint32_t volatile W3; // 0x4c
|
||||
uint32_t volatile W4; // 0x50
|
||||
uint32_t volatile W5; // 0x54
|
||||
uint32_t volatile W6; // 0x58
|
||||
uint32_t volatile W7; // 0x5c
|
||||
uint32_t volatile W8; // 0x60
|
||||
uint32_t volatile W9; // 0x64
|
||||
uint32_t volatile W10; // 0x68
|
||||
uint32_t volatile W11; // 0x6c
|
||||
uint32_t volatile W12; // 0x70
|
||||
uint32_t volatile W13; // 0x74
|
||||
uint32_t volatile W14; // 0x78
|
||||
uint32_t volatile W15; // 0x7c
|
||||
uint32_t volatile W[16]; // 0x40 - 0x7c
|
||||
uint32_t volatile _unused[28]; // 0x80 - 0xec
|
||||
uint32_t volatile EXT0; // 0xf0
|
||||
uint32_t volatile EXT1; // 0xf4
|
||||
|
@ -73,6 +58,19 @@ _Static_assert(sizeof(struct SPI_REGS) == 0x100, "SPI_REGS is the wrong size");
|
|||
|
||||
/* Details for CMD register */
|
||||
|
||||
#define SPI_CMD_READ BIT(31)
|
||||
#define SPI_CMD_WRITE_ENABLE BIT(30)
|
||||
#define SPI_CMD_WRITE_DISABLE BIT(29)
|
||||
#define SPI_CMD_READ_ID BIT(28)
|
||||
#define SPI_CMD_READ_SR BIT(27)
|
||||
#define SPI_CMD_WRITE_SR BIT(26)
|
||||
#define SPI_CMD_PP BIT(25)
|
||||
#define SPI_CMD_SE BIT(24)
|
||||
#define SPI_CMD_BE BIT(23)
|
||||
#define SPI_CMD_CE BIT(22)
|
||||
#define SPI_CMD_DP BIT(21)
|
||||
#define SPI_CMD_RES BIT(20)
|
||||
#define SPI_CMD_HPM BIT(19)
|
||||
#define SPI_CMD_USR BIT(18)
|
||||
|
||||
/* Details for CTRL0 register */
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _ESP_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef volatile uint32_t *esp_reg_t;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue