100 \return 0 in case of success, else < 0 |
100 \return 0 in case of success, else < 0 |
101 */ |
101 */ |
102 |
102 |
103 int ec_master_init(ec_master_t *master, /**< EtherCAT master */ |
103 int ec_master_init(ec_master_t *master, /**< EtherCAT master */ |
104 unsigned int index, /**< master index */ |
104 unsigned int index, /**< master index */ |
|
105 const ec_device_id_t *main_id, /**< ID of main device */ |
|
106 const ec_device_id_t *backup_id, /**< ID of main device */ |
105 unsigned int eoeif_count /**< number of EoE interfaces */ |
107 unsigned int eoeif_count /**< number of EoE interfaces */ |
106 ) |
108 ) |
107 { |
109 { |
108 ec_eoe_t *eoe, *next_eoe; |
110 ec_eoe_t *eoe, *next_eoe; |
109 unsigned int i; |
111 unsigned int i; |
110 |
112 |
111 EC_INFO("Initializing master %i.\n", index); |
|
112 |
|
113 atomic_set(&master->available, 1); |
113 atomic_set(&master->available, 1); |
114 master->index = index; |
114 master->index = index; |
115 |
115 |
116 master->device = NULL; |
116 master->device = NULL; |
|
117 master->main_device_id = main_id; |
|
118 master->backup_device_id = backup_id; |
117 init_MUTEX(&master->device_sem); |
119 init_MUTEX(&master->device_sem); |
118 |
120 |
119 master->mode = EC_MASTER_MODE_ORPHANED; |
121 master->mode = EC_MASTER_MODE_ORPHANED; |
120 |
122 |
121 INIT_LIST_HEAD(&master->slaves); |
123 INIT_LIST_HEAD(&master->slaves); |