remove some console functions; fix the items free issue in station list.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@469 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
9628c8b869
commit
e4b78f5c87
|
@ -18,8 +18,6 @@
|
|||
#include "stm32f10x.h"
|
||||
#include "board.h"
|
||||
|
||||
static void rt_hw_console_init(void);
|
||||
|
||||
/**
|
||||
* @addtogroup STM32
|
||||
*/
|
||||
|
@ -211,16 +209,11 @@ void rt_hw_board_init()
|
|||
SysTick_Config( SystemFrequency_SysClk / RT_TICK_PER_SECOND );
|
||||
|
||||
/* Console Initialization*/
|
||||
rt_hw_console_init();
|
||||
rt_hw_usart_init();
|
||||
rt_console_set_device("uart1");
|
||||
|
||||
rt_kprintf("\r\n\r\nSystemInit......\r\n");
|
||||
|
||||
/* FSMC Initialization */
|
||||
//FSMC_NAND_Init();
|
||||
|
||||
/* NAND read ID command */
|
||||
//FSMC_NAND_ReadID(&NAND_ID);
|
||||
//rt_kprintf("Read the NAND ID:%02X%02X%02X%02X",NAND_ID.Maker_ID,NAND_ID.Device_ID,NAND_ID.Third_ID,NAND_ID.Fourth_ID);
|
||||
|
||||
/* SRAM init */
|
||||
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
|
||||
FSMC_SRAM_Init();
|
||||
|
@ -296,115 +289,4 @@ void rt_hw_board_init()
|
|||
|
||||
}/* rt_hw_board_init */
|
||||
|
||||
#if STM32_CONSOLE_USART == 1
|
||||
#define CONSOLE_RX_PIN GPIO_Pin_9
|
||||
#define CONSOLE_TX_PIN GPIO_Pin_10
|
||||
#define CONSOLE_GPIO GPIOA
|
||||
#define CONSOLE_USART USART1
|
||||
#elif STM32_CONSOLE_USART == 2
|
||||
|
||||
#if defined(STM32_LD) || defined(STM32_MD)
|
||||
#define CONSOLE_RX_PIN GPIO_Pin_6
|
||||
#define CONSOLE_TX_PIN GPIO_Pin_5
|
||||
#define CONSOLE_GPIO GPIOD
|
||||
#elif defined(STM32_HD)
|
||||
#define CONSOLE_RX_PIN GPIO_Pin_3
|
||||
#define CONSOLE_TX_PIN GPIO_Pin_2
|
||||
#define CONSOLE_GPIO GPIOA
|
||||
#endif
|
||||
|
||||
#define CONSOLE_USART USART2
|
||||
#elif STM32_CONSOLE_USART == 2
|
||||
#define CONSOLE_RX_PIN GPIO_Pin_11
|
||||
#define CONSOLE_TX_PIN GPIO_Pin_10
|
||||
#define CONSOLE_GPIO GPIOB
|
||||
#define CONSOLE_USART USART3
|
||||
#endif
|
||||
|
||||
/* init console to support rt_kprintf */
|
||||
static void rt_hw_console_init(void)
|
||||
{
|
||||
/* Enable USART1 and GPIOA clocks */
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1
|
||||
| RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOC
|
||||
| RCC_APB2Periph_GPIOF, ENABLE);
|
||||
|
||||
#if STM32_CONSOLE_USART == 0
|
||||
#else
|
||||
/* GPIO configuration */
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
/* Configure USART1 Tx (PA.09) as alternate function push-pull */
|
||||
GPIO_InitStructure.GPIO_Pin = CONSOLE_RX_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_Init(CONSOLE_GPIO, &GPIO_InitStructure);
|
||||
|
||||
/* Configure USART1 Rx (PA.10) as input floating */
|
||||
GPIO_InitStructure.GPIO_Pin = CONSOLE_TX_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
|
||||
GPIO_Init(CONSOLE_GPIO, &GPIO_InitStructure);
|
||||
}
|
||||
|
||||
/* USART configuration */
|
||||
{
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
|
||||
/* USART configured as follow:
|
||||
- BaudRate = 115200 baud
|
||||
- Word Length = 8 Bits
|
||||
- One Stop Bit
|
||||
- No parity
|
||||
- Hardware flow control disabled (RTS and CTS signals)
|
||||
- Receive and transmit enabled
|
||||
- USART Clock disabled
|
||||
- USART CPOL: Clock is active low
|
||||
- USART CPHA: Data is captured on the middle
|
||||
- USART LastBit: The clock pulse of the last data bit is not output to
|
||||
the SCLK pin
|
||||
*/
|
||||
USART_InitStructure.USART_BaudRate = 115200;
|
||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
|
||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;
|
||||
USART_InitStructure.USART_Parity = USART_Parity_No;
|
||||
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
|
||||
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
|
||||
USART_Init(CONSOLE_USART, &USART_InitStructure);
|
||||
/* Enable USART1 */
|
||||
USART_Cmd(CONSOLE_USART, ENABLE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* write one character to serial, must not trigger interrupt */
|
||||
static void rt_hw_console_putc(const char c)
|
||||
{
|
||||
/*
|
||||
to be polite with serial console add a line feed
|
||||
to the carriage return character
|
||||
*/
|
||||
if (c=='\n')rt_hw_console_putc('\r');
|
||||
|
||||
while (!(CONSOLE_USART->SR & USART_FLAG_TXE));
|
||||
CONSOLE_USART->DR = (c & 0x1FF);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used by rt_kprintf to display a string on console.
|
||||
*
|
||||
* @param str the displayed string
|
||||
*/
|
||||
void rt_hw_console_output(const char* str)
|
||||
{
|
||||
#if STM32_CONSOLE_USART == 0
|
||||
/* no console */
|
||||
#else
|
||||
while (*str)
|
||||
{
|
||||
rt_hw_console_putc (*str++);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
|
|
@ -213,6 +213,8 @@ struct station_item* station_list_select(struct station_list* list, struct rtgui
|
|||
|
||||
/* destroy view */
|
||||
rtgui_list_view_destroy(view);
|
||||
/* release items */
|
||||
rt_free(items);
|
||||
|
||||
return station;
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ static void DMA_Configuration(void)
|
|||
|
||||
/*
|
||||
* Init all related hardware in here
|
||||
* rt_hw_serial_init() will register all supported USART device
|
||||
* rt_hw_usart_init() will register all supported USART device
|
||||
*/
|
||||
void rt_hw_usart_init()
|
||||
{
|
||||
|
@ -251,11 +251,8 @@ void rt_hw_usart_init()
|
|||
USART_ClockInitTypeDef USART_ClockInitStructure;
|
||||
|
||||
RCC_Configuration();
|
||||
|
||||
GPIO_Configuration();
|
||||
|
||||
NVIC_Configuration();
|
||||
|
||||
DMA_Configuration();
|
||||
|
||||
/* uart init */
|
||||
|
|
Loading…
Reference in New Issue