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_start;
\r
71 extern char __heap_end;
\r
72 static char *current_heap_end = &__heap_start;
\r
73 char *previous_heap_end;
\r
75 previous_heap_end = current_heap_end;
\r
77 if (current_heap_end + incr > &__heap_end)
\r
80 return (caddr_t) -1;
\r
83 current_heap_end += incr;
\r
85 return (caddr_t)previous_heap_end;
\r
88 int _close(int file)
\r
94 int _fstat(int file, struct stat *st)
\r
96 st->st_mode = S_IFCHR;
\r
100 int _isatty(int file)
\r
105 int _lseek(int file, int ptr, int dir)
\r
110 int _read(int file, char *ptr, int len)
\r
115 int _open(char *path, int flags, ...)
\r
117 /* Pretend like we always fail */
\r
121 int _wait(int *status)
\r
127 int _unlink(char *name)
\r
134 int _stat(char *file, struct stat *st)
\r
136 st->st_mode = S_IFCHR;
\r
140 int _link(char *old, char *new)
\r
152 int _execve(char *name, char **argv, char **env)
\r