2 * Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com)
\r
3 * All rights reserved.
\r
5 * Redistribution and use in source and binary forms, with or without
\r
6 * modification, are permitted provided that the following conditions
\r
9 * - Redistributions of source code must retain the above copyright
\r
10 * notice, this list of conditions and the following disclaimer.
\r
11 * - Redistributions in binary form must reproduce the above copyright
\r
12 * notice, this list of conditions and the following disclaimer in the
\r
13 * documentation and/or other materials provided with the distribution.
\r
14 * - The name of the author may not be used to endorse or promote products
\r
15 * derived from this software without specific prior written permission.
\r
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
\r
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
\r
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
\r
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
\r
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
\r
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
\r
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
\r
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
\r
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
29 #include <sys/stat.h>
\r
36 #include <lcd_log.h>
\r
43 int _kill(int pid, int sig)
\r
49 void _exit (int status)
\r
52 while (1) {} /* Make sure we hang here */
\r
55 int _write(int file, char *ptr, int len)
\r
59 for (todo = 0; todo < len; todo++)
\r
61 __io_putchar( *ptr++ );
\r
64 /* Implement your write code here, this is used by puts and printf for example */
\r
68 caddr_t _sbrk(int incr)
\r
70 extern char __heap_end asm("__heap_end");
\r
71 static char *heap_end;
\r
72 char *prev_heap_end;
\r
75 heap_end = &__heap_end;
\r
77 prev_heap_end = heap_end;
\r
78 if ((unsigned int)(heap_end + incr) > (0x20000000 + 0x20000))
\r
82 return (caddr_t) -1;
\r
87 return (caddr_t) prev_heap_end;
\r
90 int _close(int file)
\r
96 int _fstat(int file, struct stat *st)
\r
98 st->st_mode = S_IFCHR;
\r
102 int _isatty(int file)
\r
107 int _lseek(int file, int ptr, int dir)
\r
112 int _read(int file, char *ptr, int len)
\r
117 int _open(char *path, int flags, ...)
\r
119 /* Pretend like we always fail */
\r
123 int _wait(int *status)
\r
129 int _unlink(char *name)
\r
136 int _stat(char *file, struct stat *st)
\r
138 st->st_mode = S_IFCHR;
\r
142 int _link(char *old, char *new)
\r
154 int _execve(char *name, char **argv, char **env)
\r