78 { |
78 { |
79 ec_datagram_t *datagram, *next; |
79 ec_datagram_t *datagram, *next; |
80 |
80 |
81 // dequeue and free datagrams |
81 // dequeue and free datagrams |
82 list_for_each_entry_safe(datagram, next, &domain->datagrams, list) { |
82 list_for_each_entry_safe(datagram, next, &domain->datagrams, list) { |
83 if (!list_empty(&datagram->queue)) // datagram queued? |
|
84 list_del(&datagram->queue); |
|
85 ec_datagram_clear(datagram); |
83 ec_datagram_clear(datagram); |
86 kfree(datagram); |
84 kfree(datagram); |
87 } |
85 } |
88 |
86 |
89 ec_domain_clear_data(domain); |
87 ec_domain_clear_data(domain); |
116 |
114 |
117 domain->data_size += fmmu->data_size; |
115 domain->data_size += fmmu->data_size; |
118 list_add_tail(&fmmu->list, &domain->fmmu_configs); |
116 list_add_tail(&fmmu->list, &domain->fmmu_configs); |
119 |
117 |
120 if (domain->master->debug_level) |
118 if (domain->master->debug_level) |
121 EC_DBG("Domain %u: Added %u bytes, total %u.\n", domain->index, |
119 EC_DBG("Domain %u: Added %u bytes, total %zu.\n", domain->index, |
122 fmmu->data_size, domain->data_size); |
120 fmmu->data_size, domain->data_size); |
123 } |
121 } |
124 |
122 |
125 /*****************************************************************************/ |
123 /*****************************************************************************/ |
126 |
124 |
211 domain->logical_base_address = base_address; |
209 domain->logical_base_address = base_address; |
212 |
210 |
213 if (domain->data_size && domain->data_origin == EC_ORIG_INTERNAL) { |
211 if (domain->data_size && domain->data_origin == EC_ORIG_INTERNAL) { |
214 if (!(domain->data = |
212 if (!(domain->data = |
215 (uint8_t *) kmalloc(domain->data_size, GFP_KERNEL))) { |
213 (uint8_t *) kmalloc(domain->data_size, GFP_KERNEL))) { |
216 EC_ERR("Failed to allocate %u bytes internal memory for" |
214 EC_ERR("Failed to allocate %zu bytes internal memory for" |
217 " domain %u!\n", domain->data_size, domain->index); |
215 " domain %u!\n", domain->data_size, domain->index); |
218 return -ENOMEM; |
216 return -ENOMEM; |
219 } |
217 } |
220 } |
218 } |
221 |
219 |
265 if (ret < 0) |
263 if (ret < 0) |
266 return ret; |
264 return ret; |
267 datagram_count++; |
265 datagram_count++; |
268 } |
266 } |
269 |
267 |
270 EC_INFO("Domain%u: Logical address 0x%08x, %u byte, " |
268 EC_INFO("Domain%u: Logical address 0x%08x, %zu byte, " |
271 "expected working counter %u.\n", domain->index, |
269 "expected working counter %u.\n", domain->index, |
272 domain->logical_base_address, domain->data_size, |
270 domain->logical_base_address, domain->data_size, |
273 domain->expected_working_counter); |
271 domain->expected_working_counter); |
274 list_for_each_entry(datagram, &domain->datagrams, list) { |
272 list_for_each_entry(datagram, &domain->datagrams, list) { |
275 EC_INFO(" Datagram %s: Logical offset 0x%08x, %u byte, type %s.\n", |
273 EC_INFO(" Datagram %s: Logical offset 0x%08x, %zu byte, type %s.\n", |
276 datagram->name, EC_READ_U32(datagram->address), |
274 datagram->name, EC_READ_U32(datagram->address), |
277 datagram->data_size, ec_datagram_type_string(datagram)); |
275 datagram->data_size, ec_datagram_type_string(datagram)); |
278 } |
276 } |
279 |
277 |
280 return 0; |
278 return 0; |
326 const ec_pdo_entry_reg_t *reg; |
324 const ec_pdo_entry_reg_t *reg; |
327 ec_slave_config_t *sc; |
325 ec_slave_config_t *sc; |
328 int ret; |
326 int ret; |
329 |
327 |
330 if (domain->master->debug_level) |
328 if (domain->master->debug_level) |
331 EC_DBG("ecrt_domain_reg_pdo_entry_list(domain = 0x%x, regs = 0x%x)\n", |
329 EC_DBG("ecrt_domain_reg_pdo_entry_list(domain = 0x%p, regs = 0x%p)\n", |
332 (u32) domain, (u32) regs); |
330 domain, regs); |
333 |
331 |
334 for (reg = regs; reg->index; reg++) { |
332 for (reg = regs; reg->index; reg++) { |
335 sc = ecrt_master_slave_config_err(domain->master, reg->alias, |
333 sc = ecrt_master_slave_config_err(domain->master, reg->alias, |
336 reg->position, reg->vendor_id, reg->product_code); |
334 reg->position, reg->vendor_id, reg->product_code); |
337 if (IS_ERR(sc)) |
335 if (IS_ERR(sc)) |
358 /*****************************************************************************/ |
356 /*****************************************************************************/ |
359 |
357 |
360 void ecrt_domain_external_memory(ec_domain_t *domain, uint8_t *mem) |
358 void ecrt_domain_external_memory(ec_domain_t *domain, uint8_t *mem) |
361 { |
359 { |
362 if (domain->master->debug_level) |
360 if (domain->master->debug_level) |
363 EC_DBG("ecrt_domain_external_memory(domain = 0x%x, mem = 0x%x)\n", |
361 EC_DBG("ecrt_domain_external_memory(domain = 0x%p, mem = 0x%p)\n", |
364 (u32) domain, (u32) mem); |
362 domain, mem); |
365 |
363 |
366 down(&domain->master->master_sem); |
364 down(&domain->master->master_sem); |
367 |
365 |
368 ec_domain_clear_data(domain); |
366 ec_domain_clear_data(domain); |
369 |
367 |