资源简介

基于stm32实现的bootloader及移植的rtthread,包含lwip。

资源截图

代码片段和文件信息

/*------------------------------------
function: 网口相关初始化
time: 2017/8/16 13:51创建
------------------------------------*/

#include “stm32f10x.h“
#include “stm32_eth.h“
#include “ethernet.h“
#include “netconf.h“

/*
function:eth中断函数
*/
void ETH_IRQHandler(void)
{
while(ETH_GetRxPktSize() != 0) 
{
eth_recv_data_handle();
}

/* Clear the Eth DMA Rx IT pending bits */
ETH_DMAClearITPendingBit(ETH_DMA_IT_R);
ETH_DMAClearITPendingBit(ETH_DMA_IT_NIS);
}

/*
function:网口初始化
*/
void ethernet_init(void)
{
GPIO_InitTypeDef gpio_struct;
NVIC_InitTypeDef nvic_struct;
ETH_InitTypeDef  eth_struct;

/* 开启时钟 */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_ETH_MAC | RCC_AHBPeriph_ETH_MAC_Tx |
  RCC_AHBPeriph_ETH_MAC_Rx ENABLE);

/* 配置中断 */
nvic_struct.NVIC_IRQChannel = ETH_IRQn;
nvic_struct.NVIC_IRQChannelPreemptionPriority = 2;
nvic_struct.NVIC_IRQChannelSubPriority = 0;
nvic_struct.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&nvic_struct);    

/* ethernet io管脚配置 */
/* input */
/* MII_CRS:PA0  MII_RX_CLK:PA1  MII_COL:PA3 MII_RX_DV: PA7 */ 
gpio_struct.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_3 | GPIO_Pin_7;
gpio_struct.GPIO_Speed = GPIO_Speed_50MHz;
gpio_struct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA &gpio_struct);
/* MII_RX_ER:PB10 MII_RX2:PB0 MII_RX3:PB1 */
gpio_struct.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_10;
gpio_struct.GPIO_Speed = GPIO_Speed_50MHz;
gpio_struct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB &gpio_struct);
/* MII_TX_CLK:PC3  MII_RX0: PC4  MII_RX1: PC5 */
gpio_struct.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5;
gpio_struct.GPIO_Speed = GPIO_Speed_50MHz;
gpio_struct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOC &gpio_struct);
/* output */
/* MII_MDIO:PA2 */
gpio_struct.GPIO_Pin = GPIO_Pin_2;
gpio_struct.GPIO_Speed = GPIO_Speed_50MHz;
gpio_struct.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOA &gpio_struct);
/* MII_TXD0:PB12  MII_TXD1:PB13  MII_TXD3:PB8 MII_TX_EN: PB11 */
gpio_struct.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_11 |
                           GPIO_Pin_12 | GPIO_Pin_13;
gpio_struct.GPIO_Speed = GPIO_Speed_50MHz;
gpio_struct.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOB &gpio_struct);
/* MII_MDC:PC1  MII_TXD2:PC2 */
gpio_struct.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2;
gpio_struct.GPIO_Speed = GPIO_Speed_50MHz;
gpio_struct.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOC &gpio_struct);

/* configur ethernet interface */

/* 配置为mii接口 */
GPIO_ETH_MediaInterfaceConfig(GPIO_ETH_MediaInterface_MII);

/* Selects the clock source to output on MCO pin */
RCC_MCOConfig(RCC_MCO_NoClock);

/* Reset ETHERNET on AHB Bus */
ETH_DeInit();

/* Software reset */
ETH_SoftwareReset();
/* Wait for software reset */
while (ETH_GetSoftwareResetStatus() == SET);

/* deafault value */
ETH_StructInit(ð_struct);

/* MAC */
eth_struct.ETH_AutoNegotiation 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      10652  2017-09-30 10:18  stm32\STM32_BOOT\boot.bin

     文件       6956  2015-12-10 17:06  stm32\STM32_BOOT\DebugConfig\stm32_boot_STM32F107VC_1.0.0.dbgconf

     文件       5119  2017-09-29 18:22  stm32\STM32_BOOT\drive\ethernet.c

     文件        257  2017-08-24 13:03  stm32\STM32_BOOT\drive\ethernet.h

     文件        998  2017-09-26 17:08  stm32\STM32_BOOT\drive\io.c

     文件        234  2017-08-18 10:22  stm32\STM32_BOOT\drive\io.h

     文件        937  2017-09-26 18:56  stm32\STM32_BOOT\drive\key.c

     文件        253  2017-08-22 16:30  stm32\STM32_BOOT\drive\key.h

     文件       1334  2017-09-30 10:17  stm32\STM32_BOOT\drive\led.c

     文件        280  2017-09-29 18:16  stm32\STM32_BOOT\drive\led.h

     文件       9380  2017-09-29 18:20  stm32\STM32_BOOT\drive\sd.c

     文件       1110  2017-09-27 13:01  stm32\STM32_BOOT\drive\sd.h

     文件       3592  2017-09-27 18:28  stm32\STM32_BOOT\drive\stm_flash.c

     文件        442  2017-08-18 11:02  stm32\STM32_BOOT\drive\stm_flash.h

     文件        774  2017-09-26 18:56  stm32\STM32_BOOT\drive\timer.c

     文件        249  2017-09-26 18:56  stm32\STM32_BOOT\drive\timer.h

     文件       2716  2017-09-29 18:18  stm32\STM32_BOOT\drive\uart.c

     文件        521  2017-09-26 17:08  stm32\STM32_BOOT\drive\uart.h

     文件     116330  2009-11-20 17:07  stm32\STM32_BOOT\eth_lib\stm32_eth.c

     文件      90343  2009-11-20 17:07  stm32\STM32_BOOT\eth_lib\stm32_eth.h

     文件        339  2017-09-28 21:32  stm32\STM32_BOOT\EventRecorderStub.scvd

     文件       6396  2017-09-27 12:58  stm32\STM32_BOOT\fatfs\diskio.c

     文件       2830  2017-09-27 11:54  stm32\STM32_BOOT\fatfs\diskio.h

     文件     219223  2017-05-21 12:10  stm32\STM32_BOOT\fatfs\ff.c

     文件      14003  2017-05-21 12:10  stm32\STM32_BOOT\fatfs\ff.h

     文件      10803  2017-09-13 13:14  stm32\STM32_BOOT\fatfs\ffconf.h

     文件        853  2017-05-21 12:10  stm32\STM32_BOOT\fatfs\integer.h

     文件      95854  2017-09-29 18:26  stm32\STM32_BOOT\JlinkLog.txt

     文件        760  2017-09-27 13:10  stm32\STM32_BOOT\JlinkSettings.ini

     文件      55286  2017-09-30 10:18  stm32\STM32_BOOT\Listings\startup_stm32f10x_cl.lst

............此处省略837个文件信息

评论

共有 条评论