0% found this document useful (0 votes)
36 views7 pages

Digital Signals Processing "Lab Report # 12": Group Members

This lab report describes the initialization and configuration of a digital audio codec. It includes functions to reset and initialize the codec registers, configure the analog and digital audio paths, set the sample rate and activate the digital interface. It also initializes the McBSP controller and data buffers required to interface with the codec.

Uploaded by

marryam nawaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views7 pages

Digital Signals Processing "Lab Report # 12": Group Members

This lab report describes the initialization and configuration of a digital audio codec. It includes functions to reset and initialize the codec registers, configure the analog and digital audio paths, set the sample rate and activate the digital interface. It also initializes the McBSP controller and data buffers required to interface with the codec.

Uploaded by

marryam nawaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Digital Signals Processing

“Lab Report # 12”

Group Members:
Name Registeration #
Hifza Sajid Sp-12-Bet-029
Marryam Nawaz Sp-12-Bet-043

Submitted To:
Sir Mubeen Sabir

Submitted on :
16th May, 2014

Comsats Institute of Information Technology, Islamabad


#include <csl_mcbsp.h>

#include <csl_irq.h>

#include "MW_c6xxx_bsl.h"

#include "LAB12cfg.h"

/* Function: Write_Codec_Control ---------------------------------------

* Abstract:

* This function writes Control Word to Codec via McBSP

*/

static void Write_Codec_Control(unsigned short Register, unsigned short Data)

volatile unsigned int i;

/* Mask off lower 9 bits */

Data &= 0x1ff;

/* Wait for XRDY signal before writing data to DXR */


while (!MCBSP_xrdy(hMcbspCtrl));

for (i=0; i<1000; i++); // Extra wait required if using internal mem on C6416

/* Write 16 bit data value to DXR */

MCBSP_write(hMcbspCtrl, (Register << 9) | Data);

/* Function: config_codec ----------------------------------------------

* Abstract:

* This function initally configures the codec registers

*/

void config_codec(void)

{ unsigned short regVal = 0;

/* Reset the AIC23 */

Write_Codec_Control(AIC23_RESET, 0);

/* 0 AIC23_LEFTINVOL Left line input channel volume */

/* LIV=0dB, LIM=NotMuted, LRS=Off */

Write_Codec_Control(0, 0x0017);

/* 1 AIC23_RIGHTINVOL Right line input channel volume */

/* RIV=0dB, RIM=NotMuted, RLS=Off */

Write_Codec_Control(1, 0x0017);

/* 2 AIC23_LEFTHPVOL Left channel headphone volume */

/* LRS=On, LZC=On, LHV=0dB */

Write_Codec_Control(2, 0x01f9);
/* 3 AIC23_RIGHTHPVOL Right channel headphone volume */

/* RLS=On, RZC=On, RHV=0dB */

Write_Codec_Control(3, 0x01f9);

/* 4 AIC23_ANAPATH Analog audio path control */

/* STA=Don'tCare, STE=Off, DAC=On, BYP=Off, INSEL=Mic/Line,

MICM=On/Off, MICB=On/Off */

regVal = MASK(0x0 , AIC23_R4_STA ) |

MASK(0x0 , AIC23_R4_STE ) |

MASK(0x1 , AIC23_R4_DAC ) |

MASK(0x0 , AIC23_R4_BYP ) |

MASK(AIC23_R4_INSEL_MIC , AIC23_R4_INSEL ) |

MASK(0x0 , AIC23_R4_MICM ) |

MASK(0x0 , AIC23_R4_MICB );

Write_Codec_Control(4, regVal);

/* 5 AIC23_DIGPATH Digital audio path control */

/* DACM=Off, DEEMP=Off, ADCHP=Off */

Write_Codec_Control(5, 0x0000);

/* 6 AIC23_POWERDOWN Power down control */

/* [All modules ON] */

Write_Codec_Control(6, 0x0000);

/* 7 AIC23_DIGIF Digital audio interface format */

/* MS=Master, LRSWAP=Off, LRP=FirstBCLK, IWL=16Bit/?, FOR=DSP */

regVal = MASK(AIC23_R7_MS_MASTER, AIC23_R7_MS ) |

MASK( 0x0, AIC23_R7_LRSWAP ) |


MASK( 0x0, AIC23_R7_LRP ) |

MASK( AIC23_R7_IWL_16BIT, AIC23_R7_IWL ) |

MASK( AIC23_R7_FOR_DSP, AIC23_R7_FOR );

Write_Codec_Control(7, regVal);

/* 8 AIC23_SAMPLERATE Sample rate control */

Write_Codec_Control(8, AIC23_R8_8KHZ);

/* 9 AIC23_DIGACT Digital interface activation */

/* ACT=On */

Write_Codec_Control(9, 0x0001);

/* Function: codec_init ---------------------------------

* Abstract:

* Initialize the codec

*/

void codec_init()

initDMABuffers();

config_McBSP_control();

config_codec();

config_McBSP_data();

/* Function: config_codec_input ----------------------------------------


* This function configures the codec input characteristics

* based on model characteristics

*/

void config_codec_input(void)

/* Codec input is configured only in config_codec() for this target. */

/* Function: config_codec_output ---------------------------------------

* This function configures the codec output characteristics

* based on model characteristics

*/

void config_codec_output(void)

/* Codec output is configured only in config_codec(), for this target. */

You might also like