2015-04-26 17:54:51 +02:00
|
|
|
/*
|
|
|
|
* syscalls.c
|
|
|
|
*
|
|
|
|
* Created on: Dec 14, 2014
|
2017-03-31 13:25:42 +02:00
|
|
|
* Author: Mario Huettel <mario.huettel@gmx.net>
|
2015-04-26 17:54:51 +02:00
|
|
|
*/
|
|
|
|
|
2017-03-31 13:25:42 +02:00
|
|
|
#include <uart/uart.h>
|
2015-04-26 17:54:51 +02:00
|
|
|
|
|
|
|
char* _sbrk(int incr) {
|
|
|
|
extern char heap_low; // Defined by the linker
|
|
|
|
extern char heap_top;
|
|
|
|
static char *heap_end;
|
|
|
|
char *prev_heap_end;
|
|
|
|
|
|
|
|
if (heap_end == 0) {
|
|
|
|
heap_end = &heap_low;
|
|
|
|
}
|
|
|
|
prev_heap_end = heap_end;
|
|
|
|
if (heap_end + incr > &heap_top) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
heap_end += incr;
|
|
|
|
return (char*) prev_heap_end;
|
|
|
|
}
|
|
|
|
int _isatty(int fd) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
int _close(int fd) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int _open(int fd) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int _fstat(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int _lseek(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int _read(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int _write(int fd, const void *buf, int count) {
|
|
|
|
sendString((char*)buf, count);
|
2015-12-17 18:36:50 +01:00
|
|
|
return count;
|
2015-04-26 17:54:51 +02:00
|
|
|
}
|