TMS320C6713B: TMS320C6713 包含了头文件#include 且能在函数中找到函数原型 但是编译器提示不认识 CACHE

您所在的位置:网站首页 csl_init函数 TMS320C6713B: TMS320C6713 包含了头文件#include 且能在函数中找到函数原型 但是编译器提示不认识 CACHE

TMS320C6713B: TMS320C6713 包含了头文件#include 且能在函数中找到函数原型 但是编译器提示不认识 CACHE

2024-07-01 16:14| 来源: 网络整理| 查看: 265

Part Number: TMS320C6713B

==============================分割线===================================

/********************************************************************************** Copyright 2003 by SEED Electronic Technology Ltd.* All rights reserved. Property of SEED Electronic Technology Ltd. ** Designed by: Hongshuai.Li **********************************************************************************//* FILENAME...... DEC6713_EDMA.c* DATE CREATED.. 21/12/2004* LAST MODIFIED. 21/12/2004*------------------------------------------------------------------------------* This program uses the timer to trigger EDMA events. These events in turn* trigger linked EDMA parameter tables to fill a ping pong buffer structure.* On running the program you'll note that the program bounces between the ping* and pong buffers filling each with a value that comes from the source.* (Note: This example runs with CACHE enable).\******************************************************************************/#include

//#include

#include

#include //#include //#include //#include

/*----------------------------------------------------------------------------*//* Pick which EDMA transfer completion interrupt we want to use */#define TCCINTNUM 10

/* define the constants */#define BUFF_SZ 256 /* ping-pong buffer sizes in # of ints */#define FCPU 150000000 /* CPU clock frequency */#define SRATE 8000 /* data sample rate (simulated w/timer */#define TPRD (FCPU/(4*SRATE)) /* timer period */#define TRANSFER_CNT 20 /* Transfer count */

/* Create the buffers. We want to align the buffers to be cache friendly *//* by aligning them on an L2 cache line boundary. */#pragma DATA_ALIGN(ping,128);#pragma DATA_ALIGN(pong,128);#pragma DATA_ALIGN(outbuff,128);int ping[BUFF_SZ];int pong[BUFF_SZ];int outbuff[BUFF_SZ];

/* These two variables serve as the data sources for this example. *//* Also want to align these on a cache line boundary since they *//* sources of EDMA transfers. */#pragma DATA_ALIGN(ping_data,128);#pragma DATA_ALIGN(pong_data,128);static int ping_data;static int pong_data;

/* global variable used to track the ping-pong'ing */static int pingpong = 0;

volatile int transferCount = 0;

extern far void vectors();

void setupInterrupts(void);void stopEdma(void); /* function used to stop EDMA */

/*-------------------------------------------------------------------------*//* declare the CSL objects */TIMER_Handle hTimer; /* Handle for the timer device */EDMA_Handle hEdma; /* Handle for the EDMA channel */EDMA_Handle hEdmaPing; /* Handle for the ping EDMA reload parameters */EDMA_Handle hEdmaPong; /* Handle for the pong EDMA reload parameters */EDMA_Config cfgEdma; /* EDMA configuration structure */

/* Create the EDMA configuration structure for ping transfers */EDMA_Config cfgEdmaPing = { EDMA_OPT_RMK( /* Making Options parameter register - EDMA_OPT */

EDMA_OPT_PRI_LOW, /* Priority levels for EDMA events:- EDMA_OPT_PRI_LOW - Low priority EDMA transfer EDMA_OPT_PRI_HIGH - High priority EDMA transfer*/

EDMA_OPT_ESIZE_32BIT,/* Element size :- EDMA_OPT_ESIZE_32BIT - 32 bit word EDMA_OPT_ESIZE_16BIT - 16 bit word EDMA_OPT_ESIZE_8BIT - 8 bit word */

EDMA_OPT_2DS_NO, /* Source dimension :- EDMA_OPT_2DS_NO - 1-dimensional source EDMA_OPT_2DS_YES - 2-dimensional source */

EDMA_OPT_SUM_NONE, /* Source address update mode :- EDMA_OPT_SUM_NONE - Fixed address mode EDMA_OPT_SUM_INC - Increment address mode EDMA_OPT_SUM_DEC - Decrement address mode EDMA_OPT_SUM_IDX - Address modified by element index or frame Index */ EDMA_OPT_2DD_NO, /* Destination dimension :- EDMA_OPT_2DD_NO - 1-dimensional source EDMA_OPT_2DD_YES - 2-dimensional source */

EDMA_OPT_DUM_INC, /* Destination address update mode :- EDMA_OPT_DUM_NONE - Fixed address mode EDMA_OPT_DUM_INC - Increment address mode EDMA_OPT_DUM_DEC - Decrement address mode EDMA_OPT_DUM_IDX - Address modified by element index or frame Index */

EDMA_OPT_TCINT_YES, /* Transfer complete interrupt :- EDMA_OPT_TCINT_NO - Indication disabled EDMA_OPT_TCINT_YES - Indication enabled */

EDMA_OPT_TCC_OF(TCCINTNUM),/* Transfer complete code */

EDMA_OPT_LINK_YES, /* Linking of event parameters EDMA_OPT_LINK_NO - Disabled EDMA_OPT_LINK_YES - Enabled */

EDMA_OPT_FS_NO /* Frame synchronization EDMA_OPT_FS_NO - Channel is element/array synchronized EDMA_OPT_FS_YES - Channel is frame synchronized*/ ), EDMA_SRC_OF(&ping_data),/* Source address register &ping_data - source address */

EDMA_CNT_OF(BUFF_SZ), /* Transfer count parameter BUFF_SZ - buffer sizes in # of ints */

EDMA_DST_OF(ping), /* Destination address parameter ping - destination address */

EDMA_IDX_OF(0x00000004),/* Index parameter */

EDMA_RLD_OF(0x00000000) /* Count reload/link parameter */};

/* Create the EDMA configuration structure for pong transfers */EDMA_Config cfgEdmaPong = { EDMA_OPT_RMK( /* Making Options parameter register - EDMA_OPT */

EDMA_OPT_PRI_LOW, /* Priority levels for EDMA events:- EDMA_OPT_PRI_LOW - Low priority EDMA transfer EDMA_OPT_PRI_HIGH - High priority EDMA transfer */

EDMA_OPT_ESIZE_32BIT,/* Element size :- EDMA_OPT_ESIZE_32BIT - 32 bit word EDMA_OPT_ESIZE_16BIT - 16 bit word EDMA_OPT_ESIZE_8BIT - 8 bit word */

EDMA_OPT_2DS_NO, /* Source dimension :- EDMA_OPT_2DS_NO - 1-dimensional source EDMA_OPT_2DS_YES - 2-dimensional source */

EDMA_OPT_SUM_NONE, /* Source address update mode :- EDMA_OPT_SUM_NONE - Fixed address mode EDMA_OPT_SUM_INC - Increment address mode EDMA_OPT_SUM_DEC - Decrement address mode EDMA_OPT_SUM_IDX - Address modified by element index or frame Index */ EDMA_OPT_2DD_NO, /* Destination dimension :- EDMA_OPT_2DD_NO - 1-dimensional source EDMA_OPT_2DD_YES - 2-dimensional source */

EDMA_OPT_DUM_INC, /* Destination address update mode :- EDMA_OPT_DUM_NONE - Fixed address mode EDMA_OPT_DUM_INC - Increment address mode EDMA_OPT_DUM_DEC - Decrement address mode EDMA_OPT_DUM_IDX - Address modified by element index or frame Index */ EDMA_OPT_TCINT_YES, /* Transfer complete interrupt :- EDMA_OPT_TCINT_NO - Indication disabled EDMA_OPT_TCINT_YES - Indication enabled */

EDMA_OPT_TCC_OF(TCCINTNUM),/* Transfer complete code */

EDMA_OPT_LINK_YES, /* Linking of event parameters EDMA_OPT_LINK_NO - Disabled EDMA_OPT_LINK_YES - Enabled */

EDMA_OPT_FS_NO /* Frame synchronization EDMA_OPT_FS_NO - Channel is element/array synchronized EDMA_OPT_FS_YES - Channel is frame synchronized*/ ), EDMA_SRC_OF(&pong_data),/* Source address register &ping_data - source address */

EDMA_CNT_OF(BUFF_SZ), /* Transfer count parameter BUFF_SZ - buffer sizes in # of ints */

EDMA_DST_OF(pong), /* Destination address parameter ping - destination address */

EDMA_IDX_OF(0x00000004),/* Index parameter */

EDMA_RLD_OF(0x00000000) /* Count reload/link parameter */};

/*----------------------------------------------------------------------------*/void main(){

/*Set the CCFG register of Cache to default value*/ *(int *)0x01840000 = (*(int *)0x01840000 & 0x00000000);

/* initialize the CSL library */ CSL_init();

/* Initialize DEC6713 board */ DEC6713_init(); /* initialize the input source data */ ping_data=0x00000000; pong_data=0x80000000;

/* Since these variables are the source of an EDMA transfer, we */ /* need to flush them out of the cache since we just wrote to them. */ CACHE_wbInvL2(&ping_data, 4, CACHE_WAIT); CACHE_wbInvL2(&pong_data, 4, CACHE_WAIT);

/* Let's disable/clear related interrupts just in case they are pending */ /* from a previous run of the program. */ setupInterrupts(); /* defined below */

/* Although not required, let's clear all of the EDMA parameter RAM. */ /* This makes it easier to view the RAM and see the changes as we */ /* configure it. */ EDMA_clearPram(0x00000000);

/* Let's open up a timer device, we'll use this to simulate input events */ /* at a given sample rate. */ hTimer = TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET);

/* Lets open up the EDMA channel associated with timer #1. */ hEdma = EDMA_open(EDMA_CHA_TINT1, EDMA_OPEN_RESET);

/* We also need two EDMA reload parameter sets so let's allocate them */ /* here. Notice the -1, this means allocate any availale table. */ hEdmaPing = EDMA_allocTable(-1); hEdmaPong = EDMA_allocTable(-1);

/* Let's copy the ping reload configuration structure to an */ /* intermediate configuration structure. */ cfgEdma = cfgEdmaPing;

/* Let's initialize the link fields of the configuration structures */ cfgEdmaPing.rld = EDMA_RLD_RMK(0,hEdmaPing); cfgEdmaPong.rld = EDMA_RLD_RMK(0,hEdmaPong); cfgEdma.rld = EDMA_RLD_RMK(0,hEdmaPong);

/* Now let's program up the EDMA channel with the configuration structure */ EDMA_config(hEdma, &cfgEdma);

/* Let's also configure the reload parameter tables in the EDMA PRAM */ /* with the values in the configuration structures. */ EDMA_config(hEdmaPing, &cfgEdmaPing); EDMA_config(hEdmaPong, &cfgEdmaPong);

/* Configure up the timer. */ TIMER_configArgs(hTimer, TIMER_CTL_OF(0x00000200), TIMER_PRD_OF(TPRD), /* timer period */ TIMER_CNT_OF(0) );

/* Enable the related interrupts */ IRQ_enable(IRQ_EVT_EDMAINT); EDMA_intDisable(TCCINTNUM); EDMA_intClear(TCCINTNUM); EDMA_intEnable(TCCINTNUM);

/* Enable the EDMA channel */ EDMA_enableChannel(hEdma);

/* Finally, enable the timer which will drive everything. */ TIMER_start(hTimer);

while(transferCount



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3