add dm9000a driver; remove the polling timer of enc29j60 and fix the tx interrupt issue;

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@197 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong committed 2009-12-13 15:28:33 +00:00
1 parent 7ae254abf8
commit 680b77cd89
22 files changed
+649 -406

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
device_type = 'STM32F10X_HD'
target = 'rtthread-stm32'
# search path for C compiler
# search path for C compiler
bsp_path = RTT_ROOT + '/bsp/stm3210'
env = Environment(tools = ['mingw'],
@@ -15,7 +15,7 @@ env = Environment(tools = ['mingw'],
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
env.AppendUnique(CPPPATH = bsp_path)
env.AppendUnique(CCFLAGS = ' -DUSE_STDPERIPH_DRIVER -DSTM32F10X_HD')
env.AppendUnique(CCFLAGS = ' -DUSE_STDPERIPH_DRIVER -D' + device_type)
Export('env')
Export('RTT_ROOT')
+15 -3
View File
@@ -17,13 +17,12 @@
*/
/*@{*/
#include <board.h>
#include <rtthread.h>
#ifdef RT_USING_DFS
/* dfs init */
#include <dfs_init.h>
/* dfs filesystem:FAT filesystem init */
#include <dfs_fat.h>
/* dfs filesystem:EFS filesystem init */
#include <dfs_efs.h>
/* dfs Filesystem APIs */
@@ -33,6 +32,7 @@
#ifdef RT_USING_LWIP
#include <lwip/sys.h>
#include <lwip/api.h>
#include <netif/ethernetif.h>
#endif
void rt_init_thread_entry(void* parameter)
@@ -73,7 +73,19 @@ void rt_init_thread_entry(void* parameter)
#ifdef RT_USING_LWIP
{
extern void lwip_sys_init(void);
#ifdef RT_USING_LWIP
eth_system_device_init();
/* register ethernetif device */
#if STM32_ETH_IF == 0
rt_hw_enc28j60_init();
#elif STM32_ETH_IF == 1
rt_hw_dm9000_init();
#endif
/* re-init device driver */
rt_device_init_all();
#endif
/* init lwip system */
lwip_sys_init();
rt_kprintf("TCP/IP initialized!\n");
+64 -54
View File
@@ -1,55 +1,65 @@
/*
* File : board.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Develop Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2009-09-22 Bernard add board.h to this bsp
*/
// <<< Use Configuration Wizard in Context Menu >>>
#ifndef __BOARD_H__
#define __BOARD_H__
/* board configuration */
// <o> SDCard Driver <1=>SDIO sdcard <0=>SPI MMC card
// <i>Default: 1
#define STM32_USE_SDIO 1
/* whether use board external SRAM memory */
// <e>Use external SRAM memory on the board
// <i>Enable External SRAM memory
#define STM32_EXT_SRAM 0
// <o>Begin Address of External SRAM
// <i>Default: 0x68000000
#define STM32_EXT_SRAM_BEGIN 0x68000000 /* the begining address of external SRAM */
// <o>End Address of External SRAM
// <i>Default: 0x68080000
#define STM32_EXT_SRAM_END 0x68080000 /* the end address of external SRAM */
// </e>
// <o> Internal SRAM memory size[Kbytes] <8-64>
// <i>Default: 64
#define STM32_SRAM_SIZE 64
#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)
// <o> Console on USART: <0=> no console <1=>USART 1 <2=>USART 2 <3=> USART 3
// <i>Default: 1
/*
* File : board.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Develop Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2009-09-22 Bernard add board.h to this bsp
*/
// <<< Use Configuration Wizard in Context Menu >>>
#ifndef __BOARD_H__
#define __BOARD_H__
/* board configuration */
// <o> SDCard Driver <1=>SDIO sdcard <0=>SPI MMC card
// <i>Default: 1
#define STM32_USE_SDIO 1
/* whether use board external SRAM memory */
// <e>Use external SRAM memory on the board
// <i>Enable External SRAM memory
#define STM32_EXT_SRAM 0
// <o>Begin Address of External SRAM
// <i>Default: 0x68000000
#define STM32_EXT_SRAM_BEGIN 0x68000000 /* the begining address of external SRAM */
// <o>End Address of External SRAM
// <i>Default: 0x68080000
#define STM32_EXT_SRAM_END 0x68080000 /* the end address of external SRAM */
// </e>
// <o> Internal SRAM memory size[Kbytes] <8-64>
// <i>Default: 64
#define STM32_SRAM_SIZE 64
#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)
// <o> Console on USART: <0=> no console <1=>USART 1 <2=>USART 2 <3=> USART 3
// <i>Default: 1
#define STM32_CONSOLE_USART 1
void rt_hw_board_led_on(int n);
void rt_hw_board_led_off(int n);
void rt_hw_board_init(void);
void rt_hw_usart_init(void);
void rt_hw_sdcard_init(void);
void rt_hw_msd_init(void);
#endif
// <<< Use Configuration Wizard in Context Menu >>>
// <o> Ethernet Interface: <0=> Microchip ENC28J60 <1=> Davicom DM9000A
// <i>Default: 0
#define STM32_ETH_IF 0
void rt_hw_board_led_on(int n);
void rt_hw_board_led_off(int n);
void rt_hw_board_init(void);
void rt_hw_usart_init(void);
/* SD Card init function */
void rt_hw_sdcard_init(void);
void rt_hw_msd_init(void);
/* ETH interface init function */
void rt_hw_enc28j60_init(void);
void rt_hw_dm9000_init(void);
#endif
// <<< Use Configuration Wizard in Context Menu >>>
+152 -99
View File
File diff suppressed because it is too large. Load diff
+7 -4
View File
@@ -1,17 +1,20 @@
#ifndef __DM9000_H__
#define __DM9000_H__
#define DM9000_IO_BASE 0x6C100000
#define DM9000_DATA_BASE 0x6C100008
#define DM9000_IO_BASE 0x6C000000
#define DM9000_DATA_BASE 0x6C000008
#define DM9000_IO (*((volatile rt_uint16_t *) DM9000_IO_BASE)) // CMD = 0
#define DM9000_DATA (*((volatile rt_uint16_t *) DM9000_DATA_BASE)) // CMD = 1
#define DM9000_IO (*((volatile rt_uint16_t *) 0x6C000000)) // CMD = 0
#define DM9000_DATA (*((volatile rt_uint16_t *) 0x6C000008)) // CMD = 1
#define DM9000_inb(r) (*(volatile rt_uint8_t *)r)
#define DM9000_outb(r, d) (*(volatile rt_uint8_t *)r = d)
#define DM9000_inw(r) (*(volatile rt_uint16_t *)r)
#define DM9000_outw(r, d) (*(volatile rt_uint16_t *)r = d)
#define RST_1() GPIO_SetBits(GPIOF,GPIO_Pin_6)
#define RST_0() GPIO_ResetBits(GPIOF,GPIO_Pin_6)
#define DM9000_ID 0x90000A46 /* DM9000 ID */
#define DM9000_PKT_MAX 1536 /* Received packet max size */
#define DM9000_PKT_RDY 0x01 /* Packet ready to receive */
+66 -72
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -296,6 +296,6 @@
// max frame length which the conroller will accept:
#define MAX_FRAMELEN 1518
int rt_hw_enc28j60_init(void);
void rt_hw_enc28j60_init(void);
#endif
+3 -1
View File
@@ -18,12 +18,14 @@ File 1,1,<.\application.c><application.c>
File 1,1,<.\startup.c><startup.c>
File 1,1,<.\led.c><led.c>
File 1,1,<.\usart.c><usart.c>
File 1,1,<.\enc28j60.c><enc28j60.c>
File 1,1,<.\sdcard.c><sdcard.c>
File 1,1,<.\msd.c><msd.c>
File 1,1,<.\enc28j60.c><enc28j60.c>
File 1,1,<.\dm9000a.c><dm9000a.c>
File 1,1,<.\rtc.c><rtc.c>
File 1,5,<.\rtconfig.h><rtconfig.h>
File 1,5,<.\board.h><board.h>
File 1,1,<..\..\net\apps\tcpecho.c><tcpecho.c>
File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c><misc.c>
File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c><stm32f10x_adc.c>
File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c><stm32f10x_bkp.c>
+3
View File
@@ -1869,6 +1869,9 @@
<file>
<name>$PROJ_DIR$\board.h</name>
</file>
<file>
<name>$PROJ_DIR$\dm9000a.c</name>
</file>
<file>
<name>$PROJ_DIR$\enc28j60.c</name>
</file>
+28 -3
View File
@@ -17,13 +17,12 @@
*/
/*@{*/
#include <board.h>
#include <rtthread.h>
#ifdef RT_USING_DFS
/* dfs init */
#include <dfs_init.h>
/* dfs filesystem:FAT filesystem init */
#include <dfs_fat.h>
/* dfs filesystem:EFS filesystem init */
#include <dfs_efs.h>
/* dfs Filesystem APIs */
@@ -33,6 +32,7 @@
#ifdef RT_USING_LWIP
#include <lwip/sys.h>
#include <lwip/api.h>
#include <netif/ethernetif.h>
#endif
void rt_init_thread_entry(void* parameter)
@@ -42,6 +42,8 @@ void rt_init_thread_entry(void* parameter)
{
/* init the device filesystem */
dfs_init();
#ifdef RT_USING_DFS_EFSL
/* init the efsl filesystam*/
efsl_init();
@@ -52,7 +54,18 @@ void rt_init_thread_entry(void* parameter)
}
else
rt_kprintf("File System initialzation failed!\n");
#elif defined(RT_USING_DFS_ELMFAT)
/* init the elm chan FatFs filesystam*/
elm_init();
/* mount sd card fat partition 1 as root directory */
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
{
rt_kprintf("File System initialized!\n");
}
else
rt_kprintf("File System initialzation failed!\n");
#endif
}
#endif
@@ -60,7 +73,19 @@ void rt_init_thread_entry(void* parameter)
#ifdef RT_USING_LWIP
{
extern void lwip_sys_init(void);
#ifdef RT_USING_LWIP
eth_system_device_init();
/* register ethernetif device */
#if STM32_ETH_IF == 0
rt_hw_enc28j60_init();
#elif STM32_ETH_IF == 1
rt_hw_dm9000_init();
#endif
/* re-init device driver */
rt_device_init_all();
#endif
/* init lwip system */
lwip_sys_init();
rt_kprintf("TCP/IP initialized!\n");
+65
View File
@@ -0,0 +1,65 @@
/*
* File : board.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Develop Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2009-09-22 Bernard add board.h to this bsp
*/
// <<< Use Configuration Wizard in Context Menu >>>
#ifndef __BOARD_H__
#define __BOARD_H__
/* board configuration */
// <o> SDCard Driver <1=>SDIO sdcard <0=>SPI MMC card
// <i>Default: 1
#define STM32_USE_SDIO 1
/* whether use board external SRAM memory */
// <e>Use external SRAM memory on the board
// <i>Enable External SRAM memory
#define STM32_EXT_SRAM 0
// <o>Begin Address of External SRAM
// <i>Default: 0x68000000
#define STM32_EXT_SRAM_BEGIN 0x68000000 /* the begining address of external SRAM */
// <o>End Address of External SRAM
// <i>Default: 0x68080000
#define STM32_EXT_SRAM_END 0x68080000 /* the end address of external SRAM */
// </e>
// <o> Internal SRAM memory size[Kbytes] <8-64>
// <i>Default: 64
#define STM32_SRAM_SIZE 64
#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)
// <o> Console on USART: <0=> no console <1=>USART 1 <2=>USART 2 <3=> USART 3
// <i>Default: 1
#define STM32_CONSOLE_USART 1
// <o> Ethernet Interface: <0=> Microchip ENC28J60 <1=> Davicom DM9000A
// <i>Default: 0
#define STM32_ETH_IF 0
void rt_hw_board_led_on(int n);
void rt_hw_board_led_off(int n);
void rt_hw_board_init(void);
void rt_hw_usart_init(void);
/* SD Card init function */
void rt_hw_sdcard_init(void);
void rt_hw_msd_init(void);
/* ETH interface init function */
void rt_hw_enc28j60_init(void);
void rt_hw_dm9000_init(void);
#endif
// <<< Use Configuration Wizard in Context Menu >>>
+4 -2
View File
@@ -18,12 +18,14 @@ File 1,1,<.\application.c><application.c>
File 1,1,<.\startup.c><startup.c>
File 1,1,<.\led.c><led.c>
File 1,1,<.\usart.c><usart.c>
File 1,1,<.\enc28j60.c><enc28j60.c>
File 1,1,<.\sdcard.c><sdcard.c>
File 1,1,<.\msd.c><msd.c>
File 1,1,<.\enc28j60.c><enc28j60.c>
File 1,1,<.\dm9000a.c><dm9000a.c>
File 1,1,<.\rtc.c><rtc.c>
File 1,5,<.\rtconfig.h><rtconfig.h>
File 1,5,<.\board.h><board.h>
File 1,1,<..\..\net\apps\tcpecho.c><tcpecho.c>
File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c><misc.c>
File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c><stm32f10x_adc.c>
File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c><stm32f10x_bkp.c>
@@ -216,7 +218,7 @@ Options 1,0,0 // Target 'RT-Thread STM32'
ADSLDMC (--keep __fsym_* --keep __vsym_*)
ADSLDIF ()
ADSLDDW ()
OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F103ZE)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F103ZE)
OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F107xCSchedule)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F107xC)
OPTDBG 49150,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()()
FLASH1 { 9,0,0,0,1,0,0,0,5,16,0,0,0,0,0,0,0,0,0,0 }
FLASH2 (Segger\JL2CM3.dll)
+3
View File
@@ -1869,6 +1869,9 @@
<file>
<name>$PROJ_DIR$\board.h</name>
</file>
<file>
<name>$PROJ_DIR$\dm9000a.c</name>
</file>
<file>
<name>$PROJ_DIR$\enc28j60.c</name>
</file>
-12
View File
@@ -25,11 +25,6 @@
/*@{*/
#ifdef RT_USING_LWIP
#include "enc28j60.h"
#include <netif/ethernetif.h>
#endif
extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
@@ -111,13 +106,6 @@ void rtthread_startup(void)
rt_hw_msd_init();
#endif
#ifdef RT_USING_LWIP
eth_system_device_init();
/* register ethernetif device */
rt_hw_enc28j60_init();
#endif
rt_hw_rtc_init();
/* init all device */
+30 -2
View File
@@ -22,6 +22,7 @@
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_it.h"
#include <board.h>
#include <rtthread.h>
/** @addtogroup Template_Project
@@ -272,6 +273,8 @@ void SDIO_IRQHandler(void)
#endif
}
#ifdef RT_USING_LWIP
#if (STM32_ETH_IF == 0)
/*******************************************************************************
* Function Name : EXTI0_IRQHandler
* Description : This function handles External interrupt Line 0 request.
@@ -281,7 +284,6 @@ void SDIO_IRQHandler(void)
*******************************************************************************/
void EXTI0_IRQHandler(void)
{
#ifdef RT_USING_LWIP
extern void enc28j60_isr(void);
/* enter interrupt */
@@ -294,8 +296,34 @@ void EXTI0_IRQHandler(void)
/* leave interrupt */
rt_interrupt_leave();
#endif
}
#endif
#if (STM32_ETH_IF == 1)
/*******************************************************************************
* Function Name : EXTI9_5_IRQHandler
* Description : This function handles External lines 9 to 5 interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void EXTI9_5_IRQHandler(void)
{
extern void rt_dm9000_isr(void);
/* enter interrupt */
rt_interrupt_enter();
rt_dm9000_isr();
/* Clear the Key Button EXTI line pending bit */
EXTI_ClearITPendingBit(EXTI_Line7);
/* leave interrupt */
rt_interrupt_leave();
}
#endif
#endif /* end of RT_USING_LWIP */
/**
* @}
-1
View File
@@ -64,7 +64,6 @@
/* Using symbol table */
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
#define FINSH_DEVICE_NAME "uart1"
/* SECTION: device filesystem */
#define RT_USING_DFS
+22 -12
View File
@@ -2,16 +2,19 @@
RT_USING_FINSH = True
RT_USING_DFS = True
RT_USING_DFS_YAFFS2 = False
RT_USING_DFS_EFSL = True
RT_USING_DFS_EFSL = False
RT_USING_DFS_ELMFAT = True
RT_USING_LWIP = True
# toolchains options
ARCH='arm'
CPU='stm32'
PLATFORM = 'gcc'
EXEC_PATH = 'd:/SourceryGCC/bin'
#PLATFORM = 'armcc'
#EXEC_PATH = 'C:/Keil'
#PLATFORM = 'gcc'
#EXEC_PATH = 'd:/codesourcery/bin'
PLATFORM = 'armcc'
EXEC_PATH = 'e:/Keil'
#PLATFORM = 'iar'
#EXEC_PATH = 'E:/Program Files/IAR Systems/Embedded Workbench 5.4/'
BUILD = 'debug'
if PLATFORM == 'gcc':
@@ -21,7 +24,7 @@ if PLATFORM == 'gcc':
AS = PREFIX + 'gcc'
AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc'
TARGET_EXT = 'elf'
TARGET_EXT = 'axf'
SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy'
@@ -29,7 +32,7 @@ if PLATFORM == 'gcc':
DEVICE = ' -mcpu=cortex-m3 -mthumb'
CFLAGS = DEVICE + ' -DRT_USING_MINILIBC'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=main.elf.map,-cref,-u,Reset_Handler -T stm32_rom.ld'
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-stm32.map,-cref,-u,Reset_Handler -T stm32_rom.ld'
CPATH = ''
LPATH = ''
@@ -74,11 +77,18 @@ elif PLATFORM == 'armcc':
elif PLATFORM == 'iar':
# toolchains
CC = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
CC = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
TARGET_EXT = 'out'
DEVICE = ' --cpu DARMSTM --thumb'
CFLAGS = ''
AFLAGS = ''
LFLAGS = ''
LFLAGS = ' --config stm32f10x_flash.icf'
EXEC_PATH += '/arm/bin/'
RT_USING_MINILIBC = False
POST_ACTION = ''
+149 -62
View File
File diff suppressed because it is too large. Load diff
+1 -25
View File
@@ -25,22 +25,12 @@
/*@{*/
#ifdef RT_USING_LWIP
#ifdef STM32F10X_CL
extern void rt_hw_stm32_eth_init(void);
#else
#include "enc28j60.h"
#endif
#include <netif/ethernetif.h>
#endif
extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
/* bss end definitions for heap init */
#ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit;
#elif __ICCARM__
@@ -109,25 +99,11 @@ void rtthread_startup(void)
/* init hardware serial device */
rt_hw_usart_init();
#ifdef RT_USING_DFS
/* init sdcard driver */
#if STM32_USE_SDIO
rt_hw_sdcard_init();
#else
rt_hw_msd_init();
#endif
#endif
#ifdef RT_USING_LWIP
eth_system_device_init();
/* register ethernetif device */
#ifdef STM32F10X_CL
rt_hw_stm32_eth_init();
#else
rt_hw_enc28j60_init();
#endif
#endif
rt_hw_rtc_init();
@@ -141,7 +117,7 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
finsh_set_device(FINSH_DEVICE_NAME);
finsh_set_device("uart1");
#endif
/* init idle thread */
+27 -22
View File
@@ -1,11 +1,11 @@
/**
******************************************************************************
* @file Project/Template/stm32f10x_it.c
* @file Project/Template/stm32f10x_it.c
* @author MCD Application Team
* @version V3.1.0
* @date 06/19/2009
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @copy
@@ -18,12 +18,12 @@
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>
*/
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_it.h"
#include <board.h>
#include <rtthread.h>
#include "board.h"
/** @addtogroup Template_Project
* @{
@@ -193,7 +193,7 @@ void USART1_IRQHandler(void)
#ifdef RT_USING_UART1
extern struct rt_device uart1_device;
extern void rt_hw_serial_isr(struct rt_device *device);
/* enter interrupt */
rt_interrupt_enter();
@@ -259,7 +259,7 @@ void USART3_IRQHandler(void)
*******************************************************************************/
void SDIO_IRQHandler(void)
{
#if defined(RT_USING_DFS) && STM32_USE_SDIO
#ifdef RT_USING_DFS
extern int SD_ProcessIRQSrc(void);
/* enter interrupt */
@@ -273,6 +273,8 @@ void SDIO_IRQHandler(void)
#endif
}
#ifdef RT_USING_LWIP
#if (STM32_ETH_IF == 0)
/*******************************************************************************
* Function Name : EXTI0_IRQHandler
* Description : This function handles External interrupt Line 0 request.
@@ -282,7 +284,6 @@ void SDIO_IRQHandler(void)
*******************************************************************************/
void EXTI0_IRQHandler(void)
{
#if defined(RT_USING_LWIP) && !defined(STM32F10X_CL)
extern void enc28j60_isr(void);
/* enter interrupt */
@@ -295,34 +296,38 @@ void EXTI0_IRQHandler(void)
/* leave interrupt */
rt_interrupt_leave();
#endif
}
#endif
#if (STM32_ETH_IF == 1)
/*******************************************************************************
* Function Name : ETH_IRQHandler
* Description : This function handles ETH interrupt request.
* Function Name : EXTI9_5_IRQHandler
* Description : This function handles External lines 9 to 5 interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void ETH_IRQHandler(void)
void EXTI9_5_IRQHandler(void)
{
#if defined(RT_USING_LWIP) && defined(STM32F10X_CL)
extern void rt_hw_stm32_eth_isr(void);
/* enter interrupt */
rt_interrupt_enter();
rt_hw_stm32_eth_isr();
extern void rt_dm9000_isr(void);
/* leave interrupt */
rt_interrupt_leave();
#endif
/* enter interrupt */
rt_interrupt_enter();
rt_dm9000_isr();
/* Clear the Key Button EXTI line pending bit */
EXTI_ClearITPendingBit(EXTI_Line7);
/* leave interrupt */
rt_interrupt_leave();
}
#endif
#endif /* end of RT_USING_LWIP */
/**
* @}
*/
*/
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
+3 -3
View File
@@ -1,6 +1,6 @@
/**
******************************************************************************
* @file Project/Template/stm32f10x_it.h
* @file Project/Template/stm32f10x_it.h
* @author MCD Application Team
* @version V3.1.0
* @date 06/19/2009
@@ -16,7 +16,7 @@
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>
*/
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_IT_H
@@ -24,7 +24,7 @@
#ifdef __cplusplus
extern "C" {
#endif
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
+4 -26
View File
@@ -38,7 +38,7 @@ struct stm32_serial_device uart2 =
{
USART2,
&uart2_int_rx,
&uart2_dma_rx,
RT_NULL,
RT_NULL,
RT_NULL
};
@@ -180,12 +180,6 @@ static void NVIC_Configuration(void)
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Enable the DMA1 Channel6 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel6_IRQn;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
#endif
#ifdef RT_USING_UART3
@@ -205,7 +199,7 @@ static void NVIC_Configuration(void)
static void DMA_Configuration(void)
{
#if defined(RT_USING_UART2) || defined (RT_USING_UART3)
#if defined (RT_USING_UART3)
DMA_InitTypeDef DMA_InitStructure;
/* fill init structure */
@@ -216,21 +210,7 @@ static void DMA_Configuration(void)
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
#endif
#ifdef RT_USING_UART2
/* DMA1 Channel4 (triggered by USART2 Rx event) Config */
DMA_DeInit(UART2_RX_DMA);
DMA_InitStructure.DMA_PeripheralBaseAddr = USART2_DR_Base;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
DMA_InitStructure.DMA_MemoryBaseAddr = (u32)0;
DMA_InitStructure.DMA_BufferSize = 0;
DMA_Init(UART2_RX_DMA, &DMA_InitStructure);
DMA_ITConfig(UART2_RX_DMA, DMA_IT_TC | DMA_IT_TE, ENABLE);
DMA_ClearFlag(DMA1_FLAG_TC4);
#endif
#ifdef RT_USING_UART3
/* DMA1 Channel5 (triggered by USART3 Tx event) Config */
DMA_DeInit(UART3_TX_DMA);
DMA_InitStructure.DMA_PeripheralBaseAddr = USART3_DR_Base;
@@ -298,15 +278,13 @@ void rt_hw_usart_init()
USART_Init(USART2, &USART_InitStructure);
USART_ClockInit(USART2, &USART_ClockInitStructure);
uart2_dma_rx.dma_channel= UART2_RX_DMA;
/* register uart2 */
rt_hw_serial_register(&uart2_device, "uart2",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_DMA_RX,
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
&uart2);
/* Enable USART2 DMA Rx request */
USART_DMACmd(USART2, USART_DMAReq_Rx , ENABLE);
USART_ITConfig(USART2, USART_IT_RXNE, ENABLE);
#endif
#ifdef RT_USING_UART3