Fixed sample rate not set correctly under slave I2S mode.

Fixed string corruption problem in radio_list_update.c.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@528 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
kyle.hu.gz 2010-03-23 18:07:40 +00:00
parent c7aea05b99
commit f20ed9bbd6
2 changed files with 9 additions and 4 deletions

View File

@ -169,7 +169,7 @@ static void DMA_Configuration(rt_uint32_t addr, rt_size_t size)
DMA_Cmd(CODEC_I2S_DMA, ENABLE); DMA_Cmd(CODEC_I2S_DMA, ENABLE);
} }
static void I2S_Configuration(void) static void I2S_Configuration(uint32_t I2S_AudioFreq)
{ {
I2S_InitTypeDef I2S_InitStructure; I2S_InitTypeDef I2S_InitStructure;
@ -177,7 +177,7 @@ static void I2S_Configuration(void)
I2S_InitStructure.I2S_Standard = I2S_Standard_Phillips; I2S_InitStructure.I2S_Standard = I2S_Standard_Phillips;
I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_16b; I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_16b;
I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Disable; I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Disable;
I2S_InitStructure.I2S_AudioFreq = I2S_AudioFreq_44k; I2S_InitStructure.I2S_AudioFreq = I2S_AudioFreq;
I2S_InitStructure.I2S_CPOL = I2S_CPOL_Low; I2S_InitStructure.I2S_CPOL = I2S_CPOL_Low;
/* I2S2 configuration */ /* I2S2 configuration */
@ -404,6 +404,11 @@ rt_err_t sample_rate(int sr)
} }
codec_send(r06); codec_send(r06);
codec_send(r07); codec_send(r07);
#if !CODEC_MASTER_MODE
I2S_Configuration((uint32_t) sr);
#endif
return RT_EOK; return RT_EOK;
} }
@ -556,7 +561,7 @@ rt_err_t codec_hw_init(void)
NVIC_Configuration(); NVIC_Configuration();
GPIO_Configuration(); GPIO_Configuration();
I2S_Configuration(); I2S_Configuration(I2S_AudioFreq_44k);
dev = (rt_device_t) &codec; dev = (rt_device_t) &codec;
dev->type = RT_Device_Class_Sound; dev->type = RT_Device_Class_Sound;

View File

@ -202,7 +202,7 @@ void update_radio_list_req(void)
update_radio_list_state = UPDATE_RAIDO_LIST_PROC; update_radio_list_state = UPDATE_RAIDO_LIST_PROC;
request.type = PLAYER_REQUEST_UPDATE_RADIO_LIST; request.type = PLAYER_REQUEST_UPDATE_RADIO_LIST;
ch = strncpy(request.fn, RADIO_LIST_UPDATE_URL, strlen(RADIO_LIST_UPDATE_URL)); ch = strcpy(request.fn, RADIO_LIST_UPDATE_URL);
/* send to message queue */ /* send to message queue */
rt_mq_send(update_radio_mq, (void*)&request, sizeof(struct player_request)); rt_mq_send(update_radio_mq, (void*)&request, sizeof(struct player_request));