mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-15 00:02:49 +03:00
committed by
david gauchard
parent
98125f8860
commit
eea9999dc5
@ -1,27 +1,27 @@
|
||||
/*
|
||||
libc_replacements.c - replaces libc functions with functions
|
||||
from Espressif SDK
|
||||
libc_replacements.c - replaces libc functions with functions
|
||||
from Espressif SDK
|
||||
|
||||
Copyright (c) 2015 Ivan Grokhotkov. All rights reserved.
|
||||
This file is part of the esp8266 core for Arduino environment.
|
||||
Copyright (c) 2015 Ivan Grokhotkov. All rights reserved.
|
||||
This file is part of the esp8266 core for Arduino environment.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Modified 03 April 2015 by Markus Sattler
|
||||
Modified 03 April 2015 by Markus Sattler
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
@ -47,103 +47,88 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
int ICACHE_RAM_ATTR _open_r(struct _reent* unused, const char *ptr, int mode)
|
||||
{
|
||||
(void)unused;
|
||||
(void)ptr;
|
||||
(void)mode;
|
||||
return 0;
|
||||
}
|
||||
int ICACHE_RAM_ATTR _open_r (struct _reent* unused, const char *ptr, int mode) {
|
||||
(void)unused;
|
||||
(void)ptr;
|
||||
(void)mode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ICACHE_RAM_ATTR _close_r(struct _reent* unused, int file)
|
||||
{
|
||||
(void)unused;
|
||||
(void)file;
|
||||
return 0;
|
||||
}
|
||||
int ICACHE_RAM_ATTR _close_r(struct _reent* unused, int file) {
|
||||
(void)unused;
|
||||
(void)file;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ICACHE_RAM_ATTR _fstat_r(struct _reent* unused, int file, struct stat *st)
|
||||
{
|
||||
(void)unused;
|
||||
(void)file;
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
}
|
||||
int ICACHE_RAM_ATTR _fstat_r(struct _reent* unused, int file, struct stat *st) {
|
||||
(void)unused;
|
||||
(void)file;
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ICACHE_RAM_ATTR _lseek_r(struct _reent* unused, int file, int ptr, int dir)
|
||||
{
|
||||
(void)unused;
|
||||
(void)file;
|
||||
(void)ptr;
|
||||
(void)dir;
|
||||
return 0;
|
||||
}
|
||||
int ICACHE_RAM_ATTR _lseek_r(struct _reent* unused, int file, int ptr, int dir) {
|
||||
(void)unused;
|
||||
(void)file;
|
||||
(void)ptr;
|
||||
(void)dir;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ICACHE_RAM_ATTR _read_r(struct _reent* unused, int file, char *ptr, int len)
|
||||
{
|
||||
(void)unused;
|
||||
(void)file;
|
||||
(void)ptr;
|
||||
(void)len;
|
||||
return 0;
|
||||
}
|
||||
int ICACHE_RAM_ATTR _read_r(struct _reent* unused, int file, char *ptr, int len) {
|
||||
(void)unused;
|
||||
(void)file;
|
||||
(void)ptr;
|
||||
(void)len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ICACHE_RAM_ATTR _write_r(struct _reent* r, int file, char *ptr, int len)
|
||||
{
|
||||
(void) r;
|
||||
int pos = len;
|
||||
if (file == STDOUT_FILENO)
|
||||
{
|
||||
while (pos--)
|
||||
{
|
||||
ets_putc(*ptr);
|
||||
++ptr;
|
||||
}
|
||||
int ICACHE_RAM_ATTR _write_r(struct _reent* r, int file, char *ptr, int len) {
|
||||
(void) r;
|
||||
int pos = len;
|
||||
if (file == STDOUT_FILENO) {
|
||||
while(pos--) {
|
||||
ets_putc(*ptr);
|
||||
++ptr;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
int ICACHE_RAM_ATTR _putc_r(struct _reent* r, int c, FILE* file) __attribute__((weak));
|
||||
int ICACHE_RAM_ATTR _putc_r(struct _reent* r, int c, FILE* file) __attribute__((weak));
|
||||
|
||||
int ICACHE_RAM_ATTR _putc_r(struct _reent* r, int c, FILE* file)
|
||||
{
|
||||
(void) r;
|
||||
if (file->_file == STDOUT_FILENO)
|
||||
{
|
||||
return ets_putc(c);
|
||||
}
|
||||
return EOF;
|
||||
int ICACHE_RAM_ATTR _putc_r(struct _reent* r, int c, FILE* file) {
|
||||
(void) r;
|
||||
if (file->_file == STDOUT_FILENO) {
|
||||
return ets_putc(c);
|
||||
}
|
||||
return EOF;
|
||||
}
|
||||
|
||||
int ICACHE_RAM_ATTR puts(const char * str)
|
||||
{
|
||||
char c;
|
||||
while ((c = *str) != 0)
|
||||
{
|
||||
ets_putc(c);
|
||||
++str;
|
||||
}
|
||||
ets_putc('\n');
|
||||
return true;
|
||||
int ICACHE_RAM_ATTR puts(const char * str) {
|
||||
char c;
|
||||
while((c = *str) != 0) {
|
||||
ets_putc(c);
|
||||
++str;
|
||||
}
|
||||
ets_putc('\n');
|
||||
return true;
|
||||
}
|
||||
|
||||
#undef putchar
|
||||
int ICACHE_RAM_ATTR putchar(int c)
|
||||
{
|
||||
ets_putc(c);
|
||||
return c;
|
||||
}
|
||||
int ICACHE_RAM_ATTR putchar(int c) {
|
||||
ets_putc(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
(void) status;
|
||||
abort();
|
||||
}
|
||||
void _exit(int status) {
|
||||
(void) status;
|
||||
abort();
|
||||
}
|
||||
|
||||
int atexit(void (*func)())
|
||||
{
|
||||
(void) func;
|
||||
return 0;
|
||||
}
|
||||
int atexit(void (*func)()) {
|
||||
(void) func;
|
||||
return 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user