Prvni ulozeni z chegewara githubu
This commit is contained in:
52
tools/sdk/esp32/include/newlib/platform_include/assert.h
Normal file
52
tools/sdk/esp32/include/newlib/platform_include/assert.h
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright 2017 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 wraps newlib's own unmodified assert.h and adds
|
||||
support for silent assertion failure.
|
||||
*/
|
||||
#pragma once
|
||||
#include <sdkconfig.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include_next <assert.h>
|
||||
|
||||
/* moved part of libc provided assert to here allows
|
||||
* tweaking the assert macro to use __builtin_expect()
|
||||
* and reduce jumps in the "asserts OK" code path
|
||||
*
|
||||
* Note: using __builtin_expect() not likely() to avoid defining the likely
|
||||
* macro in namespace of non-IDF code that may include this standard header.
|
||||
*/
|
||||
#undef assert
|
||||
|
||||
/* __FILENAME__ points to the file name instead of path + filename
|
||||
* e.g __FILE__ points to "/apps/test.c" where as __FILENAME__ points to "test.c"
|
||||
*/
|
||||
#define __FILENAME__ (__builtin_strrchr( "/" __FILE__, '/') + 1)
|
||||
|
||||
#if defined(NDEBUG)
|
||||
|
||||
#define assert(__e) ((void)(__e))
|
||||
|
||||
#elif CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
|
||||
|
||||
#define assert(__e) (__builtin_expect(!!(__e), 1) ? (void)0 : __assert_func(NULL, 0, NULL, NULL))
|
||||
|
||||
#else // !CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
|
||||
|
||||
#define assert(__e) (__builtin_expect(!!(__e), 1) ? (void)0 : __assert_func (__FILENAME__, __LINE__, \
|
||||
__ASSERT_FUNC, #__e))
|
||||
#endif
|
200
tools/sdk/esp32/include/newlib/platform_include/endian.h
Normal file
200
tools/sdk/esp32/include/newlib/platform_include/endian.h
Normal file
@ -0,0 +1,200 @@
|
||||
/*
|
||||
* All the code below is a rework of
|
||||
* https://github.com/freebsd/freebsd/blob/master/sys/sys/endian.h
|
||||
* to import symbols defining non-standard endian handling functions.
|
||||
* The aforementioned source code license terms are included here.
|
||||
* For further license info, please look at https://github.com/freebsd/freebsd
|
||||
*/
|
||||
|
||||
/*-
|
||||
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020 Francesco Giancane <francesco.giancane@accenture.com>
|
||||
* SPDX-FileCopyrightText: 2002 Thomas Moestl <tmm@FreeBSD.org>
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND Apache-2.0
|
||||
*
|
||||
* Copyright (c) 2002 Thomas Moestl <tmm@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* This is a compatibility header for <endian.h>.
|
||||
* In xtensa-newlib distribution it is located in <machine/endian.h>
|
||||
* but most program expect to be plain <endian.h>.
|
||||
*/
|
||||
#include <machine/endian.h>
|
||||
|
||||
/*
|
||||
* General byte order swapping functions.
|
||||
*/
|
||||
#define bswap16(x) __bswap16(x)
|
||||
#define bswap32(x) __bswap32(x)
|
||||
#define bswap64(x) __bswap64(x)
|
||||
|
||||
/*
|
||||
* Host to big endian, host to little endian, big endian to host, and little
|
||||
* endian to host byte order functions as detailed in byteorder(9).
|
||||
*/
|
||||
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#define htobe16(x) bswap16((x))
|
||||
#define htobe32(x) bswap32((x))
|
||||
#define htobe64(x) bswap64((x))
|
||||
#define htole16(x) ((uint16_t)(x))
|
||||
#define htole32(x) ((uint32_t)(x))
|
||||
#define htole64(x) ((uint64_t)(x))
|
||||
|
||||
#define be16toh(x) bswap16((x))
|
||||
#define be32toh(x) bswap32((x))
|
||||
#define be64toh(x) bswap64((x))
|
||||
#define le16toh(x) ((uint16_t)(x))
|
||||
#define le32toh(x) ((uint32_t)(x))
|
||||
#define le64toh(x) ((uint64_t)(x))
|
||||
#else /* _BYTE_ORDER != _LITTLE_ENDIAN */
|
||||
#define htobe16(x) ((uint16_t)(x))
|
||||
#define htobe32(x) ((uint32_t)(x))
|
||||
#define htobe64(x) ((uint64_t)(x))
|
||||
#define htole16(x) bswap16((x))
|
||||
#define htole32(x) bswap32((x))
|
||||
#define htole64(x) bswap64((x))
|
||||
|
||||
#define be16toh(x) ((uint16_t)(x))
|
||||
#define be32toh(x) ((uint32_t)(x))
|
||||
#define be64toh(x) ((uint64_t)(x))
|
||||
#define le16toh(x) bswap16((x))
|
||||
#define le32toh(x) bswap32((x))
|
||||
#define le64toh(x) bswap64((x))
|
||||
#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */
|
||||
|
||||
/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
|
||||
|
||||
static __inline uint16_t
|
||||
be16dec(const void *pp)
|
||||
{
|
||||
uint8_t const *p = (uint8_t const *)pp;
|
||||
|
||||
return ((p[0] << 8) | p[1]);
|
||||
}
|
||||
|
||||
static __inline uint32_t
|
||||
be32dec(const void *pp)
|
||||
{
|
||||
uint8_t const *p = (uint8_t const *)pp;
|
||||
|
||||
return (((unsigned)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
|
||||
}
|
||||
|
||||
static __inline uint64_t
|
||||
be64dec(const void *pp)
|
||||
{
|
||||
uint8_t const *p = (uint8_t const *)pp;
|
||||
|
||||
return (((uint64_t)be32dec(p) << 32) | be32dec(p + 4));
|
||||
}
|
||||
|
||||
static __inline uint16_t
|
||||
le16dec(const void *pp)
|
||||
{
|
||||
uint8_t const *p = (uint8_t const *)pp;
|
||||
|
||||
return ((p[1] << 8) | p[0]);
|
||||
}
|
||||
|
||||
static __inline uint32_t
|
||||
le32dec(const void *pp)
|
||||
{
|
||||
uint8_t const *p = (uint8_t const *)pp;
|
||||
|
||||
return (((unsigned)p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
|
||||
}
|
||||
|
||||
static __inline uint64_t
|
||||
le64dec(const void *pp)
|
||||
{
|
||||
uint8_t const *p = (uint8_t const *)pp;
|
||||
|
||||
return (((uint64_t)le32dec(p + 4) << 32) | le32dec(p));
|
||||
}
|
||||
|
||||
static __inline void
|
||||
be16enc(void *pp, uint16_t u)
|
||||
{
|
||||
uint8_t *p = (uint8_t *)pp;
|
||||
|
||||
p[0] = (u >> 8) & 0xff;
|
||||
p[1] = u & 0xff;
|
||||
}
|
||||
|
||||
static __inline void
|
||||
be32enc(void *pp, uint32_t u)
|
||||
{
|
||||
uint8_t *p = (uint8_t *)pp;
|
||||
|
||||
p[0] = (u >> 24) & 0xff;
|
||||
p[1] = (u >> 16) & 0xff;
|
||||
p[2] = (u >> 8) & 0xff;
|
||||
p[3] = u & 0xff;
|
||||
}
|
||||
|
||||
static __inline void
|
||||
be64enc(void *pp, uint64_t u)
|
||||
{
|
||||
uint8_t *p = (uint8_t *)pp;
|
||||
|
||||
be32enc(p, (uint32_t)(u >> 32));
|
||||
be32enc(p + 4, (uint32_t)(u & 0xffffffffU));
|
||||
}
|
||||
|
||||
static __inline void
|
||||
le16enc(void *pp, uint16_t u)
|
||||
{
|
||||
uint8_t *p = (uint8_t *)pp;
|
||||
|
||||
p[0] = u & 0xff;
|
||||
p[1] = (u >> 8) & 0xff;
|
||||
}
|
||||
|
||||
static __inline void
|
||||
le32enc(void *pp, uint32_t u)
|
||||
{
|
||||
uint8_t *p = (uint8_t *)pp;
|
||||
|
||||
p[0] = u & 0xff;
|
||||
p[1] = (u >> 8) & 0xff;
|
||||
p[2] = (u >> 16) & 0xff;
|
||||
p[3] = (u >> 24) & 0xff;
|
||||
}
|
||||
|
||||
static __inline void
|
||||
le64enc(void *pp, uint64_t u)
|
||||
{
|
||||
uint8_t *p = (uint8_t *)pp;
|
||||
|
||||
le32enc(p, (uint32_t)(u & 0xffffffffU));
|
||||
le32enc(p + 4, (uint32_t)(u >> 32));
|
||||
}
|
31
tools/sdk/esp32/include/newlib/platform_include/errno.h
Normal file
31
tools/sdk/esp32/include/newlib/platform_include/errno.h
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef _ESP_PLATFORM_ERRNO_H_
|
||||
#define _ESP_PLATFORM_ERRNO_H_
|
||||
|
||||
#include_next "errno.h"
|
||||
|
||||
//
|
||||
// Possibly define some missing errors
|
||||
//
|
||||
#ifndef ESHUTDOWN
|
||||
#define ESHUTDOWN 110 /* Cannot send after transport endpoint shutdown */
|
||||
#endif
|
||||
|
||||
#ifndef EAI_SOCKTYPE
|
||||
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
|
||||
#endif
|
||||
|
||||
#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_
|
65
tools/sdk/esp32/include/newlib/platform_include/esp_newlib.h
Normal file
65
tools/sdk/esp32/include/newlib/platform_include/esp_newlib.h
Normal file
@ -0,0 +1,65 @@
|
||||
// Copyright 2015-2016 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_NEWLIB_H__
|
||||
#define __ESP_NEWLIB_H__
|
||||
|
||||
#include <sys/reent.h>
|
||||
|
||||
/*
|
||||
* Initialize newlib time functions
|
||||
*/
|
||||
void esp_newlib_time_init(void);
|
||||
|
||||
/**
|
||||
* Replacement for newlib's _REENT_INIT_PTR and __sinit.
|
||||
*
|
||||
* Called from startup code and FreeRTOS, not intended to be called from
|
||||
* application code.
|
||||
*/
|
||||
void esp_reent_init(struct _reent* r);
|
||||
|
||||
/**
|
||||
* Clean up some of lazily allocated buffers in REENT structures.
|
||||
*/
|
||||
void esp_reent_cleanup(void);
|
||||
|
||||
/**
|
||||
* Function which sets up newlib in ROM for use with ESP-IDF
|
||||
*
|
||||
* Includes defining the syscall table, setting up any common locks, etc.
|
||||
*
|
||||
* Called from the startup code, not intended to be called from application
|
||||
* code.
|
||||
*/
|
||||
void esp_newlib_init(void);
|
||||
|
||||
void esp_setup_syscall_table(void) __attribute__((deprecated("Please call esp_newlib_init() in newer code")));
|
||||
|
||||
/**
|
||||
* Update current microsecond time from RTC
|
||||
*/
|
||||
void esp_set_time_from_rtc(void);
|
||||
|
||||
/*
|
||||
* Sync counters RTC and FRC. Update boot_time.
|
||||
*/
|
||||
void esp_sync_counters_rtc_and_frc(void);
|
||||
|
||||
/**
|
||||
* Initialize newlib static locks
|
||||
*/
|
||||
void esp_newlib_locks_init(void);
|
||||
|
||||
#endif //__ESP_NEWLIB_H__
|
40
tools/sdk/esp32/include/newlib/platform_include/net/if.h
Normal file
40
tools/sdk/esp32/include/newlib/platform_include/net/if.h
Normal file
@ -0,0 +1,40 @@
|
||||
// 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_
|
||||
|
||||
#include "lwip/sockets.h"
|
||||
#include "lwip/if_api.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 IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
|
||||
|
||||
#define NI_MAXHOST 1025
|
||||
#define NI_MAXSERV 32
|
||||
#define NI_NUMERICSERV 0x00000008
|
||||
#define NI_DGRAM 0x00000010
|
||||
|
||||
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_
|
35
tools/sdk/esp32/include/newlib/platform_include/pthread.h
Normal file
35
tools/sdk/esp32/include/newlib/platform_include/pthread.h
Normal file
@ -0,0 +1,35 @@
|
||||
// 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__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/features.h>
|
||||
|
||||
#include_next <pthread.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
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 // __ESP_PLATFORM_PTHREAD_H__
|
61
tools/sdk/esp32/include/newlib/platform_include/sys/dirent.h
Normal file
61
tools/sdk/esp32/include/newlib/platform_include/sys/dirent.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/**
|
||||
* This header file provides POSIX-compatible definitions of directory
|
||||
* access data types. Starting with newlib 3.3, related functions are defined
|
||||
* in 'dirent.h' bundled with newlib.
|
||||
* See http://pubs.opengroup.org/onlinepubs/7908799/xsh/dirent.h.html
|
||||
* for reference.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Opaque directory structure
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t dd_vfs_idx; /*!< VFS index, not to be used by applications */
|
||||
uint16_t dd_rsv; /*!< field reserved for future extension */
|
||||
/* remaining fields are defined by VFS implementation */
|
||||
} DIR;
|
||||
|
||||
/**
|
||||
* @brief Directory entry structure
|
||||
*/
|
||||
struct dirent {
|
||||
ino_t d_ino; /*!< file number */
|
||||
uint8_t d_type; /*!< not defined in POSIX, but present in BSD and Linux */
|
||||
#define DT_UNKNOWN 0
|
||||
#define DT_REG 1
|
||||
#define DT_DIR 2
|
||||
#if __BSD_VISIBLE
|
||||
#define MAXNAMLEN 255
|
||||
char d_name[MAXNAMLEN+1]; /*!< zero-terminated file name */
|
||||
#else
|
||||
char d_name[256];
|
||||
#endif
|
||||
};
|
||||
|
||||
DIR* opendir(const char* name);
|
||||
struct dirent* readdir(DIR* pdir);
|
||||
long telldir(DIR* pdir);
|
||||
void seekdir(DIR* pdir, long loc);
|
||||
void rewinddir(DIR* pdir);
|
||||
int closedir(DIR* pdir);
|
||||
int readdir_r(DIR* pdir, struct dirent* entry, struct dirent** out_dirent);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
25
tools/sdk/esp32/include/newlib/platform_include/sys/ioctl.h
Normal file
25
tools/sdk/esp32/include/newlib/platform_include/sys/ioctl.h
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright 2015-2017 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int ioctl(int fd, int request, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
41
tools/sdk/esp32/include/newlib/platform_include/sys/lock.h
Normal file
41
tools/sdk/esp32/include/newlib/platform_include/sys/lock.h
Normal file
@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include_next <sys/lock.h>
|
||||
|
||||
#ifdef _RETARGETABLE_LOCKING
|
||||
|
||||
/* Actual platfrom-specific definition of struct __lock.
|
||||
* The size here should be sufficient for a FreeRTOS mutex.
|
||||
* This is checked by a static assertion in locks.c
|
||||
*
|
||||
* Note 1: this might need to be made dependent on whether FreeRTOS
|
||||
* is included in the build.
|
||||
*
|
||||
* Note 2: the size is made sufficient for the case when
|
||||
* configUSE_TRACE_FACILITY is enabled. If it is disabled,
|
||||
* this definition wastes 8 bytes.
|
||||
*/
|
||||
struct __lock {
|
||||
int reserved[23];
|
||||
};
|
||||
|
||||
/* Compatibility definitions for the legacy ESP-specific locking implementation.
|
||||
* These used to be provided by libc/sys/xtensa/sys/lock.h in newlib.
|
||||
* Newer versions of newlib don't have this ESP-specific lock.h header, and are
|
||||
* built with _RETARGETABLE_LOCKING enabled, instead.
|
||||
*/
|
||||
|
||||
typedef _LOCK_T _lock_t;
|
||||
|
||||
void _lock_init(_lock_t *plock);
|
||||
void _lock_init_recursive(_lock_t *plock);
|
||||
void _lock_close(_lock_t *plock);
|
||||
void _lock_close_recursive(_lock_t *plock);
|
||||
void _lock_acquire(_lock_t *plock);
|
||||
void _lock_acquire_recursive(_lock_t *plock);
|
||||
int _lock_try_acquire(_lock_t *plock);
|
||||
int _lock_try_acquire_recursive(_lock_t *plock);
|
||||
void _lock_release(_lock_t *plock);
|
||||
void _lock_release_recursive(_lock_t *plock);
|
||||
|
||||
#endif // _RETARGETABLE_LOCKING
|
48
tools/sdk/esp32/include/newlib/platform_include/sys/poll.h
Normal file
48
tools/sdk/esp32/include/newlib/platform_include/sys/poll.h
Normal file
@ -0,0 +1,48 @@
|
||||
// Copyright 2018-2019 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 (1u << 0) /* data other than high-priority may be read without blocking */
|
||||
#define POLLRDNORM (1u << 1) /* normal data may be read without blocking */
|
||||
#define POLLRDBAND (1u << 2) /* priority data may be read without blocking */
|
||||
#define POLLPRI (POLLRDBAND) /* high-priority data may be read without blocking */
|
||||
// Note: POLLPRI is made equivalent to POLLRDBAND in order to fit all these events into one byte
|
||||
#define POLLOUT (1u << 3) /* normal data may be written without blocking */
|
||||
#define POLLWRNORM (POLLOUT) /* equivalent to POLLOUT */
|
||||
#define POLLWRBAND (1u << 4) /* priority data my be written */
|
||||
#define POLLERR (1u << 5) /* some poll error occurred */
|
||||
#define POLLHUP (1u << 6) /* file descriptor was "hung up" */
|
||||
#define POLLNVAL (1u << 7) /* the specified file descriptor is invalid */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // _ESP_PLATFORM_SYS_POLL_H_
|
30
tools/sdk/esp32/include/newlib/platform_include/sys/random.h
Normal file
30
tools/sdk/esp32/include/newlib/platform_include/sys/random.h
Normal 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__
|
23
tools/sdk/esp32/include/newlib/platform_include/sys/reent.h
Normal file
23
tools/sdk/esp32/include/newlib/platform_include/sys/reent.h
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright 2020 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include_next<sys/reent.h>
|
||||
|
||||
/* This function is not part of the newlib API, it is defined in libc/stdio/local.h
|
||||
* There is no nice way to get __cleanup member populated while avoiding __sinit,
|
||||
* so extern declaration is used here.
|
||||
*/
|
||||
extern void _cleanup_r(struct _reent* r);
|
50
tools/sdk/esp32/include/newlib/platform_include/sys/select.h
Normal file
50
tools/sdk/esp32/include/newlib/platform_include/sys/select.h
Normal file
@ -0,0 +1,50 @@
|
||||
// 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_SYS_SELECT_H__
|
||||
#define __ESP_SYS_SELECT_H__
|
||||
|
||||
/* Newlib 2.2.0 does not provide sys/select.h, and fd_set is defined in sys/types.h */
|
||||
#include <sys/types.h>
|
||||
#ifndef fd_set
|
||||
#include_next <sys/select.h>
|
||||
#else // fd_set
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // fd_set
|
||||
|
||||
#if defined(FD_ISSET) || defined(FD_SET) || defined(FD_CLR)
|
||||
#undef FD_SET
|
||||
#undef FD_CLR
|
||||
#undef FD_ISSET
|
||||
|
||||
#define __FD_SAFE_SET(n, code) do { if ((unsigned)(n) < FD_SETSIZE) { code; } } while(0)
|
||||
#define __FD_SAFE_GET(n, code) (((unsigned)(n) < FD_SETSIZE) ? (code) : 0)
|
||||
|
||||
#define FD_SET(n, p) __FD_SAFE_SET(n, ((p)->fds_bits[(n) / NFDBITS] |= (1L << ((n) % NFDBITS))))
|
||||
#define FD_CLR(n, p) __FD_SAFE_SET(n, ((p)->fds_bits[(n) / NFDBITS] &= ~(1L << ((n) % NFDBITS))))
|
||||
#define FD_ISSET(n, p) __FD_SAFE_GET(n, ((p)->fds_bits[(n) / NFDBITS] & (1L << ((n) % NFDBITS))))
|
||||
#endif // FD_ISSET || FD_SET || FD_CLR
|
||||
|
||||
#endif //__ESP_SYS_SELECT_H__
|
296
tools/sdk/esp32/include/newlib/platform_include/sys/termios.h
Normal file
296
tools/sdk/esp32/include/newlib/platform_include/sys/termios.h
Normal 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_VFS_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_VFS_SUPPORT_TERMIOS
|
||||
|
||||
#endif //__ESP_SYS_TERMIOS_H__
|
17
tools/sdk/esp32/include/newlib/platform_include/sys/time.h
Normal file
17
tools/sdk/esp32/include/newlib/platform_include/sys/time.h
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
/* Newlib sys/time.h defines timerisset, timerclear, timercmp, timeradd, timersub macros
|
||||
for __CYGWIN__ and __rtems__. We want to define these macros in IDF as well.
|
||||
Since we wish to use un-modified newlib headers until a patched newlib version is
|
||||
available, temporarily define __rtems__ here before including sys/time.h.
|
||||
__rtems__ is chosen instead of __CYGWIN__ since there are no other checks in sys/time.h
|
||||
which depend on __rtems__.
|
||||
|
||||
Also, so that __rtems__ define does not affect other headers included from sys/time.h,
|
||||
we include them here in advance (_ansi.h and sys/types.h).
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#define __rtems__
|
||||
#include_next <sys/time.h>
|
||||
#undef __rtems__
|
24
tools/sdk/esp32/include/newlib/platform_include/sys/uio.h
Normal file
24
tools/sdk/esp32/include/newlib/platform_include/sys/uio.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct iovec;
|
||||
|
||||
int writev(int s, const struct iovec *iov, int iovcnt);
|
||||
|
||||
ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
24
tools/sdk/esp32/include/newlib/platform_include/sys/un.h
Normal file
24
tools/sdk/esp32/include/newlib/platform_include/sys/un.h
Normal 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_
|
31
tools/sdk/esp32/include/newlib/platform_include/sys/unistd.h
Normal file
31
tools/sdk/esp32/include/newlib/platform_include/sys/unistd.h
Normal file
@ -0,0 +1,31 @@
|
||||
// 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_SYS_UNISTD_H
|
||||
#define _ESP_SYS_UNISTD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include_next <sys/unistd.h>
|
||||
|
||||
int truncate(const char *, off_t __length);
|
||||
int gethostname(char *__name, size_t __len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _SYS_UNISTD_H */
|
35
tools/sdk/esp32/include/newlib/platform_include/sys/utime.h
Normal file
35
tools/sdk/esp32/include/newlib/platform_include/sys/utime.h
Normal file
@ -0,0 +1,35 @@
|
||||
// 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 _UTIME_H_
|
||||
#define _UTIME_H_
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct utimbuf {
|
||||
time_t actime; // access time
|
||||
time_t modtime; // modification time
|
||||
};
|
||||
|
||||
int utime(const char *path, const struct utimbuf *times);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* _UTIME_H_ */
|
39
tools/sdk/esp32/include/newlib/platform_include/time.h
Normal file
39
tools/sdk/esp32/include/newlib/platform_include/time.h
Normal file
@ -0,0 +1,39 @@
|
||||
// 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_TIME_H
|
||||
#define _ESP_TIME_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include_next <time.h>
|
||||
|
||||
#define _POSIX_TIMERS 1
|
||||
#ifndef CLOCK_MONOTONIC
|
||||
#define CLOCK_MONOTONIC (clockid_t)4
|
||||
#endif
|
||||
#ifndef CLOCK_BOOTTIME
|
||||
#define CLOCK_BOOTTIME (clockid_t)4
|
||||
#endif
|
||||
|
||||
int clock_settime(clockid_t clock_id, const struct timespec *tp);
|
||||
int clock_gettime(clockid_t clock_id, struct timespec *tp);
|
||||
int clock_getres(clockid_t clock_id, struct timespec *res);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _ESP_TIME_H */
|
Reference in New Issue
Block a user