]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained/libboard_samv7-ek/source/syscalls.c
Update version number ready for V8.2.1 release.
[freertos] / FreeRTOS / Demo / CORTEX_M7_SAMV71_Xplained / libboard_samv7-ek / source / syscalls.c
1 /* ----------------------------------------------------------------------------\r
2  *         SAM Software Package License \r
3  * ----------------------------------------------------------------------------\r
4  * Copyright (c) 2011, Atmel Corporation\r
5  *\r
6  * All rights reserved.\r
7  *\r
8  * Redistribution and use in source and binary forms, with or without\r
9  * modification, are permitted provided that the following conditions are met:\r
10  *\r
11  * - Redistributions of source code must retain the above copyright notice,\r
12  * this list of conditions and the disclaimer below.\r
13  *\r
14  * Atmel's name may not be used to endorse or promote products derived from\r
15  * this software without specific prior written permission.\r
16  *\r
17  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR\r
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE\r
20  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,\r
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\r
23  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
24  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
25  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
26  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
27  * ----------------------------------------------------------------------------\r
28  */\r
29  \r
30 /**\r
31   * \file syscalls.c\r
32   *\r
33   * Implementation of newlib syscall.\r
34   *\r
35   */\r
36 \r
37 /*----------------------------------------------------------------------------\r
38  *        Headers\r
39  *----------------------------------------------------------------------------*/\r
40 \r
41 \r
42 #include "board.h"\r
43 \r
44 #include <stdio.h>\r
45 #include <stdarg.h>\r
46 #include <errno.h>\r
47 #include <intrinsics.h>\r
48 \r
49 /*----------------------------------------------------------------------------\r
50  *        Exported variables\r
51  *----------------------------------------------------------------------------*/\r
52 \r
53 #undef errno\r
54 extern int errno ;\r
55 extern int  _heap ;\r
56 \r
57 /*----------------------------------------------------------------------------\r
58  *        Exported functions\r
59  *----------------------------------------------------------------------------*/\r
60 extern void _exit( int status ) ;\r
61 extern void _kill( int pid, int sig ) ;\r
62 extern int _getpid ( void ) ;\r
63 \r
64 extern caddr_t _sbrk ( int incr )\r
65 {\r
66     static unsigned char *heap = NULL ;\r
67     unsigned char *prev_heap ;\r
68 \r
69     if ( heap == NULL )\r
70     {\r
71         heap = (unsigned char *)&_heap ;\r
72     }\r
73     prev_heap = heap;\r
74 \r
75     heap += incr ;\r
76 \r
77     return (caddr_t) prev_heap ;\r
78 }\r
79 \r
80 extern int link( char *old, char *new )\r
81 {\r
82     return -1 ;\r
83 }\r
84 \r
85 extern int _close( int file )\r
86 {\r
87     return -1 ;\r
88 }\r
89 \r
90 extern int _fstat( int file, struct stat *st )\r
91 {\r
92     st->st_mode = S_IFCHR ;\r
93 \r
94     return 0 ;\r
95 }\r
96 \r
97 extern int _isatty( int file )\r
98 {\r
99     return 1 ;\r
100 }\r
101 \r
102 extern int _lseek( int file, int ptr, int dir )\r
103 {\r
104     return 0 ;\r
105 }\r
106 \r
107 extern int _read(int file, char *ptr, int len)\r
108 {\r
109     return 0 ;\r
110 }\r
111 \r
112 extern int _write( int file, char *ptr, int len )\r
113 {\r
114     int iIndex ;\r
115     \r
116     \r
117 //    for ( ; *ptr != 0 ; ptr++ )\r
118     for ( iIndex=0 ; iIndex < len ; iIndex++, ptr++ )\r
119     {\r
120         DBG_PutChar( *ptr ) ;\r
121     }\r
122 \r
123     return iIndex ;\r
124 }\r
125 \r
126 extern void _exit( int status )\r
127 {\r
128     printf( "Exiting with status %d.\n", status ) ;\r
129 \r
130     for ( ; ; ) ;\r
131 }\r
132 \r
133 extern void _kill( int pid, int sig )\r
134 {\r
135     return ; \r
136 }\r
137 \r
138 extern int _getpid ( void )\r
139 {\r
140     return -1 ;\r
141 }\r