/* Note that the source address is modified during the DMA transfer according to edma_set_src_index().  */
void edma_set_src(unsigned slot, rt_uint32_t src_port, enum address_mode mode, enum fifo_width width)
/* Note that the source address is modified during the DMA transfer according to edma_set_src_index().  */
void edma_set_src(unsigned slot, rt_uint32_t src_port, enum address_mode mode, enum fifo_width width)
{
    unsigned ctlr;
    ctlr = EDMA_CTLR(slot);
    slot = EDMA_CHAN_SLOT(slot);
    if (slot < edma_cc[ctlr]->num_slots) {
        unsigned int i = edma_parm_read(ctlr, PARM_OPT, slot);
        if (mode) {
            i = (i & ~(EDMA_FWID)) | (SAM | ((width & 0x7) << 8));
        } else {
            i &= ~SAM;
        }
        edma_parm_write(ctlr, PARM_OPT, slot, i);
        edma_parm_write(ctlr, PARM_SRC, slot, src_port);
    }
}