1 /****************************************************************************
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
8 Description: source file for EPL API module (process image)
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
16 1. Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
19 2. Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in the
21 documentation and/or other materials provided with the distribution.
23 3. Neither the name of SYSTEC electronic GmbH nor the names of its
24 contributors may be used to endorse or promote products derived
25 from this software without prior written permission. For written
26 permission, please contact info@systec-electronic.com.
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32 COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 POSSIBILITY OF SUCH DAMAGE.
43 If a provision of this License is or becomes illegal, invalid or
44 unenforceable in any jurisdiction, that shall not affect:
45 1. the validity or enforceability in that jurisdiction of any other
46 provision of this License; or
47 2. the validity or enforceability in other jurisdictions of that or
48 any other provision of this License.
50 -------------------------------------------------------------------------
52 $RCSfile: EplApiProcessImage.c,v $
56 $Revision: 1.7 $ $Date: 2008/11/13 17:13:09 $
63 -------------------------------------------------------------------------
67 2006/10/10 d.k.: start of the implementation, version 1.00
69 ****************************************************************************/
73 #include <linux/uaccess.h>
75 /***************************************************************************/
78 /* G L O B A L D E F I N I T I O N S */
81 /***************************************************************************/
83 //---------------------------------------------------------------------------
85 //---------------------------------------------------------------------------
87 //---------------------------------------------------------------------------
89 //---------------------------------------------------------------------------
91 //---------------------------------------------------------------------------
93 //---------------------------------------------------------------------------
95 //---------------------------------------------------------------------------
96 // local function prototypes
97 //---------------------------------------------------------------------------
99 /***************************************************************************/
102 /* C L A S S EplApi */
105 /***************************************************************************/
110 /***************************************************************************/
112 //=========================================================================//
114 // P R I V A T E D E F I N I T I O N S //
116 //=========================================================================//
118 //---------------------------------------------------------------------------
120 //---------------------------------------------------------------------------
122 //---------------------------------------------------------------------------
124 //---------------------------------------------------------------------------
126 #if ((EPL_API_PROCESS_IMAGE_SIZE_IN > 0) || (EPL_API_PROCESS_IMAGE_SIZE_OUT > 0))
128 #if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
129 u8 m_abProcessImageInput
[EPL_API_PROCESS_IMAGE_SIZE_IN
];
131 #if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
132 u8 m_abProcessImageOutput
[EPL_API_PROCESS_IMAGE_SIZE_OUT
];
135 } tEplApiProcessImageInstance
;
137 //---------------------------------------------------------------------------
139 //---------------------------------------------------------------------------
141 static tEplApiProcessImageInstance EplApiProcessImageInstance_g
;
144 //---------------------------------------------------------------------------
145 // local function prototypes
146 //---------------------------------------------------------------------------
148 //=========================================================================//
150 // P U B L I C F U N C T I O N S //
152 //=========================================================================//
154 //---------------------------------------------------------------------------
156 // Function: EplApiProcessImageSetup()
158 // Description: sets up static process image
160 // Parameters: (none)
162 // Returns: tEplKernel = error code
167 //---------------------------------------------------------------------------
169 tEplKernel
EplApiProcessImageSetup(void)
171 tEplKernel Ret
= kEplSuccessful
;
172 #if ((EPL_API_PROCESS_IMAGE_SIZE_IN > 0) || (EPL_API_PROCESS_IMAGE_SIZE_OUT > 0))
173 unsigned int uiVarEntries
;
177 #if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
178 uiVarEntries
= EPL_API_PROCESS_IMAGE_SIZE_IN
;
180 Ret
= EplApiLinkObject(0x2000,
181 EplApiProcessImageInstance_g
.
182 m_abProcessImageInput
, &uiVarEntries
, &ObdSize
,
185 uiVarEntries
= EPL_API_PROCESS_IMAGE_SIZE_IN
;
187 Ret
= EplApiLinkObject(0x2001,
188 EplApiProcessImageInstance_g
.
189 m_abProcessImageInput
, &uiVarEntries
, &ObdSize
,
193 uiVarEntries
= EPL_API_PROCESS_IMAGE_SIZE_IN
/ ObdSize
;
194 Ret
= EplApiLinkObject(0x2010,
195 EplApiProcessImageInstance_g
.
196 m_abProcessImageInput
, &uiVarEntries
, &ObdSize
,
200 uiVarEntries
= EPL_API_PROCESS_IMAGE_SIZE_IN
/ ObdSize
;
201 Ret
= EplApiLinkObject(0x2011,
202 EplApiProcessImageInstance_g
.
203 m_abProcessImageInput
, &uiVarEntries
, &ObdSize
,
207 uiVarEntries
= EPL_API_PROCESS_IMAGE_SIZE_IN
/ ObdSize
;
208 Ret
= EplApiLinkObject(0x2020,
209 EplApiProcessImageInstance_g
.
210 m_abProcessImageInput
, &uiVarEntries
, &ObdSize
,
214 uiVarEntries
= EPL_API_PROCESS_IMAGE_SIZE_IN
/ ObdSize
;
215 Ret
= EplApiLinkObject(0x2021,
216 EplApiProcessImageInstance_g
.
217 m_abProcessImageInput
, &uiVarEntries
, &ObdSize
,
221 #if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
222 uiVarEntries
= EPL_API_PROCESS_IMAGE_SIZE_OUT
;
224 Ret
= EplApiLinkObject(0x2030,
225 EplApiProcessImageInstance_g
.
226 m_abProcessImageOutput
, &uiVarEntries
, &ObdSize
,
229 uiVarEntries
= EPL_API_PROCESS_IMAGE_SIZE_OUT
;
231 Ret
= EplApiLinkObject(0x2031,
232 EplApiProcessImageInstance_g
.
233 m_abProcessImageOutput
, &uiVarEntries
, &ObdSize
,
237 uiVarEntries
= EPL_API_PROCESS_IMAGE_SIZE_OUT
/ ObdSize
;
238 Ret
= EplApiLinkObject(0x2040,
239 EplApiProcessImageInstance_g
.
240 m_abProcessImageOutput
, &uiVarEntries
, &ObdSize
,
244 uiVarEntries
= EPL_API_PROCESS_IMAGE_SIZE_OUT
/ ObdSize
;
245 Ret
= EplApiLinkObject(0x2041,
246 EplApiProcessImageInstance_g
.
247 m_abProcessImageOutput
, &uiVarEntries
, &ObdSize
,
251 uiVarEntries
= EPL_API_PROCESS_IMAGE_SIZE_OUT
/ ObdSize
;
252 Ret
= EplApiLinkObject(0x2050,
253 EplApiProcessImageInstance_g
.
254 m_abProcessImageOutput
, &uiVarEntries
, &ObdSize
,
258 uiVarEntries
= EPL_API_PROCESS_IMAGE_SIZE_OUT
/ ObdSize
;
259 Ret
= EplApiLinkObject(0x2051,
260 EplApiProcessImageInstance_g
.
261 m_abProcessImageOutput
, &uiVarEntries
, &ObdSize
,
268 //----------------------------------------------------------------------------
269 // Function: EplApiProcessImageExchangeIn()
271 // Description: replaces passed input process image with the one of EPL stack
273 // Parameters: pPI_p = input process image
275 // Returns: tEplKernel = error code
278 //----------------------------------------------------------------------------
280 tEplKernel
EplApiProcessImageExchangeIn(tEplApiProcessImage
*pPI_p
)
282 tEplKernel Ret
= kEplSuccessful
;
284 #if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
285 copy_to_user(pPI_p
->m_pImage
,
286 EplApiProcessImageInstance_g
.m_abProcessImageInput
,
288 sizeof(EplApiProcessImageInstance_g
.
289 m_abProcessImageInput
)));
295 //----------------------------------------------------------------------------
296 // Function: EplApiProcessImageExchangeOut()
298 // Description: copies passed output process image to EPL stack.
300 // Parameters: pPI_p = output process image
302 // Returns: tEplKernel = error code
305 //----------------------------------------------------------------------------
307 tEplKernel
EplApiProcessImageExchangeOut(tEplApiProcessImage
*pPI_p
)
309 tEplKernel Ret
= kEplSuccessful
;
311 #if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
312 copy_from_user(EplApiProcessImageInstance_g
.m_abProcessImageOutput
,
315 sizeof(EplApiProcessImageInstance_g
.
316 m_abProcessImageOutput
)));
322 //=========================================================================//
324 // P R I V A T E F U N C T I O N S //
326 //=========================================================================//