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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [kernel/] [current/] [src/] [sync/] [mbox.cxx] - Blame information for rev 819

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      mbox.cxx
4
//
5
//      Mbox mbox template class implementation
6
//
7
//==========================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
9
// -------------------------------------------                              
10
// This file is part of eCos, the Embedded Configurable Operating System.   
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under    
14
// the terms of the GNU General Public License as published by the Free     
15
// Software Foundation; either version 2 or (at your option) any later      
16
// version.                                                                 
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT      
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
21
// for more details.                                                        
22
//
23
// You should have received a copy of the GNU General Public License        
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
26
//
27
// As a special exception, if other files instantiate templates or use      
28
// macros or inline functions from this file, or you compile this file      
29
// and link it with other works to produce a work based on this file,       
30
// this file does not by itself cause the resulting work to be covered by   
31
// the GNU General Public License. However the source code for this file    
32
// must still be made available in accordance with section (3) of the GNU   
33
// General Public License v2.                                               
34
//
35
// This exception does not invalidate any other reasons why a work based    
36
// on this file might be covered by the GNU General Public License.         
37
// -------------------------------------------                              
38
// ####ECOSGPLCOPYRIGHTEND####                                              
39
//==========================================================================
40
//#####DESCRIPTIONBEGIN####
41
//
42
// Author(s):   hmt
43
// Contributors:        hmt
44
// Date:        1998-02-11
45
// Purpose:     Mbox implementation
46
// Description: This file contains the implementations of the mbox class
47
//
48
//####DESCRIPTIONEND####
49
//
50
//==========================================================================
51
 
52
#include <pkgconf/kernel.h>
53
 
54
#include <cyg/kernel/ktypes.h>         // base kernel types
55
#include <cyg/infra/cyg_trac.h>        // tracing macros
56
#include <cyg/infra/cyg_ass.h>         // assertion macros
57
#include <cyg/kernel/instrmnt.h>       // instrumentation
58
 
59
#include <cyg/kernel/thread.inl>       // Cyg_Thread inlines
60
 
61
#include <cyg/kernel/mbox.hxx>         // our own header
62
 
63
#ifndef CYGIMP_MBOXT_INLINE            // force inlining
64
#define CYGIMP_MBOXT_INLINE            // of implementation
65
#endif
66
 
67
#ifdef CYGIMP_MBOX_USE_MBOXT_PLAIN
68
#include <cyg/kernel/mboxt.inl>        // mbox template implementation
69
#else
70
#include <cyg/kernel/mboxt2.inl>       // mbox template implementation
71
#endif
72
 
73
// -------------------------------------------------------------------------
74
// This module exists to cause exactly one instance of these functions to
75
// exist; this is just like a vanilla class, except we use the template
76
// class to acquire an implementation.  The template functions are inlined
77
// in each of these methods.
78
 
79
 
80
// -------------------------------------------------------------------------
81
// Constructor
82
 
83
Cyg_Mbox::Cyg_Mbox()
84
{
85
}
86
 
87
// -------------------------------------------------------------------------
88
// Destructor
89
 
90
Cyg_Mbox::~Cyg_Mbox()
91
{
92
}
93
 
94
// -------------------------------------------------------------------------
95
// debugging/assert function
96
 
97
#ifdef CYGDBG_USE_ASSERTS
98
cyg_bool
99
Cyg_Mbox::check_this(cyg_assert_class_zeal zeal) const
100
{
101
    return m.check_this(zeal);
102
}
103
#endif
104
 
105
// -------------------------------------------------------------------------
106
// now the members themselves:
107
 
108
void *
109
Cyg_Mbox::get()
110
{
111
    void * p=NULL;
112
    if ( ! m.get( p ) )
113
        return NULL;
114
    return p;
115
}
116
 
117
#ifdef CYGFUN_KERNEL_THREADS_TIMER
118
void *
119
Cyg_Mbox::get( cyg_tick_count timeout )
120
{
121
    void * p=NULL;
122
    if ( ! m.get( p, timeout ) )
123
        return NULL;
124
    return p;
125
}
126
#endif
127
 
128
void *
129
Cyg_Mbox::tryget()
130
{
131
    void * p=NULL;
132
    if ( ! m.tryget( p ) )
133
        return NULL;
134
    return p;
135
}
136
 
137
#ifdef  CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
138
cyg_bool
139
Cyg_Mbox::put( void *item )
140
{
141
    return m.put( item );
142
}
143
 
144
#ifdef CYGFUN_KERNEL_THREADS_TIMER
145
cyg_bool
146
Cyg_Mbox::put( void *item, cyg_tick_count timeout )
147
{
148
    return m.put( item, timeout );
149
}
150
#endif
151
#endif // CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
152
 
153
cyg_bool
154
Cyg_Mbox::tryput( void *item )
155
{
156
    return m.tryput( item );
157
}
158
 
159
void *
160
Cyg_Mbox::peek_item()                   // Get next item to be returned
161
{
162
    void *p=NULL;
163
    if ( ! m.peek_item( p ) )
164
        return NULL;
165
    return p;
166
}
167
 
168
// -------------------------------------------------------------------------
169
// EOF mbox.cxx

powered by: WebSVN 2.1.0

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