Go to the documentation of this file.
73 #define EC_DEFAULTMBXSM0 0x00010026
75 #define EC_DEFAULTMBXSM1 0x00010022
77 #define EC_DEFAULTDOSM0 0x00010044
112 for(lp = 0; lp < context->
maxgroup; lp++)
143 EC_PRINT(
"Error: too many slaves on network: num_slaves=%d, EC_MAXSLAVE=%d\n",
156 memset(&zbuf, 0x00,
sizeof(zbuf));
210 if (csl->
Obits && !csl->
SM[2].StartAddr)
212 csl->
SM[0].StartAddr =
htoes(0x0f00);
215 csl->
FMMU[0].FMMUactive = 1;
216 csl->
FMMU[0].FMMUtype = 2;
228 if (csl->
Ibits && !csl->
SM[3].StartAddr)
230 csl->
SM[1].StartAddr =
htoes(0x1000);
232 csl->
SM[1].SMflags =
htoel(0x00000000);
233 csl->
FMMU[1].FMMUactive = 1;
234 csl->
FMMU[1].FMMUtype = 1;
285 for( nSM=0 ; nSM <
EC_MAXSM ; nSM++ )
312 int16 topoc, slavec, aliasadr;
316 int wkc, cindex, nSM;
319 EC_PRINT(
"ec_config_init %d\n",usetable);
343 configadr =
etohs(configadr);
348 estat =
etohs(estat);
398 if ((
etohs(val16) & 0x04) > 0)
407 topology =
etohs(topology);
410 if ((topology & 0x0300) == 0x0200)
415 if ((topology & 0x0c00) == 0x0800)
420 if ((topology & 0x3000) == 0x2000)
425 if ((topology & 0xc000) == 0x8000)
461 if (((topoc >= 0) && (topology > 1)) ||
571 EC_PRINT(
"Slave %d has no proper mailbox in configuration, try default.\n",
slave);
579 EC_PRINT(
"Slave %d has no proper mailbox out configuration, try default.\n",
slave);
625 for( nSM=0 ; nSM <
EC_MAXSM ; nSM++ )
648 EC_PRINT(
" >Slave %d, configadr %x, state %2.2x\n",
678 EC_PRINT(
" CoE Osize:%d Isize:%d\n", Osize, Isize);
686 EC_PRINT(
" SoE Osize:%d Isize:%d\n", Osize, Isize);
704 if (!Isize && !Osize)
708 if (!Isize && !Osize)
710 memset(&eepPDO, 0,
sizeof(eepPDO));
713 for( nSM=0 ; nSM <
EC_MAXSM ; nSM++ )
724 for( nSM=0 ; nSM <
EC_MAXSM ; nSM++ )
754 EC_PRINT(
" SM0 Type:%d StartAddr:%4.4x Flags:%8.8x\n",
763 EC_PRINT(
" SM1 Type:%d StartAddr:%4.4x Flags:%8.8x\n",
769 for( nSM = 2 ; nSM <
EC_MAXSM ; nSM++ )
787 EC_PRINT(
" SM%d Type:%d StartAddr:%4.4x Flags:%8.8x\n", nSM,
814 static int ecx_find_mapt(
void)
860 while ((thrn = ecx_find_mapt()) < 0)
869 &ecx_mapper_thread, &(
ecx_mapt[thrn]));
932 ByteCount += SMlength;
933 BitCount += SMlength * 8;
935 while ((BitCount < context->slavelist[
slave].Ibits) && (SMc < (
EC_MAXSM - 1)))
949 ByteCount += SMlength;
950 BitCount += SMlength * 8;
986 FMMUsize = ByteCount;
991 *LogAddr += FMMUsize;
996 FMMUdone += FMMUsize;
1025 EC_PRINT(
" Inputs %p startbit %d\n",
1064 ByteCount += SMlength;
1065 BitCount += SMlength * 8;
1067 while ((BitCount < context->slavelist[
slave].Obits) && (SMc < (
EC_MAXSM - 1)))
1081 ByteCount += SMlength;
1082 BitCount += SMlength * 8;
1118 FMMUsize = ByteCount;
1123 *LogAddr += FMMUsize;
1128 FMMUdone += FMMUsize;
1153 EC_PRINT(
" slave %d Outputs %p startbit %d\n",
1179 uint16 currentsegment = 0;
1182 if ((*(context->
slavecount) > 0) && (group < context->maxgroup))
1184 EC_PRINT(
"ec_config_map_group IOmap:%p group:%d\n", pIOmap, group);
1206 diff = LogAddr - oLogAddr;
1219 segmentsize += diff;
1266 diff = LogAddr - oLogAddr;
1279 segmentsize += diff;
1359 uint16 currentsegment = 0;
1362 if ((*(context->
slavecount) > 0) && (group < context->maxgroup))
1364 EC_PRINT(
"ec_config_map_group IOmap:%p group:%d\n", pIOmap, group);
1366 siLogAddr = mLogAddr;
1367 soLogAddr = mLogAddr;
1380 siLogAddr = soLogAddr = mLogAddr;
1389 slave, &soLogAddr, &BitPos);
1401 slave, &siLogAddr, &BitPos);
1409 tempLogAddr = (siLogAddr > soLogAddr) ? siLogAddr : soLogAddr;
1410 diff = tempLogAddr - mLogAddr;
1411 mLogAddr = tempLogAddr;
1424 segmentsize += diff;
1492 uint16 ADPh, configadr, readadr;
1501 if(readadr == configadr)
1506 if( (
wkc > 0) && (readadr == 0))
1553 int state, nSM, FMMUc;
1568 for( nSM = 0 ; nSM <
EC_MAXSM ; nSM++ )
PACKED_BEGIN struct PACKED ec_fmmu ec_fmmut
DEPRECATED Configuration list of known EtherCAT slave devices.
int(* PO2SOconfig)(uint16 slave)
int ecx_BRD(ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
int ecx_siiPDO(ecx_contextt *context, uint16 slave, ec_eepromPDOt *PDO, uint8 t)
PACKED_END PACKED_BEGIN struct PACKED ec_sm ec_smt
static int ecx_map_coe_soe(ecx_contextt *context, uint16 slave, int thread_n)
uint16 ecx_statecheck(ecx_contextt *context, uint16 slave, uint16 reqstate, int timeout)
uint16 ecx_siiSM(ecx_contextt *context, uint16 slave, ec_eepromSMt *SM)
Headerfile for ethercatmain.c.
Headerfile for ethercatconfig.c.
static int ecx_lookup_prev_sii(ecx_contextt *context, uint16 slave)
static void ecx_config_create_input_mappings(ecx_contextt *context, void *pIOmap, uint8 group, int16 slave, uint32 *LogAddr, uint8 *BitPos)
int16 ecx_siifind(ecx_contextt *context, uint16 slave, uint16 cat)
#define EC_FIRSTDCDATAGRAM
static void ecx_config_create_output_mappings(ecx_contextt *context, void *pIOmap, uint8 group, int16 slave, uint32 *LogAddr, uint8 *BitPos)
void ecx_init_context(ecx_contextt *context)
int ec_config(uint8 usetable, void *pIOmap)
uint32 ecx_readeeprom(ecx_contextt *context, uint16 slave, uint16 eeproma, int timeout)
Headerfile for ethercatbase.c.
void ecx_siistring(ecx_contextt *context, char *str, uint16 slave, uint16 Sn)
uint32 IOsegment[EC_MAXIOSEGMENTS]
ecx_mapt_t ecx_mapt[EC_MAX_MAPT]
int ec_config_init(uint8 usetable)
int(* PO2SOconfigx)(ecx_contextt *context, uint16 slave)
int ec_recover_slave(uint16 slave, int timeout)
static int ecx_get_threadcount(void)
uint16 ecx_siiFMMU(ecx_contextt *context, uint16 slave, ec_eepromFMMUt *FMMU)
int ec_config_map_group(void *pIOmap, uint8 group)
uint8 ecx_siigetbyte(ecx_contextt *context, uint16 slave, uint16 address)
int ecx_BWR(ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
static int ecx_map_sm(ecx_contextt *context, uint16 slave)
Headerfile for ethercatcoe.c.
int ec_config_overlap(uint8 usetable, void *pIOmap)
int ec_reconfig_slave(uint16 slave, int timeout)
static int ecx_lookup_mapping(ecx_contextt *context, uint16 slave, int *Osize, int *Isize)
int ecx_APWRw(ecx_portt *port, uint16 ADP, uint16 ADO, uint16 data, int timeout)
static void ecx_config_find_mappings(ecx_contextt *context, uint8 group)
ec_fmmut FMMU[EC_MAXFMMU]
#define EC_LOGGROUPOFFSET
static void ecx_set_slaves_to_default(ecx_contextt *context)
int ecx_detect_slaves(ecx_contextt *context)
void ecx_readeeprom1(ecx_contextt *context, uint16 slave, uint16 eeproma)
int ec_config_overlap_map_group(void *pIOmap, uint8 group)
int osal_usleep(uint32 usec)
int ecx_reconfig_slave(ecx_contextt *context, uint16 slave, int timeout)
Headerfile for ethercatsoe.c.
int ecx_eeprom2pdi(ecx_contextt *context, uint16 slave)
int ecx_readIDNmap(ecx_contextt *context, uint16 slave, int *Osize, int *Isize)
int ecx_FPRD(ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
#define EC_SLAVECOUNTEXCEEDED
int ecx_APRD(ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
uint32 ecx_readeeprom2(ecx_contextt *context, uint16 slave, int timeout)
uint16 ecx_siiSMnext(ecx_contextt *context, uint16 slave, ec_eepromSMt *SM, uint16 n)
int ecx_config_map_group(ecx_contextt *context, void *pIOmap, uint8 group)
uint16 SMbitsize[EC_MAXSM]
int ec_config_overlap_map(void *pIOmap)
#define OSAL_THREAD_HANDLE
uint16 ecx_FPRDw(ecx_portt *port, uint16 ADP, uint16 ADO, int timeout)
int ecx_readPDOmapCA(ecx_contextt *context, uint16 Slave, int Thread_n, int *Osize, int *Isize)
General typedefs and defines for EtherCAT.
int ecx_FPWRw(ecx_portt *port, uint16 ADP, uint16 ADO, uint16 data, int timeout)
static int ecx_map_sii(ecx_contextt *context, uint16 slave)
ec_configlist_t ec_configlist[]
int ecx_recover_slave(ecx_contextt *context, uint16 slave, int timeout)
int ecx_FPWR(ecx_portt *port, uint16 ADP, uint16 ADO, uint16 length, void *data, int timeout)
int ec_config_map(void *pIOmap)
int ecx_config_init(ecx_contextt *context, uint8 usetable)
uint16 ecx_APRDw(ecx_portt *port, uint16 ADP, uint16 ADO, int timeout)
int ecx_eeprom2master(ecx_contextt *context, uint16 slave)
int ecx_config_overlap_map_group(ecx_contextt *context, void *pIOmap, uint8 group)
static int ecx_config_from_table(ecx_contextt *context, uint16 slave)
int ecx_readPDOmap(ecx_contextt *context, uint16 Slave, int *Osize, int *Isize)
int osal_thread_create(void *thandle, int stacksize, void *func, void *param)
int ec_findconfig(uint32 man, uint32 id)
soem
Author(s): Arthur Ketels and M.J.G. van den Molengraft
autogenerated on Wed Mar 2 2022 01:01:48