1 /****************************************************************************
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
8 Description: source file for communication abstraction layer
9 for the Epl-Obd-Userspace-Modul
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions
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.
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 $
57 $Revision: 1.6 $ $Date: 2008/10/17 15:32:32 $
64 -------------------------------------------------------------------------
68 2006/06/19 k.t.: start of the implementation
70 ****************************************************************************/
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 /***************************************************************************/
80 /* G L O B A L D E F I N I T I O N S */
83 /***************************************************************************/
85 //---------------------------------------------------------------------------
87 //---------------------------------------------------------------------------
89 //---------------------------------------------------------------------------
91 //---------------------------------------------------------------------------
93 //---------------------------------------------------------------------------
95 //---------------------------------------------------------------------------
97 //---------------------------------------------------------------------------
98 // local function prototypes
99 //---------------------------------------------------------------------------
101 //=========================================================================//
103 // P U B L I C F U N C T I O N S //
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
123 //---------------------------------------------------------------------------
124 tEplKernel
EplObduCalWriteEntry(unsigned int uiIndex_p
,
125 unsigned int uiSubIndex_p
,
126 void *pSrcData_p
, tEplObdSize Size_p
)
130 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
131 Ret
= EplObdWriteEntry(uiIndex_p
, uiSubIndex_p
, pSrcData_p
, Size_p
);
133 Ret
= kEplSuccessful
;
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
156 //---------------------------------------------------------------------------
157 tEplKernel
EplObduCalReadEntry(unsigned int uiIndex_p
,
158 unsigned int uiSubIndex_p
,
159 void *pDstData_p
, tEplObdSize
*pSize_p
)
163 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
164 Ret
= EplObdReadEntry(uiIndex_p
, uiSubIndex_p
, pDstData_p
, pSize_p
);
166 Ret
= kEplSuccessful
;
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
185 //---------------------------------------------------------------------------
186 tEplKernel
EplObduCalAccessOdPart(tEplObdPart ObdPart_p
, tEplObdDir Direction_p
)
190 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
191 Ret
= EplObdAccessOdPart(ObdPart_p
, Direction_p
);
193 Ret
= kEplSuccessful
;
199 //---------------------------------------------------------------------------
201 // Function: EplObduCalDefineVar()
203 // Description: Function encapsulate access of function EplObdDefineVar
205 // Parameters: pEplVarParam_p = varentry
207 // Return: tEplKernel = errorcode
211 //---------------------------------------------------------------------------
212 tEplKernel
EplObduCalDefineVar(tEplVarParam
*pVarParam_p
)
216 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
217 Ret
= EplObdDefineVar(pVarParam_p
);
219 Ret
= kEplSuccessful
;
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
238 //---------------------------------------------------------------------------
239 void *EplObduCalGetObjectDataPtr(unsigned int uiIndex_p
, unsigned int uiSubIndex_p
)
243 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
244 pData
= EplObdGetObjectDataPtr(uiIndex_p
, uiSubIndex_p
);
252 //---------------------------------------------------------------------------
254 // Function: EplObduCalRegisterUserOd()
256 // Description: Function encapsulate access of function EplObdRegisterUserOd
258 // Parameters: pUserOd_p = pointer to user OD
260 // Return: tEplKernel = errorcode
264 //---------------------------------------------------------------------------
265 #if (defined (EPL_OBD_USER_OD) && (EPL_OBD_USER_OD != FALSE))
266 tEplKernel
EplObduCalRegisterUserOd(tEplObdEntryPtr pUserOd_p
)
270 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
271 Ret
= EplObdRegisterUserOd(pUserOd_p
);
273 Ret
= kEplSuccessful
;
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
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
);
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
319 //---------------------------------------------------------------------------
320 tEplObdSize
EplObduCalGetDataSize(unsigned int uiIndex_p
,
321 unsigned int uiSubIndex_p
)
325 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
326 Size
= EplObdGetDataSize(uiIndex_p
, uiSubIndex_p
);
334 //---------------------------------------------------------------------------
336 // Function: EplObduCalGetNodeId()
338 // Description: Function encapsulate access of function EplObdGetNodeId
343 // Return: unsigned int = Node Id
347 //---------------------------------------------------------------------------
348 unsigned int EplObduCalGetNodeId(void)
350 unsigned int uiNodeId
;
352 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
353 uiNodeId
= EplObdGetNodeId();
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
375 //---------------------------------------------------------------------------
376 tEplKernel
EplObduCalSetNodeId(unsigned int uiNodeId_p
,
377 tEplObdNodeIdType NodeIdType_p
)
381 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
382 Ret
= EplObdSetNodeId(uiNodeId_p
, NodeIdType_p
);
384 Ret
= kEplSuccessful
;
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
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
);
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
439 //---------------------------------------------------------------------------
440 tEplKernel
EplObduCalReadEntryToLe(unsigned int uiIndex_p
,
441 unsigned int uiSubIndex_p
,
443 tEplObdSize
*pSize_p
)
447 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
448 Ret
= EplObdReadEntryToLe(uiIndex_p
, uiSubIndex_p
, pDstData_p
, pSize_p
);
450 Ret
= kEplSuccessful
;
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
472 //---------------------------------------------------------------------------
473 tEplKernel
EplObduCalWriteEntryFromLe(unsigned int uiIndex_p
,
474 unsigned int uiSubIndex_p
,
475 void *pSrcData_p
, tEplObdSize Size_p
)
479 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
481 EplObdWriteEntryFromLe(uiIndex_p
, uiSubIndex_p
, pSrcData_p
, Size_p
);
483 Ret
= kEplSuccessful
;
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
502 //---------------------------------------------------------------------------
503 tEplKernel
EplObduCalSearchVarEntry(EPL_MCO_DECL_INSTANCE_PTR_
unsigned int uiIndex_p
,
504 unsigned int uiSubindex_p
,
505 tEplObdVarEntry
**ppVarEntry_p
)
509 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
510 Ret
= EplObdSearchVarEntry(uiIndex_p
, uiSubindex_p
, ppVarEntry_p
);
512 Ret
= kEplSuccessful
;
517 //=========================================================================//
519 // P R I V A T E F U N C T I O N S //
521 //=========================================================================//
523 //---------------------------------------------------------------------------
539 //---------------------------------------------------------------------------
541 #endif //(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0)