OpenCores
URL https://opencores.org/ocsvn/ion/ion/trunk

Subversion Repositories ion

[/] [ion/] [trunk/] [src/] [common/] [libsoc/] [src/] [syscalls.c] - Blame information for rev 196

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 172 ja_rd
/*
2
  syscalls.c -- Hardware-dependent functions for CodeSourcery libraries.
3
 
4
  These are just stubs meant to keep the compiler happy. Once I find out how
5
  to exclude newlib stuff from the compilation, thses functions will be
6
  removed.
7
*/
8
 
9
#include <sys/stat.h>
10
 
11
 
12
int close(int file){
13
    return -1;
14
}
15
 
16
int fstat(int file, struct stat *st){
17
    st->st_mode = S_IFCHR;
18
    return 0;
19
}
20
 
21
int isatty(int file){
22
    return 1;
23
}
24
 
25
int lseek(int file, int ptr, int dir){
26
    return 0;
27
}
28
 
29
int open(const char *name, int flags, int mode){
30
    return -1;
31
}
32
 
33
int read(int file, char *ptr, int len){
34
    /* use gets() to read from console */
35
    return 0;
36
}
37
 
38
char *heap_end = 0;
39
 
40
/* Stub -- broken -- do not use */
41
caddr_t sbrk(int incr){
42
    //extern char heap_low; /* Defined by the linker */
43
    //extern char heap_top; /* Defined by the linker */
44
    char *prev_heap_end;
45
 
46
    if (heap_end == 0){
47
        heap_end = (char *)0x00010000; //&heap_low;
48
    }
49
    prev_heap_end = heap_end;
50
 
51
    if ((unsigned)(heap_end + incr) > 0x00020000 /*&heap_top */){
52
        /* Heap and stack collision */
53
        return (caddr_t)0;
54
    }
55
 
56
    heap_end += incr;
57
    return (caddr_t) prev_heap_end;
58
}
59
 
60
int write(int file, char *ptr, int len){
61
    puts(ptr);
62
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.