/** * @fn abe_connect_cbpr_dmareq_port() * * Operations : enables the data echange between a DMA and the ABE through the * CBPr registers of AESS. * * Parameters : * id: port name * f : desired data format * d : desired dma_request line (0..7) * a : returned pointer to the base address of the CBPr register and number of * samples to exchange during a DMA_request. * * @see ABE_API.h */ void abe_connect_cbpr_dmareq_port(abe_port_id id, abe_data_format_t *f, abe_uint32 d, abe_dma_t *returned_dma_t) { _lock_enter _log(id_connect_cbpr_dmareq_port,id,f->f,f->samp_format) abe_port[id] = ((abe_port_t *)abe_port_init)[id]; abe_port[id].format = *f; abe_port[id].protocol.protocol_switch = DMAREQ_PORT_PROT; abe_port[id].protocol.p.prot_dmareq.iter = abe_dma_port_iteration(f); abe_port[id].protocol.p.prot_dmareq.dma_addr = ABE_DMASTATUS_RAW; abe_port[id].protocol.p.prot_dmareq.dma_data = (1 << d); abe_port[id].status = RUN_P; /* load the micro-task parameters */ abe_init_io_tasks(id, &((abe_port [id]).format), &((abe_port [id]).protocol)); /* load the dma_t with physical information from AE memory mapping */ abe_init_dma_t(id, &((abe_port [id]).protocol)); /* load the ATC descriptors - disabled */ abe_init_atc(id); /* return the dma pointer address */ abe_read_port_address(id, returned_dma_t); _lock_exit }
/* * ABE_HW_CONFIGURATION * * Parameter : * * Operations : * * * Return value : * */ void abe_hw_configuration() { abe_uint32 atc_reg; abe_port_protocol_t *protocol; abe_data_format_t format; /* initializes the ABE ATC descriptors in DMEM - MCPDM_UL */ protocol = &(abe_port[PDM_UL_PORT].protocol); format = abe_port[PDM_UL_PORT].format; abe_init_atc(PDM_UL_PORT); abe_init_io_tasks(PDM_UL_PORT, &format, protocol); /* initializes the ABE ATC descriptors in DMEM - MCPDM_DL */ protocol = &(abe_port[PDM_DL1_PORT].protocol); format = abe_port[PDM_DL1_PORT].format; abe_init_atc(PDM_DL1_PORT); abe_init_io_tasks(PDM_DL1_PORT, &format, protocol); /* one DMIC port enabled = all DMICs enabled, since there is a single DMIC path for all DMICs */ protocol = &(abe_port[DMIC_PORT1].protocol); format = abe_port[DMIC_PORT1].format; abe_init_atc(DMIC_PORT1); abe_init_io_tasks(DMIC_PORT1, &format, protocol); /* enables the DMAreq from AESS AESS_DMAENABLE_SET = 255 */ atc_reg = 0xFF; abe_block_copy(COPY_FROM_HOST_TO_ABE, ABE_ATC, 0x60, &atc_reg, 4); #if 0 /* let the EVENT be configured once the ports are already programmed */ /* enables EVENT_GENERATOR_START=6C from McPDM */ atc_reg = 0x01; abe_block_copy(COPY_FROM_HOST_TO_ABE, ABE_ATC, 0x6C, &atc_reg, 4); // set McPDM_DL as EVENT_SOURCE_SELECTION event = 0L; // source = DMAreq abe_block_copy(COPY_FROM_HOST_TO_ABE, ABE_ATC, 0x70, &event, 4); event = 2L; // source = MCPDM_DL to AUDIO_ENGINE_SCHEDULER abe_block_copy(COPY_FROM_HOST_TO_ABE, ABE_ATC, 0x74, &event, 4); #endif }
/* * ABE_ENABLE_DATA_TRANSFER * * Parameter : * p: port indentifier * * Operations : * enables the ATC descriptor * reset ATC pointers * enable the IO task (@f <> 0) * * Return value : * None. */ void abe_enable_data_transfer(abe_port_id id) { abe_port_protocol_t *protocol; abe_data_format_t format; _lock_enter _log(id_enable_data_transfer,id,0,0) abe_clean_temporary_buffers(id); if (id == PDM_UL_PORT) { /* initializes the ABE ATC descriptors in DMEM - MCPDM_UL */ protocol = &(abe_port[PDM_UL_PORT].protocol); format = abe_port[PDM_UL_PORT].format; abe_init_atc(PDM_UL_PORT); abe_init_io_tasks(PDM_UL_PORT, &format, protocol); } if (id == PDM_DL_PORT) { /* initializes the ABE ATC descriptors in DMEM - MCPDM_DL */ protocol = &(abe_port[PDM_DL_PORT].protocol); format = abe_port[PDM_DL_PORT].format; abe_init_atc(PDM_DL_PORT); abe_init_io_tasks(PDM_DL_PORT, &format, protocol); } if (id == DMIC_PORT) { /* one DMIC port enabled = all DMICs enabled, * since there is a single DMIC path for all DMICs */ protocol = &(abe_port[DMIC_PORT].protocol); format = abe_port[DMIC_PORT].format; abe_init_atc(DMIC_PORT); abe_init_io_tasks(DMIC_PORT, &format, protocol); } /* local host variable status= "port is running" */ abe_port[id].status = RUN_P; /* enable DMA requests */ abe_enable_dma_request(id); _lock_exit }
/** * @fn abe_connect_dmareq_ping_pong_port() * * Operations : enables the data echanges between a DMA and a direct access to * the DMEM memory of ABE. On each dma_request activation the DMA will exchange * "s" bytes and switch to the "pong" buffer for a new buffer exchange. * * Parameters : * id: port name * f : desired data format * d : desired dma_request line (0..7) * s : half-buffer (ping) size * * a : returned pointer to the base address of the ping-pong buffer and number of samples to exchange during a DMA_request. * * @see ABE_API.h */ void abe_connect_dmareq_ping_pong_port(abe_port_id id, abe_data_format_t *f, abe_uint32 d, abe_uint32 s, abe_dma_t *returned_dma_t) { abe_dma_t dma1; _lock_enter _log(id_connect_dmareq_ping_pong_port,id,f->f,f->samp_format) /* ping_pong is only supported on MM_DL */ if (id != MM_DL_PORT) { abe_dbg_param |= ERR_API; abe_dbg_error_log(ABE_PARAMETER_ERROR); } /* declare PP buffer and prepare the returned dma_t */ abe_init_ping_pong_buffer(MM_DL_PORT, s, 2, (abe_uint32 *)&(returned_dma_t->data)); abe_port[id] = ((abe_port_t *) abe_port_init) [id]; (abe_port[id]).format = (*f); (abe_port[id]).protocol.protocol_switch = PINGPONG_PORT_PROT; (abe_port[id]).protocol.p.prot_pingpong.buf_addr = dmem_ping_pong_buffer; (abe_port[id]).protocol.p.prot_pingpong.buf_size = s; (abe_port[id]).protocol.p.prot_pingpong.irq_addr = ABE_DMASTATUS_RAW; (abe_port[id]).protocol.p.prot_pingpong.irq_data = (1 << d); abe_port [id].status = RUN_P; /* load the micro-task parameters DESC_IO_PP */ abe_init_io_tasks(id, &((abe_port [id]).format), &((abe_port [id]).protocol)); /* load the dma_t with physical information from AE memory mapping */ abe_init_dma_t(id, &((abe_port [id]).protocol)); dma1.data = (abe_uint32 *)(abe_port [id].dma.data + ABE_DMEM_BASE_ADDRESS_L3); dma1.iter = abe_port [id].dma.iter; (*returned_dma_t) = dma1; _lock_exit }