📄 dma55x.c
字号:
/******************************************************************************/
/* DMA55XX.C - DMA55XX routines .c file. */
/* */
/* This module provides the devlib implementation for the DMAC */
/* on the TMS320C55XX DSP. */
/* */
/* MACRO FUNCTIONS: */
/* */
/* FUNCTIONS: */
/* dma_reset() - Resets indicated DMA channel */
/* dma_init() - Initialize channel specific control registers */
/* dma_global_init() - Initialize global control registers. */
/* dma_reset_all() - Resets all DMA channels */
/* */
/* */
/* AUTHOR: */
/* Stefan Haas */
/* */
/* REVISION HISTORY: */
/* */
/* DATE AUTHOR DESCRIPTION */
/* ------- ------------- ------------------------------------------ */
/* 13OCT98 St Haas Original. */
/* */
/******************************************************************************/
#include "dma55x.h"
/******************************************************************************/
/* FUNCTION DEFINITIONS */
/******************************************************************************/
#pragma CODE_SECTION(dma_reset, "DRV5510");
#pragma CODE_SECTION(dma_init, "DRV5510");
#pragma CODE_SECTION(dma_global_init, "DRV5510");
#pragma CODE_SECTION(dma_reset_all, "DRV5510");
/*****************************************************************************/
/* dma_reset - Reset DMA ch. */
/* */
/* This function resets the specified DMA ch by initializing */
/* ch control registers to their default values */
/* */
/*****************************************************************************/
void dma_reset(int ch)
{
DMCCR(ch) = 0;
DMCSDP(ch) = 0;
DMCICR(ch) = 0;
DMCSSAL(ch) = 0;
DMCSSAU(ch) = 0;
DMCDSAL(ch) = 0;
DMCDSAU(ch) = 0;
DMCEN(ch) = 0;
DMCFN(ch) = 0;
DMCEI(ch) = 0;
DMCFI(ch) = 0;
}
/****************************************************************************/
/* dma_init - Initialize ch specific control registers. */
/* */
/* This function is responsible for setting the DMA control registers, */
/* source address, destination address and the corresponding pages */
/* transfer count for the specified DMA ch. */
/* */
/****************************************************************************/
void dma_init(PDma55xConfig pDma)
{
DMCCR(pDma->ch) = DMCCR(pDma->ch) & ~(1<<DM_EN);
DMCSDP(pDma->ch) = pDma->csdp;
DMCICR(pDma->ch) = pDma->cicr;
DMCSSAL(pDma->ch) = pDma->srcl;
DMCSSAU(pDma->ch) = pDma->srch;
DMCDSAL(pDma->ch) = pDma->dstl;
DMCDSAU(pDma->ch) = pDma->dsth;
DMCEN(pDma->ch) = pDma->elem;
DMCFN(pDma->ch) = pDma->frame;
DMCEI(pDma->ch) = pDma->elemi;
DMCFI(pDma->ch) = pDma->framei;
DMCCR(pDma->ch) = pDma->ccr;
}
/****************************************************************************/
/* dma_global_init - Initialize global control registers. */
/* */
/* This function is responsible for setting the DMA global control */
/* register */
/****************************************************************************/
void dma_global_init(unsigned int gcr)
{
DMGCR = gcr;
}
/*****************************************************************************/
/* dma_reset_all - Reset all DMA channels. */
/* */
/* This function resets all DMA channels by initializing */
/* ch control registers to their default values */
/* */
/*****************************************************************************/
void dma_reset_all( void )
{
unsigned int ch;
for (ch = 0;ch < 5; ch++)
dma_reset(ch);
DMGCR = 0x0000;
}
#undef __INLINE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -