/****f* simple.c/do_transfer * * SUMMARY * This function is used as a task example * It triggers a dma transfers. * * SYNOPSIS * void do_transfer (uint val, uint none) * * INPUTS * uint val: argument * uint none: padding argument - task must have 2 * * SOURCE */ void do_transfer (uint val, uint none) { if (val == 3) { spin1_dma_transfer(DMA_WRITE, sysram_buffer, dtcm_buffer, DMA_WRITE, BUFFER_SIZE*sizeof(uint)); } else { if (val == 5) { spin1_dma_transfer(DMA_WRITE, sdram_buffer, dtcm_buffer, DMA_WRITE, BUFFER_SIZE*sizeof(uint)); } } }
// Reads whole input vector from SDRAM static inline void read_whole_vector() { // Schedule reading in the whole input vector from SDRAM value_t *sdram_input_vector = ensemble.parameters.sdram_input_vector; spin1_dma_transfer( READ_WHOLE_VECTOR, // Tag sdram_input_vector, // SDRAM address ensemble.input, // DTCM address DMA_READ, // Direction sizeof(value_t) * ensemble.parameters.n_dims ); }
// Writes the accumulated local section of the standard filter's output to SDRAM static inline void write_filtered_vector() { // Compute the size of the transfer uint size = sizeof(value_t) * ensemble.parameters.input_subspace.n_dims; spin1_dma_transfer( WRITE_FILTERED_VECTOR, sdram_input_vector_local, // Section of the SDRAM vector we manage ensemble.input_local, // Section of the DTCM vector we're updating DMA_WRITE, size ); }
// Reads whole input vector from SDRAM static inline void read_whole_learned_vector(uint32_t signal) { // Cache index dma_learnt_vector = signal; spin1_dma_transfer( READ_WHOLE_LEARNED_VECTOR, // Tag sdram_learnt_input_vector[signal], // SDRAM address ensemble.learnt_input[signal], // DTCM address DMA_READ, // Direction sizeof(value_t) * ensemble.parameters.n_dims ); }
// Writes the local section of the specified learnt input filter's output to SDRAM static inline void write_filtered_learnt_vector(uint32_t signal) { // Cache index dma_learnt_vector = signal; // Compute the size of the transfer uint size = sizeof(value_t) * ensemble.parameters.input_subspace.n_dims; spin1_dma_transfer( WRITE_FILTERED_LEARNT_VECTOR, sdram_learnt_input_vector_local[signal], // Section of the SDRAM vector we manage ensemble.learnt_input_local[signal], // Section of the DTCM vector we're updating DMA_WRITE, size ); }