Update IDF to 3.2-3276a13 and esptool.py to 2.5.0 (#1878)

* TX Flow Control and Code cleanup

* Use semaphore instead of delay

TX functionality is done.

* Use single buffer and empty queue on exit

* Fix compile issues because of LwIP code relocation

* Add temporary header to fix Azure not compiling

* Fix AsyncUDP early init

* AsyncUDP Multicast fixes

* Add source mac address and rework multicast

* Allow redefinition of default pins for Serials 1 and 2

* Update IDF to 3276a13

* Update esptool.py to 2.5.0

* Fix sketches

* Fix log level in BluetoothSetial
This commit is contained in:
Me No Dev
2018-09-21 08:39:36 +02:00
committed by GitHub
parent 4e96bffe0e
commit 96822d783f
447 changed files with 37993 additions and 10849 deletions

View File

@ -1,11 +1,39 @@
#ifndef __ERRNO_H__
#define __ERRNO_H__
#ifndef __error_t_defined
typedef int error_t;
#define __error_t_defined 1
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _ESP_PLATFORM_ERRNO_H_
#define _ESP_PLATFORM_ERRNO_H_
#include_next "errno.h"
//
// Possibly define some missing errors
//
#ifndef ESHUTDOWN
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
#endif
#include <sys/errno.h>
#ifndef EAI_SOCKTYPE
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
#endif
#endif /* !__ERRNO_H__ */
#ifndef EAI_AGAIN
#define EAI_AGAIN 2 /* temporary failure in name resolution */
#endif
#ifndef EAI_BADFLAGS
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
#endif
#endif // _ESP_PLATFORM_ERRNO_H_

View File

@ -0,0 +1,45 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _ESP_PLATFORM_NET_IF_H_
#define _ESP_PLATFORM_NET_IF_H_
#define MSG_DONTROUTE 0x4 /* send without using routing tables */
#define SOCK_SEQPACKET 5 /* sequenced packet stream */
#define MSG_EOR 0x8 /* data completes record */
#define SOCK_SEQPACKET 5 /* sequenced packet stream */
#define SOMAXCONN 128
#define IF_NAMESIZE 16
#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
struct ipv6_mreq {
struct in6_addr ipv6mr_multiaddr;
unsigned int ipv6mr_interface;
};
typedef u32_t socklen_t;
unsigned int if_nametoindex(const char *ifname);
char *if_indextoname(unsigned int ifindex, char *ifname);
#endif // _ESP_PLATFORM_NET_IF_H_

View File

@ -1,431 +1,33 @@
/* pthread.h
*
* Written by Joel Sherrill <joel@OARcorp.com>.
*
* COPYRIGHT (c) 1989-2013.
* On-Line Applications Research Corporation (OAR).
*
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
* is included in all copies of any software which is or includes a copy
* or modification of this software.
*
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
* OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
* SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*
* $Id$
*/
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP_PLATFORM_PTHREAD_H__
#define __ESP_PLATFORM_PTHREAD_H__
#ifndef __PTHREAD_h
#define __PTHREAD_h
#include <sys/types.h>
#include <sys/time.h>
#include_next <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <unistd.h>
#if defined(_POSIX_THREADS)
#include <sys/types.h>
#include <time.h>
#include <sys/sched.h>
#include <sys/cdefs.h>
struct _pthread_cleanup_context {
void (*_routine)(void *);
void *_arg;
int _canceltype;
struct _pthread_cleanup_context *_previous;
};
/* Register Fork Handlers */
int _EXFUN(pthread_atfork,(void (*prepare)(void), void (*parent)(void),
void (*child)(void)));
/* Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81 */
int _EXFUN(pthread_mutexattr_init, (pthread_mutexattr_t *__attr));
int _EXFUN(pthread_mutexattr_destroy, (pthread_mutexattr_t *__attr));
int _EXFUN(pthread_mutexattr_getpshared,
(_CONST pthread_mutexattr_t *__attr, int *__pshared));
int _EXFUN(pthread_mutexattr_setpshared,
(pthread_mutexattr_t *__attr, int __pshared));
#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
/* Single UNIX Specification 2 Mutex Attributes types */
int _EXFUN(pthread_mutexattr_gettype,
(_CONST pthread_mutexattr_t *__attr, int *__kind));
int _EXFUN(pthread_mutexattr_settype,
(pthread_mutexattr_t *__attr, int __kind));
#endif
/* Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87 */
int _EXFUN(pthread_mutex_init,
(pthread_mutex_t *__mutex, _CONST pthread_mutexattr_t *__attr));
int _EXFUN(pthread_mutex_destroy, (pthread_mutex_t *__mutex));
/* This is used to statically initialize a pthread_mutex_t. Example:
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
*/
#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
/* Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29 */
int _EXFUN(pthread_mutex_lock, (pthread_mutex_t *__mutex));
int _EXFUN(pthread_mutex_trylock, (pthread_mutex_t *__mutex));
int _EXFUN(pthread_mutex_unlock, (pthread_mutex_t *__mutex));
#if defined(_POSIX_TIMEOUTS)
int _EXFUN(pthread_mutex_timedlock,
(pthread_mutex_t *__mutex, _CONST struct timespec *__timeout));
#endif /* _POSIX_TIMEOUTS */
/* Condition Variable Initialization Attributes, P1003.1c/Draft 10, p. 96 */
int _EXFUN(pthread_condattr_init, (pthread_condattr_t *__attr));
int _EXFUN(pthread_condattr_destroy, (pthread_condattr_t *__attr));
int _EXFUN(pthread_condattr_getpshared,
(_CONST pthread_condattr_t *__attr, int *__pshared));
int _EXFUN(pthread_condattr_setpshared,
(pthread_condattr_t *__attr, int __pshared));
/* Initializing and Destroying a Condition Variable, P1003.1c/Draft 10, p. 87 */
int _EXFUN(pthread_cond_init,
(pthread_cond_t *__cond, _CONST pthread_condattr_t *__attr));
int _EXFUN(pthread_cond_destroy, (pthread_cond_t *__mutex));
/* This is used to statically initialize a pthread_cond_t. Example:
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
*/
#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) 0xFFFFFFFF)
/* Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101 */
int _EXFUN(pthread_cond_signal, (pthread_cond_t *__cond));
int _EXFUN(pthread_cond_broadcast, (pthread_cond_t *__cond));
/* Waiting on a Condition, P1003.1c/Draft 10, p. 105 */
int _EXFUN(pthread_cond_wait,
(pthread_cond_t *__cond, pthread_mutex_t *__mutex));
int _EXFUN(pthread_cond_timedwait,
(pthread_cond_t *__cond, pthread_mutex_t *__mutex,
_CONST struct timespec *__abstime));
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
/* Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120 */
int _EXFUN(pthread_attr_setscope,
(pthread_attr_t *__attr, int __contentionscope));
int _EXFUN(pthread_attr_getscope,
(_CONST pthread_attr_t *__attr, int *__contentionscope));
int _EXFUN(pthread_attr_setinheritsched,
(pthread_attr_t *__attr, int __inheritsched));
int _EXFUN(pthread_attr_getinheritsched,
(_CONST pthread_attr_t *__attr, int *__inheritsched));
int _EXFUN(pthread_attr_setschedpolicy,
(pthread_attr_t *__attr, int __policy));
int _EXFUN(pthread_attr_getschedpolicy,
(_CONST pthread_attr_t *__attr, int *__policy));
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
int _EXFUN(pthread_attr_setschedparam,
(pthread_attr_t *__attr, _CONST struct sched_param *__param));
int _EXFUN(pthread_attr_getschedparam,
(_CONST pthread_attr_t *__attr, struct sched_param *__param));
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
/* Dynamic Thread Scheduling Parameters Access, P1003.1c/Draft 10, p. 124 */
int _EXFUN(pthread_getschedparam,
(pthread_t __pthread, int *__policy, struct sched_param *__param));
int _EXFUN(pthread_setschedparam,
(pthread_t __pthread, int __policy, struct sched_param *__param));
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
/* Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128 */
int _EXFUN(pthread_mutexattr_setprotocol,
(pthread_mutexattr_t *__attr, int __protocol));
int _EXFUN(pthread_mutexattr_getprotocol,
(_CONST pthread_mutexattr_t *__attr, int *__protocol));
int _EXFUN(pthread_mutexattr_setprioceiling,
(pthread_mutexattr_t *__attr, int __prioceiling));
int _EXFUN(pthread_mutexattr_getprioceiling,
(_CONST pthread_mutexattr_t *__attr, int *__prioceiling));
#endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */
#if defined(_POSIX_THREAD_PRIO_PROTECT)
/* Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131 */
int _EXFUN(pthread_mutex_setprioceiling,
(pthread_mutex_t *__mutex, int __prioceiling, int *__old_ceiling));
int _EXFUN(pthread_mutex_getprioceiling,
(pthread_mutex_t *__mutex, int *__prioceiling));
#endif /* _POSIX_THREAD_PRIO_PROTECT */
/* Thread Creation Attributes, P1003.1c/Draft 10, p, 140 */
int _EXFUN(pthread_attr_init, (pthread_attr_t *__attr));
int _EXFUN(pthread_attr_destroy, (pthread_attr_t *__attr));
int _EXFUN(pthread_attr_setstack, (pthread_attr_t *attr,
void *__stackaddr, size_t __stacksize));
int _EXFUN(pthread_attr_getstack, (_CONST pthread_attr_t *attr,
void **__stackaddr, size_t *__stacksize));
int _EXFUN(pthread_attr_getstacksize,
(_CONST pthread_attr_t *__attr, size_t *__stacksize));
int _EXFUN(pthread_attr_setstacksize,
(pthread_attr_t *__attr, size_t __stacksize));
int _EXFUN(pthread_attr_getstackaddr,
(_CONST pthread_attr_t *__attr, void **__stackaddr));
int _EXFUN(pthread_attr_setstackaddr,
(pthread_attr_t *__attr, void *__stackaddr));
int _EXFUN(pthread_attr_getdetachstate,
(_CONST pthread_attr_t *__attr, int *__detachstate));
int _EXFUN(pthread_attr_setdetachstate,
(pthread_attr_t *__attr, int __detachstate));
int _EXFUN(pthread_attr_getguardsize,
(_CONST pthread_attr_t *__attr, size_t *__guardsize));
int _EXFUN(pthread_attr_setguardsize,
(pthread_attr_t *__attr, size_t __guardsize));
/* POSIX thread APIs beyond the POSIX standard but provided
* in GNU/Linux. They may be provided by other OSes for
* compatibility.
*/
#if defined(__GNU_VISIBLE)
#if defined(__rtems__)
int _EXFUN(pthread_attr_setaffinity_np,
(pthread_attr_t *__attr, size_t __cpusetsize,
const cpu_set_t *__cpuset));
int _EXFUN(pthread_attr_getaffinity_np,
(const pthread_attr_t *__attr, size_t __cpusetsize,
cpu_set_t *__cpuset));
int _EXFUN(pthread_setaffinity_np,
(pthread_t __id, size_t __cpusetsize, const cpu_set_t *__cpuset));
int _EXFUN(pthread_getaffinity_np,
(const pthread_t __id, size_t __cpusetsize, cpu_set_t *__cpuset));
int _EXFUN(pthread_getattr_np,
(pthread_t __id, pthread_attr_t *__attr));
#endif /* defined(__rtems__) */
#endif /* defined(__GNU_VISIBLE) */
/* Thread Creation, P1003.1c/Draft 10, p. 144 */
int _EXFUN(pthread_create,
(pthread_t *__pthread, _CONST pthread_attr_t *__attr,
void *(*__start_routine)( void * ), void *__arg));
/* Wait for Thread Termination, P1003.1c/Draft 10, p. 147 */
int _EXFUN(pthread_join, (pthread_t __pthread, void **__value_ptr));
/* Detaching a Thread, P1003.1c/Draft 10, p. 149 */
int _EXFUN(pthread_detach, (pthread_t __pthread));
/* Thread Termination, p1003.1c/Draft 10, p. 150 */
void _EXFUN(pthread_exit, (void *__value_ptr));
/* Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX */
pthread_t _EXFUN(pthread_self, (void));
/* Compare Thread IDs, p1003.1c/Draft 10, p. 153 */
int _EXFUN(pthread_equal, (pthread_t __t1, pthread_t __t2));
/* Dynamic Package Initialization */
/* This is used to statically initialize a pthread_once_t. Example:
pthread_once_t once = PTHREAD_ONCE_INIT;
NOTE: This is named inconsistently -- it should be INITIALIZER. */
#define PTHREAD_ONCE_INIT { 1, 0 } /* is initialized and not run */
int _EXFUN(pthread_once,
(pthread_once_t *__once_control, void (*__init_routine)(void)));
/* Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163 */
int _EXFUN(pthread_key_create,
(pthread_key_t *__key, void (*__destructor)( void * )));
/* Thread-Specific Data Management, P1003.1c/Draft 10, p. 165 */
int _EXFUN(pthread_setspecific,
(pthread_key_t __key, _CONST void *__value));
void * _EXFUN(pthread_getspecific, (pthread_key_t __key));
/* Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167 */
int _EXFUN(pthread_key_delete, (pthread_key_t __key));
/* Execution of a Thread, P1003.1c/Draft 10, p. 181 */
#define PTHREAD_CANCEL_ENABLE 0
#define PTHREAD_CANCEL_DISABLE 1
#define PTHREAD_CANCEL_DEFERRED 0
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
#define PTHREAD_CANCELED ((void *) -1)
int _EXFUN(pthread_cancel, (pthread_t __pthread));
/* Setting Cancelability State, P1003.1c/Draft 10, p. 183 */
int _EXFUN(pthread_setcancelstate, (int __state, int *__oldstate));
int _EXFUN(pthread_setcanceltype, (int __type, int *__oldtype));
void _EXFUN(pthread_testcancel, (void));
/* Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184 */
void _EXFUN(_pthread_cleanup_push,
(struct _pthread_cleanup_context *_context,
void (*_routine)(void *), void *_arg));
void _EXFUN(_pthread_cleanup_pop,
(struct _pthread_cleanup_context *_context,
int _execute));
/* It is intentional to open and close the scope in two different macros */
#define pthread_cleanup_push(_routine, _arg) \
do { \
struct _pthread_cleanup_context _pthread_clup_ctx; \
_pthread_cleanup_push(&_pthread_clup_ctx, (_routine), (_arg))
#define pthread_cleanup_pop(_execute) \
_pthread_cleanup_pop(&_pthread_clup_ctx, (_execute)); \
} while (0)
#if defined(_GNU_SOURCE)
void _EXFUN(_pthread_cleanup_push_defer,
(struct _pthread_cleanup_context *_context,
void (*_routine)(void *), void *_arg));
void _EXFUN(_pthread_cleanup_pop_restore,
(struct _pthread_cleanup_context *_context,
int _execute));
/* It is intentional to open and close the scope in two different macros */
#define pthread_cleanup_push_defer_np(_routine, _arg) \
do { \
struct _pthread_cleanup_context _pthread_clup_ctx; \
_pthread_cleanup_push_defer(&_pthread_clup_ctx, (_routine), (_arg))
#define pthread_cleanup_pop_restore_np(_execute) \
_pthread_cleanup_pop_restore(&_pthread_clup_ctx, (_execute)); \
} while (0)
#endif /* defined(_GNU_SOURCE) */
#if defined(_POSIX_THREAD_CPUTIME)
/* Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58 */
int _EXFUN(pthread_getcpuclockid,
(pthread_t __pthread_id, clockid_t *__clock_id));
#endif /* defined(_POSIX_THREAD_CPUTIME) */
#endif /* defined(_POSIX_THREADS) */
#if defined(_POSIX_BARRIERS)
int _EXFUN(pthread_barrierattr_init, (pthread_barrierattr_t *__attr));
int _EXFUN(pthread_barrierattr_destroy, (pthread_barrierattr_t *__attr));
int _EXFUN(pthread_barrierattr_getpshared,
(_CONST pthread_barrierattr_t *__attr, int *__pshared));
int _EXFUN(pthread_barrierattr_setpshared,
(pthread_barrierattr_t *__attr, int __pshared));
#define PTHREAD_BARRIER_SERIAL_THREAD -1
int _EXFUN(pthread_barrier_init,
(pthread_barrier_t *__barrier,
_CONST pthread_barrierattr_t *__attr, unsigned __count));
int _EXFUN(pthread_barrier_destroy, (pthread_barrier_t *__barrier));
int _EXFUN(pthread_barrier_wait,(pthread_barrier_t *__barrier));
#endif /* defined(_POSIX_BARRIERS) */
#if defined(_POSIX_SPIN_LOCKS)
int _EXFUN(pthread_spin_init,
(pthread_spinlock_t *__spinlock, int __pshared));
int _EXFUN(pthread_spin_destroy, (pthread_spinlock_t *__spinlock));
int _EXFUN(pthread_spin_lock, (pthread_spinlock_t *__spinlock));
int _EXFUN(pthread_spin_trylock, (pthread_spinlock_t *__spinlock));
int _EXFUN(pthread_spin_unlock, (pthread_spinlock_t *__spinlock));
#endif /* defined(_POSIX_SPIN_LOCKS) */
#if defined(_POSIX_READER_WRITER_LOCKS)
/* This is used to statically initialize a pthread_rwlock_t. Example:
pthread_mutex_t mutex = PTHREAD_RWLOCK_INITIALIZER;
*/
#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) 0xFFFFFFFF)
int _EXFUN(pthread_rwlockattr_init, (pthread_rwlockattr_t *__attr));
int _EXFUN(pthread_rwlockattr_destroy, (pthread_rwlockattr_t *__attr));
int _EXFUN(pthread_rwlockattr_getpshared,
(_CONST pthread_rwlockattr_t *__attr, int *__pshared));
int _EXFUN(pthread_rwlockattr_setpshared,
(pthread_rwlockattr_t *__attr, int __pshared));
int _EXFUN(pthread_rwlock_init,
(pthread_rwlock_t *__rwlock, _CONST pthread_rwlockattr_t *__attr));
int _EXFUN(pthread_rwlock_destroy, (pthread_rwlock_t *__rwlock));
int _EXFUN(pthread_rwlock_rdlock,(pthread_rwlock_t *__rwlock));
int _EXFUN(pthread_rwlock_tryrdlock,(pthread_rwlock_t *__rwlock));
int _EXFUN(pthread_rwlock_timedrdlock,
(pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime));
int _EXFUN(pthread_rwlock_unlock,(pthread_rwlock_t *__rwlock));
int _EXFUN(pthread_rwlock_wrlock,(pthread_rwlock_t *__rwlock));
int _EXFUN(pthread_rwlock_trywrlock,(pthread_rwlock_t *__rwlock));
int _EXFUN(pthread_rwlock_timedwrlock,
(pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime));
#endif /* defined(_POSIX_READER_WRITER_LOCKS) */
int pthread_condattr_getclock(const pthread_condattr_t * attr, clockid_t * clock_id);
int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id);
#ifdef __cplusplus
}
#endif
#endif
/* end of include file */
#endif // __ESP_PLATFORM_PTHREAD_H__

View File

@ -0,0 +1,32 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _ESP_PLATFORM_SYS_POLL_H_
#define _ESP_PLATFORM_SYS_POLL_H_
#define POLLIN 0x0001 /* any readable data available */
#define POLLOUT 0x0004 /* file descriptor is writeable */
#define POLLPRI 0x0002 /* OOB/Urgent readable data */
#define POLLERR 0x0008 /* some poll error occurred */
#define POLLHUP 0x0010 /* file descriptor was "hung up" */
struct pollfd {
int fd; /* The descriptor. */
short events; /* The event(s) is/are specified here. */
short revents; /* Events found are returned here. */
};
typedef unsigned int nfds_t;
int poll(struct pollfd *fds, nfds_t nfds, int timeout);
#endif // _ESP_PLATFORM_SYS_POLL_H_

View File

@ -0,0 +1,30 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __SYS_RANDOM__
#define __SYS_RANDOM__
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
ssize_t getrandom(void *buf, size_t buflen, unsigned int flags);
#ifdef __cplusplus
} // extern "C"
#endif
#endif //__SYS_RANDOM__

View File

@ -402,7 +402,7 @@ struct _reent
char *_asctime_buf;
/* signal info */
void (**(_sig_func))(int);
void (**_sig_func)(int);
# ifndef _REENT_GLOBAL_ATEXIT
/* atexit stuff */

View File

@ -0,0 +1,296 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// This header file is based on the termios header of
// "The Single UNIX (r) Specification, Version 2, Copyright (c) 1997 The Open Group".
#ifndef __ESP_SYS_TERMIOS_H__
#define __ESP_SYS_TERMIOS_H__
// ESP-IDF NOTE: This header provides only a compatibility layer for macros and functions defined in sys/termios.h.
// Not everything has a defined meaning for ESP-IDF (e.g. process leader IDs) and therefore are likely to be stubbed
// in actual implementations.
#include <stdint.h>
#include <sys/types.h>
#include "sdkconfig.h"
#ifdef CONFIG_SUPPORT_TERMIOS
// subscripts for the array c_cc:
#define VEOF 0 /** EOF character */
#define VEOL 1 /** EOL character */
#define VERASE 2 /** ERASE character */
#define VINTR 3 /** INTR character */
#define VKILL 4 /** KILL character */
#define VMIN 5 /** MIN value */
#define VQUIT 6 /** QUIT character */
#define VSTART 7 /** START character */
#define VSTOP 8 /** STOP character */
#define VSUSP 9 /** SUSP character */
#define VTIME 10 /** TIME value */
#define NCCS (VTIME + 1) /** Size of the array c_cc for control characters */
// input modes for use as flags in the c_iflag field
#define BRKINT (1u << 0) /** Signal interrupt on break. */
#define ICRNL (1u << 1) /** Map CR to NL on input. */
#define IGNBRK (1u << 2) /** Ignore break condition. */
#define IGNCR (1u << 3) /** Ignore CR. */
#define IGNPAR (1u << 4) /** Ignore characters with parity errors. */
#define INLCR (1u << 5) /** Map NL to CR on input. */
#define INPCK (1u << 6) /** Enable input parity check. */
#define ISTRIP (1u << 7) /** Strip character. */
#define IUCLC (1u << 8) /** Map upper-case to lower-case on input (LEGACY). */
#define IXANY (1u << 9) /** Enable any character to restart output. */
#define IXOFF (1u << 10) /** Enable start/stop input control. */
#define IXON (1u << 11) /** Enable start/stop output control. */
#define PARMRK (1u << 12) /** Mark parity errors. */
// output Modes for use as flags in the c_oflag field
#define OPOST (1u << 0) /** Post-process output */
#define OLCUC (1u << 1) /** Map lower-case to upper-case on output (LEGACY). */
#define ONLCR (1u << 2) /** Map NL to CR-NL on output. */
#define OCRNL (1u << 3) /** Map CR to NL on output. */
#define ONOCR (1u << 4) /** No CR output at column 0. */
#define ONLRET (1u << 5) /** NL performs CR function. */
#define OFILL (1u << 6) /** Use fill characters for delay. */
#define NLDLY (1u << 7) /** Select newline delays: */
#define NL0 (0u << 7) /** Newline character type 0. */
#define NL1 (1u << 7) /** Newline character type 1. */
#define CRDLY (3u << 8) /** Select carriage-return delays: */
#define CR0 (0u << 8) /** Carriage-return delay type 0. */
#define CR1 (1u << 8) /** Carriage-return delay type 1. */
#define CR2 (2u << 8) /** Carriage-return delay type 2. */
#define CR3 (3u << 8) /** Carriage-return delay type 3. */
#define TABDLY (3u << 10) /** Select horizontal-tab delays: */
#define TAB0 (0u << 10) /** Horizontal-tab delay type 0. */
#define TAB1 (1u << 10) /** Horizontal-tab delay type 1. */
#define TAB2 (2u << 10) /** Horizontal-tab delay type 2. */
#define TAB3 (3u << 10) /** Expand tabs to spaces. */
#define BSDLY (1u << 12) /** Select backspace delays: */
#define BS0 (0u << 12) /** Backspace-delay type 0. */
#define BS1 (1u << 12) /** Backspace-delay type 1. */
#define VTDLY (1u << 13) /** Select vertical-tab delays: */
#define VT0 (0u << 13) /** Vertical-tab delay type 0. */
#define VT1 (1u << 13) /** Vertical-tab delay type 1. */
#define FFDLY (1u << 14) /** Select form-feed delays: */
#define FF0 (0u << 14) /** Form-feed delay type 0. */
#define FF1 (1u << 14) /** Form-feed delay type 1. */
// Baud Rate Selection. Valid values for objects of type speed_t:
// CBAUD range B0 - B38400
#define B0 0 /** Hang up */
#define B50 1
#define B75 2
#define B110 3
#define B134 4
#define B150 5
#define B200 6
#define B300 7
#define B600 8
#define B1200 9
#define B1800 10
#define B2400 11
#define B4800 12
#define B9600 13
#define B19200 14
#define B38400 15
// CBAUDEX range B57600 - B4000000
#define B57600 16
#define B115200 17
#define B230400 18
#define B460800 19
#define B500000 20
#define B576000 21
#define B921600 22
#define B1000000 23
#define B1152000 24
#define B1500000 25
#define B2000000 26
#define B2500000 27
#define B3000000 28
#define B3500000 29
#define B4000000 30
// Control Modes for the c_cflag field:
#define CSIZE (3u << 0) /* Character size: */
#define CS5 (0u << 0) /** 5 bits. */
#define CS6 (1u << 0) /** 6 bits. */
#define CS7 (2u << 0) /** 7 bits. */
#define CS8 (3u << 0) /** 8 bits. */
#define CSTOPB (1u << 2) /** Send two stop bits, else one. */
#define CREAD (1u << 3) /** Enable receiver. */
#define PARENB (1u << 4) /** Parity enable. */
#define PARODD (1u << 5) /** Odd parity, else even. */
#define HUPCL (1u << 6) /** Hang up on last close. */
#define CLOCAL (1u << 7) /** Ignore modem status lines. */
#define CBAUD (1u << 8) /** Use baud rates defined by B0-B38400 macros. */
#define CBAUDEX (1u << 9) /** Use baud rates defined by B57600-B4000000 macros. */
#define BOTHER (1u << 10) /** Use custom baud rates */
// Local Modes for c_lflag field:
#define ECHO (1u << 0) /** Enable echo. */
#define ECHOE (1u << 1) /** Echo erase character as error-correcting backspace. */
#define ECHOK (1u << 2) /** Echo KILL. */
#define ECHONL (1u << 3) /** Echo NL. */
#define ICANON (1u << 4) /** Canonical input (erase and kill processing). */
#define IEXTEN (1u << 5) /** Enable extended input character processing. */
#define ISIG (1u << 6) /** Enable signals. */
#define NOFLSH (1u << 7) /** Disable flush after interrupt or quit. */
#define TOSTOP (1u << 8) /** Send SIGTTOU for background output. */
#define XCASE (1u << 9) /** Canonical upper/lower presentation (LEGACY). */
// Attribute Selection constants for use with tcsetattr():
#define TCSANOW 0 /** Change attributes immediately. */
#define TCSADRAIN 1 /** Change attributes when output has drained. */
#define TCSAFLUSH 2 /** Change attributes when output has drained; also flush pending input. */
// Line Control constants for use with tcflush():
#define TCIFLUSH 0 /** Flush pending input. Flush untransmitted output. */
#define TCIOFLUSH 1 /** Flush both pending input and untransmitted output. */
#define TCOFLUSH 2 /** Flush untransmitted output. */
// constants for use with tcflow():
#define TCIOFF 0 /** Transmit a STOP character, intended to suspend input data. */
#define TCION 1 /** Transmit a START character, intended to restart input data. */
#define TCOOFF 2 /** Suspend output. */
#define TCOON 3 /** Restart output. */
typedef uint8_t cc_t;
typedef uint32_t speed_t;
typedef uint16_t tcflag_t;
struct termios
{
tcflag_t c_iflag; /** Input modes */
tcflag_t c_oflag; /** Output modes */
tcflag_t c_cflag; /** Control modes */
tcflag_t c_lflag; /** Local modes */
cc_t c_cc[NCCS]; /** Control characters */
speed_t c_ispeed; /** input baud rate */
speed_t c_ospeed; /** output baud rate */
};
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Extracts the input baud rate from the input structure exactly (without interpretation).
*
* @param p input termios structure
* @return input baud rate
*/
speed_t cfgetispeed(const struct termios *p);
/**
* @brief Extracts the output baud rate from the input structure exactly (without interpretation).
*
* @param p input termios structure
* @return output baud rate
*/
speed_t cfgetospeed(const struct termios *p);
/**
* @brief Set input baud rate in the termios structure
*
* There is no effect in hardware until a subsequent call of tcsetattr().
*
* @param p input termios structure
* @param sp input baud rate
* @return 0 when successful, -1 otherwise with errno set
*/
int cfsetispeed(struct termios *p, speed_t sp);
/**
* @brief Set output baud rate in the termios structure
*
* There is no effect in hardware until a subsequent call of tcsetattr().
*
* @param p input termios structure
* @param sp output baud rate
* @return 0 when successful, -1 otherwise with errno set
*/
int cfsetospeed(struct termios *p, speed_t sp);
/**
* @brief Wait for transmission of output
*
* @param fd file descriptor of the terminal
* @return 0 when successful, -1 otherwise with errno set
*/
int tcdrain(int fd);
/**
* @brief Suspend or restart the transmission or reception of data
*
* @param fd file descriptor of the terminal
* @param action selects actions to do
* @return 0 when successful, -1 otherwise with errno set
*/
int tcflow(int fd, int action);
/**
* @brief Flush non-transmitted output data and non-read input data
*
* @param fd file descriptor of the terminal
* @param select selects what should be flushed
* @return 0 when successful, -1 otherwise with errno set
*/
int tcflush(int fd, int select);
/**
* @brief Gets the parameters of the terminal
*
* @param fd file descriptor of the terminal
* @param p output termios structure
* @return 0 when successful, -1 otherwise with errno set
*/
int tcgetattr(int fd, struct termios *p);
/**
* @brief Get process group ID for session leader for controlling terminal
*
* @param fd file descriptor of the terminal
* @return process group ID when successful, -1 otherwise with errno set
*/
pid_t tcgetsid(int fd);
/**
* @brief Send a break for a specific duration
*
* @param fd file descriptor of the terminal
* @param duration duration of break
* @return 0 when successful, -1 otherwise with errno set
*/
int tcsendbreak(int fd, int duration);
/**
* @brief Sets the parameters of the terminal
*
* @param fd file descriptor of the terminal
* @param optional_actions optional actions
* @param p input termios structure
* @return 0 when successful, -1 otherwise with errno set
*/
int tcsetattr(int fd, int optional_actions, const struct termios *p);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // CONFIG_SUPPORT_TERMIOS
#endif //__ESP_SYS_TERMIOS_H__

View File

@ -0,0 +1,21 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _ESP_PLATFORM_SYS_UIO_H_
#define _ESP_PLATFORM_SYS_UIO_H_
int writev(int s, const struct iovec *iov, int iovcnt);
ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
#endif // _ESP_PLATFORM_SYS_UIO_H_

View File

@ -0,0 +1,24 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _ESP_PLATFORM_SYS_UN_H_
#define _ESP_PLATFORM_SYS_UN_H_
#define AF_UNIX 1 /* local to host (pipes) */
struct sockaddr_un {
short sun_family; /*AF_UNIX*/
char sun_path[108]; /*path name */
};
#endif // _ESP_PLATFORM_SYS_UN_H_

View File

@ -23,6 +23,7 @@ extern "C" {
#include_next <sys/unistd.h>
int _EXFUN(truncate, (const char *, off_t __length));
int _EXFUN(gethostname, (char *__name, size_t __len));
#ifdef __cplusplus
}

View File

@ -1,291 +1,35 @@
/*
* time.h
*
* Struct and function declarations for dealing with time.
*/
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _TIME_H_
#define _TIME_H_
#include "_ansi.h"
#include <sys/reent.h>
#define __need_size_t
#define __need_NULL
#include <stddef.h>
/* Get _CLOCKS_PER_SEC_ */
#include <machine/time.h>
#ifndef _CLOCKS_PER_SEC_
#define _CLOCKS_PER_SEC_ 1000
#endif
#define CLOCKS_PER_SEC _CLOCKS_PER_SEC_
#define CLK_TCK CLOCKS_PER_SEC
#include <sys/types.h>
_BEGIN_STD_C
struct tm
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
#ifdef __TM_GMTOFF
long __TM_GMTOFF;
#endif
#ifdef __TM_ZONE
const char *__TM_ZONE;
#endif
};
clock_t _EXFUN(clock, (void));
double _EXFUN(difftime, (time_t _time2, time_t _time1));
time_t _EXFUN(mktime, (struct tm *_timeptr));
time_t _EXFUN(time, (time_t *_timer));
#ifndef _REENT_ONLY
char *_EXFUN(asctime, (const struct tm *_tblock));
char *_EXFUN(ctime, (const time_t *_time));
struct tm *_EXFUN(gmtime, (const time_t *_timer));
struct tm *_EXFUN(localtime,(const time_t *_timer));
#endif
size_t _EXFUN(strftime, (char *__restrict _s,
size_t _maxsize, const char *__restrict _fmt,
const struct tm *__restrict _t));
char *_EXFUN(asctime_r, (const struct tm *__restrict,
char *__restrict));
char *_EXFUN(ctime_r, (const time_t *, char *));
struct tm *_EXFUN(gmtime_r, (const time_t *__restrict,
struct tm *__restrict));
struct tm *_EXFUN(localtime_r, (const time_t *__restrict,
struct tm *__restrict));
_END_STD_C
#ifndef _ESP_TIME_H
#define _ESP_TIME_H
#ifdef __cplusplus
extern "C" {
#endif
#include_next <time.h>
#ifndef __STRICT_ANSI__
char *_EXFUN(strptime, (const char *__restrict,
const char *__restrict,
struct tm *__restrict));
_VOID _EXFUN(tzset, (_VOID));
_VOID _EXFUN(_tzset_r, (struct _reent *));
typedef struct __tzrule_struct
{
char ch;
int m;
int n;
int d;
int s;
time_t change;
long offset; /* Match type of _timezone. */
} __tzrule_type;
typedef struct __tzinfo_struct
{
int __tznorth;
int __tzyear;
__tzrule_type __tzrule[2];
} __tzinfo_type;
__tzinfo_type *_EXFUN (__gettzinfo, (_VOID));
/* getdate functions */
#ifdef HAVE_GETDATE
#ifndef _REENT_ONLY
#define getdate_err (*__getdate_err())
int *_EXFUN(__getdate_err,(_VOID));
struct tm * _EXFUN(getdate, (const char *));
/* getdate_err is set to one of the following values to indicate the error.
1 the DATEMSK environment variable is null or undefined,
2 the template file cannot be opened for reading,
3 failed to get file status information,
4 the template file is not a regular file,
5 an error is encountered while reading the template file,
6 memory allication failed (not enough memory available),
7 there is no line in the template that matches the input,
8 invalid input specification */
#endif /* !_REENT_ONLY */
/* getdate_r returns the error code as above */
int _EXFUN(getdate_r, (const char *, struct tm *));
#endif /* HAVE_GETDATE */
/* defines for the opengroup specifications Derived from Issue 1 of the SVID. */
extern __IMPORT long _timezone;
extern __IMPORT int _daylight;
extern __IMPORT char *_tzname[2];
/* POSIX defines the external tzname being defined in time.h */
#ifndef tzname
#define tzname _tzname
#endif
#endif /* !__STRICT_ANSI__ */
#ifdef __cplusplus
}
#endif
#include <sys/features.h>
#ifdef __CYGWIN__
#include <cygwin/time.h>
#endif /*__CYGWIN__*/
#if defined(_POSIX_TIMERS)
#include <signal.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Clocks, P1003.1b-1993, p. 263 */
#define _POSIX_TIMERS 1
#define CLOCK_MONOTONIC (clockid_t)4
#define CLOCK_BOOTTIME (clockid_t)4
int _EXFUN(clock_settime, (clockid_t clock_id, const struct timespec *tp));
int _EXFUN(clock_gettime, (clockid_t clock_id, struct timespec *tp));
int _EXFUN(clock_getres, (clockid_t clock_id, struct timespec *res));
/* Create a Per-Process Timer, P1003.1b-1993, p. 264 */
int _EXFUN(timer_create,
(clockid_t clock_id,
struct sigevent *__restrict evp,
timer_t *__restrict timerid));
/* Delete a Per_process Timer, P1003.1b-1993, p. 266 */
int _EXFUN(timer_delete, (timer_t timerid));
/* Per-Process Timers, P1003.1b-1993, p. 267 */
int _EXFUN(timer_settime,
(timer_t timerid, int flags,
const struct itimerspec *__restrict value,
struct itimerspec *__restrict ovalue));
int _EXFUN(timer_gettime, (timer_t timerid, struct itimerspec *value));
int _EXFUN(timer_getoverrun, (timer_t timerid));
/* High Resolution Sleep, P1003.1b-1993, p. 269 */
int _EXFUN(nanosleep, (const struct timespec *rqtp, struct timespec *rmtp));
#ifdef __cplusplus
}
#endif
#endif /* _POSIX_TIMERS */
#if defined(_POSIX_CLOCK_SELECTION)
#ifdef __cplusplus
extern "C" {
#endif
int _EXFUN(clock_nanosleep,
(clockid_t clock_id, int flags, const struct timespec *rqtp,
struct timespec *rmtp));
#ifdef __cplusplus
}
#endif
#endif /* _POSIX_CLOCK_SELECTION */
#ifdef __cplusplus
extern "C" {
#endif
/* CPU-time Clock Attributes, P1003.4b/D8, p. 54 */
/* values for the clock enable attribute */
#define CLOCK_ENABLED 1 /* clock is enabled, i.e. counting execution time */
#define CLOCK_DISABLED 0 /* clock is disabled */
/* values for the pthread cputime_clock_allowed attribute */
#define CLOCK_ALLOWED 1 /* If a thread is created with this value a */
/* CPU-time clock attached to that thread */
/* shall be accessible. */
#define CLOCK_DISALLOWED 0 /* If a thread is created with this value, the */
/* thread shall not have a CPU-time clock */
/* accessible. */
/* Manifest Constants, P1003.1b-1993, p. 262 */
#define CLOCK_REALTIME (clockid_t)1
/* Flag indicating time is "absolute" with respect to the clock
associated with a time. */
#define TIMER_ABSTIME 4
/* Manifest Constants, P1003.4b/D8, p. 55 */
#if defined(_POSIX_CPUTIME)
/* When used in a clock or timer function call, this is interpreted as
the identifier of the CPU_time clock associated with the PROCESS
making the function call. */
#define CLOCK_PROCESS_CPUTIME_ID (clockid_t)2
#endif
#if defined(_POSIX_THREAD_CPUTIME)
/* When used in a clock or timer function call, this is interpreted as
the identifier of the CPU_time clock associated with the THREAD
making the function call. */
#define CLOCK_THREAD_CPUTIME_ID (clockid_t)3
#endif
#if defined(_POSIX_MONOTONIC_CLOCK)
/* The identifier for the system-wide monotonic clock, which is defined
* as a clock whose value cannot be set via clock_settime() and which
* cannot have backward clock jumps. */
#define CLOCK_MONOTONIC (clockid_t)4
#endif
#if defined(_POSIX_CPUTIME)
/* Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 */
int _EXFUN(clock_getcpuclockid, (pid_t pid, clockid_t *clock_id));
#endif /* _POSIX_CPUTIME */
#if defined(_POSIX_CPUTIME) || defined(_POSIX_THREAD_CPUTIME)
/* CPU-time Clock Attribute Access, P1003.4b/D8, p. 56 */
int _EXFUN(clock_setenable_attr, (clockid_t clock_id, int attr));
int _EXFUN(clock_getenable_attr, (clockid_t clock_id, int *attr));
#endif /* _POSIX_CPUTIME or _POSIX_THREAD_CPUTIME */
#ifdef __cplusplus
}
#endif
#endif /* _TIME_H_ */
#endif /* _ESP_TIME_H */