Merge branch 'newlib'
This commit is contained in:
commit
86188c01fd
133 changed files with 23672 additions and 578 deletions
|
@ -10,7 +10,6 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "esp_libc.h"
|
||||
#include "esp_misc.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_softap.h"
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ESP_LIBC_H__
|
||||
#define __ESP_LIBC_H__
|
||||
|
||||
char *strcpy(char *dst, const char *src);
|
||||
char *strncpy(char *dst, const char *src, size_t n);
|
||||
int strcmp(const char *s1, const char *s2);
|
||||
int strncmp(const char *s1, const char *s2, size_t n);
|
||||
size_t strlen(const char *s);
|
||||
char *strstr(const char *s1, const char *s2);
|
||||
char *strcat(char *dst, const char *src);
|
||||
char *strncat(char *dst, const char *src, size_t count);
|
||||
size_t strspn(const char *s, const char *accept);
|
||||
size_t strcspn(const char *s, const char *reject);
|
||||
char *strtok_r(char *s, const char *delim, char **ptrptr);
|
||||
char *strtok(char *s, const char *delim);
|
||||
char *strrchr(const char *s, int c);
|
||||
char *strdup(const char *s);
|
||||
char *strchr(const char *s, int c);
|
||||
long strtol(const char *str, char **endptr, int base);
|
||||
|
||||
void bzero(void *s, size_t n);
|
||||
|
||||
void *memcpy(void *dst, const void *src, size_t n);
|
||||
void *memset(void *dst, int c, size_t n);
|
||||
int memcmp(const void *m1, const void *m2, size_t n);
|
||||
void *memmove(void *dst, const void *src, size_t n);
|
||||
|
||||
int rand_r(unsigned int *seed);
|
||||
int rand(void);
|
||||
void srand(unsigned int i);
|
||||
|
||||
int printf(const char *format, ...);
|
||||
int sprintf(char *out, const char *format, ...);
|
||||
int snprintf(char *buf, unsigned int count, const char *format, ...);
|
||||
int puts(const char *str);
|
||||
int putchar(int c);
|
||||
|
||||
void *malloc(size_t n);
|
||||
void free(void *p);
|
||||
void *calloc(size_t c, size_t n);
|
||||
void *zalloc(size_t n);
|
||||
void *realloc(void *p, size_t n);
|
||||
|
||||
int atoi(const char *s);
|
||||
long atol(const char *s);
|
||||
|
||||
/* NOTE: don't use printf_opt in irq handler, for test */
|
||||
#define printf_opt(fmt, ...) do { \
|
||||
static const char flash_str[] ICACHE_RODATA_ATTR = fmt; \
|
||||
printf(flash_str, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
|
||||
/* NOTE: don't use printf_opt in irq handler, for test */
|
||||
#define sprintf_opt(out, fmt, ...) do { \
|
||||
static const char flash_str[] ICACHE_RODATA_ATTR = fmt; \
|
||||
sprintf(out, flash_str, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
|
||||
#endif /* __LIBC_H__ */
|
|
@ -10,6 +10,8 @@
|
|||
#ifndef _XTENSA_INTERRUPTS_H
|
||||
#define _XTENSA_INTERRUPTS_H
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <xtruntime.h>
|
||||
#include <xtensa/hal.h>
|
||||
#include <common_macros.h>
|
||||
|
||||
|
@ -18,9 +20,36 @@ void sdk__xt_user_exit (void);
|
|||
void sdk__xt_tick_timer_init (void);
|
||||
void sdk__xt_timer_int1(void);
|
||||
|
||||
INLINED uint32_t _xt_get_intlevel(void)
|
||||
{
|
||||
uint32_t level;
|
||||
__asm__ volatile("rsr %0, intlevel" : "=a"(level));
|
||||
return level;
|
||||
}
|
||||
|
||||
/* Disable interrupts and return the old ps value, to pass into
|
||||
_xt_restore_interrupts later.
|
||||
|
||||
This is desirable to use in place of
|
||||
portDISABLE_INTERRUPTS/portENABLE_INTERRUPTS for
|
||||
non-FreeRTOS & non-portable code.
|
||||
*/
|
||||
INLINED uint32_t _xt_disable_interrupts(void)
|
||||
{
|
||||
uint32_t old_level;
|
||||
__asm__ volatile ("rsil %0, " XTSTR(XCHAL_EXCM_LEVEL) : "=a" (old_level));
|
||||
return old_level;
|
||||
}
|
||||
|
||||
/* Restore PS level. Intended to be used with _xt_disable_interrupts */
|
||||
INLINED void _xt_restore_interrupts(uint32_t new_ps)
|
||||
{
|
||||
__asm__ volatile ("wsr %0, ps; rsync" :: "a" (new_ps));
|
||||
}
|
||||
|
||||
/* ESPTODO: the mask/unmask functions aren't thread safe */
|
||||
|
||||
INLINED void _xt_isr_unmask (uint32_t unmask)
|
||||
INLINED void _xt_isr_unmask(uint32_t unmask)
|
||||
{
|
||||
uint32_t intenable;
|
||||
asm volatile ("rsr %0, intenable" : "=a" (intenable));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue