60 lines
1.3 KiB
C
60 lines
1.3 KiB
C
/*
|
|
* This is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2, as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* this software is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this software. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Author: Daniele Lacamera
|
|
*
|
|
*
|
|
*/
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
extern unsigned int _start_heap;
|
|
|
|
void * _sbrk_r(unsigned int incr)
|
|
{
|
|
static unsigned char *heap = NULL;
|
|
void *old_heap = heap;
|
|
if (((incr >> 2) << 2) != incr)
|
|
incr = ((incr >> 2) + 1) << 2;
|
|
|
|
if (old_heap == NULL)
|
|
old_heap = heap = (unsigned char *)&_start_heap;
|
|
heap += incr;
|
|
return old_heap;
|
|
}
|
|
|
|
int _close(int fd)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
int _fstat(int fd)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
int _lseek(int fd, int whence, int off)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
int _read(uint8_t *buf, int len)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
int _isatty(int fd)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
|