Skip to content

Commit

Permalink
esp8266: Bump SDK headers to 1.0
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Andrianov <andrew@ncrmnt.org>
  • Loading branch information
nekromant committed Jul 11, 2018
1 parent 8f884d0 commit 47f1a52
Show file tree
Hide file tree
Showing 15 changed files with 519 additions and 58 deletions.
115 changes: 115 additions & 0 deletions src/arch/esp8266/include-sdk/at_custom.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@

/*
* custom_at.h
*
* This file is part of Espressif's AT+ command set program.
* Copyright (C) 2013 - 2016, Espressif Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef CUSTOM_AT_H_
#define CUSTOM_AT_H_

#include "c_types.h"

typedef struct
{
char *at_cmdName;
int8_t at_cmdLen;
void (*at_testCmd)(uint8_t id);
void (*at_queryCmd)(uint8_t id);
void (*at_setupCmd)(uint8_t id, char *pPara);
void (*at_exeCmd)(uint8_t id);
}at_funcationType;

extern uint8 at_customLinkMax;
/**
* @brief Response "OK" to uart.
* @param None
* @retval None
*/
void at_response_ok(void);
/**
* @brief Response "ERROR" to uart.
* @param events: no used
* @retval None
*/
void at_response_error(void);
/**
* @brief Task of process command or txdata.
* @param custom_at_cmd_array: the array of at cmd that custom defined
* cmd_num : the num of at cmd that custom defined
* @retval None
*/
void at_cmd_array_regist(at_funcationType *custom_at_cmd_array,uint32 cmd_num);
/**
* @brief get digit form at cmd line.the maybe alter pSrc
* @param p_src: at cmd line string
* result:the buffer to be placed result
* err : err num
* @retval TRUE:
* FALSE:
*/
bool at_get_next_int_dec(char **p_src,int*result,int* err);
/**
* @brief get string form at cmd line.the maybe alter pSrc
* @param p_dest: the buffer to be placed result
* p_src: at cmd line string
* max_len :max len of string excepted to get
* @retval None
*/
int32 at_data_str_copy(char *p_dest, char **p_src, int32 max_len);

/**
* @brief initialize at module
* @param None
* @retval None
*/
void at_init(void);
/**
* @brief print string to at port
* @param string
* @retval None
*/
void at_port_print(const char *str);
/**
* @brief print custom information when AT+GMR
* @param string
* @retval None
*/
void at_set_custom_info(char* info);
/**
* @brief if current at command is processing,you can call at_enter_special_state,
* then if other comamnd coming,it will return busy.
* @param None
* @retval None
*/
void at_enter_special_state(void);
/**
* @brief
* @param None
* @retval None
*/
void at_leave_special_state(void);
/**
* @brief get at version
* @param None
* @retval at version
* bit24~31: at main version
* bit23~16: at sub version
* bit15~8 : at test version
* bit7~0 : customized version
*/
uint32 at_get_version(void);
#endif
18 changes: 15 additions & 3 deletions src/arch/esp8266/include-sdk/c_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#ifndef _C_TYPES_H_
#define _C_TYPES_H_

#include <stdint.h>
#include <stdbool.h>


#if 0
typedef unsigned char uint8_t;
typedef signed char sint8_t;
typedef signed char int8_t;
Expand All @@ -20,6 +25,7 @@ typedef unsigned long long uint64_t;
typedef unsigned long long u_int64_t;
typedef float real32_t;
typedef double real64_t;
#endif

typedef unsigned char uint8;
typedef unsigned char u8;
Expand All @@ -42,6 +48,11 @@ typedef unsigned long long u64;
typedef float real32;
typedef double real64;

#define sint16_t sint16
#define sint8_t sint8
#define sint32_t sint32
#define sint64_t sint64

#define __le16 u16

typedef unsigned int size_t;
Expand Down Expand Up @@ -73,15 +84,16 @@ typedef enum {

#ifdef ICACHE_FLASH
#define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
#define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
#else
#define ICACHE_FLASH_ATTR
#endif /* ICACHE_FLASH */

#ifndef __cplusplus
typedef unsigned char bool;
//typedef unsigned char bool;
#define BOOL bool
#define true (1)
#define false (0)
//#define true (1)
//#define false (0)
#define TRUE true
#define FALSE false

Expand Down
84 changes: 84 additions & 0 deletions src/arch/esp8266/include-sdk/espconn.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ typedef struct _esp_tcp {
espconn_connect_callback connect_callback;
espconn_reconnect_callback reconnect_callback;
espconn_connect_callback disconnect_callback;
espconn_connect_callback write_finish_fn;
} esp_tcp;

typedef struct _esp_udp {
Expand Down Expand Up @@ -87,6 +88,14 @@ struct espconn {
void *reverse;
};

enum espconn_option{
ESPCONN_START = 0x00,
ESPCONN_REUSEADDR = 0x01,
ESPCONN_NODELAY = 0x02,
ESPCONN_COPY = 0x04,
ESPCONN_END
};

/******************************************************************************
* FunctionName : espconn_connect
* Description : The function given as the connect
Expand Down Expand Up @@ -132,6 +141,43 @@ sint8 espconn_accept(struct espconn *espconn);

sint8 espconn_create(struct espconn *espconn);

/******************************************************************************
* FunctionName : espconn_tcp_get_max_con
* Description : get the number of simulatenously active TCP connections
* Parameters : none
* Returns : none
*******************************************************************************/

uint8 espconn_tcp_get_max_con(void);

/******************************************************************************
* FunctionName : espconn_tcp_set_max_con
* Description : set the number of simulatenously active TCP connections
* Parameters : num -- total number
* Returns : none
*******************************************************************************/

sint8 espconn_tcp_set_max_con(uint8 num);

/******************************************************************************
* FunctionName : espconn_tcp_get_max_con_allow
* Description : get the count of simulatenously active connections on the server
* Parameters : espconn -- espconn to get the count
* Returns : result
*******************************************************************************/

sint8 espconn_tcp_get_max_con_allow(struct espconn *espconn);

/******************************************************************************
* FunctionName : espconn_tcp_set_max_con_allow
* Description : set the count of simulatenously active connections on the server
* Parameters : espconn -- espconn to set the count
* num -- support the connection number
* Returns : result
*******************************************************************************/

sint8 espconn_tcp_set_max_con_allow(struct espconn *espconn, uint8 num);

/******************************************************************************
* FunctionName : espconn_regist_time
* Description : used to specify the time that should be called when don't recv data
Expand Down Expand Up @@ -164,6 +210,18 @@ sint8 espconn_get_connection_info(struct espconn *pespconn, remot_info **pcon_in

sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callback sent_cb);

/******************************************************************************
* FunctionName : espconn_regist_sentcb
* Description : Used to specify the function that should be called when data
* has been successfully delivered to the remote host.
* Parameters : espconn -- espconn to set the sent callback
* sent_cb -- sent callback function to call for this espconn
* when data is successfully sent
* Returns : none
*******************************************************************************/

sint8 espconn_regist_write_finish(struct espconn *espconn, espconn_connect_callback write_finish_fn);

/******************************************************************************
* FunctionName : espconn_sent
* Description : sent data for client or server
Expand Down Expand Up @@ -228,6 +286,16 @@ sint8 espconn_regist_disconcb(struct espconn *espconn, espconn_connect_callback

uint32 espconn_port(void);

/******************************************************************************
* FunctionName : espconn_set_opt
* Description : access port value for client so that we don't end up bouncing
* all connections at the same time .
* Parameters : none
* Returns : access port value
*******************************************************************************/

sint8 espconn_set_opt(struct espconn *espconn, uint8 opt);

/******************************************************************************
* TypedefName : dns_found_callback
* Description : Callback which is invoked when a hostname is found.
Expand Down Expand Up @@ -317,5 +385,21 @@ sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
*******************************************************************************/
sint8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip);

/******************************************************************************
* FunctionName : espconn_recv_hold
* Description : hold tcp receive
* Parameters : espconn -- espconn to hold
* Returns : none
*******************************************************************************/
sint8 espconn_recv_hold(struct espconn *pespconn);

/******************************************************************************
* FunctionName : espconn_recv_unhold
* Description : unhold tcp receive
* Parameters : espconn -- espconn to unhold
* Returns : none
*******************************************************************************/
sint8 espconn_recv_unhold(struct espconn *pespconn);

#endif

5 changes: 5 additions & 0 deletions src/arch/esp8266/include-sdk/espmissingincludes.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,9 @@ int os_printf (const char *fmt, ...) __attribute__(
#define os_printf os_printf_plus
#endif

/* These were dropped from newer SDKs */
int wifi_softap_set_station_info(uint8_t *addr, struct ip_addr *adr);
void system_station_got_ip_set(ip_addr_t * ip_addr, ip_addr_t *sn_mask, ip_addr_t *gw_addr);
void system_pp_recycle_rx_pkt (void*);

#endif
7 changes: 7 additions & 0 deletions src/arch/esp8266/include-sdk/ets_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ typedef struct _ETSTIMER_ {
} ETSTimer;

/* interrupt related */
#define ETS_SPI_INUM 2
#define ETS_GPIO_INUM 4
#define ETS_UART_INUM 5
#define ETS_UART1_INUM 5
Expand All @@ -56,12 +57,18 @@ typedef struct _ETSTIMER_ {
#define ETS_UART_INTR_ATTACH(func, arg) \
ets_isr_attach(ETS_UART_INUM, (func), (void *)(arg))

#define ETS_SPI_INTR_ATTACH(func, arg) \
ets_isr_attach(ETS_SPI_INUM, (func), (void *)(arg))

#define ETS_INTR_ENABLE(inum) \
ets_isr_unmask((1<<inum))

#define ETS_INTR_DISABLE(inum) \
ets_isr_mask((1<<inum))

#define ETS_SPI_INTR_ENABLE() \
ETS_INTR_ENABLE(ETS_SPI_INUM)

#define ETS_UART_INTR_ENABLE() \
ETS_INTR_ENABLE(ETS_UART_INUM)

Expand Down
2 changes: 1 addition & 1 deletion src/arch/esp8266/include-sdk/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ typedef enum {
GPIO_PIN_INTR_DISABLE = 0,
GPIO_PIN_INTR_POSEDGE = 1,
GPIO_PIN_INTR_NEGEDGE = 2,
GPIO_PIN_INTR_ANYEGDE = 3,
GPIO_PIN_INTR_ANYEDGE = 3,
GPIO_PIN_INTR_LOLEVEL = 4,
GPIO_PIN_INTR_HILEVEL = 5
} GPIO_INT_TYPE;
Expand Down
5 changes: 5 additions & 0 deletions src/arch/esp8266/include-sdk/ip_addr.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ struct ip_info {
#define ip4_addr3_16(ipaddr) ((uint16)ip4_addr3(ipaddr))
#define ip4_addr4_16(ipaddr) ((uint16)ip4_addr4(ipaddr))


/** 255.255.255.255 */
#define IPADDR_NONE ((uint32)0xffffffffUL)
/** 0.0.0.0 */
#define IPADDR_ANY ((uint32)0x00000000UL)
uint32 ipaddr_addr(const char *cp);

#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
Expand Down
3 changes: 3 additions & 0 deletions src/arch/esp8266/include-sdk/json/jsonparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ int jsonparse_get_value_as_int(struct jsonparse_state *state);
/* get the current JSON value parsed as a long */
long jsonparse_get_value_as_long(struct jsonparse_state *state);

/* get the current JSON value parsed as a unsigned long */
unsigned long jsonparse_get_value_as_ulong(struct jsonparse_state *state);

/* get the length of the current JSON value */
int jsonparse_get_len(struct jsonparse_state *state);

Expand Down
11 changes: 10 additions & 1 deletion src/arch/esp8266/include-sdk/osapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <string.h>
#include "user_config.h"
#include "espmissingincludes.h"

#define os_bzero ets_bzero
#define os_delay_us ets_delay_us
Expand Down Expand Up @@ -45,4 +44,14 @@
#define os_sprintf ets_sprintf
#define os_update_cpu_frequency ets_update_cpu_frequency

#ifdef USE_OPTIMIZE_PRINTF
#define os_printf(fmt, ...) do { \
static const char flash_str[] ICACHE_RODATA_ATTR = fmt; \
os_printf_plus(flash_str, ##__VA_ARGS__); \
} while(0)
#else
#define os_printf os_printf_plus
#endif

#endif

Loading

0 comments on commit 47f1a52

Please sign in to comment.