1 /*
2 * Copyright (c) 2010, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * */
32 /** ===========================================================================
33 * @file MultiProc.h
34 *
35 * @brief Processor ID Manager
36 *
37 * Many IPC modules require the ability to uniquely specify and identify
38 * processors in a multi-processor environment. The MultiProc module
39 * centeralizes processor id management into one module. Since this
40 * configuration is almost always universally required, most IPC applications
41 * require supplying configuration of this module.
42 *
43 * Each processor in the MultiProc module may be uniquely identified by
44 * either a name string or an integer ranging from 0 to NUMPROCESSORS - 1.
45 *
46 * At runtime, the #MultiProc_getId call returns the MultiProc id for any
47 * processor given its name.
48 */
50 #ifndef ti_ipc_MultiProc__include
51 #define ti_ipc_MultiProc__include
53 #if defined (__cplusplus)
54 extern "C" {
55 #endif
57 /* =============================================================================
58 * All success and failure codes for the module
59 * =============================================================================
60 */
62 /*!
63 * @def MultiProc_S_BUSY
64 * @brief The resource is still in use
65 */
66 #define MultiProc_S_BUSY 2
68 /*!
69 * @def MultiProc_S_ALREADYSETUP
70 * @brief The module has been already setup
71 */
72 #define MultiProc_S_ALREADYSETUP 1
74 /*!
75 * @def MultiProc_S_SUCCESS
76 * @brief Operation is successful.
77 */
78 #define MultiProc_S_SUCCESS 0
80 /*!
81 * @def MultiProc_E_FAIL
82 * @brief Generic failure.
83 */
84 #define MultiProc_E_FAIL -1
86 /*!
87 * @def MultiProc_E_INVALIDARG
88 * @brief Argument passed to function is invalid.
89 */
90 #define MultiProc_E_INVALIDARG -2
92 /*!
93 * @def MultiProc_E_MEMORY
94 * @brief Operation resulted in memory failure.
95 */
96 #define MultiProc_E_MEMORY -3
98 /*!
99 * @def MultiProc_E_ALREADYEXISTS
100 * @brief The specified entity already exists.
101 */
102 #define MultiProc_E_ALREADYEXISTS -4
104 /*!
105 * @def MultiProc_E_NOTFOUND
106 * @brief Unable to find the specified entity.
107 */
108 #define MultiProc_E_NOTFOUND -5
110 /*!
111 * @def MultiProc_E_TIMEOUT
112 * @brief Operation timed out.
113 */
114 #define MultiProc_E_TIMEOUT -6
116 /*!
117 * @def MultiProc_E_INVALIDSTATE
118 * @brief Module is not initialized.
119 */
120 #define MultiProc_E_INVALIDSTATE -7
122 /*!
123 * @def MultiProc_E_OSFAILURE
124 * @brief A failure occurred in an OS-specific call
125 */
126 #define MultiProc_E_OSFAILURE -8
128 /*!
129 * @def MultiProc_E_RESOURCE
130 * @brief Specified resource is not available
131 */
132 #define MultiProc_E_RESOURCE -9
134 /*!
135 * @def MultiProc_E_RESTART
136 * @brief Operation was interrupted. Please restart the operation
137 */
138 #define MultiProc_E_RESTART -10
140 /* =============================================================================
141 * Macros
142 * =============================================================================
143 */
145 /*!
146 * @def MultiProc_INVALIDID
147 * @brief Invalid processor id.
148 */
149 #define MultiProc_INVALIDID (0xFFFF)
151 /* =============================================================================
152 * MultiProc Module-wide Functions
153 * =============================================================================
154 */
156 /*!
157 * @brief Gets the MultiProc id
158 *
159 * Retrieves the MultiProc id for the processor with corresponding MultiProc
160 * name. #MultiProc_INVALIDID is returned if the name was not found.
161 *
162 * @param name Name of the processor.
163 *
164 * @return MultiProc id
165 *
166 * @sa MultiProc_getId
167 */
168 UInt16 MultiProc_getId(String name);
170 /*!
171 * @brief Gets the name of a processor
172 *
173 * @param id MultiProc id.
174 *
175 * @return Name of the processor
176 *
177 * @sa MultiProc_getName
178 */
179 String MultiProc_getName(UInt16 id);
181 /*!
182 * @brief Gets the number of processors
183 *
184 * @return Number of processors configured with MultiProc
185 */
186 UInt16 MultiProc_getNumProcessors(Void);
188 /*!
189 * @brief Gets executing processor's MultiProc id
190 *
191 * @return Executing processor's id
192 *
193 * @sa MultiProc_getId
194 */
195 UInt16 MultiProc_self(Void);
198 #if defined (__cplusplus)
199 }
200 #endif /* defined (__cplusplus) */
202 #endif /* ti_ipc_MultiProc__include */
204 /*
205 */
206 /*
207 * @(#) ti.ipc; 1, 0, 0, 0,111; 6-25-2010 18:56:21; /db/vtree/library/trees/ipc/ipc-e16x/src/
208 */