1
0
Эх сурвалжийг харах

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

kyle.hu.gz 15 жил өмнө
parent
commit
f20ed9bbd6

+ 8 - 3
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;

+ 1 - 1
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));