SOEM EtherCAT Master library for STM Nucleo F767ZI
Dependents: EasyCAT_LAB_simple EasyCAT_LAB_very_simple EasyCAT_LAB
- This repository contains the SOEM (Simple Open EtherCAT® Master) library by rt-labs, that has been ported in the ecosystem by AB&T Tecnologie Informatiche.
- It has been developed for the EasyCAT LAB , a complete educational and experimental EtherCAT® system, composed of one master and two slaves .
- The EasyCAT LAB is provided as a kit by AB&T Tecnologie Informatiche, to allow everybody to have an educational EtherCAT® system up and running in a matter of minutes.
Warning
- Currently only the Nucleo STM32F767ZI board is supported.
SOEM/ethercatcoe.h@0:543d6784d4cc, 2019-06-11 (annotated)
- Committer:
- EasyCAT
- Date:
- Tue Jun 11 10:29:09 2019 +0000
- Revision:
- 0:543d6784d4cc
SOEM EtherCAT Master Library for STM Nucleo F767ZI
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EasyCAT | 0:543d6784d4cc | 1 | /* |
EasyCAT | 0:543d6784d4cc | 2 | * Licensed under the GNU General Public License version 2 with exceptions. See |
EasyCAT | 0:543d6784d4cc | 3 | * LICENSE file in the project root for full license information |
EasyCAT | 0:543d6784d4cc | 4 | */ |
EasyCAT | 0:543d6784d4cc | 5 | |
EasyCAT | 0:543d6784d4cc | 6 | /** \file |
EasyCAT | 0:543d6784d4cc | 7 | * \brief |
EasyCAT | 0:543d6784d4cc | 8 | * Headerfile for ethercatcoe.c |
EasyCAT | 0:543d6784d4cc | 9 | */ |
EasyCAT | 0:543d6784d4cc | 10 | |
EasyCAT | 0:543d6784d4cc | 11 | #ifndef _ethercatcoe_ |
EasyCAT | 0:543d6784d4cc | 12 | #define _ethercatcoe_ |
EasyCAT | 0:543d6784d4cc | 13 | |
EasyCAT | 0:543d6784d4cc | 14 | #ifdef __cplusplus |
EasyCAT | 0:543d6784d4cc | 15 | extern "C" |
EasyCAT | 0:543d6784d4cc | 16 | { |
EasyCAT | 0:543d6784d4cc | 17 | #endif |
EasyCAT | 0:543d6784d4cc | 18 | |
EasyCAT | 0:543d6784d4cc | 19 | /** max entries in Object Description list */ |
EasyCAT | 0:543d6784d4cc | 20 | #define EC_MAXODLIST 1024 |
EasyCAT | 0:543d6784d4cc | 21 | |
EasyCAT | 0:543d6784d4cc | 22 | /** max entries in Object Entry list */ |
EasyCAT | 0:543d6784d4cc | 23 | #define EC_MAXOELIST 256 |
EasyCAT | 0:543d6784d4cc | 24 | |
EasyCAT | 0:543d6784d4cc | 25 | /* Storage for object description list */ |
EasyCAT | 0:543d6784d4cc | 26 | typedef struct |
EasyCAT | 0:543d6784d4cc | 27 | { |
EasyCAT | 0:543d6784d4cc | 28 | /** slave number */ |
EasyCAT | 0:543d6784d4cc | 29 | uint16 Slave; |
EasyCAT | 0:543d6784d4cc | 30 | /** number of entries in list */ |
EasyCAT | 0:543d6784d4cc | 31 | uint16 Entries; |
EasyCAT | 0:543d6784d4cc | 32 | /** array of indexes */ |
EasyCAT | 0:543d6784d4cc | 33 | uint16 Index[EC_MAXODLIST]; |
EasyCAT | 0:543d6784d4cc | 34 | /** array of datatypes, see EtherCAT specification */ |
EasyCAT | 0:543d6784d4cc | 35 | uint16 DataType[EC_MAXODLIST]; |
EasyCAT | 0:543d6784d4cc | 36 | /** array of object codes, see EtherCAT specification */ |
EasyCAT | 0:543d6784d4cc | 37 | uint8 ObjectCode[EC_MAXODLIST]; |
EasyCAT | 0:543d6784d4cc | 38 | /** number of subindexes for each index */ |
EasyCAT | 0:543d6784d4cc | 39 | uint8 MaxSub[EC_MAXODLIST]; |
EasyCAT | 0:543d6784d4cc | 40 | /** textual description of each index */ |
EasyCAT | 0:543d6784d4cc | 41 | char Name[EC_MAXODLIST][EC_MAXNAME+1]; |
EasyCAT | 0:543d6784d4cc | 42 | } ec_ODlistt; |
EasyCAT | 0:543d6784d4cc | 43 | |
EasyCAT | 0:543d6784d4cc | 44 | /* storage for object list entry information */ |
EasyCAT | 0:543d6784d4cc | 45 | typedef struct |
EasyCAT | 0:543d6784d4cc | 46 | { |
EasyCAT | 0:543d6784d4cc | 47 | /** number of entries in list */ |
EasyCAT | 0:543d6784d4cc | 48 | uint16 Entries; |
EasyCAT | 0:543d6784d4cc | 49 | /** array of value infos, see EtherCAT specification */ |
EasyCAT | 0:543d6784d4cc | 50 | uint8 ValueInfo[EC_MAXOELIST]; |
EasyCAT | 0:543d6784d4cc | 51 | /** array of value infos, see EtherCAT specification */ |
EasyCAT | 0:543d6784d4cc | 52 | uint16 DataType[EC_MAXOELIST]; |
EasyCAT | 0:543d6784d4cc | 53 | /** array of bit lengths, see EtherCAT specification */ |
EasyCAT | 0:543d6784d4cc | 54 | uint16 BitLength[EC_MAXOELIST]; |
EasyCAT | 0:543d6784d4cc | 55 | /** array of object access bits, see EtherCAT specification */ |
EasyCAT | 0:543d6784d4cc | 56 | uint16 ObjAccess[EC_MAXOELIST]; |
EasyCAT | 0:543d6784d4cc | 57 | /** textual description of each index */ |
EasyCAT | 0:543d6784d4cc | 58 | char Name[EC_MAXOELIST][EC_MAXNAME+1]; |
EasyCAT | 0:543d6784d4cc | 59 | } ec_OElistt; |
EasyCAT | 0:543d6784d4cc | 60 | |
EasyCAT | 0:543d6784d4cc | 61 | #ifdef EC_VER1 |
EasyCAT | 0:543d6784d4cc | 62 | void ec_SDOerror(uint16 Slave, uint16 Index, uint8 SubIdx, int32 AbortCode); |
EasyCAT | 0:543d6784d4cc | 63 | int ec_SDOread(uint16 slave, uint16 index, uint8 subindex, |
EasyCAT | 0:543d6784d4cc | 64 | boolean CA, int *psize, void *p, int timeout); |
EasyCAT | 0:543d6784d4cc | 65 | int ec_SDOwrite(uint16 Slave, uint16 Index, uint8 SubIndex, |
EasyCAT | 0:543d6784d4cc | 66 | boolean CA, int psize, void *p, int Timeout); |
EasyCAT | 0:543d6784d4cc | 67 | int ec_RxPDO(uint16 Slave, uint16 RxPDOnumber , int psize, void *p); |
EasyCAT | 0:543d6784d4cc | 68 | int ec_TxPDO(uint16 slave, uint16 TxPDOnumber , int *psize, void *p, int timeout); |
EasyCAT | 0:543d6784d4cc | 69 | int ec_readPDOmap(uint16 Slave, int *Osize, int *Isize); |
EasyCAT | 0:543d6784d4cc | 70 | int ec_readPDOmapCA(uint16 Slave, int Thread_n, int *Osize, int *Isize); |
EasyCAT | 0:543d6784d4cc | 71 | int ec_readODlist(uint16 Slave, ec_ODlistt *pODlist); |
EasyCAT | 0:543d6784d4cc | 72 | int ec_readODdescription(uint16 Item, ec_ODlistt *pODlist); |
EasyCAT | 0:543d6784d4cc | 73 | int ec_readOEsingle(uint16 Item, uint8 SubI, ec_ODlistt *pODlist, ec_OElistt *pOElist); |
EasyCAT | 0:543d6784d4cc | 74 | int ec_readOE(uint16 Item, ec_ODlistt *pODlist, ec_OElistt *pOElist); |
EasyCAT | 0:543d6784d4cc | 75 | #endif |
EasyCAT | 0:543d6784d4cc | 76 | |
EasyCAT | 0:543d6784d4cc | 77 | void ecx_SDOerror(ecx_contextt *context, uint16 Slave, uint16 Index, uint8 SubIdx, int32 AbortCode); |
EasyCAT | 0:543d6784d4cc | 78 | int ecx_SDOread(ecx_contextt *context, uint16 slave, uint16 index, uint8 subindex, |
EasyCAT | 0:543d6784d4cc | 79 | boolean CA, int *psize, void *p, int timeout); |
EasyCAT | 0:543d6784d4cc | 80 | int ecx_SDOwrite(ecx_contextt *context, uint16 Slave, uint16 Index, uint8 SubIndex, |
EasyCAT | 0:543d6784d4cc | 81 | boolean CA, int psize, void *p, int Timeout); |
EasyCAT | 0:543d6784d4cc | 82 | int ecx_RxPDO(ecx_contextt *context, uint16 Slave, uint16 RxPDOnumber , int psize, void *p); |
EasyCAT | 0:543d6784d4cc | 83 | int ecx_TxPDO(ecx_contextt *context, uint16 slave, uint16 TxPDOnumber , int *psize, void *p, int timeout); |
EasyCAT | 0:543d6784d4cc | 84 | int ecx_readPDOmap(ecx_contextt *context, uint16 Slave, int *Osize, int *Isize); |
EasyCAT | 0:543d6784d4cc | 85 | int ecx_readPDOmapCA(ecx_contextt *context, uint16 Slave, int Thread_n, int *Osize, int *Isize); |
EasyCAT | 0:543d6784d4cc | 86 | int ecx_readODlist(ecx_contextt *context, uint16 Slave, ec_ODlistt *pODlist); |
EasyCAT | 0:543d6784d4cc | 87 | int ecx_readODdescription(ecx_contextt *context, uint16 Item, ec_ODlistt *pODlist); |
EasyCAT | 0:543d6784d4cc | 88 | int ecx_readOEsingle(ecx_contextt *context, uint16 Item, uint8 SubI, ec_ODlistt *pODlist, ec_OElistt *pOElist); |
EasyCAT | 0:543d6784d4cc | 89 | int ecx_readOE(ecx_contextt *context, uint16 Item, ec_ODlistt *pODlist, ec_OElistt *pOElist); |
EasyCAT | 0:543d6784d4cc | 90 | |
EasyCAT | 0:543d6784d4cc | 91 | #ifdef __cplusplus |
EasyCAT | 0:543d6784d4cc | 92 | } |
EasyCAT | 0:543d6784d4cc | 93 | #endif |
EasyCAT | 0:543d6784d4cc | 94 | |
EasyCAT | 0:543d6784d4cc | 95 | #endif |