1 #include <debug-uart.h>
7 _open(
const char *name,
int flags,
int mode) {
15 if (file == 1 || file == 2) {
26 if (file >= 0 && file <= 2)
return 1;
31 _read(
int file,
char *ptr,
int len){
38 _write(
int file,
const char *ptr,
int len){
40 if (file == 1 || file == 2) {
41 sent = dbg_send_bytes((
const unsigned char*)ptr, len);
47 _lseek(
int file,
int ptr,
int dir){
52 _fstat(
int file,
struct stat *st) {
53 if (file >= 0 && file <= 2) {
54 st->st_mode = S_IFCHR;
62 _stat(
char *file,
struct stat *st) {
70 extern char __heap_start__;
71 extern char __heap_end__;
72 static char *heap_end = &__heap_start__;
75 prev_heap_end = heap_end;
76 if (heap_end + incr > &__heap_end__) {
77 printf(
"Heap full (requested %d, available %d)\n",
78 incr, (
int)(&__heap_end__ - heap_end));
84 return (caddr_t) prev_heap_end;
90 if (fd == 1 || fd == 2) {
94 if (fd == 0)
return 0;
124 bkpt_instr = 0xe1200070;