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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [MCF5235_GCC/] [system/] [newlib.c] - Blame information for rev 584

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 584 jeremybenn
/*
2
    FreeRTOS MCF5235 port - Copyright (C) 2006 Christian Walter.
3
 
4
    This file is part of the FreeRTOS distribution.
5
 
6
    FreeRTOS is free software; you can redistribute it and/or modify
7
    it under the terms of the GNU General Public License** as published by
8
    the Free Software Foundation; either version 2 of the License, or
9
    (at your option) any later version.
10
 
11
    FreeRTOS is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
    GNU General Public License for more details.
15
 
16
    You should have received a copy of the GNU General Public License
17
    along with FreeRTOS; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 
20
    A special exception to the GPL can be applied should you wish to distribute
21
    a combined work that includes FreeRTOS, without being obliged to provide
22
    the source code for any proprietary components.  See the licensing section
23
    of http://www.FreeRTOS.org for full details of how and when the exception
24
    can be applied.
25
 
26
    ***************************************************************************
27
    ***************************************************************************
28
    *                                                                         *
29
    * Get the FreeRTOS eBook!  See http://www.FreeRTOS.org/Documentation      *
30
        *                                                                         *
31
        * This is a concise, step by step, 'hands on' guide that describes both   *
32
        * general multitasking concepts and FreeRTOS specifics. It presents and   *
33
        * explains numerous examples that are written using the FreeRTOS API.     *
34
        * Full source code for all the examples is provided in an accompanying    *
35
        * .zip file.                                                              *
36
    *                                                                         *
37
    ***************************************************************************
38
    ***************************************************************************
39
 
40
        Please ensure to read the configuration and relevant port sections of the
41
        online documentation.
42
 
43
        http://www.FreeRTOS.org - Documentation, latest information, license and
44
        contact details.
45
 
46
        http://www.SafeRTOS.com - A version that is certified for use in safety
47
        critical systems.
48
 
49
        http://www.OpenRTOS.com - Commercial support, development, porting,
50
        licensing and training services.
51
*/
52
 
53
/* ------------------------ System includes ------------------------------- */
54
#include <sys/types.h>
55
#include <sys/stat.h>
56
#include <unistd.h>
57
#include <errno.h>
58
 
59
/* ------------------------ FreeRTOS includes ----------------------------- */
60
#include <FreeRTOS.h>
61
#include <serial.h>
62
 
63
/* ------------------------ Prototypes ------------------------------------ */
64
void vSerialPutStringNOISR( xComPortHandle pxPort,
65
                            const signed char * const pcString,
66
                            unsigned short usStringLength );
67
 
68
/* ------------------------ Start implementation -------------------------- */
69
void
70
_exit( int status )
71
{
72
    asm volatile    ( "halt" );
73
 
74
    for( ;; );
75
}
76
 
77
pid_t
78
getpid( void )
79
{
80
    return 0;
81
}
82
 
83
int
84
kill( pid_t pid, int sig )
85
{
86
    _exit( 0 );
87
}
88
 
89
int
90
close( int fd )
91
{
92
    return 0;
93
}
94
 
95
int
96
fstat( int fd, struct stat *buf )
97
{
98
    buf->st_mode = S_IFCHR;
99
    buf->st_blksize = 0;
100
    return 0;
101
}
102
 
103
ssize_t
104
write( int fd, const void *buf, size_t nbytes )
105
{
106
    ssize_t res = nbytes;
107
    extern xComPortHandle xSTDComPort;
108
    switch ( fd )
109
    {
110
        case STDERR_FILENO:
111
            vSerialPutStringNOISR( xSTDComPort,
112
                                   ( const signed char * const )buf,
113
                                   ( unsigned short )nbytes );
114
            break;
115
        case STDOUT_FILENO:
116
            vSerialPutString( xSTDComPort,
117
                              ( const signed char * const)buf,
118
                              ( unsigned short )nbytes );
119
            break;
120
        default:
121
            errno = EIO;
122
            res = -1;
123
            break;
124
    }
125
    return res;
126
}
127
 
128
int
129
read( int fd, void *buf, size_t nbytes )
130
{
131
    switch ( fd )
132
    {
133
        default:
134
            errno = EIO;
135
            return -1;
136
    }
137
}
138
 
139
int
140
isatty( int fd )
141
{
142
    return 0;
143
}
144
 
145
off_t
146
lseek( int fd, off_t offset, int whence )
147
{
148
    errno = EIO;
149
    return ( off_t ) - 1;
150
}
151
 
152
extern char     _end[];
153
char           *heap_ptr;
154
 
155
void           *
156
sbrk( ptrdiff_t nbytes )
157
{
158
    char           *base;
159
 
160
    if( !heap_ptr )
161
        heap_ptr = ( char * )&_end;
162
    base = heap_ptr;
163
    heap_ptr += nbytes;
164
 
165
    return base;
166
}

powered by: WebSVN 2.1.0

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