ACPICA: Fix a few warnings for gcc 3.4.4
[linux-2.6] / drivers / staging / epl / EplSdo.h
1 /****************************************************************************
2
3   (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4       www.systec-electronic.com
5
6   Project:      openPOWERLINK
7
8   Description:  include file for api function of the sdo module
9
10   License:
11
12     Redistribution and use in source and binary forms, with or without
13     modification, are permitted provided that the following conditions
14     are met:
15
16     1. Redistributions of source code must retain the above copyright
17        notice, this list of conditions and the following disclaimer.
18
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.
22
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.
27
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.
40
41     Severability Clause:
42
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.
49
50   -------------------------------------------------------------------------
51
52                 $RCSfile: EplSdo.h,v $
53
54                 $Author: D.Krueger $
55
56                 $Revision: 1.6 $  $Date: 2008/04/17 21:36:32 $
57
58                 $State: Exp $
59
60                 Build Environment:
61                     GCC V3.4
62
63   -------------------------------------------------------------------------
64
65   Revision History:
66
67  2006/06/26 k.t.:   start of the implementation
68
69 ****************************************************************************/
70
71 #include "EplInc.h"
72 #include "EplFrame.h"
73 #include "EplSdoAc.h"
74
75 #ifndef _EPLSDO_H_
76 #define _EPLSDO_H_
77
78 //---------------------------------------------------------------------------
79 // const defines
80 //---------------------------------------------------------------------------
81 // global defines
82 #ifndef EPL_SDO_MAX_PAYLOAD
83 #define EPL_SDO_MAX_PAYLOAD     256
84 #endif
85
86 // handle between Protocol Abstraction Layer and asynchronous SDO Sequence Layer
87 #define EPL_SDO_UDP_HANDLE      0x8000
88 #define EPL_SDO_ASND_HANDLE     0x4000
89 #define EPL_SDO_ASY_HANDLE_MASK 0xC000
90 #define EPL_SDO_ASY_INVALID_HDL 0x3FFF
91
92 // handle between  SDO Sequence Layer and sdo command layer
93 #define EPL_SDO_ASY_HANDLE      0x8000
94 #define EPL_SDO_PDO_HANDLE      0x4000
95 #define EPL_SDO_SEQ_HANDLE_MASK 0xC000
96 #define EPL_SDO_SEQ_INVALID_HDL 0x3FFF
97
98 #define EPL_ASND_HEADER_SIZE        4
99 //#define EPL_SEQ_HEADER_SIZE         4
100 #define EPL_ETHERNET_HEADER_SIZE    14
101
102 #define EPL_SEQ_NUM_MASK            0xFC
103
104 // size for send buffer and history
105 #define EPL_MAX_SDO_FRAME_SIZE      EPL_C_IP_MIN_MTU
106 // size for receive frame
107 // -> needed because SND-Kit sends up to 1518 Byte
108 //    without Sdo-Command: Maximum Segment Size
109 #define EPL_MAX_SDO_REC_FRAME_SIZE  EPL_C_IP_MAX_MTU
110
111 //---------------------------------------------------------------------------
112 // typedef
113 //---------------------------------------------------------------------------
114 // handle between Protocol Abstraction Layer and asynchronuus SDO Sequence Layer
115 typedef unsigned int tEplSdoConHdl;
116
117 // callback function pointer for Protocol Abstraction Layer to call
118 // asynchronuus SDO Sequence Layer
119 typedef tEplKernel(*tEplSequLayerReceiveCb) (tEplSdoConHdl ConHdl_p,
120                                              tEplAsySdoSeq *pSdoSeqData_p,
121                                              unsigned int uiDataSize_p);
122
123 // handle between asynchronuus SDO Sequence Layer and SDO Command layer
124 typedef unsigned int tEplSdoSeqConHdl;
125
126 // callback function pointer for asynchronuus SDO Sequence Layer to call
127 // SDO Command layer for received data
128 typedef tEplKernel(* tEplSdoComReceiveCb) (tEplSdoSeqConHdl SdoSeqConHdl_p,
129                                            tEplAsySdoCom *pAsySdoCom_p,
130                                            unsigned int uiDataSize_p);
131
132 // status of connection
133 typedef enum {
134         kAsySdoConStateConnected = 0x00,
135         kAsySdoConStateInitError = 0x01,
136         kAsySdoConStateConClosed = 0x02,
137         kAsySdoConStateAckReceived = 0x03,
138         kAsySdoConStateFrameSended = 0x04,
139         kAsySdoConStateTimeout = 0x05
140 } tEplAsySdoConState;
141
142 // callback function pointer for asynchronuus SDO Sequence Layer to call
143 // SDO Command layer for connection status
144 typedef tEplKernel(* tEplSdoComConCb) (tEplSdoSeqConHdl SdoSeqConHdl_p,
145                                        tEplAsySdoConState AsySdoConState_p);
146
147 // handle between  SDO Command layer and application
148 typedef unsigned int tEplSdoComConHdl;
149
150 // status of connection
151 typedef enum {
152         kEplSdoComTransferNotActive = 0x00,
153         kEplSdoComTransferRunning = 0x01,
154         kEplSdoComTransferTxAborted = 0x02,
155         kEplSdoComTransferRxAborted = 0x03,
156         kEplSdoComTransferFinished = 0x04,
157         kEplSdoComTransferLowerLayerAbort = 0x05
158 } tEplSdoComConState;
159
160 // SDO Services and Command-Ids from DS 1.0.0 p.152
161 typedef enum {
162         kEplSdoServiceNIL = 0x00,
163         kEplSdoServiceWriteByIndex = 0x01,
164         kEplSdoServiceReadByIndex = 0x02
165             //--------------------------------
166             // the following services are optional and
167             // not supported now
168 /*
169     kEplSdoServiceWriteAllByIndex   = 0x03,
170     kEplSdoServiceReadAllByIndex    = 0x04,
171     kEplSdoServiceWriteByName       = 0x05,
172     kEplSdoServiceReadByName        = 0x06,
173
174     kEplSdoServiceFileWrite         = 0x20,
175     kEplSdoServiceFileRead          = 0x21,
176
177     kEplSdoServiceWriteMultiByIndex = 0x31,
178     kEplSdoServiceReadMultiByIndex  = 0x32,
179
180     kEplSdoServiceMaxSegSize        = 0x70
181
182     // 0x80 - 0xFF manufacturer specific
183
184  */
185 } tEplSdoServiceType;
186
187 // describes if read or write access
188 typedef enum {
189         kEplSdoAccessTypeRead = 0x00,
190         kEplSdoAccessTypeWrite = 0x01
191 } tEplSdoAccessType;
192
193 typedef enum {
194         kEplSdoTypeAuto = 0x00,
195         kEplSdoTypeUdp = 0x01,
196         kEplSdoTypeAsnd = 0x02,
197         kEplSdoTypePdo = 0x03
198 } tEplSdoType;
199
200 typedef enum {
201         kEplSdoTransAuto = 0x00,
202         kEplSdoTransExpedited = 0x01,
203         kEplSdoTransSegmented = 0x02
204 } tEplSdoTransType;
205
206 // structure to inform application about finish of SDO transfer
207 typedef struct {
208         tEplSdoComConHdl m_SdoComConHdl;
209         tEplSdoComConState m_SdoComConState;
210         u32 m_dwAbortCode;
211         tEplSdoAccessType m_SdoAccessType;
212         unsigned int m_uiNodeId;        // NodeId of the target
213         unsigned int m_uiTargetIndex;   // index which was accessed
214         unsigned int m_uiTargetSubIndex;        // subindex which was accessed
215         unsigned int m_uiTransferredByte;       // number of bytes transferred
216         void *m_pUserArg;       // user definable argument pointer
217
218 } tEplSdoComFinished;
219
220 // callback function pointer to inform application about connection
221 typedef tEplKernel(* tEplSdoFinishedCb) (tEplSdoComFinished *pSdoComFinished_p);
222
223 // structure to init SDO transfer to Read or Write by Index
224 typedef struct {
225         tEplSdoComConHdl m_SdoComConHdl;
226         unsigned int m_uiIndex;
227         unsigned int m_uiSubindex;
228         void *m_pData;
229         unsigned int m_uiDataSize;
230         unsigned int m_uiTimeout;       // not used in this version
231         tEplSdoAccessType m_SdoAccessType;
232         tEplSdoFinishedCb m_pfnSdoFinishedCb;
233         void *m_pUserArg;       // user definable argument pointer
234
235 } tEplSdoComTransParamByIndex;
236
237 //---------------------------------------------------------------------------
238 // function prototypes
239 //---------------------------------------------------------------------------
240
241 #endif // #ifndef _EPLSDO_H_