| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
Texas Instruments ABSTRACT This application report describes AIC24 cod
Top Searches for this datasheetHands-Free Kit: Integration AIC24 Driver Reference Framework Texas Instruments ABSTRACT This application report describes AIC24 codec driver used Hands-Free (HFK) system presents integration Reference Framework (RF3). Reference Frameworks have been developed Texas Instruments provide foundation easy integration eXpressDSP-compliant algorithms DSP/BIOS environment. This report designed tutorial help users understand integrate software modules RF3. application report presents first implementation AIC24 driver. Second customization standard package system presented. Third, integration AIC24 driver with described. Software Applications Contents Introduction Getting Started AIC24 Driver Implementation AIC24 Driver 3.1.1 Hfk5407.c 3.1.2 Hfk5407_drvGbl.c 3.1.3 Hfk5407_aic24.c 3.1.4 Aic24.c Modifying System Folder Structure Customizing System Integrating AIC24 Driver Conclusion List Figures Figure Figure Figure Block Diagram Loopback Audio Example hfk5407_aic24 Buffers System Folder Structure Trademarks property their respective owners. SPRA966 Introduction Hands-Free Development Platform (HFK system described this application report developed open system based DSP/BIOS RF3. This system implemented motherboard that features TMS320C5407 TLV320AIC24 codec from Texas Instruments. This application reports describes implementation AIC24 driver integration RF3. integration AIC24 codec presented tutorial format help understand process. final result this tutorial provided folder block diagram this example provided Figure example hfk5407_aic24 developed using files provided Code Composer Studio 2.20. AIC24 driver McBSP Data move AIC24 McBSP Figure Block Diagram Loopback Audio Example hfk5407_aic24 NOTE: Before executing HFK-related code Code Composer Studio, please update chip support library (CSL) Code Composer Studio with provided SDK. located HFK\Src\misc\CSL. Getting Started This section will provide necessary steps audio loopback example, hfk5407_aic24 provided with SDK. Updating libraries updated libraries header files provided file HFK\Src\misc\CSL\c54xx.zip Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Unzip file c54xx.zip temporary folder temp Create temp\include temp\lib directories temporary folder. Inspect folder where current libraries located. libraries installed part Code Composer Studio installation process. default, they located c:\ti\c5400\bios\include c:\ti\c5400\bios\lib. Copy content temp\lib temp\include respective Code Composer Studio folders c:\ti\c5400\bios\include c:\ti\c5400\bios\lib. Overwrite existing file. replace Code Composer Studio folders with ones temporary folder because Code Composer Studio folders contain additional useful DSP/BIOS libraries. Preparing hardware Connect JTAG cable Connect player microphone input using audio cable provided HFK. Connect amplified speaker speaker output EVM. Power-up Running audio loopback example hfk5407_aic24 Start Code Composer Studio open project called app.pjt located using Project Open Menu command. Load file provided HFK\Src\GEL Load executable app.out from .\Debug subdirectory with File Load Program Start audio source. code: Select Debug from Debug menu press audio signal will heard amplified speaker. Inspecting project files project view window left-hand side Code Composer Studio screen, examine project. Open Source folder examine project files. Open file hfk5407_aic24.c. This file defines functions: function HFK5407_AIC24_init() (line 154) used initialize aic24 driver function HFK5407_AIC24_DMA_isr() (line 295) aic24 driver interrupt service routine (ISR). Note that swiHfkAudio object posted HFK5407_AIC24_DMA_isr(line 328). breakpoint HFK5407_AIC24_DMA_isr() function select Debug Animate from Debug menu press F12. will called every time there buffers available processing. Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Remove breakpoint close file hfk5407_aic24.c. Open file hfk5407_drvGbl.c. This file defines function HFK5407_audioBuffer_init() (line used initialize aic24 driver buffers. This function called during initialization process. file hfk5407_drvGbl.c, aic24 driver buffers liMicData[] loSpkData[] defined Determine starting addresses buffers setting cursor first letter name. Write down addresses buffers. They will used later view signal with graph tool. Close file hfk5407_ drvGbl.c Code Composer Studio window select View menu View Graph Time/Frequency. Graph Property Dialog window will open. Modify following fields: Start Address: address liMicData[] buffer Acquisition Buffer Size: Display Data Size: Data Type: 16-bit signed integer should something similar Select Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Graph Window will display content buffer. order update display right-click select Refresh. first locations represent AIC24 Channel receive buffer next locations through 127) represent AIC24 Channel receive buffer. Open file thrHfkAudio_aic24.c. This file defines functions: function thrHfkAudioInit() (line used initialize Audio thread function thrHfkAudioRun() (line thread processing function associated with swiHfkAudio object. function thrHfkAudioRun() called DSP/BIOS kernel after swiHfkAudio object posted ISR. example hfk5407_aic24 this function performs simple data move. AIC24 Driver AIC24 driver provided with available folder driver includes: header files: aic24.h, hfk5407_aic24.h source code: aic24.c, hfk5407_aic24.c Global variables buffers used driver provided same folder. header files: hfk5407_drvGbl.h source code: hfk5407_drvGbl.c Implementation AIC24 Driver AIC24 driver implemented files aic24.c, hfk5407_aic24.c hfk5407_drvgbl.c associated their respective header files. operation driver depends also functions implemented file hfk5407.c. Before describing these files detail summary each file presented. Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 hfk5407.c file hfk5407.c located HFK\Src\evmInit implements function AIC24_resetInit() used take AIC24 reset. hfk5407_drvGbl.c file hfk5407_drvGbl.c located HFK\Src\drivers\drv8kHz_nobsync defines initializes global variables structures used AIC24 driver. hfk5407_aic24.c file hfk5407_aic24.c located HFK\Src\drivers\drv8kHz_nobsync implements AIC24 driver initialization function that defines, initializes starts McBSP port channels used AIC24 driver. also implements Interrupt Service Routine (ISR) used AIC24 driver. aic24.c This file located HFK\Src\drivers\drv8kHz_nobsync implements AIC24_setParams() function that programs AIC24 with parameters defined file aic24.h 3.1.1 Hfk5407.c file hfk5407.c contains HFK5407 initialization functions. function AIC24_resetInit()is used take AIC24 reset. This accomplished writing CDCRST field MISCREG register defined PLD. more information about this register reader referred Texas Instruments Hands-Free Development Platform User's Guide (SPRU703) 3.1.2 Hfk5407_drvGbl.c file hfk5407_drvGbl.c defines global variables, structures arrays used AIC24 driver. also implements functions that initialize these global variables. data buffers used AIC24 driver defined this file. line input Microphone data buffer, liMicData[], line output Speaker data buffer loSpkData[], have same size FRAME_SIZE_8K*4. This corresponds ping/pong buffers each channel. Since AIC24 channels this represents total four buffers input four buffers output. size buffer defined FRAME_SIZE_8K AIC24 Data Buffers #pragma #pragma #pragma #pragma Codec Buffers 8kHz liMicData[FRAME_SIZE_8K*4]; loSpkData[FRAME_SIZE_8K*4]; notice that AIC24 buffers have been allocated specifically .HFK_AUDIO memory section using #pragma DATA_SECTION directive. This accomplished order ensure that AIC24 buffers will allocated internal memory. this been specified, buffers would have been allocated part general .bss section which allocated user external memory. AIC24 driver uses global variable, bufActive, specify buffers available processing. also uses global structure dmaBufPtrs store pointers driver buffers. Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 AIC24 Global Variables volatile unsigned short bufferActive; volatile DMA_BUF_PTRS dmaBufPtrs[1]; global variables structures initialized function void HFK5407_audioBufferInit(void) implemented file hfk5407_drvGbl.c This function initializes bufActive dmaBufPtrs. output buffers initialized zero order avoid re-programming AIC24. Indeed, AIC24 normally operated continuous data transfer mode. this mode, control mode reactivated when AIC24 operated 15+1 data format mode setting AIC24 input data more information about modes operation AIC24 reader referred TLV320AIC24 Data Manual (SLAS366). void HFK5407_audioBufferInit(void) off_0,i Initialize Global Variables bufActive MUST initialize buffers otherwise will re-program AIC24*/ (i=0; FRAME_SIZE_8K*4; i++){ loSpkData[i] Buffers off_0 off_0 2*FRAME_SIZE_8K; off_0 2*FRAME_SIZE_16K; (unsigned short)&loSpkData[off_0]; (unsigned short)&liMicData[off_0]; (unsigned short)&loSpkData[off_0]; (unsigned short)&liMicData[off_0]; 3.1.3 Hfk5407_aic24.c file hfk5407_aic24.c implements initialization function AIC24 driver. connects AIC24 serial port McBSP This property board changed. channels connected McBSP defined software changed. However before changing channels user must familiar with system order fully understand where changes need made. AIC24 software uses McBSP port channels defined header file hfk5407_aic24.h: #define HFK5407_AIC24_RXDMAID_DEFAULT #define HFK5407_AIC24_TXDMAID_DEFAULT #define HFK5407_AIC24_MCBSPID_DEFAULT chip support library (CSL) used program McBSP port channels. McBSP configuration structure, MCBSP_Config mcbspCfgAic24, defined file hfk5407_aic24.c. Some remarks about serial port configuration: Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Free running mode. Free running mode enabled Serial Port Control Register (SPCR2). This feature used emulation purposes. External frame-synchronization clock signals frame-synchronization clock signals provided externally AIC24. Control Register (PCR) accordingly. Frame word lengths. AIC24 operated continuous mode. this mode serial port operates with 16-bit words frame. These settings defined Receive Control Register (RCR1) Transmit Control Register (XCR1). Data Delay (R/X) DATDLY AIC24 requires McBSP operated with data delay. config structure McBSP AIC24 connected MCBSP const MCBSP_Config mcbspCfgAic24 MCBSP_SPCR1_RMK( MCBSP_SPCR1_DLB_OFF, MCBSP_SPCR1_RJUST_RZF, MCBSP_SPCR1_CLKSTP_DEFAULT, MCBSP_SPCR1_DXENA_NA, MCBSP_SPCR1_RINTM_RRDY, MCBSP_SPCR1_RRST_DISABLE MCBSP_SPCR2_RMK( MCBSP_SPCR2_FREE_YES, MCBSP_SPCR2_SOFT_DEFAULT, MCBSP_SPCR2_FRST_RESET, MCBSP_SPCR2_GRST_RESET, MCBSP_SPCR2_XINTM_XRDY, MCBSP_SPCR2_XRST_DISABLE MCBSP_RCR1_RMK( MCBSP_RCR1_RFRLEN1_OF(1), MCBSP_RCR1_RWDLEN1_16BIT MCBSP_RCR2_RMK( MCBSP_RCR2_RPHASE_SINGLE, MCBSP_RCR2_RFRLEN2_OF(0), MCBSP_RCR2_RWDLEN2_8BIT, MCBSP_RCR2_RCOMPAND_MSB, MCBSP_RCR2_RFIG_YES, MCBSP_RCR2_RDATDLY_1BIT MCBSP_XCR1_RMK( MCBSP_XCR1_XFRLEN1_OF(1), MCBSP_XCR1_XWDLEN1_16BIT MCBSP_XCR2_RMK( MCBSP_XCR2_XPHASE_SINGLE, MCBSP_XCR2_XFRLEN2_OF(0), MCBSP_XCR2_XWDLEN2_8BIT, MCBSP_XCR2_XCOMPAND_MSB, RJUST CLKSTP DXENA RINRRST FREE SOFT FRST GRST XINXRST RFRLEN1 RWDLEN1 words/frame ;16-bit words RPHASE RFRLEN2 RWDLEN2 RCOMPAND RFIG RDATDLY XFRLEN1 XWDLEN1 words/frame 16-bit words XPHASE XFRLEN2 XWDLEN2 XCOMPAND Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 MCBSP_XCR2_XFIG_YES, MCBSP_XCR2_XDATDLY_1BIT MCBSP_SRGR1_RMK( MCBSP_SRGR1_FWID_OF(0), MCBSP_SRGR1_CLKGDV_OF(0) MCBSP_SRGR2_RMK( MCBSP_SRGR2_GSYNC_FREE, MCBSP_SRGR2_CLKSP_RISING, MCBSP_SRGR2_CLKSM_DEFAULT, MCBSP_SRGR2_FSGM_DXR2XSR, MCBSP_SRGR2_FPER_OF(0) MCBSP_MCR1_DEFAULT, MCBSP_MCR2_DEFAULT, MCBSP_PCR_RMK( MCBSP_PCR_XIOEN_SP, MCBSP_PCR_RIOEN_SP, MCBSP_PCR_FSXM_EXTERNAL, MCBSP_PCR_FSRM_EXTERNAL, MCBSP_PCR_CLKXM_INPUT, MCBSP_PCR_CLKRM_INPUT, MCBSP_PCR_FSXP_ACTIVEHIGH, MCBSP_PCR_FSRP_ACTIVEHIGH, MCBSP_PCR_CLKXP_RISING, MCBSP_PCR_CLKRP_FALLING MCBSP_RCERA_DEFAULT, MCBSP_RCERB_DEFAULT, MCBSP_XCERA_DEFAULT, MCBSP_XCERB_DEFAULT XFIG XDATDLY FWID CLKGDV FREE CLKSP CLKSM FSGM FPER XIOEN RIOEN FSXM FSRM CLKXM CLKRM FSXP FSRP CLKXP CLKRP structures also defined this file. structure provided receive channel structure transmit channel. config structure AIC24 DMAs const DMA_Config dmaRxCfgAic24 0x0000, 0xC055, 0x3000, (DMA_AdrPtr)0x0031, (DMA_AdrPtr)0x0000, 0x0000, const DMA_Config dmaTxCfgAic24 0x0000, 0xC541, 0x3000, (DMA_AdrPtr)0x0000, (DMA_AdrPtr)0x0033, 0x0000, Channel Priority (0x0000 0x0001) Transfer Mode Control Register (DMMCR) Sync Event Frame Count Register (DMSFC) Source Address Register (DMSRC) Numeric Destination Address Register (DMDST) Numeric Element Count Register (DMCTR) Channel Priority (0x0000 0x0001) Transfer Mode Control Register (DMMCR) Sync Event Frame Count Register (DMSFC) Source Address Register (DMSRC) Numeric Destination Address Register (DMDST) Element Count Register (DMCTR) Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Some remarks about channel configurations: Autoinitialization system uses autoinitialization channels enabled (AUTOINIT Interrupt Generation interrupts generated transfers defined Transfer Mode Control (DMMCRn) register. system interrupts generated ONLY receive channel. transmit channel does generate interrupts. Synchronization Events synchronization events defined DSYN field Sync Event Frame Count (DMSFCn) Register. system BOTH channels synchronized McBSP receive event (REVT2). This setting enables synchronize receive transmit channel only receive channel interrupt. Addressing Modes system channels operate multiframe mode. This mode operation selected setting zero CTMOD DMMCR. multiframe mode, data transfers structured multiple elements frame multiple frames block. system uses element index register DMIDX0 step next value within frame frame-index register DMFRI0 step next frame. source destination address transfer mode bits defined SIND DIND fields DMMCR. system uses Postincrement with index offset (DMIDX0 DMFRIO) both fields. 3.1.3.1 AIC24 Initialization Function initialization function AIC24 driver, HFK5407_AIC24_init() defined hfk5407_aic24.c file. This function calls AIC24 configuration function AIC24_setParams() passes pointer default AIC24 configuration array. configuration function AIC24_setParams defined file aic24.c will described next section. default AIC24 configuration defined file aic24.h. ======== HFK5407_AIC24_init ======== Should called once power init AIC24 void HFK5407_AIC24_init(void) eventRx; imask; volatile dummy; HFK5407_AIC24_DevParams attrsAic24 HWI_ATTRS; *params; defaults attrs params (HFK5407_AIC24_DevParams *)&defaultParams; Configuration Function Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 After configuring AIC24, function initializes params object with structures that will used configure McBSP port channels. params->mcbspCfg (MCBSP_Config*)&mcbspCfgAic24; params->dmaRxCfg (DMA_Config*)&dmaRxCfgAic24; params->dmaTxCfg (DMA_Config*)&dmaTxCfgAic24; After these initial steps, HFK5407_AIC24_init() function uses DSP/BIOS functions disable interrupts open configure McBSP port channels. Disable interrupts globally (INTM) imask HWI_disable(); open configure McBSP params->hMcbsp MCBSP_open(params->McbspId, MCBSP_OPEN_RESET); MCBSP_config(params->hMcbsp, params->mcbspCfg); open configure DMAs params->hDmaRx DMA_open(params->dmaRxId, DMA_OPEN_RESET); params->hDmaTx DMA_open(params->dmaTxId, DMA_OPEN_RESET); DMA_config(params->hDmaRx params->dmaRxCfg); DMA_config(params->hDmaTx params->dmaTxCfg); Then, function completes initialization controller. First, some fields channel priority enable control (DMPREC) Register set. FREE order transfers continue even emulator stopped. INTOSEL field order activate interrupts channels AUTOIX order enable presence autoinitialization registers channels. beware this global register! DMA_FSET(DMPREC, FREE, using AIC24 Enable AUTOINIT mode each DMA: AUTOIX DMPREC DMPREC DMPREC|0x4000; Second, channel autoinitialization registers initialized. Initialize Autoinit Registers DMSBAR DMSBAI DMSBAI DMSBAI DMSBAI DMSBAR DMSBAI DMSBAI DMSBAI DMSBAI DMGSA0_SUBADDR; MCBSP2_DRR1_ADDR; McBSP2 data register buffer pong address words frame*/ 0x3000|(FRAME_SIZE_8K-1); DMGSA1_SUBADDR; buffer pong address MCBSP2_DXR1_ADDR; McBSP2 data register words frame*/ 0x3000|(FRAME_SIZE_8K-1); Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Third, complete initialization active registers. Complete initialization DMAs Configure Channel Receive McBsp2(AIC24) DMSBAR DMSRC0_SUBADDR; point DMSRC0 register DMSBAI MCBSP2_DRR1_ADDR; McBSP2 data register DMSBAI buffer ping address DMSBAI words frame*/ DMSBAI 0x3000|(FRAME_SIZE_16K-1); DMSBAI 0x3000|(FRAME_SIZE_8K-1); REVT2 Configure Channel Transmit McBsp2 (AIC24) SYNC=0010 DMSBAR DMSRC1_SUBADDR; point DMSRC1 register DMSBAI buffer ping address DMSBAI MCBSP2_DXR1_ADDR; McBSP2 data register DMSBAI words frame DMSBAI 0x3000|(FRAME_SIZE_16K-1); DMSBAI 0x3000|(FRAME_SIZE_8K-1); REVT2 Multi-frame for(AIC24) channels (i.e. buffer length FRAME_SIZE_8K DMSBAR DMIDX0_SUBADDR; DMSBAN FRAME_SIZE_16K; DMIDX0 step next sample frame DMSBAN FRAME_SIZE_8K; DMSBAR DMFRI0_SUBADDR; DMSBANI 1-(FRAME_SIZE_16K); DMFRI0 step next frame DMSBANI 1-(FRAME_SIZE_8K); Figure shows organization buffers system. transfers will alternate between ping/pong buffers. Each ping/pong buffer size 2xFRAME_SIZE_8K divided channel channel buffer. transfer ping/pong buffer transferred. result 2xFRAME_SIZE_8K samples transferred during each transfer. Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 liMicData Ping FRAME_SIZE_8K Ping FRAME_SIZE_8K loSpkData Ping FRAME_SIZE_8K Ping FRAME_SIZE_8K Pong FRAME_SIZE_8K Pong FRAME_SIZE_8K Pong FRAME_SIZE_8K Pong FRAME_SIZE_8K Figure Buffers System After completing initialization controller, initialization function plugs AIC24 ISR, HFK5407_AIC24_DMA_isr, vector table using HWI_dispatchPlug DSP/BIOS function. structure type HWI_Attrs used specify HWI's dispatcher properties. Only intMask value interest. other values default ones. function uses intrMask value 0xFFFF order mask interrupts while executing HWI. receive channel interrupt enabled McBSP port channels started. Before exiting initialization function global interrupts enabled. eventRx DMA_getEventId(params->hDmaRx); Clear pending IRQ_clear (eventRx); interrupts plug interrupt vector using DSP/BIOS Dispatcher Disable interrupts during ISR, 0x0000 attrsAic24.intrMask 0xFFFF; HWI_dispatchPlug(eventRx, (Fxn)HFK5407_AIC24_DMA_isr, &attrsAic24); RESET McBsp registers*/ Enable interrupts IRQ_enable(eventRx); imask HWI_disable(); Start DMAs DMA_start(params->hDmaRx); DMA_start(params->hDmaTx); Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Start MCBSPs MCBSP_start(params->hMcbsp, MCBSP_RCV_START, 0x0); MCBSP_start(params->hMcbsp, MCBSP_XMIT_START, 0x0); Purge McBsp Buffer Clear pending interrupts IRQ_clear (eventRx); HWI_restore(imask); Enable interrupts globally (INTM) IRQ_globalEnable(); 3.1.3.2 AIC24 Interrupt Service Routine AIC24 implemented file hfk5407_aic24.c. called when receive channel interrupt occurs completion transfer. updates autoinitialization registers based value bufActive global flag. After updating autoinitialization registers, updates bufActive flag posts processing SWI, swiAudio. AIC24 Interrupt Service Routine void HFK5407_AIC24_DMA_isr(void) Called when completes transfer unsigned short volatile unsigned short tmpreg; Save address register tmpreg DMSBAR; (bufActive)?0:1; DMSBAR DMSBAI DMSBAI DMSBAI DMSBAI DMSBAI DMSBAR DMSBAI DMSBAI DMSBAI DMSBAI DMSBAI DMGSA0_SUBADDR; MCBSP2_DRR1_ADDR; McBSP2 data receive register Receieve buffer address words frame*/ FRAME_SIZE_8K-1; FRAME_SIZE_16K-1; DMGSA1_SUBADDR; Transmit buffer address MCBSP2_DXR1_ADDR; McBSP2 data transmit register words frame*/ FRAME_SIZE_8K-1; FRAME_SIZE_16K-1; Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Restore address register DMSBAR=tmpreg; Update BufferActive Flag BufferActive (BufferActive)?0:1; Post SWI_post(&swiHfkAudio); 3.1.4 Aic24.c file aic24.c implements AIC24 configuration function AIC24_setParams AIC24 programmed through serial port (McBSP McBSP programmed using Chip Support Library (CSL) with following initialization structure: /*This config will used only AIC24 initialization*/ const MCBSP_Config mcbspCfgAic24Init MCBSP_SPCR1_RMK( MCBSP_SPCR1_DLB_OFF, MCBSP_SPCR1_RJUST_RSE, MCBSP_SPCR1_CLKSTP_DEFAULT, MCBSP_SPCR1_DXENA_NA, MCBSP_SPCR1_RINTM_RRDY, MCBSP_SPCR1_RRST_DISABLE MCBSP_SPCR2_RMK( MCBSP_SPCR2_FREE_YES, MCBSP_SPCR2_SOFT_DEFAULT, MCBSP_SPCR2_FRST_RESET, MCBSP_SPCR2_GRST_RESET, MCBSP_SPCR2_XINTM_FRM, FS*/ MCBSP_SPCR2_XRST_DISABLE MCBSP_RCR1_RMK( MCBSP_RCR1_RFRLEN1_OF(3), MCBSP_RCR1_RWDLEN1_16BIT MCBSP_RCR2_RMK( MCBSP_RCR2_RPHASE_SINGLE, MCBSP_RCR2_RFRLEN2_OF(0), MCBSP_RCR2_RWDLEN2_8BIT, MCBSP_RCR2_RCOMPAND_MSB, MCBSP_RCR2_RFIG_YES, MCBSP_RCR2_RDATDLY_1BIT MCBSP_XCR1_RMK( MCBSP_XCR1_XFRLEN1_OF(3), MCBSP_XCR1_XWDLEN1_16BIT MCBSP_XCR2_RMK( MCBSP_XCR2_XPHASE_SINGLE, MCBSP_XCR2_XFRLEN2_OF(0), MCBSP_XCR2_XWDLEN2_8BIT, MCBSP_XCR2_XCOMPAND_MSB, RJUST CLKSTP DXENA RINRRST FREE SOFT FRST GRST XIN XINT generated XRST RFRLEN1 words/rx frame RWDLEN1 16-bit worfds RPHASE RFRLEN2 RWDLEN2 RCOMPAND RFIG RDATDLY XFRLEN1 XWDLEN1 words/tx prog frame 16-bit words*/ XPHASE XFRLEN2 XWDLEN2 XCOMPAND Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 MCBSP_XCR2_XFIG_YES, MCBSP_XCR2_XDATDLY_1BIT MCBSP_SRGR1_RMK( MCBSP_SRGR1_FWID_OF(0), MCBSP_SRGR1_CLKGDV_OF(0) MCBSP_SRGR2_RMK( MCBSP_SRGR2_GSYNC_FREE, MCBSP_SRGR2_CLKSP_RISING, MCBSP_SRGR2_CLKSM_DEFAULT, MCBSP_SRGR2_FSGM_DXR2XSR, MCBSP_SRGR2_FPER_OF(13) MCBSP_MCR1_DEFAULT, MCBSP_MCR2_DEFAULT, MCBSP_PCR_RMK( MCBSP_PCR_XIOEN_SP, MCBSP_PCR_RIOEN_SP, MCBSP_PCR_FSXM_EXTERNAL, MCBSP_PCR_FSRM_EXTERNAL, MCBSP_PCR_CLKXM_INPUT, MCBSP_PCR_CLKRM_INPUT, MCBSP_PCR_FSXP_ACTIVEHIGH, MCBSP_PCR_FSRP_ACTIVEHIGH, MCBSP_PCR_CLKXP_RISING, MCBSP_PCR_CLKRP_FALLING MCBSP_RCERA_DEFAULT, MCBSP_RCERB_DEFAULT, MCBSP_XCERA_DEFAULT, MCBSP_XCERB_DEFAULT XFIG XDATDLY FWID CLKGDV FREE CLKSP CLKSM FSGM FPER XIOEN RIOEN FSXM FSRM CLKXM CLKRM FSXP FSRP CLKXP CLKRP AIC24_setParams() function disables first global interrupts using DSP/BIOS HWI_disable() function. Void AIC24_setParams(AIC24_Params *params) imask; unsigned XmtEventId; MCBSP_Handle hMcbsp; Temporarily disable maskable interrupts, preserving previous state INimask HWI_disable(); Then, INTOSEL field DMPREC register order activate McBSP transmit interrupt (BXINT2) using AIC24 Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 McBSP opened configured using functions plugged interrupt vector table using HWI_dispatchPlug() DSP/BIOS function. Then, McBSP transmit interrupt enabled. function global interrupts enabled McBSP started. open configure McBSP hMcbsp MCBSP_open(MCBSP_PORT2, MCBSP_OPEN_RESET); &mcbspCfgAic24Init); event ID's McBSP interrupt provides location XmtEventId MCBSP_getXmtEventId(hMcbsp); Clear pending MCBSP interrupts IRQ_clear(XmtEventId); plug interrupt vector using HWI_dispatchPlug() HWI_dispatchPlug(XmtEventId, (Fxn)ISR_frameSync, NULL); Enable MCBSP interrupt IRQ_enable(XmtEventId); Enable interrupts globally (INTM) IRQ_globalEnable(); Start McBSP MCBSP_start(hMcbsp, MCBSP_XMIT_START, 100); McBSP interrupt used order synchronize transmission control words with frame synch signal. After AIC24 comes reset operating programming mode. this mode every frame slots: data slots control slots. special function static void AIC24_writeControlWords implemented manage transmission control words. notice that this function sends during frame following valid data transmission frame order avoid over writing channel control word with channel control word which still present MCBSP Data Transmit Register (DXR) when next frame synch occurs. value valid command therefore will alter values already programmed. void hMcbsp,unsigned EventId,int datch1, datch2) Wait next Frame Synch start AIC24_waitNextFS(); write dummy data Data Frame slots Slot written with Garbage //CH1 (Slot0) Data Frame Garbage content when occurs AIC24_write(hMcbsp,0) //CH2 (Slot1) Data Frame write control data Control Frame slots AIC24_write(hMcbsp, datch1) //CH1 (Slot2) Control Frame AIC24_write(hMcbsp, datch2) //CH2 (Slot3) Control Frame wait config take effect AIC24_waitNextFS(); Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Slot written with Garbage //CH1 (Slot0) Data Frame Garbage content occurs AIC24_write(hMcbsp,0) //CH2 (Slot1) Data Frame write control data Control Frame slots AIC24_write(hMcbsp, //CH1 (Slot2) Control Frame AIC24_write(hMcbsp, //CH2 (Slot3) Control Frame There some more functions which used file aic24.c perform codec programming. Since these functions easy understand they described here. reader invited inspect these functions study they used. Modifying System standard Reference Framework (RF) package available download Texas Instruments website. tutorial provided this application report based version 2.1. source code reference framework provided folder HFK\Src\misc\RF2.1 time publication version also available, however there need upgrade RF2.2 since this release only brings support C6000 DSKs. This tutorial designed provide concepts integration system environment system uses which best suited static applications which require many channels. more detailed information about reader referred Reference Frameworks eXpressDSP Software: Flexible, Multichannel, Multi-Algorithm, Static System (SPRA793). following section excerpt this document. Folder Structure Reference Framework folder tree contains application sources library modules. begin explore examining folder tree that contains application associated files. recommend that retain provided structure your development. Figure shows folders used highlights some important files they contain. Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 algorithm default parameters function wrappers fir.c fir.h ifir.c algorithm default parameters function wrappers vol.c vol.h ivol.c Platformindependent scripts Platform-specific files app.pjt app.cdb app.gel appIO.c target _devParams.c appcfg.tcf appBoard.tci Target_mem.tci Target_udevCodec.tci makeConfig.bat link.cmd modules used appGlobal.tci appInstrument.tci appParams.tci appPipes.tci appThreads.tci Platform-independent code appMain.c appBiosObjects.h appIO.h appResources.c, appThreads.c, thrAudioproc.c, thrControl.c, thrRxSplit.c, thrTxJoin.c, Figure Folder Structure Folders notice include: apps\rf3. Contains Code Composer Studio projects that make RF3. modify RF3, make copy rf3\ tree same folder level, modify copy. appConfig. Contains hardware-independent script files configuration. appModules. Contains hardware-independent files application. This includes implementation threads (thr*.* files) initialization code (app*.*). target. Contains hardware-specific files application. This includes configuration files, project file, linker file. These files placed platform-named folders that provided multiple platforms. algFIR. Contains application-side wrappers communicating with algorithm. Your algorithms wrapped similarly match structure. example, might create algMP3 folder. algVOL. Contains application-side wrappers communicating with algorithm. include. Contains number public header files used Reference Frameworks. uses some, all, these header files. Public header files referenced both algorithm framework code. contrast, private header files stored with source code that includes them intended other modules. Each library module header file this folder. Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 lib. Contains number library files linked with Reference Framework applications. uses some, all, these libraries. Each library module library chip this folder. src. Contains folders with source files modules include folders. readme.txt files each these folders provide information about modules their use. Library modules typically need little modification. modules used are: algrf. Contains source files IALG implementation used instantiate eXpressDSP-compliant algorithms using DSP/BIOS module dynamic memory allocation. fir_ti. Contains files Finite Impulse Response (FIR) filter, eXpressDSP-compliant algorithm provided Texas Instruments used default RF3. vol_ti. Contains files Volume algorithm, eXpressDSP-compliant algorithm provided Texas Instruments used default RF3. utl. Contains source files debugging diagnostics module. Reference Frameworks distribution does include source code device driver modules. Such files obtained part DSP/BIOS Driver Developer's (DDK). need order Reference Frameworks-the driver library public header files included Reference Frameworks distribution. details about mini-driver development use, DSP/BIOS Driver Developer's Guide (SPRU616). Customizing System This section describes customize package system. information this section presented that will help reader understand step step process. Removing folders files required system Start with standard package: Start Windows Explorer extract file sprc063.zip available HFK\Src\misc\RF2.1 folder. self extractable file will produced. This file will extract file rf_v2_10_00_11.zip Unzip this file folder called RF3_myHFK Delete folders: Delete batch files used build projects platforms: Delete source code folders EXCEPT: Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Delete libraries EXCEPT: algmin.l54f algrf.l54f utl.l54f Delete include files EXCEPT: Delete board specific application folders EXCEPT: Delete XDAIS wrapper function folders: Delete following Applications Modules Files: appIO.h appIO.c dsk5402_devParams.c thrRxSplit.c,h thrTxSplit.c,h thrControl.c,h thrAudioproc.c,h Preparing project folder 5407 this dsk5402 application folder will modified 5407 platform. Change name folder Open Code Composer Studio project called app.pjt located Code Composer Studio window will open with message "Cannot find file Select "Remove". Repeat this action many times prompted remove files from project. Updating global settings Code Composer Studio Project View window open DSP/BIOS Config folder. Open configuration file app.cdb double-clicking file Project View window. Open System folder, right-click Global Settings inspect properties. Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 need initialize settings with following values 5407 EVM: Select Apply Removing DSP/BIOS objects required system Scheduling: CLK-Clock Manager folder remove clkControl object right-clicking selecting Delete. Scheduling: folder remove objects. Input/Output: folder remove objects. Input/Output: Device Drivers: User-Defined Devices folder remove udevCodec object Save close DSP/BIOS config file app.cdb Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Integrating AIC24 Driver This section describes integrate AIC24 codec driver RF3. information this section presented Lab. Integrating AIC24 driver with customized AIC24 driver files RF3. Copy folders: HFK\Src\drivers HFK\Src\evmInit Copy header files include folder. Copy files: \evmInit\ hfk5407.h \drivers\ include\aic24.h \drivers\ include\hfk5407_aic24.h \drivers\ include\hfk5407_drvGbl.h Creating audio processing thread Create files thrHfkAudio_aic24.c thrHfkAudio.h save them folder. These files created using File icon Code Composer Studio window. thrHfkAudio_aic24.c specific this example whereas file thrHfkAudio.h generic will updated future examples. file thrHfkAudio.h include following: #ifndef THRHFKAUDIO_ #define THRHFKAUDIO_ #include "appResources.h" #include "appThreads.h" #ifdef _cplusplus extern #endif application-wide common info thread-wide common info Include declaration thread functions: Declaration "public" thread functions init function, called from thrInit() extern Void thrHfkAudioInit( Void function, called swiHfkAudio object extern Void thrHfkAudioRun( Void #ifdef _cplusplus #endif extern #endif THRHFKAUDIO_ Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Save close file thrHfkAudio.h. Open file thrHfkAudio_aic24.c include following: #include <std.h> #include <utl.h> #include "appResources.h" #include "appThreads.h" #include "thrHfkAudio.h" debug/diagnostics utility functions application-wide common info thread-wide common info definition thrHfkAudio object #include <hfk5407_drvGbl.h> driver global varaibles #include <hfk5407.h> hfk5407 board info #include <hfk5407_aic24.h> aic24 driver info #include <xdas.h> XDAIS types definition Next define HfkAudio thread initialization function. This function calls AIC24 initialization functions. ========= thrHfkAudioInit ======== Initialization data structures thread, called from appThreads.c:thrInit() init time. Void thrHfkAudioInit( Void HFK5407_AIC24_init(); HFK5407_audioBuffer_init(); Finally, define HfkAudio thread processing function. This function will called swiHfkAudio that will defined next sections. This function will determine active buffers will perform data move. ========= thrHfkAudioRun ======== "body" swiHfkAudio thread. Void thrHfkAudioRun( Void XDAS_Int16 *aicSrcBufL, *aicDstBufL; XDAS_Int16 *aicSrcBufR, *aicDstBufR; XDAS_Int16 i,off; bufActive*FRAME_SIZE_8K*2; aicSrcBufL aicDstBufL FRAME_SIZE_8K; aicSrcBufR aicDstBufR (XDAS_Int16*)&liMicData[off]; (XDAS_Int16*)&loSpkData[off]; (XDAS_Int16*)&liMicData[off]; (XDAS_Int16*)&loSpkData[off]; //INP3 //OUT2 INP2 Ring OUT3 Ring data move. Mask compatibility with those codecs that interpret command flag. FRAME_SIZE_8K; i++) aicDstBufL[i] aicSrcBufL[i] 0xfffe; aicDstBufR[i] aicSrcBufR[i] 0xfffe; Save close file. Save close file thrHfkAudio_aic24.c Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Modifying application files file remove references appIO.h file appIOInit() appIOPrime() functions. call HFK5407 initialization function, HFK5407_init() BEFORE call threads initialization function thrInit(). ======== appMain.c ======== Startup module application initialization: first initializes I/O, then initializes threads, primes pipes. application-specific module initialization should called from here. #include <std.h> #include <utl.h> debug/diagnostics utility functions #include "appResources.h" application-wide common info #include "appThreads.h" thread-wide common info (thrInit() decl.) ======== main ======== main() initializes threads, anything else application might need initialize Void main() name objects used error/warning/general/debug messages UTL_setLogs( &logTrace, &logTrace, &logTrace, &logTrace initialize HFK5407 HFK5407_init(); initialize threads thrInit(); greet user UTL_logDebug( "Application started." fall into BIOS idle loop return; Save close file appMain.c file remove reference intermediate buffer. Declaration intermediate buffers used threads' algorithms this buffer used Audioproc thread. "Sample" usually wide. extern Sample bufAudioproc[ FRAMELEN file remove reference header files threads that have been removed include header files audio thread. Remove definition intermediate buffer. Remove thread initialization functions threads that were removed audio thread. Save close opened files. ======== appThreads.c ======== Initialization threads, definition global variables buffers #include <std.h> Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 #include <algrf.h> #include <utl.h> #include "appResources.h" #include "appThreads.h" #include "thrHfkAudio.h" debug/diagnostics utility functions application-wide common info thread-wide common info definition Audio thread ========= thrInit ======== initialize threads that have Init() function Void thrInit( Void Configure ALGRF module tell names heaps algorithms: argument name heap internal memory: INTERNALHEAP argument name heap external memory: EXTERNALHEAP ALGRF_setup( INTERNALHEAP, EXTERNALHEAP Here invoke specific individual initialization functions threads that have (some them empty) thrHfkAudioInit(); audio thread show heap usage, that threads initialized UTL_showHeapUsage( INTERNALHEAP UTL_showHeapUsage( EXTERNALHEAP Scheduling audio processing thread: Adding object Code Composer Studio Project View window open DSP/BIOS Config folder open configuration file app.cdb. Scheduling: folder right-click select Insert SWI. Rename created object swiHfkAudio. Open swiHfkAudio object (i.e., right-click swiHfkAudio select Properties) following properties: function: priority: mailbox: arg0: arg1: Select Modifying memory System:MEM folder right-click Memory Section Manager inspect properties. Inspect tabs menu move sections allocated EPROG IPROG sections allocated EDATA IDATA. Select _thrHfkAudioRun 0x00000000 0x00000000 Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 Open EDATA memory section modify following properties: base: len: heap size: 0xA000 0x6000 0x300 heap identifier label: _EXTERNALHEAP Open EPROG memory section modify following properties: base: len: 0x0418000 0x8000 single external memory. However this external memory allocated program space data space simultaneously. Since there only physical memory overlapping will occur. more information about external memory reader referred Texas Instruments Hands-Free Development Platform User's Guide (SPRU703) Open IDATA memory section modify following properties: base: len: heap size: 0x0100 0x3f00 0x300 heap identifier label: _EXTERNALHEAP Select Open IPROG memory section modify following properties: base: len: Select Open VECT memory section modify following properties: base: Select Save Close file. Adding files project AIC24 driver files Code Composer Studio project. Right-click app.pjt folder Code Composer Studio Project View window. Select Files Project following files. \evmInit\ hfk5407.c \drivers\ drv8kHz_nobsync\aic24.c \drivers\ drv8kHz_nobsync\hfk5407_aic24.c 0x0080 0x04000 0x4000 Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 \drivers\ audio thread definition file project. thrHfkAudio_aic24.c Changing project build options Select Project\ Build Options Code Composer Studio window. Select Category: Preprocessor. Preprocessor window remove defined symbol APPMONOCODEC change defined symbol CHIP_5402 CHIP_5407. Preprocessor window remove include search paths: .\algFIR;.\algVOL; Select Changing linker command file Open linker command file clicking link.cmd Code Composer Studio Project View window. Remove from linker command file libraries required this example. linker command file user defined .HFK_AUDIO memory section. This section contains buffers global variables used AIC24 driver. This section MUST allocated internal data memory. resulting linker command file should similar include config-generated link command file appcfg.cmd include module implementing XDAIS algs. instantiation procedures algrf.l54f include debugging module needed) utl.l54f SECTIONS .HFK_AUDIO IDATA PAGE Save close linker command file Building project Select Project\Build Code Composer Studio window build project. Load file provided HFK\Src\Gel folder After loading Gel, menu Code Composer Studio window enables C5407_Configuration functions: CPU_Reset, C5407_Init. These functions should executed each time before loading program. Load program using File Load Program menu Connect audio source player) microphone input. audio source available on-board microphones used audio source. Connect speaker output amplified speaker. program. audio signal should heard speaker. Hands-Free Kit: Integration AIC24 Driver Reference Framework SPRA966 signal heard, check been updated Code Composer Studio used. Conclusion This application report described AIC24 driver used system presented step step process integrate this driver RF3. result this integration available folder Hands-Free Kit: Integration AIC24 Driver Reference Framework IMPORTANT NOTICE Texas Instruments Incorporated subsidiaries (TI) reserve right make corrections, modifications, enhancements, improvements, other changes products services time discontinue product service without notice. Customers should obtain latest relevant information before placing orders should verify that such information current complete. products sold subject TI's terms conditions sale supplied time order acknowledgment. warrants performance hardware products specifications applicable time sale accordance with TI's standard warranty. Testing other quality control techniques used extent deems necessary support this warranty. Except where mandated government requirements, testing parameters each product necessarily performed. assumes liability applications assistance customer product design. Customers responsible their products applications using components. minimize risks associated with customer products applications, customers should provide adequate design operating safeguards. does warrant represent that license, either express implied, granted under patent right, copyright, mask work right, other intellectual property right relating combination, machine, process which products services used. Information published regarding third-party products services does constitute license from such products services warranty endorsement thereof. such information require license from third party under patents other intellectual property third party, license from under patents other intellectual property Reproduction information data books data sheets permissible only reproduction without alteration accompanied associated warranties, conditions, limitations, notices. Reproduction this information with alteration unfair deceptive business practice. responsible liable such altered documentation. Resale products services with statements different from beyond parameters stated that product service voids express implied warranties associated product service unfair deceptive business practice. responsible liable such statements. Following URLs where obtain information other Texas Instruments products application solutions: Products Amplifiers Data Converters Interface Logic Power Mgmt Microcontrollers amplifier.ti.com dataconverter.ti.com dsp.ti.com interface.ti.com logic.ti.com power.ti.com microcontroller.ti.com Applications Audio Automotive Broadband Digital Control Military Optical Networking Security Telephony Video Imaging Wireless Mailing Address: Texas Instruments Post Office 655303 Dallas, Texas 75265 Copyright 2003, Texas Instruments Incorporated www.ti.com/audio www.ti.com/automotive www.ti.com/broadband www.ti.com/digitalcontrol www.ti.com/military www.ti.com/opticalnetwork www.ti.com/security www.ti.com/telephony www.ti.com/video www.ti.com/wireless Other recent searchesZXM64P03X - ZXM64P03X ZXM64P03X Datasheet XP0121N - XP0121N XP0121N Datasheet XIO2213 - XIO2213 XIO2213 Datasheet RT1C060UN - RT1C060UN RT1C060UN Datasheet FP106 - FP106 FP106 Datasheet AK4614 - AK4614 AK4614 Datasheet ADR293 - ADR293 ADR293 Datasheet AB26TRJ - AB26TRJ AB26TRJ Datasheet
Privacy Policy | Disclaimer |