EtherCAT slave that reads 3 Xsens IMU's connected to a Xbus Master
Dependencies: MODSERIAL mbed KL25Z_ClockControl
Fork of EtherCAT by
objectlist.h
00001 /* 00002 * SOES Simple Open EtherCAT Slave 00003 * 00004 * File : objectlist.h 00005 * Version : 0.9.2 00006 * Date : 22-02-2010 00007 * Copyright (C) 2007-2010 Arthur Ketels 00008 * 00009 * SOES is free software; you can redistribute it and/or modify it under 00010 * the terms of the GNU General Public License version 2 as published by the Free 00011 * Software Foundation. 00012 * 00013 * SOES is distributed in the hope that it will be useful, but WITHOUT ANY 00014 * WARRANTY; without even the implied warranty of MERCHANTABILITY or 00015 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00016 * for more details. 00017 * 00018 * As a special exception, if other files instantiate templates or use macros 00019 * or inline functions from this file, or you compile this file and link it 00020 * with other works to produce a work based on this file, this file does not 00021 * by itself cause the resulting work to be covered by the GNU General Public 00022 * License. However the source code for this file must still be made available 00023 * in accordance with section (3) of the GNU General Public License. 00024 * 00025 * This exception does not invalidate any other reasons why a work based on 00026 * this file might be covered by the GNU General Public License. 00027 * 00028 * The EtherCAT Technology, the trade name and logo "EtherCAT" are the intellectual 00029 * property of, and protected by Beckhoff Automation GmbH. 00030 */ 00031 #ifndef __objectlist__ 00032 #define __objectlist__ 00033 00034 /** 00035 For info about this file, please check http://bitbucket.org/utwente_bss/soes_arm/wiki/objectlist_h 00036 */ 00037 typedef const struct 00038 { 00039 uint16 subindex; 00040 uint16 datatype; 00041 uint16 bitlength; 00042 uint16 access; 00043 char const *name; 00044 uint32 value; 00045 void *data; 00046 } _objd; 00047 00048 typedef const struct 00049 { 00050 uint16 index; 00051 uint16 objtype; 00052 uint8 maxsub; 00053 uint8 pad1; 00054 char const *name; 00055 _objd const *objdesc; 00056 } _objectlist; 00057 00058 #define OBJH_READ 0 00059 #define OBJH_WRITE 1 00060 00061 #define _ac const char 00062 #define nil 0 00063 00064 //Described in Table 63 & Table 64 of ETG1000.6 00065 #define OTYPE_DOMAIN 0x0002 00066 #define OTYPE_DEFTYPE 0x0005 00067 #define OTYPE_DEFSTRUCT 0x0006 00068 #define OTYPE_VAR 0x0007 00069 #define OTYPE_ARRAY 0x0008 00070 #define OTYPE_RECORD 0x0009 00071 00072 //Described in Table 70 of ETG1000.6 00073 #define DTYPE_BOOLEAN 0x0001 00074 #define DTYPE_INTEGER8 0x0002 00075 #define DTYPE_INTEGER16 0x0003 00076 #define DTYPE_INTEGER32 0x0004 00077 #define DTYPE_UNSIGNED8 0x0005 00078 #define DTYPE_UNSIGNED16 0x0006 00079 #define DTYPE_UNSIGNED32 0x0007 00080 #define DTYPE_REAL32 0x0008 00081 #define DTYPE_VISIBLE_STRING 0x0009 00082 #define DTYPE_OCTET_STRING 0x000A 00083 #define DTYPE_UNICODE_STRING 0x000B 00084 #define DTYPE_INTEGER24 0x0010 00085 #define DTYPE_UNSIGNED24 0x0016 00086 #define DTYPE_INTEGER64 0x0015 00087 #define DTYPE_UNSIGNED64 0x001B 00088 #define DTYPE_REAL64 0x0011 00089 #define DTYPE_PDO_MAPPING 0x0021 00090 #define DTYPE_IDENTITY 0x0023 00091 #define DTYPE_BIT1 0x0030 00092 #define DTYPE_BIT2 0x0031 00093 #define DTYPE_BIT3 0x0032 00094 #define DTYPE_BIT4 0x0033 00095 #define DTYPE_BIT5 0x0034 00096 #define DTYPE_BIT6 0x0035 00097 #define DTYPE_BIT7 0x0036 00098 #define DTYPE_BIT8 0x0037 00099 00100 //See 'Object Access' in Table 47 of ETG1000.6 00101 #define ATYPE_R 0x07 00102 #define ATYPE_RW 0x3F 00103 #define ATYPE_RWpre 0x0F 00104 #define ATYPE_RXPDO 0x40 00105 #define ATYPE_TXPDO 0x80 00106 00107 /** Mapping of parameters is according to ETG.5000 document, and ETG.1000.6 00108 */ 00109 _ac acName1000[]="Device Type"; 00110 _ac acName1008[]="Manufacturer Device Name"; 00111 _ac acName1009[]="Manufacturer Hardware Version"; 00112 _ac acName100A[]="Manufacturer Software Version"; 00113 _ac acName1018[]="Identity Object"; 00114 /*Subindexes for Identity Object*/ 00115 _ac acName1018_01[]="Vendor ID"; 00116 _ac acName1018_02[]="Product Code"; 00117 _ac acName1018_03[]="Revision Number"; 00118 _ac acName1018_04[]="Serial Number"; 00119 /*End of subindexes for Identity Object*/ 00120 _ac acNameMO[]="Mapped object"; 00121 _ac acName1600[]="Receive PDO mapping"; 00122 _ac acName1A00[]="Transmit PDO mapping - First IMU"; 00123 _ac acName1A01[]="Transmit PDO mapping - Second IMU"; 00124 _ac acName1A02[]="Transmit PDO mapping - Third IMU"; 00125 _ac acName1A03[]="Transmit PDO mapping - Timestamp"; 00126 _ac acName1C00[]="Sync Manager Communication type"; 00127 /*Subindexes for Sync Manager Communication type*/ 00128 _ac acName1C00_01[]="Communications type SM0"; 00129 _ac acName1C00_02[]="Communications type SM1"; 00130 _ac acName1C00_03[]="Communications type SM2"; 00131 _ac acName1C00_04[]="Communications type SM3"; 00132 /*End of subindexes for Sync Manager Communication type*/ 00133 _ac acName1C10[]="Sync Manager 0 PDO Assignment"; 00134 _ac acName1C11[]="Sync Manager 1 PDO Assignment"; 00135 _ac acName1C12[]="Sync Manager 2 PDO Assignment"; 00136 _ac acName1C13[]="Sync Manager 3 PDO Assignment"; 00137 _ac acNameNOE[]="Number of entries"; 00138 _ac acName6000[]="First IMU"; 00139 /*Subindexes for IMUs*/ 00140 _ac acName6000_01[]="Quaternion q0"; 00141 _ac acName6000_02[]="Quaternion q1"; 00142 _ac acName6000_03[]="Quaternion q2"; 00143 _ac acName6000_04[]="Quaternion q3"; 00144 _ac acName6000_05[]="Timestamp"; 00145 /*_ac acName6000_01[]="Accelerometer X"; 00146 _ac acName6000_02[]="Accelerometer Y"; 00147 _ac acName6000_03[]="Accelerometer Z"; 00148 _ac acName6000_04[]="Gyroscope X"; 00149 _ac acName6000_05[]="Gyroscope Y"; 00150 _ac acName6000_06[]="Gyroscope Z"; 00151 _ac acName6000_07[]="Magnetometer X"; 00152 _ac acName6000_08[]="Magnetometer Y"; 00153 _ac acName6000_09[]="Magnetometer Z"; 00154 _ac acName6000_0A[]="Temperature";*/ 00155 /*End of subindexes for Digital Inputs*/ 00156 _ac acName6001[]="Second IMU"; 00157 _ac acName6002[]="Third IMU"; 00158 _ac acName6003[]="Timestamp"; 00159 _ac acName6003_01[]="Timestamp"; 00160 /*End of subindexes for Analog inputs*/ 00161 _ac acName7000[]="Outputs"; 00162 /*Subindexes of Outputs*/ 00163 _ac acName7000_01[]="Correct Offset"; 00164 /*End of subindexes for Outputs*/ 00165 _ac acName8000[]="Configuration"; 00166 /*Subindexes of configuration*/ 00167 _ac acName8000_01[]="Settings 8"; 00168 //_ac acName8000_02[]="Settings 16"; 00169 /*End of subindexes of configuration*/ 00170 00171 ///////////////////////////////////////////////////////////////////////////////////// 00172 /** Definiton of Device Name */ 00173 char ac1008_00[]="EtherCAT Xbus Master Interface (3 slaves)"; 00174 /** Definition of Hardware version*/ 00175 char ac1009_00[]="0.0.1"; 00176 /** Definition of Software version*/ 00177 char ac100A_00[]="0.0.2"; 00178 /** Service Data Object 1000: Device Type */ 00179 const _objd SDO1000[]= 00180 {{0x00,DTYPE_UNSIGNED32,32,ATYPE_R,&acName1000[0],0x00000000}}; 00181 /** Service Data Object 1008: Device Name */ 00182 const _objd SDO1008[]= 00183 {{0x00,DTYPE_VISIBLE_STRING,sizeof(ac1008_00)<<3,ATYPE_R,&acName1008[0],0,&ac1008_00[0]}}; 00184 /** Service Data Object 1009: Hardware Version */ 00185 const _objd SDO1009[]= 00186 {{0x00,DTYPE_VISIBLE_STRING,sizeof(ac1009_00)<<3,ATYPE_R,&acName1009[0],0,&ac1009_00[0]}}; 00187 /** Service Data Object 100A: Software Version */ 00188 const _objd SDO100A[]= 00189 {{0x00,DTYPE_VISIBLE_STRING,sizeof(ac100A_00)<<3,ATYPE_R,&acName100A[0],0,&ac100A_00[0]}}; 00190 const _objd SDO1018[]= //See ETG.1000.6 'Identity Object' 00191 {{0x00,DTYPE_UNSIGNED8,8,ATYPE_R,&acNameNOE[0],0x04}, //Number of Entries 00192 {0x01,DTYPE_UNSIGNED32,32,ATYPE_R,&acName1018_01[0],0x500}, //Vendor ID 00193 {0x02,DTYPE_UNSIGNED32,32,ATYPE_R,&acName1018_02[0],005 }, //Product Code 00194 {0x03,DTYPE_UNSIGNED32,32,ATYPE_R,&acName1018_03[0],0x01}, //Revision Number 00195 {0x04,DTYPE_UNSIGNED32,32,ATYPE_R,&acName1018_04[0],0x001} //Serial Number 00196 }; 00197 00198 00199 ///////////////////////////////////////////////////////////////////////////////////////////// 00200 const _objd SDO1600[]= //RxPDO mapping (objects from master to slave) 00201 {{0x00,DTYPE_UNSIGNED8,8,ATYPE_R,&acNameNOE[0],0x01}, //Number of RxPDOs 00202 {0x01,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x70000108} //First Object, pointing to object 7001:01 00203 }; 00204 const _objd SDO1A00[]= //TxPDO mapping (objects from slave to master) 00205 {{0x00,DTYPE_UNSIGNED8,8,ATYPE_R,&acNameNOE[0],0x05}, //Number of TxPDOs 00206 {0x01,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60000120}, //First Object, pointing to object 6000:01 00207 {0x02,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60000220}, //Second Object, pointing to object 6000:02 //.. 00208 {0x03,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60000320}, 00209 {0x04,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60000420}, 00210 {0x05,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60000510} 00211 }; 00212 00213 const _objd SDO1A01[]= //TxPDO mapping (objects from slave to master) 00214 {{0x00,DTYPE_UNSIGNED8,8,ATYPE_R,&acNameNOE[0],0x05}, //Number of TxPDOs 00215 {0x01,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60010120}, //First Object, pointing to object 6001:01 00216 {0x02,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60010220}, //Second Object, pointing to object 6001:02 //.. 00217 {0x03,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60010320}, 00218 {0x04,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60010420}, 00219 {0x05,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60010510} 00220 }; 00221 00222 const _objd SDO1A02[]= //TxPDO mapping (objects from slave to master) 00223 {{0x00,DTYPE_UNSIGNED8,8,ATYPE_R,&acNameNOE[0],0x05}, //Number of TxPDOs 00224 {0x01,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60020120}, //First Object, pointing to object 6002:01 00225 {0x02,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60020220}, //Second Object, pointing to object 6002:02 //.. 00226 {0x03,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60020320}, 00227 {0x04,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60020420}, 00228 {0x05,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60020510} 00229 }; 00230 00231 const _objd SDO1A03[]= //TxPDO mapping (objects from slave to master) 00232 {{0x00,DTYPE_UNSIGNED8,8,ATYPE_R,&acNameNOE[0],0x01}, //Number of TxPDOs 00233 {0x01,DTYPE_UNSIGNED32,32,ATYPE_R,&acNameMO[0],0x60030110} //First Object, pointing to object 6003:01 00234 }; 00235 00236 const _objd SDO1C00[]= //Sync Manager 00237 {{0x00,DTYPE_UNSIGNED8,8,ATYPE_R,&acNameNOE[0],0x04}, //Number of used Sync Manager channels 00238 {0x01,DTYPE_UNSIGNED8,8,ATYPE_R,&acName1C00_01[0],0x01}, //Sync Manager 0: Mailbox Receive (master->slave) 00239 {0x02,DTYPE_UNSIGNED8,8,ATYPE_R,&acName1C00_02[0],0x02}, //Sync Manager 1: Mailbos send (slave->master) 00240 {0x03,DTYPE_UNSIGNED8,8,ATYPE_R,&acName1C00_03[0],0x03}, //Process Data Output (or Inputs if no Outputs are used) 00241 {0x04,DTYPE_UNSIGNED8,8,ATYPE_R,&acName1C00_04[0],0x04} //Process Data Input 00242 }; 00243 const _objd SDO1C10[]= //Sync Manager 0 PDO Assignment 00244 {{0x00,DTYPE_UNSIGNED8,8,ATYPE_R,&acName1C10[0],0x00}}; 00245 const _objd SDO1C11[]= //Sync Manager 1 PDO Assignment 00246 {{0x00,DTYPE_UNSIGNED8,8,ATYPE_R,&acName1C11[0],0x00}}; 00247 const _objd SDO1C12[]= //RxPDO Assign objects 00248 {{0x00,DTYPE_UNSIGNED8,8,ATYPE_R,&acNameNOE[0],0x01}, //Number of Entries 00249 {0x01,DTYPE_UNSIGNED16,16,ATYPE_R,&acNameMO[0],0x1600} //Send objects in index 0x1600 00250 }; 00251 const _objd SDO1C13[]= //TxPDO Assign objects ; CHANGEABLE, thus 'RWpre' mode 00252 {{0x00,DTYPE_UNSIGNED8,8,ATYPE_R,&acNameNOE[0],0x04}, //Number of Entries 00253 {0x01,DTYPE_UNSIGNED16,16,ATYPE_R,&acNameMO[0],0x1A00}, //Send objects in index 0x1A00 00254 {0x02,DTYPE_UNSIGNED16,16,ATYPE_R,&acNameMO[0],0x1A01}, //Send objects in index 0x1A10 00255 {0x03,DTYPE_UNSIGNED16,16,ATYPE_R,&acNameMO[0],0x1A02}, 00256 {0x04,DTYPE_UNSIGNED16,16,ATYPE_R,&acNameMO[0],0x1A03} 00257 }; 00258 00259 const _objd SDO6000[]= //TxPDO module 00260 {{0x00,DTYPE_UNSIGNED8 ,8,ATYPE_R,&acNameNOE[0],0x05}, //Number of elements 00261 {0x01,DTYPE_REAL32 ,32,ATYPE_R,&acName6000_01[0],0,&(Rb.xsens_imu[0].q0)},//6000:01 is q0 00262 {0x02,DTYPE_REAL32 ,32,ATYPE_R,&acName6000_02[0],0,&(Rb.xsens_imu[0].q1)},//6000:02 is q1 00263 {0x03,DTYPE_REAL32 ,32,ATYPE_R,&acName6000_03[0],0,&(Rb.xsens_imu[0].q2)},//6000:03 is q2 00264 {0x04,DTYPE_REAL32 ,32,ATYPE_R,&acName6000_04[0],0,&(Rb.xsens_imu[0].q3)},//6000:04 is q3 00265 {0x05,DTYPE_UNSIGNED16, 16,ATYPE_R,&acName6000_05[0],0,&(Rb.xsens_imu[0].samplecounter)}//6000:05 is timestamp 00266 }; 00267 00268 const _objd SDO6001[]= //TxPDO module 00269 {{0x00,DTYPE_UNSIGNED8 ,8,ATYPE_R,&acNameNOE[0],0x05}, //Number of elements 00270 {0x01,DTYPE_REAL32 ,32,ATYPE_R,&acName6000_01[0],0,&(Rb.xsens_imu[1].q0)},//6001:01 is q0 00271 {0x02,DTYPE_REAL32 ,32,ATYPE_R,&acName6000_02[0],0,&(Rb.xsens_imu[1].q1)},//6001:02 is q1 00272 {0x03,DTYPE_REAL32 ,32,ATYPE_R,&acName6000_03[0],0,&(Rb.xsens_imu[1].q2)},//6001:03 is q2 00273 {0x04,DTYPE_REAL32 ,32,ATYPE_R,&acName6000_04[0],0,&(Rb.xsens_imu[1].q3)},//6001:04 is q3 00274 {0x05,DTYPE_UNSIGNED16, 16,ATYPE_R,&acName6000_05[0],0,&(Rb.xsens_imu[1].samplecounter)}//6000:05 is timestamp 00275 }; 00276 00277 00278 const _objd SDO6002[]= //TxPDO module 00279 {{0x00,DTYPE_UNSIGNED8 ,8,ATYPE_R,&acNameNOE[0],0x05}, //Number of elements 00280 {0x01,DTYPE_REAL32 ,32,ATYPE_R,&acName6000_01[0],0,&(Rb.xsens_imu[2].q0)},//6002:01 is q0 00281 {0x02,DTYPE_REAL32 ,32,ATYPE_R,&acName6000_02[0],0,&(Rb.xsens_imu[2].q1)},//6002:02 is q1 00282 {0x03,DTYPE_REAL32 ,32,ATYPE_R,&acName6000_03[0],0,&(Rb.xsens_imu[2].q2)},//6002:03 is q2 00283 {0x04,DTYPE_REAL32 ,32,ATYPE_R,&acName6000_04[0],0,&(Rb.xsens_imu[2].q3)},//6002:04 is q3 00284 {0x05,DTYPE_UNSIGNED16, 16,ATYPE_R,&acName6000_05[0],0,&(Rb.xsens_imu[2].samplecounter)}//6002:05 is timestamp 00285 }; 00286 00287 const _objd SDO6003[]= //TxPDO module 00288 {{0x00,DTYPE_UNSIGNED8 ,8,ATYPE_R,&acNameNOE[0],0x01}, //Number of elements 00289 {0x01,DTYPE_UNSIGNED16 ,16,ATYPE_R,&acName6003_01[0],0,&(Rb.xsens_imu[0].samplecounter)},//6003:01 is timestamp 00290 }; 00291 00292 const _objd SDO7000[]= //RxPDO module 00293 {{0x00,DTYPE_UNSIGNED8 ,8,ATYPE_R,&acNameNOE[0],0x01}, //Number of elements 00294 {0x01,DTYPE_UNSIGNED8 ,8,ATYPE_RW,&acName7000_01[0],0,&(Wb.correct_offset)} //7001:02 is correct_offset 00295 }; 00296 const _objd SDO8000[]= //Configuration mailbox 00297 {{0x00,DTYPE_UNSIGNED8 ,8,ATYPE_R,&acNameNOE[0],0x01}, //number of elements 00298 {0x01,DTYPE_UNSIGNED8 ,8,ATYPE_RW,&acName8000_01[0],0,&(Eb.setting8)} //8000:01 is setting8 00299 //{0x02,DTYPE_UNSIGNED16 ,16,ATYPE_RW,&acName8000_02[0],0,&(Eb.setting16)} //8000:02 is setting16 00300 }; 00301 /** Object list; all objects used in EtherCAT slave */ 00302 const _objectlist SDOobjects[]= 00303 {{0x1000,OTYPE_VAR , 0,0,&acName1000[0],&SDO1000[0]}, //Device Type 00304 {0x1008,OTYPE_VAR , 0,0,&acName1008[0],&SDO1008[0]}, //Device Name 00305 {0x1009,OTYPE_VAR , 0,0,&acName1009[0],&SDO1009[0]}, //Hardware Version 00306 {0x100A,OTYPE_VAR , 0,0,&acName100A[0],&SDO100A[0]}, //Software Version 00307 {0x1018,OTYPE_RECORD , 4,0,&acName1018[0],&SDO1018[0]}, //Identity 00308 {0x1600,OTYPE_RECORD , 0x01,0,&acName1600[0],&SDO1600[0]}, //RxPDO mapping 00309 {0x1A00,OTYPE_RECORD , 5,0,&acName1A00[0],&SDO1A00[0]}, //TxPDO mapping 00310 {0x1A01,OTYPE_RECORD , 5,0,&acName1A01[0],&SDO1A01[0]}, //TxPDO mapping 00311 {0x1A02,OTYPE_RECORD , 5,0,&acName1A02[0],&SDO1A02[0]}, //TxPDO mapping 00312 {0x1A03,OTYPE_RECORD , 1,0,&acName1A03[0],&SDO1A03[0]}, //TxPDO mapping 00313 {0x1C00,OTYPE_ARRAY , 4,0,&acName1C00[0],&SDO1C00[0]}, //Sync Manager configuration 00314 {0x1C10,OTYPE_ARRAY , 0,0,&acName1C10[0],&SDO1C10[0]}, //Sync Manager 0 PDO assignment 00315 {0x1C11,OTYPE_ARRAY , 0,0,&acName1C11[0],&SDO1C11[0]}, //Sync Manager 1 PDO assignment 00316 {0x1C12,OTYPE_ARRAY , 1,0,&acName1C12[0],&SDO1C12[0]}, //RxPDO objects 00317 {0x1C13,OTYPE_ARRAY , 4,0,&acName1C13[0],&SDO1C13[0]}, //TxPDO objects 00318 {0x6000,OTYPE_ARRAY , 5,0,&acName6000[0],&SDO6000[0]}, //TxPDO module 00319 {0x6001,OTYPE_ARRAY , 5,0,&acName6001[0],&SDO6001[0]}, //TxPDO module 00320 {0x6002,OTYPE_ARRAY , 5,0,&acName6002[0],&SDO6002[0]}, //TxPDO module 00321 {0x6003,OTYPE_ARRAY , 1,0,&acName6003[0],&SDO6003[0]}, //TxPDO module 00322 {0x7000,OTYPE_ARRAY , 0x01,0,&acName7000[0],&SDO7000[0]}, //RxPDO module 00323 {0x8000,OTYPE_ARRAY , 0x01,0,&acName8000[0],&SDO8000[0]}, //RxPDO module 00324 {0xffff,0xff,0xff,0xff,nil,nil} 00325 }; 00326 00327 #endif 00328
Generated on Wed Jul 13 2022 17:16:52 by 1.7.2