⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 net_bsp.c

📁 uCOS-II V2.84 LM3S6965 TCPIP Demo
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
*********************************************************************************************************
*                                              uC/TCP-IP
*                                      The Embedded TCP/IP Stack
*
*                            (c) Copyright 2004; Micrium, Inc.; Weston, FL
*
*                   All rights reserved.  Protected by international copyright laws.
*                   Knowledge of the source code may not be used to write a similar
*                   product.  This file may only be used in accordance with a license
*                   and should not be redistributed in any way.
*********************************************************************************************************
*
*                                BOARD SUPPORT PACKAGE (BSP) FUNCTIONS
*
*                                       Luminary Micro LM3S6965
*                                              with the
*                             Luminary Micro LM3S6965 ENET Development Kit
*
* Filename   : net_bsp.c
* Programmer : Brian Nagel
* Version    : 1.0
* Date       : 04/05/2007
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                            INCLUDE FILES
*********************************************************************************************************
*/

#include  <includes.h>
#include  <gpio.h>

/*
*********************************************************************************************************
*                                            LOCAL DEFINES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                           LOCAL CONSTANTS
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                          LOCAL DATA TYPES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                            LOCAL TABLES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                       LOCAL GLOBAL VARIABLES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                      LOCAL FUNCTION PROTOTYPES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*********************************************************************************************************
*                                  NETWORK INTERFACE CARD FUNCTIONS
*********************************************************************************************************
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                        NetBSP_DlyMs()
*
* Description : This function is used by the NIC driver to create delays of an arbitrary abount
*               of milliseconds during initialization.
*
* Arguments   : none
*********************************************************************************************************
*/

void  NetBSP_DlyMs (CPU_INT32U ms)
{
    OSTimeDlyHMSM(0, 0, 0, ms);
}


/*
*********************************************************************************************************
*                                    NetNIC_LinkUp() & NetNIC_LinkDown()
*
* Description : Message from NIC that the ethernet link is up/down.
*
* Argument(s) : none.
*
* Return(s)   : none.
*
* Caller(s)   : none.
*
* Note(s)     : WARNING: Called in interruption context most of the time.
*********************************************************************************************************
*/

void  NetNIC_LinkUp (void)
{

}


void  NetNIC_LinkDown (void)
{

}


/*
*********************************************************************************************************
*********************************************************************************************************
*                                  Board Support Functions
*********************************************************************************************************
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                            Initialize the PHY hardware
*
* Description : This function configures the I/O pins for the PHY if no internal PHY is present.
*
* Argument(s) : none.
*
* Returns     : none.
*
* Note(s)     : (1) If an external PHY is present, then the pin connections are as follows:
*
*                      LM3SNNNN PIN       EMAC PIN      DIRECTION
*                         A.02              TXD2         Output
*                         A.03              TXD1         Output
*                         A.04              TXD0         Output
*                         A.05              RXDV          Input
*                         A.06              RXCK          Input
*                         A.07              RXERR         Input
*                         C.04              TXD3         Output
*                         F.02              PHYINTRn      Input
*                         F.03              MDC          Output
*                         F.04              MDIO      Input/Output
*                         F.05              RXD3          Input
*                         F.06              RXD2          Input
*                         F.07              RXD1          Input
*                         G.02              COL           Input
*                         G.03              CRS           Input
*                         G.04              RXD0          Input
*                         G.05              TXEN         Output
*                         G.06              TXCK          Input
*                         G.07              TXER          Input
*                         H.00              PHYRSTn
*
*********************************************************************************************************
*/

void  NetBSP_PHY_HW_Init (void)
{
#ifdef  SYSCTL_PERIPH_PHY
    if (SysCtlPeripheralPresent(SYSCTL_PERIPH_PHY) == DEF_TRUE) {
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
        GPIODirModeSet(  GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3), GPIO_DIR_MODE_HW);
        GPIOPadConfigSet(GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3), GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_OD_WPU);
        return;
    }

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    GPIODirModeSet(  GPIO_PORTA_BASE, (GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 ), GPIO_DIR_MODE_HW);
    GPIOPadConfigSet(GPIO_PORTA_BASE, (GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 ), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    GPIODirModeSet(  GPIO_PORTC_BASE, GPIO_PIN_4, GPIO_DIR_MODE_HW);
    GPIOPadConfigSet(GPIO_PORTC_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    GPIODirModeSet(  GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7), GPIO_DIR_MODE_HW);
    GPIOPadConfigSet(GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7), GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
    GPIODirModeSet(  GPIO_PORTG_BASE, (GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7), GPIO_DIR_MODE_HW);
    GPIOPadConfigSet(GPIO_PORTG_BASE, (GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
    GPIODirModeSet(  GPIO_PORTH_BASE, GPIO_PIN_0, GPIO_DIR_MODE_HW);
    GPIOPadConfigSet(GPIO_PORTH_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
#else
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    GPIODirModeSet(  GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3), GPIO_DIR_MODE_HW);
    GPIOPadConfigSet(GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3), GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_OD_WPU);
    return;
#endif
}


/*
*********************************************************************************************************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -