equal
deleted
inserted
replaced
164 { |
164 { |
165 unsigned int i; |
165 unsigned int i; |
166 ec_fmmu_config_t *fmmu; |
166 ec_fmmu_config_t *fmmu; |
167 ec_fmmu_config_t *prev_fmmu; |
167 ec_fmmu_config_t *prev_fmmu; |
168 uint32_t fmmu_logical_start_address; |
168 uint32_t fmmu_logical_start_address; |
169 size_t tx_size; |
169 size_t tx_size, old_prev_tx_size; |
170 |
170 |
171 // FMMU configuration already prepared? |
171 // FMMU configuration already prepared? |
172 for (i = 0; i < sc->used_fmmus; i++) { |
172 for (i = 0; i < sc->used_fmmus; i++) { |
173 fmmu = &sc->fmmu_configs[i]; |
173 fmmu = &sc->fmmu_configs[i]; |
174 if (fmmu->domain == domain && fmmu->sync_index == sync_index) |
174 if (fmmu->domain == domain && fmmu->sync_index == sync_index) |
189 if (sc->allow_overlapping_pdos && sc->used_fmmus > 0) { |
189 if (sc->allow_overlapping_pdos && sc->used_fmmus > 0) { |
190 prev_fmmu = &sc->fmmu_configs[sc->used_fmmus-1]; |
190 prev_fmmu = &sc->fmmu_configs[sc->used_fmmus-1]; |
191 if (fmmu->dir != prev_fmmu->dir && prev_fmmu->tx_size != 0) { |
191 if (fmmu->dir != prev_fmmu->dir && prev_fmmu->tx_size != 0) { |
192 // prev fmmu has opposite direction |
192 // prev fmmu has opposite direction |
193 // and is not already paired with prev-prev fmmu |
193 // and is not already paired with prev-prev fmmu |
|
194 old_prev_tx_size = prev_fmmu->tx_size; |
194 prev_fmmu->tx_size = max(fmmu->data_size,prev_fmmu->data_size); |
195 prev_fmmu->tx_size = max(fmmu->data_size,prev_fmmu->data_size); |
|
196 domain->tx_size += prev_fmmu->tx_size - old_prev_tx_size; |
195 tx_size = 0; |
197 tx_size = 0; |
196 fmmu_logical_start_address = prev_fmmu->logical_start_address; |
198 fmmu_logical_start_address = prev_fmmu->logical_start_address; |
197 } |
199 } |
198 } |
200 } |
199 ec_fmmu_config_domain(fmmu,domain,fmmu_logical_start_address,tx_size); |
201 ec_fmmu_config_domain(fmmu,domain,fmmu_logical_start_address,tx_size); |
709 const ec_sync_config_t *sync_config; |
711 const ec_sync_config_t *sync_config; |
710 unsigned int bit_offset, bit_pos; |
712 unsigned int bit_offset, bit_pos; |
711 ec_pdo_t *pdo; |
713 ec_pdo_t *pdo; |
712 ec_pdo_entry_t *entry; |
714 ec_pdo_entry_t *entry; |
713 int sync_offset; |
715 int sync_offset; |
714 |
|
715 EC_CONFIG_DBG(sc, 1, "%s(sc = 0x%p, index = 0x%04X, " |
|
716 "subindex = 0x%02X, domain = 0x%p, bit_position = 0x%p)\n", |
|
717 __func__, sc, index, subindex, domain, bit_position); |
|
718 |
716 |
719 for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++) { |
717 for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++) { |
720 sync_config = &sc->sync_configs[sync_index]; |
718 sync_config = &sc->sync_configs[sync_index]; |
721 bit_offset = 0; |
719 bit_offset = 0; |
722 |
720 |
737 sync_offset = ec_slave_config_prepare_fmmu( |
735 sync_offset = ec_slave_config_prepare_fmmu( |
738 sc, domain, sync_index, sync_config->dir); |
736 sc, domain, sync_index, sync_config->dir); |
739 if (sync_offset < 0) |
737 if (sync_offset < 0) |
740 return sync_offset; |
738 return sync_offset; |
741 |
739 |
742 return sync_offset + bit_offset / 8; |
740 EC_CONFIG_DBG(sc, 1, "%s(index = 0x%04X, " |
|
741 "subindex = 0x%02X, domain = %u, bytepos=%u, bitpos=%u)\n", |
|
742 __func__,index, subindex, |
|
743 domain->index, sync_offset + bit_offset / 8, bit_pos); |
|
744 return sync_offset + bit_offset / 8; |
743 } |
745 } |
744 } |
746 } |
745 } |
747 } |
746 } |
748 } |
747 |
749 |