[BSP] tm4c129x add eth driver

1. Add ETH MAC driver using DMA for Tx and Rx lwip pBuf.
2. Modify the tivaware emac library to fix the bug that PHY read is not stable when sysclk is 120MHz
3. In PHY IRQ handler, insert a dummy reading (REG_BMSR) before read PHY_STS to force update STS register.
This commit is contained in:
ArdaFu 2014-07-25 19:07:25 +08:00
parent 1e396417d8
commit 3879133d90
5 changed files with 1467 additions and 1 deletions

View File

@ -16,6 +16,9 @@
#include <board.h>
#include <components.h>
#ifdef RT_USING_LWIP
#include "drv_eth.h"
#endif
/* thread phase init */
void rt_init_thread_entry(void *parameter)
{
@ -24,6 +27,9 @@ void rt_init_thread_entry(void *parameter)
#ifdef RT_USING_FINSH
finsh_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_LWIP
rt_hw_tiva_eth_init();
#endif
}
int rt_application_init(void)

View File

@ -92,7 +92,7 @@ void rt_hw_board_init()
/*init uart device*/
rt_hw_uart_init();
//redirect RTT stdio to CONSOLE device
//redirect RTT stdio to CONSOLE device
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
//
// Enable interrupts to the processor.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
/*
* File : drv_eth.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009-2013 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
* 2014-07-25 ArdaFu Port to TM4C129X
*/
#ifndef __TIVA_ETH_H__
#define __TIVA_ETH_H__
rt_err_t rt_hw_tiva_eth_init(void);
#endif

View File

@ -2917,6 +2917,7 @@ EMACPHYRead(uint32_t ui32Base, uint8_t ui8PhyAddr, uint8_t ui8RegAddr)
//
HWREG(ui32Base + EMAC_O_MIIADDR) =
((HWREG(ui32Base + EMAC_O_MIIADDR) & EMAC_MIIADDR_CR_M) |
EMAC_MIIADDR_CR_100_150 |
(ui8RegAddr << EMAC_MIIADDR_MII_S) |
(ui8PhyAddr << EMAC_MIIADDR_PLA_S) | EMAC_MIIADDR_MIIB);