comparison gsm-fw/nucleus/smse.c @ 143:afceeeb2cba1

Our nuc-fw is destined to become gsm-fw, so I went ahead and did the big hg mv
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 12 Nov 2013 05:35:48 +0000
parents nuc-fw/nucleus/smse.c@947b1f473960
children
comparison
equal deleted inserted replaced
142:15d5977390c2 143:afceeeb2cba1
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 /* smse.c Nucleus PLUS 1.14 */
17 /* */
18 /* COMPONENT */
19 /* */
20 /* SM - Semaphore Management */
21 /* */
22 /* DESCRIPTION */
23 /* */
24 /* This file contains the error checking routines for the */
25 /* supplemental functions of the Semaphore component. This permits */
26 /* easy removal of error checking logic when it is not needed. */
27 /* */
28 /* DATA STRUCTURES */
29 /* */
30 /* None */
31 /* */
32 /* FUNCTIONS */
33 /* */
34 /* SMSE_Reset_Semaphore Reset a semaphore */
35 /* */
36 /* DEPENDENCIES */
37 /* */
38 /* cs_extr.h Common Service functions */
39 /* tc_extr.h Thread Control functions */
40 /* sm_extr.h Semaphore functions */
41 /* */
42 /* HISTORY */
43 /* */
44 /* DATE REMARKS */
45 /* */
46 /* 03-01-1994 Created initial version 1.1 from */
47 /* routines originally in core */
48 /* error checking file */
49 /* */
50 /* 03-18-1994 Verified version 1.1 */
51 /* 04-17-1996 updated to version 1.2 */
52 /* 03-24-1998 Released version 1.3 */
53 /* 04-17-2002 Released version 1.13m */
54 /* 11-07-2002 Released version 1.14 */
55 /*************************************************************************/
56 #define NU_SOURCE_FILE
57
58
59 #include "cs_extr.h" /* Common service functions */
60 #include "tc_extr.h" /* Thread control functions */
61 #include "sm_extr.h" /* Semaphore functions */
62
63
64
65 /*************************************************************************/
66 /* */
67 /* FUNCTION */
68 /* */
69 /* SMSE_Reset_Semaphore */
70 /* */
71 /* DESCRIPTION */
72 /* */
73 /* This function performs error checking on the parameters supplied */
74 /* to the reset semaphore function. */
75 /* */
76 /* CALLED BY */
77 /* */
78 /* Application */
79 /* */
80 /* CALLS */
81 /* */
82 /* SMS_Reset_Semaphore Actual reset semaphore func. */
83 /* */
84 /* INPUTS */
85 /* */
86 /* semaphore_ptr Semaphore control block ptr */
87 /* initial_count Initial count to reset the */
88 /* semaphore to */
89 /* */
90 /* OUTPUTS */
91 /* */
92 /* NU_INVALID_SEMAPHORE Invalid semaphore pointer */
93 /* */
94 /* HISTORY */
95 /* */
96 /* DATE REMARKS */
97 /* */
98 /* 03-01-1993 Created initial version 1.0 */
99 /* 04-19-1993 Verified version 1.0 */
100 /* 03-01-1994 Modified function interface, */
101 /* resulting in version 1.1 */
102 /* */
103 /* 03-18-1994 Verified version 1.1 */
104 /* */
105 /*************************************************************************/
106 STATUS SMSE_Reset_Semaphore(NU_SEMAPHORE *semaphore_ptr,
107 UNSIGNED initial_count)
108 {
109
110 SM_SCB *semaphore; /* Semaphore control blk ptr */
111 STATUS status; /* Completion status */
112
113
114 /* Move input semaphore pointer into internal pointer. */
115 semaphore = (SM_SCB *) semaphore_ptr;
116
117 /* Determine if the semaphore pointer is valid. */
118 if ((semaphore) && (semaphore -> sm_id == SM_SEMAPHORE_ID))
119
120 /* Semaphore pointer is valid, call function to reset it. */
121 status = SMS_Reset_Semaphore(semaphore_ptr, initial_count);
122
123 else
124
125 /* Semaphore pointer is invalid, indicate in completion status. */
126 status = NU_INVALID_SEMAPHORE;
127
128 /* Return completion status. */
129 return(status);
130 }
131
132
133
134