comparison src/nucleus/mbse.c @ 0:92470e5d0b9e

src: partial import from FC Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 May 2020 01:28:16 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:92470e5d0b9e
1 /*************************************************************************/
2 /* */
3 /* Copyright Mentor Graphics Corporation 2002 */
4 /* All Rights Reserved. */
5 /* */
6 /* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS */
7 /* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS */
8 /* SUBJECT TO LICENSE TERMS. */
9 /* */
10 /*************************************************************************/
11
12 /*************************************************************************/
13 /* */
14 /* FILE NAME VERSION */
15 /* */
16 /* mbse.c Nucleus PLUS 1.14 */
17 /* */
18 /* COMPONENT */
19 /* */
20 /* MB - Mailbox Management */
21 /* */
22 /* DESCRIPTION */
23 /* */
24 /* This file contains the error checking routines for the functions */
25 /* in the Mailbox component. This permits easy removal of error */
26 /* checking logic when it is not needed. */
27 /* */
28 /* DATA STRUCTURES */
29 /* */
30 /* None */
31 /* */
32 /* FUNCTIONS */
33 /* */
34 /* MBSE_Reset_Mailbox Reset a mailbox */
35 /* MBSE_Receive_From_Mailbox Receive a mailbox message */
36 /* */
37 /* DEPENDENCIES */
38 /* */
39 /* cs_extr.h Common Service functions */
40 /* tc_extr.h Thread Control functions */
41 /* mb_extr.h Mailbox functions */
42 /* */
43 /* HISTORY */
44 /* */
45 /* DATE REMARKS */
46 /* */
47 /* 03-01-1994 Created initial version 1.1 from */
48 /* routines originally in core */
49 /* error checking file */
50 /* */
51 /* 03-18-1994 Verified version 1.1 */
52 /* 04-17-1996 updated to version 1.2 */
53 /* 03-24-1998 Released version 1.3 */
54 /* 04-17-2002 Released version 1.13m */
55 /* 11-07-2002 Released version 1.14 */
56 /*************************************************************************/
57 #define NU_SOURCE_FILE
58
59
60 #include "cs_extr.h" /* Common service functions */
61 #include "tc_extr.h" /* Thread control functions */
62 #include "mb_extr.h" /* Mailbox functions */
63
64
65
66 /*************************************************************************/
67 /* */
68 /* FUNCTION */
69 /* */
70 /* MBSE_Reset_Mailbox */
71 /* */
72 /* DESCRIPTION */
73 /* */
74 /* This function performs error checking on the parameters supplied */
75 /* to the actual reset mailbox function. */
76 /* */
77 /* CALLED BY */
78 /* */
79 /* Application */
80 /* */
81 /* CALLS */
82 /* */
83 /* MBS_Reset_Mailbox Actual reset mailbox function*/
84 /* */
85 /* INPUTS */
86 /* */
87 /* mailbox_ptr Mailbox control block pointer*/
88 /* */
89 /* OUTPUTS */
90 /* */
91 /* NU_INVALID_MAILBOX Invalid mailbox supplied */
92 /* */
93 /* HISTORY */
94 /* */
95 /* DATE REMARKS */
96 /* */
97 /* 03-01-1993 Created initial version 1.0 */
98 /* 04-19-1993 Verified version 1.0 */
99 /* 03-01-1994 Modified interface to exactly */
100 /* match prototype, resulting in */
101 /* version 1.1 */
102 /* */
103 /* 03-18-1994 Verified version 1.1 */
104 /* */
105 /*************************************************************************/
106 STATUS MBSE_Reset_Mailbox(NU_MAILBOX *mailbox_ptr)
107 {
108
109 MB_MCB *mailbox; /* Mailbox control block ptr */
110 STATUS status; /* Completion status */
111
112
113 /* Move input mailbox pointer into internal pointer. */
114 mailbox = (MB_MCB *) mailbox_ptr;
115
116 /* Determine if the mailbox pointer is valid. */
117 if ((mailbox) && (mailbox -> mb_id == MB_MAILBOX_ID))
118
119 /* Mailbox pointer is valid, call function to reset it. */
120 status = MBS_Reset_Mailbox(mailbox_ptr);
121
122 else
123
124 /* Mailbox pointer is invalid, indicate in completion status. */
125 status = NU_INVALID_MAILBOX;
126
127 /* Return completion status. */
128 return(status);
129 }
130
131
132 /*************************************************************************/
133 /* */
134 /* FUNCTION */
135 /* */
136 /* MBSE_Broadcast_To_Mailbox */
137 /* */
138 /* DESCRIPTION */
139 /* */
140 /* This function performs error checking on the parameters supplied */
141 /* to the mailbox broadcast function. */
142 /* */
143 /* CALLED BY */
144 /* */
145 /* Application */
146 /* */
147 /* CALLS */
148 /* */
149 /* MBS_Broadcast_To_Mailbox Actual broadcast mailbox func*/
150 /* TCCE_Suspend_Error Check suspend validity */
151 /* */
152 /* INPUTS */
153 /* */
154 /* mailbox_ptr Mailbox control block pointer*/
155 /* message Pointer to message to send */
156 /* suspend Suspension option if full */
157 /* */
158 /* OUTPUTS */
159 /* */
160 /* NU_INVALID_MAILBOX Mailbox pointer is invalid */
161 /* NU_INVALID_POINTER Message pointer is invalid */
162 /* NU_INVALID_SUSPEND Invalid suspend request */
163 /* */
164 /* HISTORY */
165 /* */
166 /* DATE REMARKS */
167 /* */
168 /* 03-01-1993 Created initial version 1.0 */
169 /* 04-19-1993 Verified version 1.0 */
170 /* 03-01-1994 Modified interface to exactly */
171 /* match prototype, resulting in */
172 /* version 1.1 */
173 /* */
174 /* 03-18-1994 Verified version 1.1 */
175 /* */
176 /*************************************************************************/
177 STATUS MBSE_Broadcast_To_Mailbox(NU_MAILBOX *mailbox_ptr, VOID *message,
178 UNSIGNED suspend)
179 {
180
181 MB_MCB *mailbox; /* Mailbox control block ptr */
182 STATUS status; /* Completion status */
183
184
185
186 /* Move input mailbox pointer into internal pointer. */
187 mailbox = (MB_MCB *) mailbox_ptr;
188
189 /* Determine if mailbox pointer is invalid. */
190 if (mailbox == NU_NULL)
191
192 /* Mailbox pointer is invalid, indicate in completion status. */
193 status = NU_INVALID_MAILBOX;
194
195 else if (mailbox -> mb_id != MB_MAILBOX_ID)
196
197 /* Mailbox pointer is invalid, indicate in completion status. */
198 status = NU_INVALID_MAILBOX;
199
200 else if (message == NU_NULL)
201
202 /* Message pointer is invalid, indicate in completion status. */
203 status = NU_INVALID_POINTER;
204
205 else if ((suspend) && (TCCE_Suspend_Error()))
206
207 /* Indicate that suspension is only valid from a task thread. */
208 status = NU_INVALID_SUSPEND;
209
210 else
211
212 /* Parameters are valid, call actual function. */
213 status = MBS_Broadcast_To_Mailbox(mailbox_ptr, message, suspend);
214
215 /* Return the completion status. */
216 return(status);
217 }
218
219
220
221
222