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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [rdos/] [rdoshelp.c] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/*#######################################################################
2
# RDOS operating system
3
# Copyright (C) 1988-2006, Leif Ekblad
4
#
5
# This library is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU Lesser General Public License as published
7
# by the Free Software Foundation; either version 2.1 of the License, or
8
# (at your option) any later version.
9
#
10
# This library is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU Lesser General Public License for more details.
14
#
15
# You should have received a copy of the GNU Lesser General Public
16
# License along with this library; if not, write to the Free Software
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
#
19
# The author of this program may be contacted at leif@rdos.net
20
#
21
# rdoshelp.c
22
# implementation of various structures and helpers
23
#
24
##########################################################################*/
25
 
26
#include <reent.h>
27
#include <rdos.h>
28
#include <stdio.h>
29
 
30
char *__env[1] = { 0 };
31
char **environ = __env;
32
 
33
static int once_section;
34
static int key_section;
35
 
36
/*##########################################################################
37
#
38
#   Name       : _get_impure_data_size
39
#
40
#   Purpose....: Get size of _reent structure
41
#
42
#   In params..: *
43
#   Out params.: *
44
#   Returns....: size
45
#
46
##########################################################################*/
47
int get_impure_data_size()
48
{
49
        return sizeof(struct _reent);
50
}
51
 
52
/*##########################################################################
53
#
54
#   Name       : __rdos_thread_once
55
#
56
#   Purpose....: Emulate GCC pthread_once
57
#
58
#   In params..: Handle initially 0
59
#              : function to initially call
60
#   Out params.: *
61
#   Returns....: result
62
#
63
##########################################################################*/
64
int __rdos_thread_once (int *handle, void (*func) (void))
65
{
66
    if (handle == 0 || func == 0)
67
        return 0;
68
 
69
    RdosEnterSection(once_section);
70
    if (*handle == 0)
71
        (*func)();
72
    else
73
        *handle = 1;
74
    RdosLeaveSection(once_section);
75
    return 0;
76
}
77
 
78
/*##########################################################################
79
#
80
#   Name       : __rdos_thread_mutex_init
81
#
82
#   Purpose....: Emulate GCC pthread_thread_mutex_init
83
#
84
#   In params..: *
85
#   Out params.: *
86
#   Returns....: handle
87
#
88
##########################################################################*/
89
int __rdos_thread_mutex_init (void)
90
{
91
    return RdosCreateSection();
92
}
93
 
94
/*##########################################################################
95
#
96
#   Name       : __rdos_thread_mutex_lock
97
#
98
#   Purpose....: Emulate GCC pthread_thread_mutex_lock
99
#
100
#   In params..: handle
101
#   Out params.: *
102
#   Returns....: *
103
#
104
##########################################################################*/
105
int __rdos_thread_mutex_lock (int handle)
106
{
107
    RdosEnterSection(handle);
108
    return 0;
109
}
110
 
111
/*##########################################################################
112
#
113
#   Name       : __rdos_thread_mutex_trylock
114
#
115
#   Purpose....: Emulate GCC pthread_thread_mutex_trylock
116
#                Try is not yet implemented, and lock is used.
117
#
118
#   In params..: handle
119
#   Out params.: *
120
#   Returns....: *
121
#
122
##########################################################################*/
123
int __rdos_thread_mutex_trylock (int handle)
124
{
125
    RdosEnterSection(handle);
126
    return 0;
127
}
128
 
129
/*##########################################################################
130
#
131
#   Name       : __rdos_thread_mutex_unlock
132
#
133
#   Purpose....: Emulate GCC pthread_thread_mutex_unlock
134
#
135
#   In params..: handle
136
#   Out params.: *
137
#   Returns....: *
138
#
139
##########################################################################*/
140
int __rdos_thread_mutex_unlock (int handle)
141
{
142
    RdosLeaveSection(handle);
143
    return 0;
144
}
145
 
146
/*##########################################################################
147
#
148
#   Name       : __init_rdos
149
#
150
#   Purpose....: Init RDOS specific data
151
#
152
#   In params..: reent structure
153
#   Out params.: *
154
#   Returns....: *
155
#
156
##########################################################################*/
157
void __init_rdos(struct _reent *reent)
158
{
159
        once_section = RdosCreateSection();
160
        _REENT_INIT_PTR(reent);
161
        __sinit(reent);
162
}

powered by: WebSVN 2.1.0

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