最近閱讀了davinci新版舊版內(nèi)核的DMA驅(qū)動(dòng)那塊,再回頭查看應(yīng)用程序中關(guān)于DMA調(diào)用接口部分,將兩個(gè)版本內(nèi)核DMA調(diào)用接口捋出對(duì)比了一下,
只是大概備注了一下,其實(shí)接口很簡(jiǎn)單,但DMA具體操作很復(fù)雜,光是EDMA的datasheet就有150多頁(yè),懶得看,所以有誤的地方就沒去在乎,僅作參
考。關(guān)于I2C接口部分稍后貼出......
2.6.10內(nèi)核DMA函數(shù)
1.申請(qǐng)DMA通道
result = davinci_request_dma (EDMA_QDMA_CHANNEL_ANY, "A-SYNC_DMA0",
callback1, NULL,
&qdma_ch, &tcc,
event_queue);
2.6.32內(nèi)核DMA函數(shù)
1.申請(qǐng)DMA通道
dma_ch1 = edma_alloc_channel(EDMA_CHANNEL_ANY, callback1, NULL,
event_queue);
---------------------------------------------------------------------------------------------------------------------------
2.6.10內(nèi)核DMA函數(shù)
1.設(shè)置dmaphyssrc1地址作為DMA通道的數(shù)據(jù)源
davinci_set_dma_src_params (qdma_ch, (unsigned long)(dmaphyssrc1),
INCR, W8BIT);
2.6.32內(nèi)核DMA函數(shù)
1.設(shè)置dmaphyssrc1地址作為DMA通道要傳輸?shù)臄?shù)據(jù)源
edma_set_src(dma_ch1, (unsigned long)(dmaphyssrc1), INCR, W8BIT);
---------------------------------------------------------------------------------------------------------------------------
2.6.10內(nèi)核DMA函數(shù)
1.設(shè)置dmaphysdest1地址作為DMA通道要傳輸數(shù)據(jù)的目的地
davinci_set_dma_dest_params (qdma_ch, (unsigned long)(dmaphysdest1),
INCR, W8BIT);
2.6.32內(nèi)核DMA函數(shù)
1.設(shè)置dmaphysdest1地址作為DMA通道要傳輸數(shù)據(jù)的目的地
edma_set_dest(dma_ch1, (unsigned long)(dmaphysdest1), INCR, W8BIT);
---------------------------------------------------------------------------------------------------------------------------
2.6.10內(nèi)核DMA函數(shù)
1.設(shè)置srcbidx、srccidx作為DMA通道源B-C寄存器的序號(hào)
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內(nèi)核DMA函數(shù)
1.設(shè)置srcbidx、srccidx作為DMA通道源B-C寄存器的序號(hào)
edma_set_src_index(dma_ch1, srcbidx, srccidx);
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10內(nèi)核DMA函數(shù)
1.設(shè)置desbidx、descidx作為DMA通道目的B-C寄存器的序號(hào)
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內(nèi)核DMA函數(shù)
1.設(shè)置desbidx、descidx作為DMA通道目的B-C寄存器的序號(hào)
edma_set_dest_index(dma_ch1, desbidx, descidx);
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10內(nèi)核DMA函數(shù)
1.獲取DMA通道的參數(shù)
davinci_get_dma_params (qdma_ch, ¶m_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內(nèi)核DMA函數(shù)
1.獲取DMA通道的參數(shù)
edma_read_slot(dma_ch1, ¶m_set);
/* Enable the Interrupts on Channel 1 */
edma_read_slot(dma_ch1, ¶m_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內(nèi)核DMA函數(shù)
1.設(shè)置DMA通道的參數(shù)
davinci_set_dma_params(dma_ch1, ¶m_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內(nèi)核DMA函數(shù)
1.設(shè)置DMA通道的參數(shù)
edma_write_slot(dma_ch1, ¶m_set);
/* Enable the Interrupts on Channel 1 */
edma_read_slot(dma_ch1, ¶m_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, ¶m_set);
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10內(nèi)核DMA函數(shù)
1.設(shè)置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內(nèi)核DMA函數(shù)
1.設(shè)置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內(nèi)核DMA函數(shù)
1.連接dma_ch1和dma_ch2兩個(gè)通道
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內(nèi)核DMA函數(shù)
1.連接dma_ch1和dma_ch2兩個(gè)通道
/* Link both the channels */
edma_link(dma_ch1, dma_ch2);
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10內(nèi)核DMA函數(shù)
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內(nèi)核DMA函數(shù)
1.開始DMA傳輸
result = davinci_start_dma(dma_ch1);
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10內(nèi)核DMA函數(shù)
1.停止DMA通道
davinci_stop_dma(dma_ch1);
2.6.32內(nèi)核DMA函數(shù)
1.停止DMA通道
edma_stop(dma_ch1);
edma_clean_channel(dma_ch1);
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
2.6.10內(nèi)核DMA函數(shù)
1.釋放DMA通道
davinci_free_dma(dma_ch1);
2.6.32內(nèi)核DMA函數(shù)
1.停止DMA通道
edma_free_slot(dma_ch1);
edma_free_channel(dma_ch1);
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)
點(diǎn)擊舉報(bào)。