Configuration module for EtherCAT master.
More...
#include <stdio.h>
#include <string.h>
#include "osal.h"
#include "oshw.h"
#include "ethercattype.h"
#include "ethercatbase.h"
#include "ethercatmain.h"
#include "ethercatcoe.h"
#include "ethercatsoe.h"
#include "ethercatconfig.h"
#include "ethercatconfiglist.h"
Go to the source code of this file.
|
int | ec_config (uint8 usetable, void *pIOmap) |
|
int | ec_config_init (uint8 usetable) |
|
int | ec_config_map (void *pIOmap) |
|
int | ec_config_map_group (void *pIOmap, uint8 group) |
|
int | ec_config_overlap (uint8 usetable, void *pIOmap) |
|
int | ec_config_overlap_map (void *pIOmap) |
|
int | ec_config_overlap_map_group (void *pIOmap, uint8 group) |
|
int | ec_findconfig (uint32 man, uint32 id) |
|
int | ec_reconfig_slave (uint16 slave, int timeout) |
|
int | ec_recover_slave (uint16 slave, int timeout) |
|
static void | ecx_config_create_input_mappings (ecx_contextt *context, void *pIOmap, uint8 group, int16 slave, uint32 *LogAddr, uint8 *BitPos) |
|
static void | ecx_config_create_output_mappings (ecx_contextt *context, void *pIOmap, uint8 group, int16 slave, uint32 *LogAddr, uint8 *BitPos) |
|
static void | ecx_config_find_mappings (ecx_contextt *context, uint8 group) |
|
static int | ecx_config_from_table (ecx_contextt *context, uint16 slave) |
|
int | ecx_config_init (ecx_contextt *context, uint8 usetable) |
|
int | ecx_config_map_group (ecx_contextt *context, void *pIOmap, uint8 group) |
|
int | ecx_config_overlap_map_group (ecx_contextt *context, void *pIOmap, uint8 group) |
|
int | ecx_detect_slaves (ecx_contextt *context) |
|
static int | ecx_get_threadcount (void) |
|
void | ecx_init_context (ecx_contextt *context) |
|
static int | ecx_lookup_mapping (ecx_contextt *context, uint16 slave, int *Osize, int *Isize) |
|
static int | ecx_lookup_prev_sii (ecx_contextt *context, uint16 slave) |
|
static int | ecx_map_coe_soe (ecx_contextt *context, uint16 slave, int thread_n) |
|
static int | ecx_map_sii (ecx_contextt *context, uint16 slave) |
|
static int | ecx_map_sm (ecx_contextt *context, uint16 slave) |
|
int | ecx_reconfig_slave (ecx_contextt *context, uint16 slave, int timeout) |
|
int | ecx_recover_slave (ecx_contextt *context, uint16 slave, int timeout) |
|
static void | ecx_set_slaves_to_default (ecx_contextt *context) |
|
Configuration module for EtherCAT master.
After successful initialisation with ec_init() or ec_init_redundant() the slaves can be auto configured with this module.
Definition in file ethercatconfig.c.
◆ EC_DEFAULTDOSM0
#define EC_DEFAULTDOSM0 0x00010044 |
standard SM0 flags configuration for digital output slaves
Definition at line 77 of file ethercatconfig.c.
◆ EC_DEFAULTMBXSM0
#define EC_DEFAULTMBXSM0 0x00010026 |
standard SM0 flags configuration for mailbox slaves
Definition at line 73 of file ethercatconfig.c.
◆ EC_DEFAULTMBXSM1
#define EC_DEFAULTMBXSM1 0x00010022 |
standard SM1 flags configuration for mailbox slaves
Definition at line 75 of file ethercatconfig.c.
◆ ec_config()
int ec_config |
( |
uint8 |
usetable, |
|
|
void * |
pIOmap |
|
) |
| |
Enumerate / map and init all slaves.
- Parameters
-
[in] | usetable | = TRUE when using configtable to init slaves, FALSE otherwise |
[out] | pIOmap | = pointer to IOmap |
- Returns
- Workcounter of slave discover datagram = number of slaves found
Definition at line 1665 of file ethercatconfig.c.
◆ ec_config_init()
int ec_config_init |
( |
uint8 |
usetable | ) |
|
Enumerate and init all slaves.
- Parameters
-
[in] | usetable | = TRUE when using configtable to init slaves, FALSE otherwise |
- Returns
- Workcounter of slave discover datagram = number of slaves found
- See also
- ecx_config_init
Definition at line 1606 of file ethercatconfig.c.
◆ ec_config_map()
int ec_config_map |
( |
void * |
pIOmap | ) |
|
Map all PDOs from slaves to IOmap with Outputs/Inputs in sequential order (legacy SOEM way).
- Parameters
-
[out] | pIOmap | = pointer to IOmap |
- Returns
- IOmap size
Definition at line 1643 of file ethercatconfig.c.
◆ ec_config_map_group()
int ec_config_map_group |
( |
void * |
pIOmap, |
|
|
uint8 |
group |
|
) |
| |
Map all PDOs in one group of slaves to IOmap with Outputs/Inputs in sequential order (legacy SOEM way).
- Parameters
-
[out] | pIOmap | = pointer to IOmap |
[in] | group | = group to map, 0 = all groups |
- Returns
- IOmap size
- See also
- ecx_config_map_group
Definition at line 1619 of file ethercatconfig.c.
◆ ec_config_overlap()
int ec_config_overlap |
( |
uint8 |
usetable, |
|
|
void * |
pIOmap |
|
) |
| |
Enumerate / map and init all slaves.
- Parameters
-
[in] | usetable | = TRUE when using configtable to init slaves, FALSE otherwise |
[out] | pIOmap | = pointer to IOmap |
- Returns
- Workcounter of slave discover datagram = number of slaves found
Definition at line 1682 of file ethercatconfig.c.
◆ ec_config_overlap_map()
int ec_config_overlap_map |
( |
void * |
pIOmap | ) |
|
Map all PDOs from slaves to IOmap with Outputs/Inputs overlapping. NOTE: Must use this for TI ESC when using LRW.
- Parameters
-
[out] | pIOmap | = pointer to IOmap |
- Returns
- IOmap size
Definition at line 1654 of file ethercatconfig.c.
◆ ec_config_overlap_map_group()
int ec_config_overlap_map_group |
( |
void * |
pIOmap, |
|
|
uint8 |
group |
|
) |
| |
Map all PDOs in one group of slaves to IOmap with Outputs/Inputs overlapping. NOTE: Must use this for TI ESC when using LRW.
- Parameters
-
[out] | pIOmap | = pointer to IOmap |
[in] | group | = group to map, 0 = all groups |
- Returns
- IOmap size
- See also
- ecx_config_overlap_map_group
Definition at line 1632 of file ethercatconfig.c.
◆ ec_findconfig()
Find slave in standard configuration list ec_configlist[]
- Parameters
-
[in] | man | = manufacturer |
[in] | id | = ID |
- Returns
- index in ec_configlist[] when found, otherwise 0
Definition at line 86 of file ethercatconfig.c.
◆ ec_reconfig_slave()
int ec_reconfig_slave |
( |
uint16 |
slave, |
|
|
int |
timeout |
|
) |
| |
Reconfigure slave.
- Parameters
-
[in] | slave | = slave to reconfigure |
[in] | timeout | = local timeout f.e. EC_TIMEOUTRET3 |
- Returns
- Slave state
- See also
- ecx_reconfig_slave
Definition at line 1712 of file ethercatconfig.c.
◆ ec_recover_slave()
int ec_recover_slave |
( |
uint16 |
slave, |
|
|
int |
timeout |
|
) |
| |
Recover slave.
- Parameters
-
[in] | slave | = slave to recover |
[in] | timeout | = local timeout f.e. EC_TIMEOUTRET3 |
- Returns
- >0 if successful
- See also
- ecx_recover_slave
Definition at line 1700 of file ethercatconfig.c.
◆ ecx_config_create_input_mappings()
◆ ecx_config_create_output_mappings()
◆ ecx_config_find_mappings()
◆ ecx_config_from_table()
◆ ecx_config_init()
Enumerate and init all slaves.
- Parameters
-
[in] | context | = context struct |
[in] | usetable | = TRUE when using configtable to init slaves, FALSE otherwise |
- Returns
- Workcounter of slave discover datagram = number of slaves found
Definition at line 308 of file ethercatconfig.c.
◆ ecx_config_map_group()
Map all PDOs in one group of slaves to IOmap with Outputs/Inputs in sequential order (legacy SOEM way).
- Parameters
-
[in] | context | = context struct |
[out] | pIOmap | = pointer to IOmap |
[in] | group | = group to map, 0 = all groups |
- Returns
- IOmap size
Definition at line 1172 of file ethercatconfig.c.
◆ ecx_config_overlap_map_group()
int ecx_config_overlap_map_group |
( |
ecx_contextt * |
context, |
|
|
void * |
pIOmap, |
|
|
uint8 |
group |
|
) |
| |
Map all PDOs in one group of slaves to IOmap with Outputs/Inputs overlapping. NOTE: Must use this for TI ESC when using LRW.
- Parameters
-
[in] | context | = context struct |
[out] | pIOmap | = pointer to IOmap |
[in] | group | = group to map, 0 = all groups |
- Returns
- IOmap size
Definition at line 1350 of file ethercatconfig.c.
◆ ecx_detect_slaves()
◆ ecx_get_threadcount()
static int ecx_get_threadcount |
( |
void |
| ) |
|
|
static |
◆ ecx_init_context()
◆ ecx_lookup_mapping()
static int ecx_lookup_mapping |
( |
ecx_contextt * |
context, |
|
|
uint16 |
slave, |
|
|
int * |
Osize, |
|
|
int * |
Isize |
|
) |
| |
|
static |
◆ ecx_lookup_prev_sii()
◆ ecx_map_coe_soe()
◆ ecx_map_sii()
◆ ecx_map_sm()
◆ ecx_reconfig_slave()
Reconfigure slave.
- Parameters
-
[in] | context | = context struct |
[in] | slave | = slave to reconfigure |
[in] | timeout | = local timeout f.e. EC_TIMEOUTRET3 |
- Returns
- Slave state
Definition at line 1551 of file ethercatconfig.c.
◆ ecx_recover_slave()
Recover slave.
- Parameters
-
[in] | context | = context struct |
[in] | slave | = slave to recover |
[in] | timeout | = local timeout f.e. EC_TIMEOUTRET3 |
- Returns
- >0 if successful
Definition at line 1488 of file ethercatconfig.c.
◆ ecx_set_slaves_to_default()
static void ecx_set_slaves_to_default |
( |
ecx_contextt * |
context | ) |
|
|
static |
◆ ecx_mapt