From f20ed9bbd6adc83c834982e5e10dd994b216be89 Mon Sep 17 00:00:00 2001 From: "kyle.hu.gz" Date: Tue, 23 Mar 2010 18:07:40 +0000 Subject: [PATCH] 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 --- bsp/stm32_radio/codec.c | 11 ++++++++--- bsp/stm32_radio/radio_list_update.c | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bsp/stm32_radio/codec.c b/bsp/stm32_radio/codec.c index 4e293617c..ddc12d7a8 100644 --- a/bsp/stm32_radio/codec.c +++ b/bsp/stm32_radio/codec.c @@ -169,7 +169,7 @@ static void DMA_Configuration(rt_uint32_t addr, rt_size_t size) DMA_Cmd(CODEC_I2S_DMA, ENABLE); } -static void I2S_Configuration(void) +static void I2S_Configuration(uint32_t I2S_AudioFreq) { I2S_InitTypeDef I2S_InitStructure; @@ -177,7 +177,7 @@ static void I2S_Configuration(void) I2S_InitStructure.I2S_Standard = I2S_Standard_Phillips; I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_16b; 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; /* I2S2 configuration */ @@ -404,6 +404,11 @@ rt_err_t sample_rate(int sr) } codec_send(r06); codec_send(r07); + +#if !CODEC_MASTER_MODE + I2S_Configuration((uint32_t) sr); +#endif + return RT_EOK; } @@ -556,7 +561,7 @@ rt_err_t codec_hw_init(void) NVIC_Configuration(); GPIO_Configuration(); - I2S_Configuration(); + I2S_Configuration(I2S_AudioFreq_44k); dev = (rt_device_t) &codec; dev->type = RT_Device_Class_Sound; diff --git a/bsp/stm32_radio/radio_list_update.c b/bsp/stm32_radio/radio_list_update.c index 23b529ec3..0a24fdecd 100644 --- a/bsp/stm32_radio/radio_list_update.c +++ b/bsp/stm32_radio/radio_list_update.c @@ -202,7 +202,7 @@ void update_radio_list_req(void) update_radio_list_state = UPDATE_RAIDO_LIST_PROC; 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 */ rt_mq_send(update_radio_mq, (void*)&request, sizeof(struct player_request));