powerlnk.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. /*
  2. powerlnk.h
  3. (C) B&R Industrie Elektronik
  4. */
  5. #ifndef POWERLNK_H_
  6. #define POWERLNK_H_ 0x1109 /* Version V1.10.9 */
  7. #ifdef __cplusplus
  8. extern "C"
  9. {
  10. #endif
  11. #include <bur/plctypes.h>
  12. #ifndef _BUR_PUBLIC
  13. #define _BUR_PUBLIC
  14. #endif
  15. /* Constants */
  16. #ifdef _REPLACE_CONST
  17. /* Error Numbers */
  18. #define ERR_PLMGR_VERS_CONFLICT 20900 /* Version conflict in system structures */
  19. #define ERR_PLMGR_NOMEM 20901 /* Failed to allocate memory */
  20. #define ERR_PLMGR_WRONG_DEVICE 20903 /* wrong device description */
  21. #define ERR_PLMGR_CONFIG_NOT_FOUND 20904 /* configuration not found */
  22. #define ERR_PLMGR_ALREADY_CONFIGURATED 20905 /* configuration already done */
  23. #define ERR_PLMGR_NOT_IMPLEMENTED 20906 /* function is not implemented */
  24. #define ERR_PLMGR_ILLEGAL_PARAMETER 20908 /* Illegal parameters in function call */
  25. #define ERR_PLMGR_WRONG_IDENT 20911 /* Wrong ident */
  26. #define ERR_PLMGR_ERROR_ALLOC_STATION 20913 /* Error at allocating station */
  27. #define ERR_PLMGR_ERROR_ALLOC_CHANNEL 20914 /* Error at allocating channel */
  28. #define ERR_PLMGR_ERROR_ALLOC_BUFFER 20915 /* Error at allocating buffer */
  29. #define ERR_PLMGR_CHANNEL_ALREADY_OPEN 20916 /* Channel was opened by someone else */
  30. #define ERR_PLMGR_NO_FRAME_RECEIVED 20917 /* No frame received by now */
  31. #define ERR_PLMGR_FRAME_TOO_LONG 20918 /* Received frame does not fit into buffer */
  32. #define ERR_PLMGR_WRITE_ACTIVE 20919 /* Write is already active for this channel */
  33. #define ERR_PLMGR_OFFSET_TO_HIGH 20920 /* Offset for ident is too high */
  34. #define ERR_PLMGR_NIL_POINTER 20921 /* parameter pointed to address 0 */
  35. #define ERR_PLMGR_OVERFLOW 20922 /* overflow of buffer */
  36. #define ERR_PLMGR_UNAVAILABLE_DATAPOINT 20923 /* datapoint not available */
  37. #define ERR_PLMGR_WRONG_TASKCLASS 20924 /* taskklass does not exist */
  38. #define ERR_PLMGR_STATION_NOT_ACTIVE 20925 /* station not active */
  39. #define ERR_PLMGR_TOO_MANY_INTERFACES 20926 /* To many PowerLink-Interfaces configured */
  40. #define ERR_PLMGR_BUS_CONFIGURED_TWICE 20927 /* Same bus number declared twice */
  41. #define ERR_PLMGR_SYNC_BY_SYSTEM 20928 /* Syncronisation has to be configured by System */
  42. #define ERR_PLMGR_SYNC_FAILED 20929 /* Synchronizing System failed */
  43. #define ERR_PLMGR_CONFIG_CONFLICT 20930 /* Conflict with IOTIMER-Device-Configuration */
  44. #define ERR_PLMGR_NOT_IN_PRES 20931 /* data point not in poll response of station */
  45. #define ERR_PLMGR_UNKNOWN_TYPE 20932 /* datatype of data point not valid */
  46. #define ERR_PLMGR_NO_PDO_MAPPING_DEFINED 20933 /* no PDO mapping defined */
  47. #define ERR_PLMGR_ALREADY_INITIALIZED 20937 /* station already initialized */
  48. #define ERR_PLMGR_INIT_NOT_FINISHED 20938 /* initialization of delayed station not finished yet*/
  49. #define ERR_PLMGR_PARSE_ERROR 20950 /* Error at parsing datapoint description */
  50. #define ERR_PLMGR_PARSE_END_EXPECTED 20951 /* expected end of string earlier */
  51. #define ERR_PLMGR_PARSE_NO_PERCENT 20952 /* no percent % singn at start of datapoint description */
  52. #define ERR_PLMGR_PARSE_NOT_IN_OR_OUT 20953 /* Direction neither I nor Q */
  53. #define ERR_PLMGR_PARSE_INTERFACE 20954 /* incorrect interface number */
  54. #define ERR_PLMGR_PARSE_STATION 20955 /* incorrect station number */
  55. #define ERR_PLMGR_PARSE_MODUL 20956 /* incorrect modul number */
  56. #define ERR_PLMGR_PARSE_SUBMODUL 20957 /* incorrect sub modul number */
  57. #define ERR_PLMGR_PARSE_CHANNEL 20958 /* incorrect channel number */
  58. #define ERR_PLMGR_PARSE_BIT 20959 /* incorrect bit number */
  59. #define ERR_PLMGR_PARSE_TO_MANY_NUMBERS 20960 /* too many numbers in datapoint description */
  60. #define ERR_PLMGR_PARSE_NETTIME 20961 /* wrong datatype or length for nettime */
  61. #define ERR_PLMGR_PARSE_SLOT 20962 /* incorrect slot number SL */
  62. #define ERR_PLMGR_PARSE_SUBSLOT 20963 /* incorrect subslot number SS */
  63. #define ERR_PLMGR_PARSE_TRAILINGCHARS 20964 /* trailing characters after valid channel or device name*/
  64. #define ERR_PLMGR_PARSE_ARRAYSIZE 20965 /* arraysize not valid */
  65. #define ERR_PLMGR_WARNING_FW_UPDATE 20980 /* Updated firmware for station, (in error log book) */
  66. #define ERR_PLMGR_HW_BOOTUP_FAILED 20981 /* Error at starting PowerLink hardware (in error log book) */
  67. #define ERR_PLMGR_RECOMMEND_FW_UPDATE 20982 /* Firmware update for IF686 is recommended, download plfif686.br */
  68. #define ERR_PLMGR_INTERNAL 20997 /* Internal error in Library, this should never happen (in error log book) */
  69. #define ERR_PLMGR_EXCEPTION 20998 /* unexpected exception from PowerLink hardware (in error log book) */
  70. #define ERR_PLMGR_NO_POWERLNK_LIBRARY 20999 /* PowerLink-Library not on plc */
  71. /* Taskclasses for plCECreate function */
  72. #define plCE_CYCLIC_1 1
  73. #define plCE_CYCLIC_2 2
  74. #define plCE_CYCLIC_3 3
  75. #define plCE_CYCLIC_4 4
  76. /* plCE_CYCLIC_5 .. 8 only valid for i386-Targets */
  77. #define plCE_CYCLIC_5 5
  78. #define plCE_CYCLIC_6 6
  79. #define plCE_CYCLIC_7 7
  80. #define plCE_CYCLIC_8 8
  81. /* plCE_TIMER_x only valid for m68k-Targets */
  82. #define plCE_TIMER_1 -1
  83. #define plCE_TIMER_2 -2
  84. /* Flags for plAcycOpen function */
  85. #define plOPEN_MODE_READ 0 /* open channel for read*/
  86. #define plOPEN_MODE_WRITE 1 /* open channel for write */
  87. #define plOPEN_MODE_RW 2 /* open channel for read and write */
  88. #define plOPEN_MODE_EPLV1 0x10 /* Force to V1 format */
  89. #define plOPEN_MODE_EPLV2 0x20 /* Force to V2 format */
  90. #define plOPEN_MODE_LENGTH 0x40 /* Use length in frame even in V2 */
  91. #define plOPEN_PRIORITY_ENABLE 0x8000 /* enable using priority (used in V2 only) */
  92. /* priority for asynchrounous send, applied in EPL V2 only */
  93. #define plOPEN_PRIORITY_LOWEST 0x0000 /* lowest priority */
  94. #define plOPEN_PRIORITY_LOWER 0x0100
  95. #define plOPEN_PRIORITY_LOW 0x0200
  96. #define plOPEN_PRIORITY_GENERIC 0x0300 /* normal priority (default) */
  97. #define plOPEN_PRIORITY_HIGH 0x0400
  98. #define plOPEN_PRIORITY_HIGHER 0x0500
  99. #define plOPEN_PRIORITY_HIGHEST 0x0600 /* highest priority */
  100. #define plOPEN_PRIORITY_NMT 0x0700 /* reserved for NMT requests */
  101. /* States from plState Function */
  102. /* Error States from plState */
  103. #define plSTATE_WRONG_IDENT 0xffff
  104. /* States of Stations */
  105. #define plSTATE_STATION_NONEXISTANT 0x0000 /* No Access to this station has occured yet */
  106. #define plSTATE_STATION_WAITING 0x0001 /* The software tried to access this station, but it is not on the BUS */
  107. #define plSTATE_STATION_OSDL 0x0002 /* The firmware had the wrong version so a Firmwareupdate is in progress */
  108. #define plSTATE_STATION_CONFIG 0x0003 /* The configuration of the Station is in progress */
  109. #define plSTATE_STATION_ACTIVATEING 0x0004 /* The activation of the copy entries is in progress */
  110. #define plSTATE_STATION_ACTIVE 0x0005 /* The station is online and the copy entries are handle cyclically */
  111. #define plSTATE_STATION_INACTIVE 0x0006 /* The station is offline but was active before */
  112. #define plSTATE_STATION_CHANGED 0x0007 /* The IO configuration of the station has changed, a reboot is necessary to
  113. allow the changed station to get active. */
  114. #define plSTATE_STATION_CFGFAILED 0x0008 /* The configuration of the station failed, and the option EPL_NoResetOnConfigFail is on. */
  115. #define plSTATE_STATION_FAILED 0x000f /* Configuration of Station failed (out of memory or other serious problem) */
  116. /* States of Copy Entries */
  117. #define plSTATE_CE_WAITING 1 /* Station for Copy-Entry was not active since Copy-Entry was created */
  118. #define plSTATE_CE_ACTIVE 2 /* Station is online and Copy-Entry is active */
  119. #define plSTATE_CE_INACTIVE 3 /* Copy-Entry is active, but Station is not online */
  120. #define plSTATE_CE_ERROR 4 /* Copy-Entry is not available on its Station */
  121. /* States of Write Channels */
  122. #define plSTATE_CHANNEL_WRITE_MASK 0x0f00 /* Mask state of Read/Write-Channels with this mask to get the Write-State */
  123. #define plSTATE_CHANNEL_WRITE_CLOSED 0x0000 /* This Channel is not opend for Write access */
  124. #define plSTATE_CHANNEL_WRITE_OPEN 0x0100 /* Channel is open, no Frames are waiting to be sent */
  125. #define plSTATE_CHANNEL_WRITE_ACTIVE 0x0200 /* Write-Buffer is waiting to be sent */
  126. #define plSTATE_CHANNEL_WRITE_WRONG 0x0f00 /* Result of plSTATE_WRONG_IDENT & plSTATE_CHANNEL_WRITE_MASK */
  127. /* States of Read Channels */
  128. #define plSTATE_CHANNEL_READ_MASK 0x00f0 /* Mask state of Read/Write-Channels with this mask to get the Read-State */
  129. #define plSTATE_CHANNEL_READ_CLOSED 0x0000 /* This channel is not opend for Read access */
  130. #define plSTATE_CHANNEL_READ_EMPTY 0x0010 /* This channel is open but does not have any frames */
  131. #define plSTATE_CHANNEL_READ_READY 0x0020 /* This channel is open and has a ready frame to be read */
  132. #define plSTATE_CHANNEL_READ_WRONG 0x00f0 /* Result of plSTATE_WRONG_IDEND & plSTATE_CHANNEL_READ_MASK */
  133. /* actionIDs for plAction function */
  134. #define plACTION_GET_NET_QUALITY 1 /* read statistical info of netquality*/
  135. #define plACTION_GET_IDENT 2 /* get ident of a PowerLink station */
  136. #define plACTION_START_SYNC_STATISTICS 3 /* start collection of statistic information of synchronous task class only on SG3 */
  137. #define plACTION_STOP_SYNC_STATISTICS 4 /* stop collection of statistic information of synchronous task class only on SG3*/
  138. #define plACTION_GET_SYNC_STATISTICS 5 /* read statistic information of synchrounous task class to
  139. a PLACTION_SYNC_STATISTICS_typ structure only on SG3 */
  140. #define plACTION_GET_FIRMWARE_VERSION 6 /* read version of firmware to UDINT variable */
  141. #define plACTION_DEVICE_TO_BUS_NR 7 /* Convert device string to bus number */
  142. #define plACTION_GET_STATION_NUMBER 8 /* read node number of local station to UDINT variable */
  143. #define plACTION_GET_IF_PARAMETERS 9 /* get the interface parameters for a powerlink bus */
  144. #define plACTION_GET_LOST_INA_SOURCE 10 /* internal only! get last source station of lost ina request to a DINT (-1) if no lost */
  145. #define plACTION_GET_STATIONFLAG 12 /* get station flag e.g. plSYSCONF_STATIONFLAG_SLOW to UDINT variable */
  146. #define plACTION_GET_STATION_HWVARIANT 13 /* get hardware ident of station to UDINT variable */
  147. #define plACTION_GET_STATION_SHIFT 14 /* get cyclic cycle shift of multiplexed station to UDINT variable */
  148. #define plACTION_GET_IF_CYCLE_TIME 15 /* get powerlink cycle time to UDINT variable */
  149. #define plACTION_GET_IF_PRESCALE 16 /* get powerlink prescale to UDINT variable */
  150. #define plACTION_GET_IF_MUXPRESCALE 17 /* get multiplex prescale to UDINT variable */
  151. #define plACTION_GET_IF_RSQUEUELAPCNT 18 /* get rs queue lap count to UDINT variable */
  152. #define plACTION_GET_CROSSLINK_INFO 19 /* get crosslink infomation of input datapoint (only SG4 >= AR V2.85) */
  153. #define plACTION_GET_PROTOCOL_VERSION 20 /* get set protocol version to UDINT variable */
  154. #define plACTION_GET_DP_INFO 21 /* query the PDO information of an I/O data point (only SG4 >= AR B2.96) */
  155. #define plACTION_GET_PDO_INFO 22 /* query the PDO information of by Index/Subindex (only SG4 >= AR B2.96) */
  156. /* action 23, 24 and 25 used by ncman */
  157. /* action 26, 27 cycletime info for NCManager */
  158. #define plACTION_SET_STATION_NUMBER 28 /* set node number of delayed iCN */
  159. /* action 29 used by vision */
  160. #define plDIRECTION_IN 1 /* Direction "input" to PLC returned from plACTION_GET_PDO_INFO */
  161. #define plDIRECTION_OUT 2 /* Direction "output" from PLC returned from plACTION_GET_PDO_INFO */
  162. #define plDIRECTION_XOUT 3 /* Direction "crosslinked output" returned from plACTION_GET_PDO_INFO */
  163. #define plMESSAGE_TYPE_PREQ 3 /* MessageType "poll request" returned from plACTION_GET_PDO_INFO */
  164. #define plMESSAGE_TYPE_PRES 4 /* MessageType "poll response" returned from plACTION_GET_PDO_INFO */
  165. /* Flags for stations in config */
  166. #define plSYSCONF_STATIONFLAG_SLOW 0x20 /* Station is a slow one */
  167. #else
  168. #ifndef _GLOBAL_CONST
  169. #define _GLOBAL_CONST _WEAK const
  170. #endif
  171. _GLOBAL_CONST signed char plCE_CYCLIC_8;
  172. _GLOBAL_CONST signed char plCE_CYCLIC_7;
  173. _GLOBAL_CONST signed char plCE_CYCLIC_6;
  174. _GLOBAL_CONST signed char plCE_CYCLIC_5;
  175. _GLOBAL_CONST signed char plCE_CYCLIC_4;
  176. _GLOBAL_CONST signed char plCE_CYCLIC_3;
  177. _GLOBAL_CONST signed char plCE_CYCLIC_2;
  178. _GLOBAL_CONST signed char plCE_CYCLIC_1;
  179. _GLOBAL_CONST signed char plCE_TIMER_2;
  180. _GLOBAL_CONST signed char plCE_TIMER_1;
  181. _GLOBAL_CONST unsigned long plOPEN_MODE_LENGTH;
  182. _GLOBAL_CONST unsigned long plOPEN_MODE_EPLV2;
  183. _GLOBAL_CONST unsigned long plOPEN_MODE_EPLV1;
  184. _GLOBAL_CONST unsigned long plOPEN_MODE_RW;
  185. _GLOBAL_CONST unsigned long plOPEN_MODE_WRITE;
  186. _GLOBAL_CONST unsigned long plOPEN_MODE_READ;
  187. _GLOBAL_CONST unsigned char plSYSCONF_STATIONFLAG_SLOW;
  188. _GLOBAL_CONST unsigned short plSTATE_WRONG_IDENT;
  189. _GLOBAL_CONST unsigned short plSTATE_CE_ERROR;
  190. _GLOBAL_CONST unsigned short plSTATE_CE_INACTIVE;
  191. _GLOBAL_CONST unsigned short plSTATE_CE_ACTIVE;
  192. _GLOBAL_CONST unsigned short plSTATE_CE_WAITING;
  193. _GLOBAL_CONST unsigned short plSTATE_STATION_FAILED;
  194. _GLOBAL_CONST unsigned short plSTATE_STATION_CFGFAILED;
  195. _GLOBAL_CONST unsigned short plSTATE_STATION_CHANGED;
  196. _GLOBAL_CONST unsigned short plSTATE_STATION_INACTIVE;
  197. _GLOBAL_CONST unsigned short plSTATE_STATION_ACTIVE;
  198. _GLOBAL_CONST unsigned short plSTATE_STATION_ACTIVATEING;
  199. _GLOBAL_CONST unsigned short plSTATE_STATION_CONFIG;
  200. _GLOBAL_CONST unsigned short plSTATE_STATION_OSDL;
  201. _GLOBAL_CONST unsigned short plSTATE_STATION_WAITING;
  202. _GLOBAL_CONST unsigned short plSTATE_STATION_NONEXISTANT;
  203. _GLOBAL_CONST unsigned short plSTATE_CHANNEL_WRITE_WRONG;
  204. _GLOBAL_CONST unsigned short plSTATE_CHANNEL_WRITE_OPEN;
  205. _GLOBAL_CONST unsigned short plSTATE_CHANNEL_WRITE_ACTIVE;
  206. _GLOBAL_CONST unsigned short plSTATE_CHANNEL_WRITE_CLOSED;
  207. _GLOBAL_CONST unsigned short plSTATE_CHANNEL_WRITE_MASK;
  208. _GLOBAL_CONST unsigned short plSTATE_CHANNEL_READ_WRONG;
  209. _GLOBAL_CONST unsigned short plSTATE_CHANNEL_READ_READY;
  210. _GLOBAL_CONST unsigned short plSTATE_CHANNEL_READ_EMPTY;
  211. _GLOBAL_CONST unsigned short plSTATE_CHANNEL_READ_CLOSED;
  212. _GLOBAL_CONST unsigned short plSTATE_CHANNEL_READ_MASK;
  213. _GLOBAL_CONST unsigned char plMESSAGE_TYPE_PRES;
  214. _GLOBAL_CONST unsigned char plMESSAGE_TYPE_PREQ;
  215. _GLOBAL_CONST unsigned char plDIRECTION_XOUT;
  216. _GLOBAL_CONST unsigned char plDIRECTION_OUT;
  217. _GLOBAL_CONST unsigned char plDIRECTION_IN;
  218. _GLOBAL_CONST unsigned long plACTION_GET_PDO_INFO;
  219. _GLOBAL_CONST unsigned long plACTION_GET_DP_INFO;
  220. _GLOBAL_CONST unsigned long plACTION_GET_CROSSLINK_INFO;
  221. _GLOBAL_CONST unsigned long plACTION_GET_IF_RSQUEUELAPCNT;
  222. _GLOBAL_CONST unsigned long plACTION_GET_IF_MUXPRESCALE;
  223. _GLOBAL_CONST unsigned long plACTION_GET_IF_PRESCALE;
  224. _GLOBAL_CONST unsigned long plACTION_GET_IF_CYCLE_TIME;
  225. _GLOBAL_CONST unsigned long plACTION_GET_STATION_HWVARIANT;
  226. _GLOBAL_CONST unsigned long plACTION_GET_STATIONFLAG;
  227. _GLOBAL_CONST unsigned long plACTION_GET_IF_PARAMETERS;
  228. _GLOBAL_CONST unsigned long plACTION_GET_STATION_NUMBER;
  229. _GLOBAL_CONST unsigned long plACTION_DEVICE_TO_BUS_NR;
  230. _GLOBAL_CONST unsigned long plACTION_GET_FIRMWARE_VERSION;
  231. _GLOBAL_CONST unsigned long plACTION_GET_SYNC_STATISTICS;
  232. _GLOBAL_CONST unsigned long plACTION_STOP_SYNC_STATISTICS;
  233. _GLOBAL_CONST unsigned long plACTION_START_SYNC_STATISTICS;
  234. _GLOBAL_CONST unsigned long plACTION_GET_IDENT;
  235. _GLOBAL_CONST unsigned long plACTION_GET_NET_QUALITY;
  236. _GLOBAL_CONST unsigned long plACTION_SET_STATION_NUMBER;
  237. _GLOBAL_CONST unsigned short ERR_PLMGR_NO_POWERLNK_LIBRARY;
  238. _GLOBAL_CONST unsigned short ERR_PLMGR_EXCEPTION;
  239. _GLOBAL_CONST unsigned short ERR_PLMGR_INTERNAL;
  240. _GLOBAL_CONST unsigned short ERR_PLMGR_RECOMMEND_FW_UPDATE;
  241. _GLOBAL_CONST unsigned short ERR_PLMGR_HW_BOOTUP_FAILED;
  242. _GLOBAL_CONST unsigned short ERR_PLMGR_WARNING_FW_UPDATE;
  243. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_ARRAYSIZE;
  244. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_TRAILINGCHARS;
  245. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_SUBSLOT;
  246. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_SLOT;
  247. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_NETTIME;
  248. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_TO_MANY_NUMBERS;
  249. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_BIT;
  250. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_CHANNEL;
  251. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_SUBMODUL;
  252. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_MODUL;
  253. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_STATION;
  254. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_INTERFACE;
  255. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_NOT_IN_OR_OUT;
  256. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_NO_PERCENT;
  257. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_END_EXPECTED;
  258. _GLOBAL_CONST unsigned short ERR_PLMGR_PARSE_ERROR;
  259. _GLOBAL_CONST unsigned short ERR_PLMGR_INIT_NOT_FINISHED;
  260. _GLOBAL_CONST unsigned short ERR_PLMGR_ALREADY_INITIALIZED;
  261. _GLOBAL_CONST unsigned short ERR_PLMGR_NO_PDO_MAPPING_DEFINED;
  262. _GLOBAL_CONST unsigned short ERR_PLMGR_UNKNOWN_TYPE;
  263. _GLOBAL_CONST unsigned short ERR_PLMGR_NOT_IN_PRES;
  264. _GLOBAL_CONST unsigned short ERR_PLMGR_CONFIG_CONFLICT;
  265. _GLOBAL_CONST unsigned short ERR_PLMGR_SYNC_FAILED;
  266. _GLOBAL_CONST unsigned short ERR_PLMGR_SYNC_BY_SYSTEM;
  267. _GLOBAL_CONST unsigned short ERR_PLMGR_BUS_CONFIGURED_TWICE;
  268. _GLOBAL_CONST unsigned short ERR_PLMGR_TOO_MANY_INTERFACES;
  269. _GLOBAL_CONST unsigned short ERR_PLMGR_STATION_NOT_ACTIVE;
  270. _GLOBAL_CONST unsigned short ERR_PLMGR_WRONG_TASKCLASS;
  271. _GLOBAL_CONST unsigned short ERR_PLMGR_UNAVAILABLE_DATAPOINT;
  272. _GLOBAL_CONST unsigned short ERR_PLMGR_OVERFLOW;
  273. _GLOBAL_CONST unsigned short ERR_PLMGR_NIL_POINTER;
  274. _GLOBAL_CONST unsigned short ERR_PLMGR_OFFSET_TO_HIGH;
  275. _GLOBAL_CONST unsigned short ERR_PLMGR_WRITE_ACTIVE;
  276. _GLOBAL_CONST unsigned short ERR_PLMGR_FRAME_TOO_LONG;
  277. _GLOBAL_CONST unsigned short ERR_PLMGR_NO_FRAME_RECEIVED;
  278. _GLOBAL_CONST unsigned short ERR_PLMGR_CHANNEL_ALREADY_OPEN;
  279. _GLOBAL_CONST unsigned short ERR_PLMGR_ERROR_ALLOC_BUFFER;
  280. _GLOBAL_CONST unsigned short ERR_PLMGR_ERROR_ALLOC_CHANNEL;
  281. _GLOBAL_CONST unsigned short ERR_PLMGR_ERROR_ALLOC_STATION;
  282. _GLOBAL_CONST unsigned short ERR_PLMGR_WRONG_IDENT;
  283. _GLOBAL_CONST unsigned short ERR_PLMGR_ILLEGAL_PARAMETER;
  284. _GLOBAL_CONST unsigned short ERR_PLMGR_NOT_IMPLEMENTED;
  285. _GLOBAL_CONST unsigned short ERR_PLMGR_ALREADY_CONFIGURATED;
  286. _GLOBAL_CONST unsigned short ERR_PLMGR_CONFIG_NOT_FOUND;
  287. _GLOBAL_CONST unsigned short ERR_PLMGR_WRONG_DEVICE;
  288. _GLOBAL_CONST unsigned short ERR_PLMGR_NOMEM;
  289. _GLOBAL_CONST unsigned short ERR_PLMGR_VERS_CONFLICT;
  290. #endif
  291. /* Datatypes and datatypes of function blocks */
  292. /* Konfiguration for remote stations */
  293. typedef struct PLSYSCONF_RS_typ
  294. {
  295. USINT size_x16; /* Size of configuration entry in blocks of 16 bytes (by now always 1) */
  296. /* Set size_x16 to 0 to mark the last remote station configuration entry */
  297. USINT bus; /* Bus number: Valid Numbers 1 .. 255 */
  298. USINT station; /* Station number */
  299. USINT flags; /* flags as OR of constants plSYSCONF_STATIONFLAG_... */
  300. UDINT hwVariant; /* Hardware variant: 0=any */
  301. INT insize; /* Size for input buffer (0xffff for automatic)*/
  302. INT outsize; /* Size for output buffer (0xffff for automatic)*/
  303. INT RespTimeout; /* response timeout in µs <= 0 -> default = 25µs */
  304. USINT MuxNetworkSlot; /* ignored for normal stations, for multiplexed stations 1 to MuxPrescaler */
  305. USINT reserve2; /* reserved set to 0 */
  306. }PLSYSCONF_RS_typ;
  307. /* Konfiguration of interfaces */
  308. typedef struct PLSYSCONF_IF_typ/* Configuration structure for PowerLink Interface Modules */
  309. {
  310. USINT station; /* Station number 0 for Master, 1..253 for intelligent slave */
  311. USINT slot; /* slot of the POWERLINK interface card */
  312. USINT subslot; /* subslot of the POWERLINK interface card */
  313. USINT interface; /* interface number */
  314. UDINT pl_cycle; /* cycle time of PowerLink cycle in us */
  315. UDINT pl_prescale; /* prescaler for synchron PowerLink timer-taskclass */
  316. UDINT uptimeout; /* timeout for configurated remote stations at power up in us */
  317. USINT bus; /* Bus number of PowerLink interface. Corresponds to
  318. "bus" element in the PLSYSCONF_RS_typ. Valid Number 1...255.
  319. If bus is set to 0, the Library countes the busses by itself. */
  320. USINT MuxStationsPerCycle; /* ignored since FW-Version V0.06.0: until FW-Version V0.05.9 number of handled multiplexed stations in each powerlink cycle */
  321. USINT MuxPrescaler; /* number of powerlink cycles for one mux cycle 1 .. 253 */
  322. SINT ATOCtaskclass;/* taskclass triggering the Output-DMA, 0 ..triggered by System-Tick, plCE_CYCLIC_1 to plCE_CYCLIC_8 ..triggered by cyclic taskklass */
  323. UDINT reservedlong; /* reserved set to 0 */
  324. }PLSYSCONF_IF_typ;
  325. typedef struct PLSYSCONF_typ /* global PowerLink configuration */
  326. {
  327. USINT noIF; /* number of interface cards (allways 1 on SG3) */
  328. USINT takt_master; /* Which interface is taktmaster on SG3 (allways 1), 0 for no taktmaster */
  329. UINT reserve1; /* reserved set to 0 */
  330. UDINT pRemoteCfg; /* Pointer to array of remote station configuration */
  331. /* end array with an entry with .size_x16=0 */
  332. PLSYSCONF_IF_typ interfaces[15]; /* Interface configurations */
  333. }PLSYSCONF_typ;
  334. /* Object structures for plAction function */
  335. typedef struct PLACTION_NET_QUALITY_typ{
  336. UDINT nLineQualFreezeCnt; /* out: count of started io cycles within last time */
  337. UDINT nLineQualFailCnt; /* out: count of failed cycles within last time */
  338. }PLACTION_NET_QUALITY_typ;
  339. typedef struct PLACTION_GET_IDENT_typ{
  340. char *pName; /* in: name */
  341. UDINT ident; /* out: ident */
  342. }PLACTION_GET_IDENT_typ;
  343. typedef struct PLACTION_DEVICE_TO_BUS_NR_typ{
  344. char *pDeviceString; /* in: device string */
  345. USINT busNumber; /* out: bus number */
  346. }PLACTION_DEVICE_TO_BUS_NR_typ;
  347. /* PLACTION_SYNC_STATISTICS_typ Supported only on SG3 */
  348. typedef struct PLACTION_SYNC_STATISTICS_typ{
  349. UINT act_usec; /* out: duration of last synchrounous taskclass */
  350. UINT min_usec; /* out: minimal duration of synchrounous taskclass */
  351. UINT max_usec; /* out: maximal duration of synchrounous taskclass */
  352. UINT act_cycle; /* out: exact cycletime of last synchronous taskclass */
  353. UINT min_cycle; /* out: minimal cycletime of synchronous taskclass */
  354. UINT max_cycle; /* out: maximal cycletime of synchronous taskclass */
  355. }PLACTION_SYNC_STATISTICS_typ;
  356. typedef struct PLACTION_GET_CROSSLINK_INFO_typ{
  357. const char *DeviceName; /* in: name of io device e.g. "SS1.IF2.ST3.SL7" */
  358. const char *ChannelName; /* in: name of datapoint e.g. "AnalogInput01" */
  359. UINT NodeId; /* out: Node number of powerlink station */
  360. UINT Offset; /* out: Offset in data counted in Bits */
  361. UINT Length; /* out: Length of data point counted in Bits */
  362. UINT TypeId; /* out: Type ident of datapoint EPL V2 (matches CANopen Specification) */
  363. }PLACTION_GET_CROSSLINK_INFO_typ;
  364. typedef struct PLACTION_GET_DP_INFO_typ{
  365. const char *DeviceName; /* in: name of io device e.g. "SS1.IF2.ST3.SL7" */
  366. const char *ChannelName; /* in: name of datapoint e.g. "AnalogInput01" */
  367. USINT DestNode; /* out: Node number of destination in network frame */
  368. USINT SrcNode; /* out: Node number of source in network frame */
  369. USINT MessageType; /* out: Message Type on Powerlink (plMESSAGE_TYPE_PREQ(=3) PReq, plMESSAGE_TYPE_PRES(=4) PRes) */
  370. USINT MuxSlot; /* out: multiplex slot (0 continous station) */
  371. UINT OffsetAbs; /* out: Offset in net data of EPL frame counted in bits */
  372. UINT OffsetRel; /* out: Offset relative to station net data in bits */
  373. UINT Length; /* out: Length of data point counted in bits */
  374. UINT TypeId; /* out: Type ident of datapoint EPL V2 (matches CANopen Specification) */
  375. UINT NodeInSize; /* out: input net size of station (PRes) */
  376. UINT NodeOutSize; /* out: output net size of station (size of PReq, or part of PResMN ) */
  377. USINT Direction; /* out: plDIRECTION_IN(=1) Input,plDIRECTION_OUT(=2) Output relative to local node */
  378. USINT Node; /* out: node of datapoint */
  379. UINT reserved; /* res: reserved word for alignment */
  380. UDINT ImageIndex; /* out: image index for inputs 0 for outputs */
  381. UDINT ImageOffset; /* out: offset of datapoint in local image buffer (bytes) */
  382. }PLACTION_GET_DP_INFO_typ;
  383. typedef struct PLACTION_GET_PDO_INFO_typ{
  384. const char *DeviceName; /* in: name of io device e.g. "SS1.IF2.ST3.SL7" */
  385. UINT ODIndex; /* in: Index of object in Powerlink object dictionary */
  386. USINT ODSubindex; /* in: query the PDO information of by Index/Subindex */
  387. USINT align; /* res: reseved for alignment */
  388. USINT DestNode; /* out: Node number of destination in network frame */
  389. USINT SrcNode; /* out: Node number of source in network frame */
  390. USINT MessageType; /* out: Message Type on Powerlink (plMESSAGE_TYPE_PREQ(=3) PReq, plMESSAGE_TYPE_PRES(=4) PRes) */
  391. USINT MuxSlot; /* out: multiplex slot (0 continous station) */
  392. UINT OffsetAbs; /* out: Offset in net data of EPL frame counted in bits */
  393. UINT OffsetRel; /* out: Offset relative to station net data in bits */
  394. UINT Length; /* out: Length of data point counted in bits */
  395. UINT TypeId; /* out: Type ident of datapoint EPL V2 (matches CANopen Specification) */
  396. UINT NodeInSize; /* out: input net size of station (PRes) */
  397. UINT NodeOutSize; /* out: output net size of station (size of PReq, or part of PResMN ) */
  398. USINT Direction; /* out: plDIRECTION_IN(=1) Input,plDIRECTION_OUT(=2) Output relative to local node */
  399. USINT Node; /* out: node of datapoint */
  400. UINT reserved; /* res: reserved word for alignment */
  401. UDINT ImageIndex; /* out: image index for inputs 0 for outputs */
  402. UDINT ImageOffset; /* out: offset of datapoint in local image buffer (bytes) */
  403. }PLACTION_GET_PDO_INFO_typ;
  404. /* Prototyping of functions and function blocks */
  405. _BUR_PUBLIC UINT plConfig(PLSYSCONF_typ *pConfigStruct);
  406. _BUR_PUBLIC UINT plCECreate(const char* pDatapoint, void* address, SINT taskclass, UDINT *pIdent);
  407. _BUR_PUBLIC UINT plCEDelete(UDINT ident);
  408. _BUR_PUBLIC UINT plState(UDINT ident);
  409. _BUR_PUBLIC UINT plAction(UDINT ident, UDINT actionID, void* pObject, UDINT objectSize);
  410. _BUR_PUBLIC UINT plAcycOpen(const char* pName, UDINT flags, UDINT *pIdent);
  411. _BUR_PUBLIC UINT plAcycClose(UDINT ident);
  412. _BUR_PUBLIC UINT plAcycRead(UDINT ident, void* bufferAdr, UDINT bufferLen, UDINT *pReadLen);
  413. _BUR_PUBLIC UINT plAcycInvite(UDINT ident);
  414. _BUR_PUBLIC UINT plAcycWrite(UDINT ident, void* bufferAdr, UDINT bufferLen, UDINT *pWrittenLen);
  415. #ifdef __cplusplus
  416. };
  417. #endif
  418. #endif /* POWERLNK_H_ */