📄 edma_ping_pong_xfer_reg5.c
字号:
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied.
* ===========================================================================
*/
/** ============================================================================
*
* @file Edma_ping_pong_xfer_reg5.c
*
* @path $(CSLPATH)\example\edma\edma_ping_pong_xfer_reg5\src
*
* @desc Example of EDMA
*
* ============================================================================
* @n Target Platform: EVM
* ============================================================================
* @n <b> Example Description </b>
* @n This is an example of the CSL EDMA usage for the use edma Channel
* Initialization for ping pong buffer where channels are opened
* in the region 5.
* This example do the following operations
* - Initializes and Opens the edma module
* - Sets up the Module and gets the module setup values
* - Enables (Bits 0-15) the Shadow Region 0
* - Disables (Bits 12-15) the Shadow Region 0
* - Enables interrupt (Bits 0-11) for the Shadow Region 0
* - Disables interrupt (Bits 2-11) for the Shadow Region 0
* - Opens Channel 0 in context of Shadow region 0
* - Obtains a handles to parameters set 0, 1 and 2
* - Sets up the first param set (Ping buffer)
* - Sets up the Ping Entry which is loaded after the Pong entry
* gets exhausted
* - Enables Channel and Initialize the data
* - Manually triggers the Channel
* - Polls on interrupt bit 0 and clears interrupt bit 0
* - Maps Channel 0 to Event Queue 1
* - Manually triggers the Channel
* - Polls on interrupt pend bit 1 and clears interrupt bit 1
* - Compares the transfered data
* - Displays the result based on previous step
*
* ============================================================================
*
* <b> Procedure to run the example </b>
* @verbatim
* 1. Configure the CCS setup to work with the emulator being used
* 2. Please refer CCS manual for setup configuration and loading
* proper GEL file
* 3. Launch CCS window
* 4. Open project Edma_ping_pong_xfer_reg5.pjt
* 5. Build the project and load the .out file of the project.
*
* @endverbatim
*
*/
/* =============================================================================
* Revision History
* ===============
* 29-May-2004 Ruchika Kharwar File Created.
*
* 16-Dec-2005 DS Minor documentation changes
* =============================================================================
*/
#include <stdio.h>
#include <csl_edma3.h>
#include <soc.h>
/* Globals */
Uint8 srcBuff1[512];
Uint8 srcBuff2[512];
Uint8 dstBuff1[512];
Uint8 dstBuff2[512];
Uint32 passStatus = 1;
/* Forward declaration */
void edma_ping_pong_xfer_region5 (void);
/*
* =============================================================================
* @func main
*
* @desc
* This is the main routine for the file.
*
* =============================================================================
*/
void main(void)
{
/* Invoke example */
edma_ping_pong_xfer_region5 ();
return;
}
/*
* =============================================================================
* @func edma_ping_pong_xfer_region5
*
* @arg
* NONE
*
* @desc
* This is the example routine which perform edma ping pong buffer transfer
* where channel is open in region 5.
* It implements following steps
* 1. Initializes and Opens the edma module
* 2. Sets up the Module and gets the module setup values
* 3. Enables (Bits 0-15) the Shadow Region 0
* 4. Disables (Bits 12-15) the Shadow Region 0
* 5. Enables interrupt (Bits 0-11) for the Shadow Region 0
* 6. Disables interrupt (Bits 2-11) for the Shadow Region 0
* 7. Opens Channel 0 in context of Shadow region 0
* 8. Obtains a handles to parameters set 0, 1 and 2
* 9. Sets up the first param set (Ping buffer)
* 10. Sets up the Ping Entry which is loaded after the Pong entry
* gets exhausted
* 11. Enables Channel and Initialize the data
* 12. Manually triggers the Channel
* 13. Polls on interrupt bit 0 and clears interrupt bit 0
* 14. Maps Channel 0 to Event Queue 1
* 15. Manually triggers the Channel
* 16. Polls on interrupt pend bit 1 and clears interrupt bit 1
* 17. Compares the transfered data
* 18. Close the Edma module and channel
*
* @return
* NONE
*
* =============================================================================
*/
void edma_ping_pong_xfer_region5 (void)
{
CSL_Edma3Handle hModule;
CSL_Edma3HwSetup hwSetup;
CSL_Edma3Obj edmaObj;
CSL_Edma3ParamHandle hParamPing;
CSL_Edma3ParamHandle hParamPong;
CSL_Edma3ParamHandle hParamBasic;
CSL_Edma3ChannelObj chObj;
CSL_Edma3CmdIntr regionIntr;
CSL_Edma3CmdDrae regionAccess;
CSL_Edma3ChannelHandle hChannel;
CSL_Edma3ParamSetup myParamSetup;
CSL_Edma3Context context;
CSL_Edma3ChannelAttr chAttr;
CSL_Status status;
CSL_Edma3HwDmaChannelSetup dmahwSetup;
volatile Uint32 loopIndex;
printf ("Running Edma Example\n");
/* Module Initialization */
status = CSL_edma3Init(&context);
if (status != CSL_SOK) {
printf ("Edma module initialization failed\n");
return;
}
/* Module level open */
hModule = CSL_edma3Open(&edmaObj,CSL_EDMA3,NULL,&status);
if ( (hModule == NULL) || (status != CSL_SOK)) {
printf ("Edma module open failed\n");
return;
}
/* Module setup */
dmahwSetup.paramNum = 0;
dmahwSetup.que = CSL_EDMA3_QUE_0;
hwSetup.dmaChaSetup = &dmahwSetup;
hwSetup.qdmaChaSetup = NULL;
status = CSL_edma3HwSetup(hModule,&hwSetup);
if (status != CSL_SOK) {
printf ("Hardware setup failed\n");
CSL_edma3Close (hModule);
return;
}
/* DRAE enable(Bits 0-15) for the shadow region 5 */
regionAccess.region = CSL_EDMA3_REGION_5 ;
regionAccess.drae = 0xFFFF ;
regionAccess.draeh = 0x0000 ;
status = CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_DMAREGION_ENABLE, \
®ionAccess);
if (status != CSL_SOK) {
printf ("Edma region enable command failed\n");
return;
}
/* DRAE disable(Bits 12-15) for the shadow region 5 */
regionAccess.region = CSL_EDMA3_REGION_5 ;
regionAccess.drae = 0xF000 ;
regionAccess.draeh = 0x0000 ;
status = CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_DMAREGION_DISABLE, \
®ionAccess);
if (status != CSL_SOK) {
printf ("Edma region disable command failed\n");
return;
}
if (hModule->regs->DRA[CSL_EDMA3_REGION_5].DRAE != 0x0FFF)
passStatus = 0;
/* Interrupt enable (Bits 0-11) for the shadow region 5 */
regionIntr.region = CSL_EDMA3_REGION_5 ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -