分享

davinci内核2.6.10与2.6.32应用程序DMA调用接口对比

 felwell 2012-12-31
        最近阅读了davinci新版旧版内核的DMA驱动那块,再回头查看应用程序中关于DMA调用接口部分,将两个版本内核DMA调用接口捋出对比了一下,
只是大概备注了一下,其实接口很简单,但DMA具体操作很复杂,光是EDMA的datasheet就有150多页,懒得看,所以有误的地方就没去在乎,仅作参
考。
关于I2C接口部分稍后贴出......
2.6.10内核DMA函数
1.申请DMA通道
result = davinci_request_dma (EDMA_QDMA_CHANNEL_ANY, "A-SYNC_DMA0",
                                    callback1, NULL,
                                    &qdma_ch, &tcc,
                                    event_queue);

2.6.32内核DMA函数
1.申请DMA通道
dma_ch1 = edma_alloc_channel(EDMA_CHANNEL_ANY, callback1, NULL,
                event_queue);

---------------------------------------------------------------------------------------------------------------------------

2.6.10内核DMA函数
1.设置dmaphyssrc1地址作为DMA通道的数据源
davinci_set_dma_src_params (qdma_ch, (unsigned long)(dmaphyssrc1),
                                    INCR, W8BIT);

2.6.32内核DMA函数
1.设置dmaphyssrc1地址作为DMA通道要传输的数据源
edma_set_src(dma_ch1, (unsigned long)(dmaphyssrc1), INCR, W8BIT);

---------------------------------------------------------------------------------------------------------------------------
2.6.10内核DMA函数
1.设置dmaphysdest1地址作为DMA通道要传输数据的目的地
davinci_set_dma_dest_params (qdma_ch, (unsigned long)(dmaphysdest1),
                                    INCR, W8BIT);

2.6.32内核DMA函数
1.设置dmaphysdest1地址作为DMA通道要传输数据的目的地
edma_set_dest(dma_ch1, (unsigned long)(dmaphysdest1), INCR, W8BIT);

---------------------------------------------------------------------------------------------------------------------------
2.6.10内核DMA函数
1.设置srcbidx、srccidx作为DMA通道源B-C寄存器的序号
davinci_set_dma_src_index (qdma_ch, srcbidx, srccidx);
/******************************************************************************
 *
 * DMA source index setup
 * ARGUMENTS:
 *      lch     - channel or param device for configuration of source index
 *      srcbidx - source B-register index
 *      srccidx - source C-register index
 *
 *****************************************************************************/
2.6.32内核DMA函数
1.设置srcbidx、srccidx作为DMA通道源B-C寄存器的序号
edma_set_src_index(dma_ch1, srcbidx, srccidx);

---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10内核DMA函数
1.设置desbidx、descidx作为DMA通道目的B-C寄存器的序号
davinci_set_dma_dest_index (qdma_ch, desbidx, descidx);
/******************************************************************************
 *
 * DMA source index setup
 * ARGUMENTS:
 *      lch     - channel or param device for configuration of source index
 *      srcbidx - source B-register index
 *      srccidx - source C-register index
 *
 *****************************************************************************/
2.6.32内核DMA函数
1.设置desbidx、descidx作为DMA通道目的B-C寄存器的序号
edma_set_dest_index(dma_ch1, desbidx, descidx);

---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10内核DMA函数
1.获取DMA通道的参数
davinci_get_dma_params (qdma_ch, &param_set);
/******************************************************************************
 *
 * DMA source index setup
 * ARGUMENTS:
 *      lch     - channel or param device for configuration of source index
 *      srcbidx - source B-register index
 *      srccidx - source C-register index
 *
 *****************************************************************************/
2.6.32内核DMA函数
1.获取DMA通道的参数
edma_read_slot(dma_ch1, &param_set);
/* Enable the Interrupts on Channel 1 */
    edma_read_slot(dma_ch1, &param_set);
    param_set.opt |= (1 << ITCINTEN_SHIFT);
    param_set.opt |= (1 << TCINTEN_SHIFT);
    param_set.opt |= EDMA_TCC(EDMA_CHAN_SLOT(dma_ch1));

---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10内核DMA函数
1.设置DMA通道的参数
davinci_set_dma_params(dma_ch1, &param_set);
/******************************************************************************
 *
 * DMA source index setup
 * ARGUMENTS:
 *      lch     - channel or param device for configuration of source index
 *      srcbidx - source B-register index
 *      srccidx - source C-register index
 *
 *****************************************************************************/
2.6.32内核DMA函数
1.设置DMA通道的参数
edma_write_slot(dma_ch1, &param_set);
/* Enable the Interrupts on Channel 1 */
    edma_read_slot(dma_ch1, &param_set);
    param_set.opt |= (1 << ITCINTEN_SHIFT);
    param_set.opt |= (1 << TCINTEN_SHIFT);
    param_set.opt |= EDMA_TCC(EDMA_CHAN_SLOT(dma_ch1));
    edma_write_slot(dma_ch1, &param_set);

---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10内核DMA函数
1.设置DMA通道传输模式
davinci_set_dma_transfer_params (dma_ch2, acnt, bcnt, ccnt,
                                            BRCnt, ASYNC);
/******************************************************************************
 *
 * DMA transfer parameters setup
 * ARGUMENTS:
 *      lch  - channel or param device for configuration of aCount, bCount and
 *         cCount regs.
 *      acnt - acnt register value to be configured
 *      bcnt - bcnt register value to be configured
 *      ccnt - ccnt register value to be configured
 *
 *****************************************************************************/
void davinci_set_dma_transfer_params(int lch, unsigned short acnt,
                     unsigned short bcnt, unsigned short ccnt,
                     unsigned short bcntrld,
                     enum sync_dimension sync_mode)

2.6.32内核DMA函数
1.设置DMA通道传输模式
edma_set_transfer_params(dma_ch2, acnt, bcnt, ccnt, BRCnt, ASYNC);

void edma_set_transfer_params(unsigned slot,
        u16 acnt, u16 bcnt, u16 ccnt,
        u16 bcnt_rld, enum sync_dimension sync_mode)
/**
 * edma_set_transfer_params - configure DMA transfer parameters
 * @slot: parameter RAM slot being configured
 * @acnt: how many bytes per array (at least one)
 * @bcnt: how many arrays per frame (at least one)
 * @ccnt: how many frames per block (at least one)
 * @bcnt_rld: used only for A-Synchronized transfers; this specifies
 *    the value to reload into bcnt when it decrements to zero
 * @sync_mode: ASYNC or ABSYNC
**/

---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10内核DMA函数
1.连接dma_ch1和dma_ch2两个通道
davinci_dma_link_lch(dma_ch1, dma_ch2);
void davinci_dma_link_lch(int lch_head, int lch_queue)
/******************************************************************************
 *
 * DMA channel link - link the two logical channels passed through by linking
 *                    the link field of head to the param pointed by the lch_queue.
 * ARGUMENTS:
 *      lch_head  - logical channel number, in which the link field is linked
 *                  to the param pointed to by lch_queue
 * lch_queue - logical channel number or the param entry number, which is to be
 *                  linked to the lch_head
******************************************************************************/

2.6.32内核DMA函数
1.连接dma_ch1和dma_ch2两个通道
/* Link both the channels */
    edma_link(dma_ch1, dma_ch2);


---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10内核DMA函数
1.开始DMA传输
result = davinci_start_dma(dma_ch1);
/******************************************************************************
 *
 * DMA Start - Starts the dma on the channel passed
 * ARGUMENTS:
 *      lch - logical channel number
 *
 *****************************************************************************/
int davinci_start_dma(int lch)

2.6.32内核DMA函数
1.开始DMA传输
result = davinci_start_dma(dma_ch1);

---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10内核DMA函数
1.停止DMA通道
davinci_stop_dma(dma_ch1);

2.6.32内核DMA函数
1.停止DMA通道
edma_stop(dma_ch1);
edma_clean_channel(dma_ch1);

---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10内核DMA函数
1.释放DMA通道
davinci_free_dma(dma_ch1);

2.6.32内核DMA函数
1.停止DMA通道
edma_free_slot(dma_ch1);
edma_free_channel(dma_ch1);

---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
























    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多