diff options
| author | wuyangyong <[email protected]> | 2010-02-25 06:14:18 +0000 |
|---|---|---|
| committer | wuyangyong <[email protected]> | 2010-02-25 06:14:18 +0000 |
| commit | 915bba10b5d2f8c853f07c29dbb062cf24c4fda3 (patch) | |
| tree | 8e8549b74bd2e9577eb914d4a762ef36e2fb8731 /bsp | |
| parent | cd793d257b94087b4be7cb58624ab545ccfa7f82 (diff) | |
add all device reset for stm32 netradio
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@446 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'bsp')
| -rw-r--r-- | bsp/stm32_radio/board.c | 79 |
1 files changed, 54 insertions, 25 deletions
diff --git a/bsp/stm32_radio/board.c b/bsp/stm32_radio/board.c index a11925bb36..c53af4429c 100644 --- a/bsp/stm32_radio/board.c +++ b/bsp/stm32_radio/board.c @@ -70,6 +70,59 @@ void rt_hw_timer_handler(void) /* NAND Flash */
#include "fsmc_nand.h"
+static void all_device_reset(void)
+{
+ /* RESET */
+ /* DM9000A PE5 */
+ /* LCD PF10 */
+ /* SPI-FLASH PA3 */
+
+ /* CS */
+ /* DM9000A FSMC_NE4 PG12 */
+ /* LCD FSMC_NE2 PG9 */
+ /* SPI_FLASH PA4 */
+ /* CODEC PC5 */
+ /* TOUCH PC4 */
+
+ GPIO_InitTypeDef GPIO_InitStructure;
+ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOE
+ | RCC_APB2Periph_GPIOF | RCC_APB2Periph_GPIOG,ENABLE);
+
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
+ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
+
+ /* SPI_FLASH CS */
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
+ GPIO_Init(GPIOA,&GPIO_InitStructure);
+ GPIO_SetBits(GPIOA,GPIO_Pin_4);
+
+ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
+
+ /* CODEC && TOUCH CS */
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5;
+ GPIO_Init(GPIOC,&GPIO_InitStructure);
+ GPIO_SetBits(GPIOC,GPIO_Pin_4 | GPIO_Pin_5);
+
+ /* DM9000A RESET */
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
+ GPIO_Init(GPIOE,&GPIO_InitStructure);
+ GPIO_ResetBits(GPIOE,GPIO_Pin_5);
+
+ /* LCD RESET */
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
+ GPIO_Init(GPIOF,&GPIO_InitStructure);
+ GPIO_ResetBits(GPIOF,GPIO_Pin_10);
+
+ /* SPI_FLASH RESET */
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
+ GPIO_Init(GPIOA,&GPIO_InitStructure);
+ GPIO_ResetBits(GPIOA,GPIO_Pin_3);
+
+ GPIO_SetBits(GPIOE,GPIO_Pin_5); /* DM9000A */
+ GPIO_SetBits(GPIOF,GPIO_Pin_10); /* LCD */
+ GPIO_SetBits(GPIOA,GPIO_Pin_3); /* SPI_FLASH */
+}
+
/**
* This function will initial STM32 Radio board.
*/
@@ -81,31 +134,7 @@ void rt_hw_board_init() /* Configure the system clocks */
SystemInit();
- /* DM9000A */
- {
- GPIO_InitTypeDef GPIO_InitStructure;
-
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE,ENABLE);
-
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(GPIOE,&GPIO_InitStructure);
- GPIO_SetBits(GPIOE,GPIO_Pin_5);
- }
-
-#if LCD_VERSION == 2
- {
- GPIO_InitTypeDef GPIO_InitStructure;
-
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOF,ENABLE);
-
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
- GPIO_Init(GPIOF,&GPIO_InitStructure);
- }
-#endif
+ all_device_reset();
/* NVIC Configuration */
NVIC_Configuration();
|
