dma1cfg_c.c

来自「DSP/BIOS 应用实例,里面的例子比较经典,是入门的好程序」· C语言 代码 · 共 58 行

C
58
字号
/*   Do *not* directly modify this file.  It was    */
/*   generated by the Configuration Tool; any  */
/*   changes risk being overwritten.                */

/* INPUT dma1.cdb */

/*  Include Header File  */
#include "dma1cfg.h"


#pragma CODE_SECTION(CSL_cfgInit,".text:CSL_cfgInit")

/*  Config Structures */
DMA_Config dmaCfg1 = {
    0x10000050,        /*  Primary Control Register  */
    0x00000080,        /*  Secondary Control Register  */
    0x00000000,        /*  Source Address - Numeric  */
    0x00000000,        /*  Destination Address - Numeric  */
    0x00000100         /*  Transfer Counter - Numeric  */
};

DMA_Config dmaCfg2 = {
    0x12000050,        /*  Primary Control Register  */
    0x00000080,        /*  Secondary Control Register  */
    0x00000000,        /*  Source Address - Numeric  */
    0x00000000,        /*  Destination Address - Numeric  */
    0x00000100         /*  Transfer Counter - Numeric  */
};

DMA_GlobalConfig dmaGblCfg0 = {
    0x00000000,        /*  Reload Register A - Numeric  */
    0x00000000,        /*  Reload Register B - Numeric  */
    0x00000000,        /*  Reload Register C - Numeric  */
    0x00000000,        /*  Reload Register D - Numeric  */
    0x00000000,        /*  Global Index Reg A (GBLIDXA)  */
    0x00000000,        /*  Global Index Reg B (GBLIDXB)  */
    0x00000000,        /*  Global Count Reload Reg A (GBLCNTA)  */
    0x00000000         /*  Global Count Reload Reg B (GBLCNTB)  */
};

/*  Handles  */
DMA_Handle hDma1;
DMA_Handle hDma3;
Uint32 dmaGblRegId;

/*
 *  ======== CSL_cfgInit() ========  
 */
void CSL_cfgInit()
{
    dmaGblRegId = DMA_globalAlloc(0xff);
    DMA_globalConfig(dmaGblRegId, &dmaGblCfg0);
    hDma1 = DMA_open(DMA_CHA1, DMA_OPEN_RESET);
    hDma3 = DMA_open(DMA_CHA3, DMA_OPEN_RESET);
    DMA_config(hDma1, &dmaCfg1);
    DMA_config(hDma3, &dmaCfg1);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?