📄 dm642init.c
字号:
#include <stdio.h>
#include <netmain.h>
#include <csl.h>
#include <csl_cache.h>
#include <evmdm642.h>
#include <evmdm642_led.h>
#include <evmdm642_eeprom.h>
#include "SysConfig.h"
#define MAX_NAME_CHAR 32
char RemoteIPAddrTmp[MAX_NAME_CHAR] = default_RemoteIP ; /* Remote IP */
char LocalIPAddrTmp[MAX_NAME_CHAR] = default_LocalIP ; /* Local IP */
char GatewayIPTmp[MAX_NAME_CHAR] = default_GatewayIP ; // Not used when using DHCP;
char LocalIPMaskTmp[MAX_NAME_CHAR] = default_LocalIPMask ;
char HostNameTmp[MAX_NAME_CHAR] = "TI_DSP";
char *RemoteIPAddr = &RemoteIPAddrTmp[0];
char *LocalIPAddr = &LocalIPAddrTmp[0]; // Set to "0.0.0.0" for DHCP
char *LocalIPMask = &LocalIPMaskTmp[0]; // Not used when using DHCP
char *GatewayIP = &GatewayIPTmp[0]; // Not used when using DHCP
char *HostName = &HostNameTmp[0];
static UINT8 bMacAddr[MAX_NAME_CHAR] = { 0x00,0x00,0x00, 0x00,0x00,0x08 } ;
// This string array corresponds to link state as define in csl_mdio.h
static char *LinkStr[] = { "No Link",
"10Mb/s Half Duplex",
"10Mb/s Full Duplex",
"100Mb/s Half Duplex",
"100Mb/s Full Duplex" };
// New CSL Functions in csl_mdio.c
CSLAPI uint MDIO_phyRegWrite( uint phyIdx, uint phyReg, Uint16 data );
CSLAPI uint MDIO_phyRegRead( uint, uint, UINT16 * );
//
// Main Thread
//
// We changed our CDB file to point call this private init
// function. Here we initialize our board and read in our
// MAC address.
//
void dm642_init()
{
//CACHE_enableCaching(CACHE_EMIFA_CE00);
//CACHE_enableCaching(CACHE_EMIFA_CE01);
// Init the EVM
EVMDM642_init();
//EVMDM642_LED_init();
// Read in EMAC MAC Address
//GetMACInfoConfig( bMacAddr ) ;
//GetIPInfoConfig(HostName,LocalIPAddr,LocalIPMask,GatewayIP);
}
//
// DM642EMAC_getConfig()
//
// This is a callback from the Ethernet driver. This function
// is used by the driver to get its 6 byte MAC address, and
// to determine which DSP interrupt the EMAC should be mapped to.
//
void DM642EMAC_getConfig( UINT8 *pMacAddr, uint *pIntVector )
{
printf("Using MAC Address: %02x-%02x-%02x-%02x-%02x-%02x\n",
bMacAddr[0], bMacAddr[1], bMacAddr[2],
bMacAddr[3], bMacAddr[4], bMacAddr[5]);
// We fill in the two pointers here. We'll use int 15 for EMAC
mmCopy( pMacAddr, bMacAddr, 6 );
*pIntVector = 15;
}
//
// DM642EMAC_linkStatus()
//
// This is a callback from the Ethernet driver. This function
// is called whenever there is a change in link state. The
// current PHY and current link state are passed as parameters.
//
void DM642EMAC_linkStatus( uint phy, uint linkStatus )
{
printf("Link Status: %s\n",LinkStr[linkStatus]);
// Since we know we're using the Intel PHY, we'll
// go ahead and program the LEDs to make sense.
MDIO_phyRegWrite( phy, 0x14, 0xd5d0 );
SemPost( m_hNetSem ) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -