/*H***************************************************************************
*
* $Archive:: /boards/dsk5509a/examples/dsk_app/dsk_app.c $
* $Revision:: 1 $
* $Date:: 11/10/05 11:13a $
* $Author:: Shilpab $
*
* DESCRIPTION:
*
*
* (C) Copyright 2005 by Spectrum Digital Incorporated
* All rights reserved
*
*H***************************************************************************/
/*
* ======== dsk_app.c ========
*
* Version 0.90
*
* This example digitally processes audio data from the line input on the
* AIC23 codec and plays the result on the line output and headphone output.
* It uses the McBSP and DMA to efficiently handle the data transfer without
* significant intervention from the DSP.
*
*
* Data transfer
*
* Audio data is transferred back and forth from the codec through McBSP0,
* a bidirectional serial port. The DMA is configured to take every 16-bit
* signed audio sample arriving on McBSP0 and store it in a buffer in memory
* until it can be processed. Once it has been processed, it is sent back out
* through McBSP0 to the codec for output. DMA channel 4 is used for
* transmitting data to the codec and channel 5 is used to receive data from
* the codec.
*
* The AIC23 codec is configured through the I2C interface.
*
*
* Program flow
*
* When the program is run, the individual DSP/BIOS modules are initialized
* as configured in dsk_app.cdb with the DSP/BIOS configuration tool. The
* main( ) function is then called as the main user thread. In this example
* main( ) performs application initialization and starts the DMA data
* transfers. When main exits, control passes back entirely to DSP/BIOS
* which services any interrupts or threads on an as-needed basis. When
* there is no work to be done, the idle thread is run.
*
* The dmaHwiRcv( ) and dmaHwiXmp interrupt service routines are called when
* buffers have been transmitted or received. is called when a buffer has been
* filled. It contains a state variable named pingOrPong that indicates
* whether the buffer is a PING or PONG buffer. dmaHwi switches the buffer
* state to the opposite buffer and calls the SWI thread processBuffer to
* process the audio data.
*/
/*
* DSP/BIOS is configured using the DSP/BIOS configuration tool. Settings
* for this example are stored in a configuration file called dsk_app.cdb.
* At compile time, Code Composer will auto-generate DSP/BIOS related files
* based on these settings. A header file called dsk_appcfg.h contains the
* results of the autogeneration and must be included for proper operation.
* The name of the file is taken from dsk_app.cdb and adding cfg.h.
*/
#include "aic23.h"
/*
* This program uses Code Composer's Chip Support Library to access
* C55x peripheral registers and interrupt setup. The following
* include files are required for the CSL modules.
*/
#include <csl.h>
#include <csl_irq.h>
#include <csl_dma.h>
#include <csl_mcbsp.h>
#include <csl_irq.h>
#include <csl_gpio.h>
#include <math.h>
/* Noise pre-processing*/
/* In case, the system is connected to ARM through McBSP2 working under SPI mode*/
#define USE_SPI 1
/* Led out and data ready signaling to ARM to start the SPI data transfer */
#define USE_LED 1
/* Signalling led which will trigger the SPI communication with ARM */
#define LED_0 GPIO_PIN6
/* Constants for buffers */
/*Disable this define when including other files in Noise Reduction Package*/
#define FRAME 180
#define BUFFSIZE 2*FRAME
#define BUFFERS 3
/* Function prototypes */
void initIrq( void );
void initDma( void );
void initMcbsp( void );
void setDmaSrc( DMA_Handle hDma, Int16 bufnum );
void setDmaDst( DMA_Handle hDma, Int16 bufnum );
/* Handles */
//The McBSP for communication with AIC23
DMA_Handle hDmaXmt;
DMA_Handle hDmaRcv;
MCBSP_Handle hMcbsp;
#if (USE_SPI)
//The McBSP working as SPI for communication with ARM
DMA_Handle hDmaXmt2;
//DMA_Handle hDmaRcv2; //we only use the transmit side
MCBSP_Handle hMcbsp2;
#endif
//Int32 count = 0;
/* Config Structures */
/* CSL config structure for DMAs */
static DMA_Config dmaCfgReceive = {
DMA_DMACSDP_RMK(
DMA_DMACSDP_DSTBEN_NOBURST,
DMA_DMACSDP_DSTPACK_OFF,
DMA_DMACSDP_DST_DARAM, //???
DMA_DMACSDP_SRCBEN_NOBURST,
DMA_DMACSDP_SRCPACK_OFF,
DMA_DMACSDP_SRC_PERIPH,
DMA_DMACSDP_DATATYPE_16BIT
), /* DMACDSP */
DMA_DMACCR_RMK(
DMA_DMACCR_DSTAMODE_POSTINC,
DMA_DMACCR_SRCAMODE_CONST,
DMA_DMACCR_ENDPROG_OFF,
DMA_DMACCR_REPEAT_OFF,
DMA_DMACCR_AUTOINIT_OFF,
DMA_DMACCR_EN_STOP,
DMA_DMACCR_PRIO_HI,
DMA_DMACCR_FS_DISABLE,
DMA_DMACCR_SYNC_REVT1
), /* DMACCR */
DMA_DMACICR_RMK(
DMA_DMACICR_BLOCKIE_OFF,
DMA_DMACICR_LASTIE_OFF,
DMA_DMACICR_FRAMEIE_ON,
DMA_DMACICR_FIRSTHALFIE_OFF,
DMA_DMACICR_DROPIE_OFF,
DMA_DMACICR_TIMEOUTIE_OFF
), /* DMACICR */
(DMA_AdrPtr)((Uint32)(_MCBSP_DRR11_ADDR<<1)), /* DMACSSAL */
0, /* DMACSSAU */
NULL, /* DMACDSAL, to be loaded by submit */
0, /* DMACDSAU */
BUFFSIZE, /* DMACEN */
1, /* DMACFN */
0, /* DMACFI */
0 /* DMACEI */
};
static DMA_Config dmaCfgTransmit = {
DMA_DMACSDP_RMK(
DMA_DMACSDP_DSTBEN_NOBURST,
DMA_DMACSDP_DSTPACK_OFF,
DMA_DMACSDP_DST_PERIPH,
DMA_DMACSDP_SRCBEN_NOBURST,
DMA_DMACSDP_SRCPACK_OFF,
DMA_DMACSDP_SRC_DARAM, //???
DMA_DMACSDP_DATATYPE_16BIT
), /* DMACDSP */
DMA_DMACCR_RMK(
DMA_DMACCR_DSTAMODE_CONST,
DMA_DMACCR_SRCAMODE_POSTINC,
DMA_DMACCR_ENDPROG_OFF,
DMA_DMACCR_REPEAT_OFF,
DMA_DMACCR_AUTOINIT_OFF,
DMA_DMACCR_EN_STOP,
DMA_DMACCR_PRIO_HI,
DMA_DMACCR_FS_DISABLE,
DMA_DMACCR_SYNC_XEVT1
), /* DMACCR */
DMA_DMACICR_RMK(
DMA_DMACICR_BLOCKIE_OFF,
DMA_DMACICR_LASTIE_OFF,
DMA_DMACICR_FRAMEIE_ON,
DMA_DMACICR_FIRSTHALFIE_OFF,
DMA_DMACICR_DROPIE_OFF,
DMA_DMACICR_TIMEOUTIE_OFF
), /* DMACICR */
NULL, /* DMACSSAL */
0, /* DMACSSAU */
(DMA_AdrPtr)((Uint32)(_MCBSP_DXR11_ADDR<<1)),/* DMACDSAL */
0, /* DMACDSAU */
BUFFSIZE, /* DMACEN */
1, /* DMACFN */
0, /* DMACFI */
0 /* DMACEI */
};
#if (USE_SPI)
static DMA_Config dmaCfgTransmit2 = {
DMA_DMACSDP_RMK(
DMA_DMACSDP_DSTBEN_NOBURST,
DMA_DMACSDP_DSTPACK_OFF,
DMA_DMACSDP_DST_PERIPH,
DMA_DMACSDP_SRCBEN_NOBURST,
DMA_DMACSDP_SRCPACK_OFF,
DMA_DMACSDP_SRC_DARAM, //???
DMA_DMACSDP_DATATYPE_16BIT
), /* DMACDSP */
DMA_DMACCR_RMK(
DMA_DMACCR_DSTAMODE_CONST,
DMA_DMACCR_SRCAMODE_POSTINC,
DMA_DMACCR_ENDPROG_OFF,
DMA_DMACCR_REPEAT_OFF,
DMA_DMACCR_AUTOINIT_OFF,
DMA_DMACCR_EN_STOP,
Driver5509.rar_DSP C5509A_audio dsp_dsp DMA_parts2fp_welcome9qr
版权申诉
47 浏览量
2022-07-15
02:00:56
上传
评论
收藏 444KB RAR 举报
APei
- 粉丝: 64
- 资源: 1万+
最新资源
- 整卷预览.mhtml
- MySQL是一种广泛使用的开源关系型数据库管理系统,它提供了丰富的SQL语句用于数据库的创建、查询、更新和管理 以下是一些常见的
- MySQL是一种广泛使用的开源关系型数据库管理系统,它提供了丰富的SQL语句用于数据库的创建、查询、更新和管理 以下是一些常见
- MySQL是一种广泛使用的开源关系型数据库管理系统,它提供了丰富的SQL语句用于数据库的创建、查询、更新和管理 以下是一些常见的
- 基于Javascript的结婚请帖设计源码 - Invitation
- mysql语句大全及用法
- mysql语句大全及用法
- mysql语句大全及用法
- MySQL是一种广泛使用的开源关系型数据库管理系统
- MySQL是一种广泛使用的开源关系型数据库管理系统
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈