📄 uda1341ts.c
字号:
//=====================================================================
// TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
// Property of Texas Instruments -- For Unrestricted Internal Use Only
// Unauthorized reproduction and/or distribution is strictly prohibited
// This product is protected under copyright law and trade secret law as
// an unpublished work.Created 1987,(C) Copyright 1997 Texas Instruments.
// All rights reserved.
//=====================================================================
#include "pers_conf_a9.h"
#include "uda1341ts.h"
#include "timer32_a9.h"
#include "gpio_a9.h"
#include "inth.h"
#include "l3_interface.h"
volatile codec_message_t codec_message;
codec_message_t status0={ SHORT_MESSAGE,STATUS_ADDR,0};
codec_message_t status1={ SHORT_MESSAGE,STATUS_ADDR,0};
codec_message_t volume_control={SHORT_MESSAGE, DATA_0_ADDR,0};
//codec_message_t mic_mixer={EXTENDED_MESSAGE, DATA_0_ADDR,{DATA_0_EXTENDED_ADDR_MASK,DATA_0_EXTENDED_DATA_MASK}};
codec_message_t mic_mixer={EXTENDED_MESSAGE, DATA_0_ADDR,0}; // only for validation PS
// flag for timer1 interrupt
extern BOOL interrupt_timer32_occured;
//---------------------------------------------------------
//NAME : UDA_SendDataToCodec
//DESCRIPTION : configure the codec using the L3 interface
//PARAMETERS : None
//RETURN VALUE: None
//LIMITATIONS : None
//---------------------------------------------------------
void UDA_SendDataToCodec(codec_message_t message)
{
// send address to codec
L3MODE_ADDRESS;
L3_SendByte(message.adresse);
if (message.type == SHORT_MESSAGE)
{
L3MODE_DATA;
L3_SendByte(message.param.data);
}
else
// extended message
{
L3MODE_DATA;
L3_SendByte(message.param.ex_message.ex_address);
L3MODE_ADDRESS;
// TIME_StartTimer(OSTIMER1);
timer32_set_CR(START_TIMER,RELOAD_TIMER,IT_ENABLED,AUTO_RESTART_MODE);
while (interrupt_timer32_occured == False)
{};
interrupt_timer32_occured = False;//
// TIME_StopTimer(OSTIMER1);
timer32_set_CR(STOP_TIMER,RELOAD_TIMER,IT_ENABLED,AUTO_RESTART_MODE);
L3MODE_DATA;
L3_SendByte(message.param.ex_message.ex_data);
}
}
//---------------------------------------------------------
//NAME : UDA_ConfigForSoundRecording
//DESCRIPTION : configure UDA1341 for recording
//PARAMETERS : None
//RETURN VALUE: None
//LIMITATIONS : None
//---------------------------------------------------------
void UDA_ConfigForSoundRecording(void)
{
status0.param.data=(STATUS_CONTROL_0|RST|SC_384FS|IF_I2S|DC_FILTER_OFF);
UDA_SendDataToCodec(status0);
status1.param.data=(STATUS_CONTROL_1|OGS_OFF|IGS_OFF|PAD_NON_INV|PDA_NON_INV|SINGLE_SPEED|RECORD);
UDA_SendDataToCodec(status1);
status0.param.data=(STATUS_CONTROL_0|NO_RST|SC_384FS|IF_I2S|DC_FILTER_OFF);
UDA_SendDataToCodec(status0);
//only for validation PS
// mic_mixer.param.ex_message.ex_address= DATA_0_EXTENDED_ADDR_MASK | MIC_MIXER_ADDR;
//mic_mixer.param.ex_message.ex_data= DATA_0_EXTENDED_DATA_MASK | MIC_PLUS3;
// UDA_SendDataToCodec(mic_mixer);
}
//---------------------------------------------------------
//NAME : UDA_ConfigForSoundRecording
//DESCRIPTION : configure UDA1341 for playing
//PARAMETERS : None
//RETURN VALUE: None
//LIMITATIONS : None
//---------------------------------------------------------
void UDA_ConfigForSoundPlaying(void)
{
status0.param.data=(STATUS_CONTROL_0|RST|SC_384FS|IF_I2S|DC_FILTER_ON);
UDA_SendDataToCodec(status0);
status1.param.data=(STATUS_CONTROL_1|OGS_OFF|IGS_OFF|PAD_NON_INV|PDA_NON_INV|SINGLE_SPEED|PLAY);
UDA_SendDataToCodec(status1);
volume_control.param.data=0x16;
UDA_SendDataToCodec(volume_control);
status0.param.data=(STATUS_CONTROL_0|NO_RST|SC_384FS|IF_I2S|DC_FILTER_OFF);
UDA_SendDataToCodec(status0);
}
#define CHANGE_VOLUME send_codec(codec_message); // to be defined PS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -