ASoC: Remove duplicate ADC/DAC widgets from wm_hubs.c
[linux/fpc-iii.git] / drivers / staging / epl / EplObduCal.c
blob55612cff82113b0c52d7b35c221038ce6721393e
1 /****************************************************************************
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
6 Project: openPOWERLINK
8 Description: source file for communication abstraction layer
9 for the Epl-Obd-Userspace-Modul
11 License:
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions
15 are met:
17 1. Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
20 2. Redistributions in binary form must reproduce the above copyright
21 notice, this list of conditions and the following disclaimer in the
22 documentation and/or other materials provided with the distribution.
24 3. Neither the name of SYSTEC electronic GmbH nor the names of its
25 contributors may be used to endorse or promote products derived
26 from this software without prior written permission. For written
27 permission, please contact info@systec-electronic.com.
29 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
32 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
33 COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
34 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
35 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
37 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
39 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 POSSIBILITY OF SUCH DAMAGE.
42 Severability Clause:
44 If a provision of this License is or becomes illegal, invalid or
45 unenforceable in any jurisdiction, that shall not affect:
46 1. the validity or enforceability in that jurisdiction of any other
47 provision of this License; or
48 2. the validity or enforceability in other jurisdictions of that or
49 any other provision of this License.
51 -------------------------------------------------------------------------
53 $RCSfile: EplObduCal.c,v $
55 $Author: D.Krueger $
57 $Revision: 1.6 $ $Date: 2008/10/17 15:32:32 $
59 $State: Exp $
61 Build Environment:
62 GCC V3.4
64 -------------------------------------------------------------------------
66 Revision History:
68 2006/06/19 k.t.: start of the implementation
70 ****************************************************************************/
71 #include "EplInc.h"
72 #include "user/EplObduCal.h"
73 #include "kernel/EplObdk.h"
75 #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) && (EPL_OBD_USE_KERNEL != FALSE)
77 /***************************************************************************/
78 /* */
79 /* */
80 /* G L O B A L D E F I N I T I O N S */
81 /* */
82 /* */
83 /***************************************************************************/
85 //---------------------------------------------------------------------------
86 // const defines
87 //---------------------------------------------------------------------------
89 //---------------------------------------------------------------------------
90 // local types
91 //---------------------------------------------------------------------------
93 //---------------------------------------------------------------------------
94 // modul globale vars
95 //---------------------------------------------------------------------------
97 //---------------------------------------------------------------------------
98 // local function prototypes
99 //---------------------------------------------------------------------------
101 //=========================================================================//
102 // //
103 // P U B L I C F U N C T I O N S //
104 // //
105 //=========================================================================//
107 //---------------------------------------------------------------------------
109 // Function: EplObduCalWriteEntry()
111 // Description: Function encapsulate access of function EplObdWriteEntry
113 // Parameters: uiIndex_p = Index of the OD entry
114 // uiSubIndex_p = Subindex of the OD Entry
115 // pSrcData_p = Pointer to the data to write
116 // Size_p = Size of the data in Byte
118 // Return: tEplKernel = Errorcode
121 // State:
123 //---------------------------------------------------------------------------
124 tEplKernel EplObduCalWriteEntry(unsigned int uiIndex_p,
125 unsigned int uiSubIndex_p,
126 void *pSrcData_p, tEplObdSize Size_p)
128 tEplKernel Ret;
130 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
131 Ret = EplObdWriteEntry(uiIndex_p, uiSubIndex_p, pSrcData_p, Size_p);
132 #else
133 Ret = kEplSuccessful;
134 #endif
136 return Ret;
139 //---------------------------------------------------------------------------
141 // Function: EplObduCalReadEntry()
143 // Description: Function encapsulate access of function EplObdReadEntry
145 // Parameters: uiIndex_p = Index oof the OD entry to read
146 // uiSubIndex_p = Subindex to read
147 // pDstData_p = pointer to the buffer for data
148 // Offset_p = offset in data for read access
149 // pSize_p = IN: Size of the buffer
150 // OUT: number of readed Bytes
152 // Return: tEplKernel = errorcode
154 // State:
156 //---------------------------------------------------------------------------
157 tEplKernel EplObduCalReadEntry(unsigned int uiIndex_p,
158 unsigned int uiSubIndex_p,
159 void *pDstData_p, tEplObdSize *pSize_p)
161 tEplKernel Ret;
163 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
164 Ret = EplObdReadEntry(uiIndex_p, uiSubIndex_p, pDstData_p, pSize_p);
165 #else
166 Ret = kEplSuccessful;
167 #endif
169 return Ret;
172 //---------------------------------------------------------------------------
174 // Function: EplObduCalAccessOdPart()
176 // Description: Function encapsulate access of function EplObdAccessOdPart
178 // Parameters: ObdPart_p = od-part to reset
179 // Direction_p = directory flag for
181 // Return: tEplKernel = errorcode
183 // State:
185 //---------------------------------------------------------------------------
186 tEplKernel EplObduCalAccessOdPart(tEplObdPart ObdPart_p, tEplObdDir Direction_p)
188 tEplKernel Ret;
190 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
191 Ret = EplObdAccessOdPart(ObdPart_p, Direction_p);
192 #else
193 Ret = kEplSuccessful;
194 #endif
196 return Ret;
199 //---------------------------------------------------------------------------
201 // Function: EplObduCalDefineVar()
203 // Description: Function encapsulate access of function EplObdDefineVar
205 // Parameters: pEplVarParam_p = varentry
207 // Return: tEplKernel = errorcode
209 // State:
211 //---------------------------------------------------------------------------
212 tEplKernel EplObduCalDefineVar(tEplVarParam *pVarParam_p)
214 tEplKernel Ret;
216 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
217 Ret = EplObdDefineVar(pVarParam_p);
218 #else
219 Ret = kEplSuccessful;
220 #endif
222 return Ret;
225 //---------------------------------------------------------------------------
227 // Function: EplObduCalGetObjectDataPtr()
229 // Description: Function encapsulate access of function EplObdGetObjectDataPtr
231 // Parameters: uiIndex_p = Index of the entry
232 // uiSubindex_p = Subindex of the entry
234 // Return: void * = pointer to object data
236 // State:
238 //---------------------------------------------------------------------------
239 void *EplObduCalGetObjectDataPtr(unsigned int uiIndex_p, unsigned int uiSubIndex_p)
241 void *pData;
243 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
244 pData = EplObdGetObjectDataPtr(uiIndex_p, uiSubIndex_p);
245 #else
246 pData = NULL;
247 #endif
249 return pData;
252 //---------------------------------------------------------------------------
254 // Function: EplObduCalRegisterUserOd()
256 // Description: Function encapsulate access of function EplObdRegisterUserOd
258 // Parameters: pUserOd_p = pointer to user OD
260 // Return: tEplKernel = errorcode
262 // State:
264 //---------------------------------------------------------------------------
265 #if (defined (EPL_OBD_USER_OD) && (EPL_OBD_USER_OD != FALSE))
266 tEplKernel EplObduCalRegisterUserOd(tEplObdEntryPtr pUserOd_p)
268 tEplKernel Ret;
270 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
271 Ret = EplObdRegisterUserOd(pUserOd_p);
272 #else
273 Ret = kEplSuccessful;
274 #endif
276 return Ret;
279 #endif
280 //---------------------------------------------------------------------------
282 // Function: EplObduCalInitVarEntry()
284 // Description: Function encapsulate access of function EplObdInitVarEntry
286 // Parameters: pVarEntry_p = pointer to var entry structure
287 // bType_p = object type
288 // ObdSize_p = size of object data
290 // Returns: none
292 // State:
294 //---------------------------------------------------------------------------
295 void EplObduCalInitVarEntry(tEplObdVarEntry *pVarEntry_p, u8 bType_p,
296 tEplObdSize ObdSize_p)
298 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
299 EplObdInitVarEntry(pVarEntry_p, bType_p, ObdSize_p);
300 #endif
303 //---------------------------------------------------------------------------
305 // Function: EplObduCalGetDataSize()
307 // Description: Function encapsulate access of function EplObdGetDataSize
309 // gets the data size of an object
310 // for string objects it returnes the string length
312 // Parameters: uiIndex_p = Index
313 // uiSubIndex_p= Subindex
315 // Return: tEplObdSize
317 // State:
319 //---------------------------------------------------------------------------
320 tEplObdSize EplObduCalGetDataSize(unsigned int uiIndex_p,
321 unsigned int uiSubIndex_p)
323 tEplObdSize Size;
325 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
326 Size = EplObdGetDataSize(uiIndex_p, uiSubIndex_p);
327 #else
328 Size = 0;
329 #endif
331 return Size;
334 //---------------------------------------------------------------------------
336 // Function: EplObduCalGetNodeId()
338 // Description: Function encapsulate access of function EplObdGetNodeId
341 // Parameters:
343 // Return: unsigned int = Node Id
345 // State:
347 //---------------------------------------------------------------------------
348 unsigned int EplObduCalGetNodeId(void)
350 unsigned int uiNodeId;
352 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
353 uiNodeId = EplObdGetNodeId();
354 #else
355 uiNodeId = 0;
356 #endif
358 return uiNodeId;
361 //---------------------------------------------------------------------------
363 // Function: EplObduCalSetNodeId()
365 // Description: Function encapsulate access of function EplObdSetNodeId
368 // Parameters: uiNodeId_p = Node Id to set
369 // NodeIdType_p= Type on which way the Node Id was set
371 // Return: tEplKernel = Errorcode
373 // State:
375 //---------------------------------------------------------------------------
376 tEplKernel EplObduCalSetNodeId(unsigned int uiNodeId_p,
377 tEplObdNodeIdType NodeIdType_p)
379 tEplKernel Ret;
381 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
382 Ret = EplObdSetNodeId(uiNodeId_p, NodeIdType_p);
383 #else
384 Ret = kEplSuccessful;
385 #endif
387 return Ret;
390 //---------------------------------------------------------------------------
392 // Function: EplObduCalGetAccessType()
394 // Description: Function encapsulate access of function EplObdGetAccessType
396 // Parameters: uiIndex_p = Index of the OD entry
397 // uiSubIndex_p = Subindex of the OD Entry
398 // pAccessTyp_p = pointer to buffer to store accesstype
400 // Return: tEplKernel = errorcode
403 // State:
405 //---------------------------------------------------------------------------
406 tEplKernel EplObduCalGetAccessType(unsigned int uiIndex_p,
407 unsigned int uiSubIndex_p,
408 tEplObdAccess *pAccessTyp_p)
410 tEplObdAccess AccesType;
412 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
413 AccesType = EplObdGetAccessType(uiIndex_p, uiSubIndex_p, pAccessTyp_p);
414 #else
415 AccesType = 0;
416 #endif
418 return AccesType;
422 //---------------------------------------------------------------------------
424 // Function: EplObduCalReadEntryToLe()
426 // Description: Function encapsulate access of function EplObdReadEntryToLe
428 // Parameters: uiIndex_p = Index of the OD entry to read
429 // uiSubIndex_p = Subindex to read
430 // pDstData_p = pointer to the buffer for data
431 // Offset_p = offset in data for read access
432 // pSize_p = IN: Size of the buffer
433 // OUT: number of readed Bytes
435 // Return: tEplKernel
437 // State:
439 //---------------------------------------------------------------------------
440 tEplKernel EplObduCalReadEntryToLe(unsigned int uiIndex_p,
441 unsigned int uiSubIndex_p,
442 void *pDstData_p,
443 tEplObdSize *pSize_p)
445 tEplKernel Ret;
447 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
448 Ret = EplObdReadEntryToLe(uiIndex_p, uiSubIndex_p, pDstData_p, pSize_p);
449 #else
450 Ret = kEplSuccessful;
451 #endif
453 return Ret;
456 //---------------------------------------------------------------------------
458 // Function: EplObduCalWriteEntryFromLe()
460 // Description: Function encapsulate access of function EplObdWriteEntryFromLe
462 // Parameters: uiIndex_p = Index of the OD entry
463 // uiSubIndex_p = Subindex of the OD Entry
464 // pSrcData_p = Pointer to the data to write
465 // Size_p = Size of the data in Byte
467 // Return: tEplKernel = Errorcode
470 // State:
472 //---------------------------------------------------------------------------
473 tEplKernel EplObduCalWriteEntryFromLe(unsigned int uiIndex_p,
474 unsigned int uiSubIndex_p,
475 void *pSrcData_p, tEplObdSize Size_p)
477 tEplKernel Ret;
479 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
480 Ret =
481 EplObdWriteEntryFromLe(uiIndex_p, uiSubIndex_p, pSrcData_p, Size_p);
482 #else
483 Ret = kEplSuccessful;
484 #endif
485 return Ret;
488 //---------------------------------------------------------------------------
490 // Function: EplObduCalSearchVarEntry()
492 // Description: gets variable from OD
494 // Parameters: uiIndex_p = index of the var entry to search
495 // uiSubindex_p = subindex of var entry to search
496 // ppVarEntry_p = pointer to the pointer to the varentry
498 // Return: tEplKernel
500 // State:
502 //---------------------------------------------------------------------------
503 tEplKernel EplObduCalSearchVarEntry(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
504 unsigned int uiSubindex_p,
505 tEplObdVarEntry **ppVarEntry_p)
507 tEplKernel Ret;
509 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
510 Ret = EplObdSearchVarEntry(uiIndex_p, uiSubindex_p, ppVarEntry_p);
511 #else
512 Ret = kEplSuccessful;
513 #endif
514 return Ret;
517 //=========================================================================//
518 // //
519 // P R I V A T E F U N C T I O N S //
520 // //
521 //=========================================================================//
523 //---------------------------------------------------------------------------
525 // Function:
527 // Description:
531 // Parameters:
534 // Returns:
537 // State:
539 //---------------------------------------------------------------------------
541 #endif //(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0)
543 // EOF