Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 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 EPL API layer |
| 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: Epl.h,v $ |
| 53 | |
| 54 | $Author: D.Krueger $ |
| 55 | |
| 56 | $Revision: 1.8 $ $Date: 2008/11/17 16:40:39 $ |
| 57 | |
| 58 | $State: Exp $ |
| 59 | |
| 60 | Build Environment: |
| 61 | GCC V3.4 |
| 62 | |
| 63 | ------------------------------------------------------------------------- |
| 64 | |
| 65 | Revision History: |
| 66 | |
| 67 | 2006/05/22 d.k.: start of the implementation, version 1.00 |
| 68 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 69 | ****************************************************************************/ |
| 70 | |
| 71 | #ifndef _EPL_API_H_ |
| 72 | #define _EPL_API_H_ |
| 73 | |
| 74 | #include "EplInc.h" |
| 75 | #include "EplSdo.h" |
| 76 | #include "EplObd.h" |
| 77 | #include "EplLed.h" |
| 78 | #include "EplEvent.h" |
| 79 | |
| 80 | //--------------------------------------------------------------------------- |
| 81 | // const defines |
| 82 | //--------------------------------------------------------------------------- |
| 83 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 84 | //--------------------------------------------------------------------------- |
| 85 | // typedef |
| 86 | //--------------------------------------------------------------------------- |
| 87 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 88 | typedef struct { |
| 89 | unsigned int m_uiNodeId; |
| 90 | tEplNmtState m_NmtState; |
| 91 | tEplNmtNodeEvent m_NodeEvent; |
| 92 | WORD m_wErrorCode; // EPL error code if m_NodeEvent == kEplNmtNodeEventError |
| 93 | BOOL m_fMandatory; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 94 | |
| 95 | } tEplApiEventNode; |
| 96 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 97 | typedef struct { |
| 98 | tEplNmtState m_NmtState; // local NMT state |
| 99 | tEplNmtBootEvent m_BootEvent; |
| 100 | WORD m_wErrorCode; // EPL error code if m_BootEvent == kEplNmtBootEventError |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 101 | |
| 102 | } tEplApiEventBoot; |
| 103 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 104 | typedef struct { |
| 105 | tEplLedType m_LedType; // type of the LED (e.g. Status or Error) |
| 106 | BOOL m_fOn; // state of the LED (e.g. on or off) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 107 | |
| 108 | } tEplApiEventLed; |
| 109 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 110 | typedef enum { |
| 111 | kEplApiEventNmtStateChange = 0x10, // m_NmtStateChange |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 112 | // kEplApiEventRequestNmt = 0x11, // m_bNmtCmd |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 113 | kEplApiEventCriticalError = 0x12, // m_InternalError, Stack halted |
| 114 | kEplApiEventWarning = 0x13, // m_InternalError, Stack running |
| 115 | kEplApiEventNode = 0x20, // m_Node |
| 116 | kEplApiEventBoot = 0x21, // m_Boot |
| 117 | kEplApiEventSdo = 0x62, // m_Sdo |
| 118 | kEplApiEventObdAccess = 0x69, // m_ObdCbParam |
| 119 | kEplApiEventLed = 0x70, // m_Led |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 120 | |
| 121 | } tEplApiEventType; |
| 122 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 123 | typedef union { |
| 124 | tEplEventNmtStateChange m_NmtStateChange; |
| 125 | tEplEventError m_InternalError; |
| 126 | tEplSdoComFinished m_Sdo; |
| 127 | tEplObdCbParam m_ObdCbParam; |
| 128 | tEplApiEventNode m_Node; |
| 129 | tEplApiEventBoot m_Boot; |
| 130 | tEplApiEventLed m_Led; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 131 | |
| 132 | } tEplApiEventArg; |
| 133 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 134 | typedef tEplKernel(PUBLIC ROM * tEplApiCbEvent) (tEplApiEventType EventType_p, // IN: event type (enum) |
| 135 | tEplApiEventArg * pEventArg_p, // IN: event argument (union) |
| 136 | void GENERIC * pUserArg_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 137 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 138 | typedef struct { |
| 139 | unsigned int m_uiSizeOfStruct; |
| 140 | BOOL m_fAsyncOnly; // do not need to register PRes |
| 141 | unsigned int m_uiNodeId; // local node ID |
| 142 | BYTE m_abMacAddress[6]; // local MAC address |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 143 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 144 | // 0x1F82: NMT_FeatureFlags_U32 |
| 145 | DWORD m_dwFeatureFlags; |
| 146 | // Cycle Length (0x1006: NMT_CycleLen_U32) in [us] |
| 147 | DWORD m_dwCycleLen; // required for error detection |
| 148 | // 0x1F98: NMT_CycleTiming_REC |
| 149 | // 0x1F98.1: IsochrTxMaxPayload_U16 |
| 150 | unsigned int m_uiIsochrTxMaxPayload; // const |
| 151 | // 0x1F98.2: IsochrRxMaxPayload_U16 |
| 152 | unsigned int m_uiIsochrRxMaxPayload; // const |
| 153 | // 0x1F98.3: PResMaxLatency_U32 |
| 154 | DWORD m_dwPresMaxLatency; // const in [ns], only required for IdentRes |
| 155 | // 0x1F98.4: PReqActPayloadLimit_U16 |
| 156 | unsigned int m_uiPreqActPayloadLimit; // required for initialisation (+28 bytes) |
| 157 | // 0x1F98.5: PResActPayloadLimit_U16 |
| 158 | unsigned int m_uiPresActPayloadLimit; // required for initialisation of Pres frame (+28 bytes) |
| 159 | // 0x1F98.6: ASndMaxLatency_U32 |
| 160 | DWORD m_dwAsndMaxLatency; // const in [ns], only required for IdentRes |
| 161 | // 0x1F98.7: MultiplCycleCnt_U8 |
| 162 | unsigned int m_uiMultiplCycleCnt; // required for error detection |
| 163 | // 0x1F98.8: AsyncMTU_U16 |
| 164 | unsigned int m_uiAsyncMtu; // required to set up max frame size |
| 165 | // 0x1F98.9: Prescaler_U16 |
| 166 | unsigned int m_uiPrescaler; // required for sync |
| 167 | // $$$ Multiplexed Slot |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 168 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 169 | // 0x1C14: DLL_LossOfFrameTolerance_U32 in [ns] |
| 170 | DWORD m_dwLossOfFrameTolerance; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 171 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 172 | // 0x1F8A: NMT_MNCycleTiming_REC |
| 173 | // 0x1F8A.1: WaitSoCPReq_U32 in [ns] |
| 174 | DWORD m_dwWaitSocPreq; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 175 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 176 | // 0x1F8A.2: AsyncSlotTimeout_U32 in [ns] |
| 177 | DWORD m_dwAsyncSlotTimeout; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 178 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 179 | DWORD m_dwDeviceType; // NMT_DeviceType_U32 |
| 180 | DWORD m_dwVendorId; // NMT_IdentityObject_REC.VendorId_U32 |
| 181 | DWORD m_dwProductCode; // NMT_IdentityObject_REC.ProductCode_U32 |
| 182 | DWORD m_dwRevisionNumber; // NMT_IdentityObject_REC.RevisionNo_U32 |
| 183 | DWORD m_dwSerialNumber; // NMT_IdentityObject_REC.SerialNo_U32 |
| 184 | QWORD m_qwVendorSpecificExt1; |
| 185 | DWORD m_dwVerifyConfigurationDate; // CFM_VerifyConfiguration_REC.ConfDate_U32 |
| 186 | DWORD m_dwVerifyConfigurationTime; // CFM_VerifyConfiguration_REC.ConfTime_U32 |
| 187 | DWORD m_dwApplicationSwDate; // PDL_LocVerApplSw_REC.ApplSwDate_U32 on programmable device or date portion of NMT_ManufactSwVers_VS on non-programmable device |
| 188 | DWORD m_dwApplicationSwTime; // PDL_LocVerApplSw_REC.ApplSwTime_U32 on programmable device or time portion of NMT_ManufactSwVers_VS on non-programmable device |
| 189 | DWORD m_dwIpAddress; |
| 190 | DWORD m_dwSubnetMask; |
| 191 | DWORD m_dwDefaultGateway; |
| 192 | BYTE m_sHostname[32]; |
| 193 | BYTE m_abVendorSpecificExt2[48]; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 194 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 195 | char *m_pszDevName; // NMT_ManufactDevName_VS (0x1008/0 local OD) |
| 196 | char *m_pszHwVersion; // NMT_ManufactHwVers_VS (0x1009/0 local OD) |
| 197 | char *m_pszSwVersion; // NMT_ManufactSwVers_VS (0x100A/0 local OD) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 198 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 199 | tEplApiCbEvent m_pfnCbEvent; |
| 200 | void *m_pEventUserArg; |
| 201 | tEplSyncCb m_pfnCbSync; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 202 | |
| 203 | } tEplApiInitParam; |
| 204 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 205 | typedef struct { |
| 206 | void *m_pImage; |
| 207 | unsigned int m_uiSize; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 208 | |
| 209 | } tEplApiProcessImage; |
| 210 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 211 | //--------------------------------------------------------------------------- |
| 212 | // function prototypes |
| 213 | //--------------------------------------------------------------------------- |
| 214 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 215 | tEplKernel PUBLIC EplApiInitialize(tEplApiInitParam * pInitParam_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 216 | |
| 217 | tEplKernel PUBLIC EplApiShutdown(void); |
| 218 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 219 | tEplKernel PUBLIC EplApiReadObject(tEplSdoComConHdl * pSdoComConHdl_p, |
| 220 | unsigned int uiNodeId_p, |
| 221 | unsigned int uiIndex_p, |
| 222 | unsigned int uiSubindex_p, |
| 223 | void *pDstData_le_p, |
| 224 | unsigned int *puiSize_p, |
| 225 | tEplSdoType SdoType_p, void *pUserArg_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 226 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 227 | tEplKernel PUBLIC EplApiWriteObject(tEplSdoComConHdl * pSdoComConHdl_p, |
| 228 | unsigned int uiNodeId_p, |
| 229 | unsigned int uiIndex_p, |
| 230 | unsigned int uiSubindex_p, |
| 231 | void *pSrcData_le_p, |
| 232 | unsigned int uiSize_p, |
| 233 | tEplSdoType SdoType_p, void *pUserArg_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 234 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 235 | tEplKernel PUBLIC EplApiFreeSdoChannel(tEplSdoComConHdl SdoComConHdl_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 236 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 237 | tEplKernel PUBLIC EplApiReadLocalObject(unsigned int uiIndex_p, |
| 238 | unsigned int uiSubindex_p, |
| 239 | void *pDstData_p, |
| 240 | unsigned int *puiSize_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 241 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 242 | tEplKernel PUBLIC EplApiWriteLocalObject(unsigned int uiIndex_p, |
| 243 | unsigned int uiSubindex_p, |
| 244 | void *pSrcData_p, |
| 245 | unsigned int uiSize_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 246 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 247 | tEplKernel PUBLIC EplApiCbObdAccess(tEplObdCbParam MEM * pParam_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 248 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 249 | tEplKernel PUBLIC EplApiLinkObject(unsigned int uiObjIndex_p, |
| 250 | void *pVar_p, |
| 251 | unsigned int *puiVarEntries_p, |
| 252 | tEplObdSize * pEntrySize_p, |
| 253 | unsigned int uiFirstSubindex_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 254 | |
| 255 | tEplKernel PUBLIC EplApiExecNmtCommand(tEplNmtEvent NmtEvent_p); |
| 256 | |
| 257 | tEplKernel PUBLIC EplApiProcess(void); |
| 258 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 259 | #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0) |
| 260 | tEplKernel PUBLIC EplApiMnTriggerStateChange(unsigned int uiNodeId_p, |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 261 | tEplNmtNodeCommand NodeCommand_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 262 | #endif |
| 263 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 264 | tEplKernel PUBLIC EplApiGetIdentResponse(unsigned int uiNodeId_p, |
| 265 | tEplIdentResponse ** |
| 266 | ppIdentResponse_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 267 | |
| 268 | // functions for process image will be implemented in separate file |
| 269 | tEplKernel PUBLIC EplApiProcessImageSetup(void); |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 270 | tEplKernel PUBLIC EplApiProcessImageExchangeIn(tEplApiProcessImage * pPI_p); |
| 271 | tEplKernel PUBLIC EplApiProcessImageExchangeOut(tEplApiProcessImage * pPI_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 272 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 273 | #endif // #ifndef _EPL_API_H_ |