00001 /* 00002 * Simple Open EtherCAT Master Library 00003 * 00004 * File : ethercatcoe.h 00005 * Version : 1.2.5 00006 * Date : 09-04-2011 00007 * Copyright (C) 2005-2011 Speciaal Machinefabriek Ketels v.o.f. 00008 * Copyright (C) 2005-2011 Arthur Ketels 00009 * Copyright (C) 2008-2009 TU/e Technische Universiteit Eindhoven 00010 * 00011 * SOEM is free software; you can redistribute it and/or modify it under 00012 * the terms of the GNU General Public License version 2 as published by the Free 00013 * Software Foundation. 00014 * 00015 * SOEM is distributed in the hope that it will be useful, but WITHOUT ANY 00016 * WARRANTY; without even the implied warranty of MERCHANTABILITY or 00017 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00018 * for more details. 00019 * 00020 * As a special exception, if other files instantiate templates or use macros 00021 * or inline functions from this file, or you compile this file and link it 00022 * with other works to produce a work based on this file, this file does not 00023 * by itself cause the resulting work to be covered by the GNU General Public 00024 * License. However the source code for this file must still be made available 00025 * in accordance with section (3) of the GNU General Public License. 00026 * 00027 * This exception does not invalidate any other reasons why a work based on 00028 * this file might be covered by the GNU General Public License. 00029 * 00030 * The EtherCAT Technology, the trade name and logo “EtherCAT” are the intellectual 00031 * property of, and protected by Beckhoff Automation GmbH. You can use SOEM for 00032 * the sole purpose of creating, using and/or selling or otherwise distributing 00033 * an EtherCAT network master provided that an EtherCAT Master License is obtained 00034 * from Beckhoff Automation GmbH. 00035 * 00036 * In case you did not receive a copy of the EtherCAT Master License along with 00037 * SOEM write to Beckhoff Automation GmbH, Eiserstraße 5, D-33415 Verl, Germany 00038 * (www.beckhoff.com). 00039 */ 00040 00046 #ifndef _ethercatcoe_ 00047 #define _ethercatcoe_ 00048 00050 #define EC_MAXODLIST 1024 00051 00053 #define EC_MAXOELIST 256 00054 00055 /* Storage for object description list */ 00056 typedef struct 00057 { 00059 uint16 Slave; 00061 uint16 Entries; 00063 uint16 Index[EC_MAXODLIST]; 00065 uint16 DataType[EC_MAXODLIST]; 00067 uint8 ObjectCode[EC_MAXODLIST]; 00069 uint8 MaxSub[EC_MAXODLIST]; 00071 char Name[EC_MAXODLIST][EC_MAXNAME + 1]; 00072 } ec_ODlistt; 00073 00074 /* storage for object list entry information */ 00075 typedef struct 00076 { 00078 uint16 Entries; 00080 uint8 ValueInfo[EC_MAXOELIST]; 00082 uint16 DataType[EC_MAXOELIST]; 00084 uint16 BitLength[EC_MAXOELIST]; 00086 uint16 ObjAccess[EC_MAXOELIST]; 00088 char Name[EC_MAXOELIST][EC_MAXNAME + 1]; 00089 } ec_OElistt; 00090 00091 void ec_SDOerror(uint16 Slave, uint16 Index, uint8 SubIdx, int32 AbortCode); 00092 int ec_SDOread(uint16 slave, uint16 index, uint8 subindex, boolean CA, int *psize, void *p, int timeout); 00093 int ec_SDOwrite(uint16 Slave, uint16 Index, uint8 SubIndex, boolean CA, int psize, void *p, int Timeout); 00094 int ec_RxPDO(uint16 Slave, uint16 RxPDOnumber, int psize, void *p); 00095 int ec_TxPDO(uint16 slave, uint16 TxPDOnumber, int *psize, void *p, int timeout); 00096 int ec_readPDOmap(uint16 Slave, int *Osize, int *Isize); 00097 int ec_readPDOmapCA(uint16 Slave, int *Osize, int *Isize); 00098 int ec_readODlist(uint16 Slave, ec_ODlistt *pODlist); 00099 int ec_readODdescription(uint16 Item, ec_ODlistt *pODlist); 00100 int ec_readOE(uint16 Item, ec_ODlistt *pODlist, ec_OElistt *pOElist); 00101 00102 #endif