Пример #1
0
struct transfer_record *
list_transfers(dma_instruction *program)
{
	struct transfer_record *false_head, *true_head, *tail;
        false_head = malloc(sizeof(struct transfer_record));
	false_head->next = NULL;
	tail = false_head;

	struct dma_thread thread;
	thread.dmat_program_counter =
		thread.dmat_external_program_counter = program;
	// Use 0 because we are interested in relative offsets.
	thread.dmat_source = thread.dmat_external_source = 0;
	thread.dmat_destination = thread.dmat_external_destination = 0;
	thread.dmat_state = DMAM_RUNNING;

	while (thread.dmat_state != DMAM_STOPPED) {
		dma_execute_instruction(&thread, record_transfer, tail);
		if (tail->next != NULL) {
			tail = tail->next;
		}
	}

	true_head = false_head->next;
	free(false_head);

	return true_head;
}
Пример #2
0
static bool inline dma_start_thread(uint8_t thread_id, uint8_t* program_addr)
{
    uint8_t go_instr[] = { DMAGO(thread_id, ns, program_addr) };

    dma_execute_instruction (&go_instr[0]);

    return true;
}