Lines Matching refs:desc
160 static bool xlnx_dpdma_desc_is_last(DPDMADescriptor *desc) in xlnx_dpdma_desc_is_last() argument
162 return ((desc->control & DSCR_CTRL_LAST_DESCRIPTOR) != 0); in xlnx_dpdma_desc_is_last()
165 static bool xlnx_dpdma_desc_is_last_of_frame(DPDMADescriptor *desc) in xlnx_dpdma_desc_is_last_of_frame() argument
167 return ((desc->control & DSCR_CTRL_LAST_DESCRIPTOR_OF_FRAME) != 0); in xlnx_dpdma_desc_is_last_of_frame()
170 static uint64_t xlnx_dpdma_desc_get_source_address(DPDMADescriptor *desc, in xlnx_dpdma_desc_get_source_address() argument
178 addr = (uint64_t)desc->source_address in xlnx_dpdma_desc_get_source_address()
179 + (extract64(desc->address_extension, 16, 16) << 32); in xlnx_dpdma_desc_get_source_address()
182 addr = (uint64_t)desc->source_address2 in xlnx_dpdma_desc_get_source_address()
183 + (extract64(desc->address_extension_23, 0, 16) << 32); in xlnx_dpdma_desc_get_source_address()
186 addr = (uint64_t)desc->source_address3 in xlnx_dpdma_desc_get_source_address()
187 + (extract64(desc->address_extension_23, 16, 16) << 32); in xlnx_dpdma_desc_get_source_address()
190 addr = (uint64_t)desc->source_address4 in xlnx_dpdma_desc_get_source_address()
191 + (extract64(desc->address_extension_45, 0, 16) << 32); in xlnx_dpdma_desc_get_source_address()
194 addr = (uint64_t)desc->source_address5 in xlnx_dpdma_desc_get_source_address()
195 + (extract64(desc->address_extension_45, 16, 16) << 32); in xlnx_dpdma_desc_get_source_address()
205 static uint32_t xlnx_dpdma_desc_get_transfer_size(DPDMADescriptor *desc) in xlnx_dpdma_desc_get_transfer_size() argument
207 return desc->xfer_size; in xlnx_dpdma_desc_get_transfer_size()
210 static uint32_t xlnx_dpdma_desc_get_line_size(DPDMADescriptor *desc) in xlnx_dpdma_desc_get_line_size() argument
212 return extract32(desc->line_size_stride, 0, 18); in xlnx_dpdma_desc_get_line_size()
215 static uint32_t xlnx_dpdma_desc_get_line_stride(DPDMADescriptor *desc) in xlnx_dpdma_desc_get_line_stride() argument
217 return extract32(desc->line_size_stride, 18, 14) * 16; in xlnx_dpdma_desc_get_line_stride()
220 static inline bool xlnx_dpdma_desc_crc_enabled(DPDMADescriptor *desc) in xlnx_dpdma_desc_crc_enabled() argument
222 return (desc->control & DSCR_CTRL_ENABLE_CRC) != 0; in xlnx_dpdma_desc_crc_enabled()
225 static inline bool xlnx_dpdma_desc_check_crc(DPDMADescriptor *desc) in xlnx_dpdma_desc_check_crc() argument
227 uint32_t *p = (uint32_t *)desc; in xlnx_dpdma_desc_check_crc()
239 return crc == desc->crc; in xlnx_dpdma_desc_check_crc()
242 static inline bool xlnx_dpdma_desc_completion_interrupt(DPDMADescriptor *desc) in xlnx_dpdma_desc_completion_interrupt() argument
244 return (desc->control & DSCR_CTRL_EN_DSCR_DONE_INTR) != 0; in xlnx_dpdma_desc_completion_interrupt()
247 static inline bool xlnx_dpdma_desc_is_valid(DPDMADescriptor *desc) in xlnx_dpdma_desc_is_valid() argument
249 return (desc->control & DSCR_CTRL_PREAMBLE) == CONTROL_PREAMBLE_VALUE; in xlnx_dpdma_desc_is_valid()
252 static inline bool xlnx_dpdma_desc_is_contiguous(DPDMADescriptor *desc) in xlnx_dpdma_desc_is_contiguous() argument
254 return (desc->control & DSCR_CTRL_DESCRIPTOR_MODE) == 0; in xlnx_dpdma_desc_is_contiguous()
257 static inline bool xlnx_dpdma_desc_update_enabled(DPDMADescriptor *desc) in xlnx_dpdma_desc_update_enabled() argument
259 return (desc->control & DSCR_CTRL_EN_DSCR_UPDATE) != 0; in xlnx_dpdma_desc_update_enabled()
262 static inline void xlnx_dpdma_desc_set_done(DPDMADescriptor *desc) in xlnx_dpdma_desc_set_done() argument
264 desc->timestamp_msb |= STATUS_DONE; in xlnx_dpdma_desc_set_done()
267 static inline bool xlnx_dpdma_desc_is_already_done(DPDMADescriptor *desc) in xlnx_dpdma_desc_is_already_done() argument
269 return (desc->timestamp_msb & STATUS_DONE) != 0; in xlnx_dpdma_desc_is_already_done()
272 static inline bool xlnx_dpdma_desc_ignore_done_bit(DPDMADescriptor *desc) in xlnx_dpdma_desc_ignore_done_bit() argument
274 return (desc->control & DSCR_CTRL_IGNORE_DONE) != 0; in xlnx_dpdma_desc_ignore_done_bit()
340 DPDMADescriptor *desc) in xlnx_dpdma_update_desc_info() argument
343 extract32(desc->address_extension, 0, 16); in xlnx_dpdma_update_desc_info()
344 s->registers[DPDMA_DSCR_NEXT_ADDR_CH(channel)] = desc->next_descriptor; in xlnx_dpdma_update_desc_info()
346 extract32(desc->address_extension, 16, 16); in xlnx_dpdma_update_desc_info()
347 s->registers[DPDMA_PYLD_CUR_ADDR_CH(channel)] = desc->source_address; in xlnx_dpdma_update_desc_info()
349 extract32(desc->line_size_stride, 18, 14) in xlnx_dpdma_update_desc_info()
350 + (extract32(desc->line_size_stride, 0, 18) in xlnx_dpdma_update_desc_info()
352 s->registers[DPDMA_PYLD_SZ_CH(channel)] = desc->xfer_size; in xlnx_dpdma_update_desc_info()
353 s->registers[DPDMA_DSCR_ID_CH(channel)] = desc->descriptor_id; in xlnx_dpdma_update_desc_info()
357 extract32(desc->control, 0, 8) << 13; in xlnx_dpdma_update_desc_info()
358 if ((desc->control & DSCR_CTRL_EN_DSCR_DONE_INTR) != 0) { in xlnx_dpdma_update_desc_info()
361 if ((desc->control & DSCR_CTRL_EN_DSCR_UPDATE) != 0) { in xlnx_dpdma_update_desc_info()
364 if ((desc->timestamp_msb & STATUS_DONE) != 0) { in xlnx_dpdma_update_desc_info()
367 if ((desc->control & DSCR_CTRL_IGNORE_DONE) != 0) { in xlnx_dpdma_update_desc_info()
370 if ((desc->control & DSCR_CTRL_LAST_DESCRIPTOR_OF_FRAME) != 0) { in xlnx_dpdma_update_desc_info()
373 if ((desc->control & DSCR_CTRL_LAST_DESCRIPTOR) != 0) { in xlnx_dpdma_update_desc_info()
376 if ((desc->control & DSCR_CTRL_ENABLE_CRC) != 0) { in xlnx_dpdma_update_desc_info()
379 if ((desc->control & DSCR_CTRL_DESCRIPTOR_MODE) != 0) { in xlnx_dpdma_update_desc_info()
382 if ((desc->control & DSCR_CTRL_AXI_BURST_TYPE) != 0) { in xlnx_dpdma_update_desc_info()
387 static void xlnx_dpdma_dump_descriptor(DPDMADescriptor *desc) in xlnx_dpdma_dump_descriptor() argument
391 qemu_hexdump(stdout, "", desc, sizeof(DPDMADescriptor)); in xlnx_dpdma_dump_descriptor()
619 DPDMADescriptor *desc) in xlnx_dpdma_read_descriptor() argument
622 desc, sizeof(DPDMADescriptor), in xlnx_dpdma_read_descriptor()
629 desc->control = le32_to_cpu(desc->control); in xlnx_dpdma_read_descriptor()
630 desc->descriptor_id = le32_to_cpu(desc->descriptor_id); in xlnx_dpdma_read_descriptor()
631 desc->xfer_size = le32_to_cpu(desc->xfer_size); in xlnx_dpdma_read_descriptor()
632 desc->line_size_stride = le32_to_cpu(desc->line_size_stride); in xlnx_dpdma_read_descriptor()
633 desc->timestamp_lsb = le32_to_cpu(desc->timestamp_lsb); in xlnx_dpdma_read_descriptor()
634 desc->timestamp_msb = le32_to_cpu(desc->timestamp_msb); in xlnx_dpdma_read_descriptor()
635 desc->address_extension = le32_to_cpu(desc->address_extension); in xlnx_dpdma_read_descriptor()
636 desc->next_descriptor = le32_to_cpu(desc->next_descriptor); in xlnx_dpdma_read_descriptor()
637 desc->source_address = le32_to_cpu(desc->source_address); in xlnx_dpdma_read_descriptor()
638 desc->address_extension_23 = le32_to_cpu(desc->address_extension_23); in xlnx_dpdma_read_descriptor()
639 desc->address_extension_45 = le32_to_cpu(desc->address_extension_45); in xlnx_dpdma_read_descriptor()
640 desc->source_address2 = le32_to_cpu(desc->source_address2); in xlnx_dpdma_read_descriptor()
641 desc->source_address3 = le32_to_cpu(desc->source_address3); in xlnx_dpdma_read_descriptor()
642 desc->source_address4 = le32_to_cpu(desc->source_address4); in xlnx_dpdma_read_descriptor()
643 desc->source_address5 = le32_to_cpu(desc->source_address5); in xlnx_dpdma_read_descriptor()
644 desc->crc = le32_to_cpu(desc->crc); in xlnx_dpdma_read_descriptor()
650 DPDMADescriptor *desc) in xlnx_dpdma_write_descriptor() argument
652 DPDMADescriptor tmp_desc = *desc; in xlnx_dpdma_write_descriptor()
681 DPDMADescriptor desc; in xlnx_dpdma_start_operation() local
713 if (xlnx_dpdma_read_descriptor(s, desc_addr, &desc)) { in xlnx_dpdma_start_operation()
721 xlnx_dpdma_update_desc_info(s, channel, &desc); in xlnx_dpdma_start_operation()
724 xlnx_dpdma_dump_descriptor(&desc); in xlnx_dpdma_start_operation()
728 if (!xlnx_dpdma_desc_is_valid(&desc)) { in xlnx_dpdma_start_operation()
736 if (xlnx_dpdma_desc_crc_enabled(&desc) in xlnx_dpdma_start_operation()
737 && !xlnx_dpdma_desc_check_crc(&desc)) { in xlnx_dpdma_start_operation()
745 if (xlnx_dpdma_desc_is_already_done(&desc) in xlnx_dpdma_start_operation()
746 && !xlnx_dpdma_desc_ignore_done_bit(&desc)) { in xlnx_dpdma_start_operation()
755 done = xlnx_dpdma_desc_is_last(&desc) in xlnx_dpdma_start_operation()
756 || xlnx_dpdma_desc_is_last_of_frame(&desc); in xlnx_dpdma_start_operation()
760 int64_t transfer_len = xlnx_dpdma_desc_get_transfer_size(&desc); in xlnx_dpdma_start_operation()
761 uint32_t line_size = xlnx_dpdma_desc_get_line_size(&desc); in xlnx_dpdma_start_operation()
762 uint32_t line_stride = xlnx_dpdma_desc_get_line_stride(&desc); in xlnx_dpdma_start_operation()
763 if (xlnx_dpdma_desc_is_contiguous(&desc)) { in xlnx_dpdma_start_operation()
764 source_addr[0] = xlnx_dpdma_desc_get_source_address(&desc, 0); in xlnx_dpdma_start_operation()
785 xlnx_dpdma_desc_get_source_address(&desc, frag); in xlnx_dpdma_start_operation()
812 if (xlnx_dpdma_desc_update_enabled(&desc)) { in xlnx_dpdma_start_operation()
815 xlnx_dpdma_desc_set_done(&desc); in xlnx_dpdma_start_operation()
816 if (xlnx_dpdma_write_descriptor(desc_addr, &desc)) { in xlnx_dpdma_start_operation()
822 if (xlnx_dpdma_desc_completion_interrupt(&desc)) { in xlnx_dpdma_start_operation()