/* This deallocates the parameter RAM slots allocated by edma_alloc_cont_slots. Callers/applications need to keep track of sets of contiguous parameter RAM slots that have been allocated using the edma_alloc_cont_slots API. Callers are responsible for ensuring the slots are inactive, and will not be activated.  */
int edma_free_cont_slots(unsigned slot, int count)
/* This deallocates the parameter RAM slots allocated by edma_alloc_cont_slots. Callers/applications need to keep track of sets of contiguous parameter RAM slots that have been allocated using the edma_alloc_cont_slots API. Callers are responsible for ensuring the slots are inactive, and will not be activated.  */
int edma_free_cont_slots(unsigned slot, int count)
{
    unsigned ctlr, slot_to_free;
    int i;
    ctlr = EDMA_CTLR(slot);
    slot = EDMA_CHAN_SLOT(slot);
    if (slot < edma_cc[ctlr]->num_channels ||
        slot >= edma_cc[ctlr]->num_slots ||
        count < 1)
        return -RT_ERROR;
    for (i = slot; i < slot + count; ++i) {
        ctlr = EDMA_CTLR(i);
        slot_to_free = EDMA_CHAN_SLOT(i);
        rt_memcpy((void *)(edmacc_regs_base[ctlr] + PARM_OFFSET(slot_to_free)),
            &dummy_paramset, PARM_SIZE);
        clear_bit(slot_to_free, edma_cc[ctlr]->edma_inuse);
    }
    return 0;
}