00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00035
00036
00037 #ifndef __EC_SLAVE_CONFIG_H__
00038 #define __EC_SLAVE_CONFIG_H__
00039
00040 #include <linux/list.h>
00041
00042 #include "globals.h"
00043 #include "slave.h"
00044 #include "sync_config.h"
00045 #include "fmmu_config.h"
00046 #include "coe_emerg_ring.h"
00047
00048
00049
00061 #define EC_CONFIG_INFO(sc, fmt, args...) \
00062 printk(KERN_INFO "EtherCAT %u %u:%u: " fmt, sc->master->index, \
00063 sc->alias, sc->position, ##args)
00064
00075 #define EC_CONFIG_ERR(sc, fmt, args...) \
00076 printk(KERN_ERR "EtherCAT ERROR %u %u:%u: " fmt, sc->master->index, \
00077 sc->alias, sc->position, ##args)
00078
00089 #define EC_CONFIG_WARN(sc, fmt, args...) \
00090 printk(KERN_WARNING "EtherCAT WARNING %u %u:%u: " fmt, \
00091 sc->master->index, sc->alias, sc->position, ##args)
00092
00106 #define EC_CONFIG_DBG(sc, level, fmt, args...) \
00107 do { \
00108 if (sc->master->debug_level >= level) { \
00109 printk(KERN_DEBUG "EtherCAT DEBUG %u %u:%u: " fmt, \
00110 sc->master->index, sc->alias, sc->position, ##args); \
00111 } \
00112 } while (0)
00113
00114
00115
00118 struct ec_slave_config {
00119 struct list_head list;
00120 ec_master_t *master;
00122 uint16_t alias;
00123 uint16_t position;
00125 uint32_t vendor_id;
00126 uint32_t product_code;
00128 uint16_t watchdog_divider;
00130 uint16_t watchdog_intervals;
00133 ec_slave_t *slave;
00136 ec_sync_config_t sync_configs[EC_MAX_SYNC_MANAGERS];
00138 ec_fmmu_config_t fmmu_configs[EC_MAX_FMMUS];
00139 uint8_t used_fmmus;
00140 uint16_t dc_assign_activate;
00141 ec_sync_signal_t dc_sync[EC_SYNC_SIGNAL_COUNT];
00143 struct list_head sdo_configs;
00144 struct list_head sdo_requests;
00145 struct list_head voe_handlers;
00146 struct list_head reg_requests;
00147 struct list_head soe_configs;
00149 ec_coe_emerg_ring_t emerg_ring;
00150 };
00151
00152
00153
00154 void ec_slave_config_init(ec_slave_config_t *, ec_master_t *, uint16_t,
00155 uint16_t, uint32_t, uint32_t);
00156 void ec_slave_config_clear(ec_slave_config_t *);
00157
00158 int ec_slave_config_attach(ec_slave_config_t *);
00159 void ec_slave_config_detach(ec_slave_config_t *);
00160
00161 void ec_slave_config_load_default_sync_config(ec_slave_config_t *);
00162
00163 unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *);
00164 const ec_sdo_request_t *ec_slave_config_get_sdo_by_pos_const(
00165 const ec_slave_config_t *, unsigned int);
00166 unsigned int ec_slave_config_idn_count(const ec_slave_config_t *);
00167 const ec_soe_request_t *ec_slave_config_get_idn_by_pos_const(
00168 const ec_slave_config_t *, unsigned int);
00169 ec_sdo_request_t *ec_slave_config_find_sdo_request(ec_slave_config_t *,
00170 unsigned int);
00171 ec_reg_request_t *ec_slave_config_find_reg_request(ec_slave_config_t *,
00172 unsigned int);
00173 ec_voe_handler_t *ec_slave_config_find_voe_handler(ec_slave_config_t *,
00174 unsigned int);
00175
00176 ec_sdo_request_t *ecrt_slave_config_create_sdo_request_err(
00177 ec_slave_config_t *, uint16_t, uint8_t, size_t);
00178 ec_voe_handler_t *ecrt_slave_config_create_voe_handler_err(
00179 ec_slave_config_t *, size_t);
00180 ec_reg_request_t *ecrt_slave_config_create_reg_request_err(
00181 ec_slave_config_t *, size_t);
00182
00183
00184
00185 #endif