mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-07-17 08:28:56 +00:00
removed commented-out code for interrupts; this was old code that will no longer work with the current structure
This commit is contained in:
parent
d6f3af8fb6
commit
53c1f7d8b2
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2001, 2002 Xilinx, Inc.
|
* Copyright (c) 2001, 2002, 2003 Xilinx, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -54,7 +54,6 @@
|
|||||||
#include "xemac.h"
|
#include "xemac.h"
|
||||||
#include "xparameters.h"
|
#include "xparameters.h"
|
||||||
#include "xstatus.h"
|
#include "xstatus.h"
|
||||||
//#include "xintc.h"
|
|
||||||
#include "xexception_l.h"
|
#include "xexception_l.h"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -91,11 +90,6 @@ extern XEmacIf_Config XEmacIf_ConfigTable[];
|
|||||||
static err_t xemacif_output(struct netif *netif, struct pbuf *p,
|
static err_t xemacif_output(struct netif *netif, struct pbuf *p,
|
||||||
struct ip_addr *ipaddr);
|
struct ip_addr *ipaddr);
|
||||||
|
|
||||||
#ifdef LWIP_XEMAC_USE_INTMODE
|
|
||||||
static void FifoSendHandler(void *CallBackRef);
|
|
||||||
static void ErrorHandler(void *CallBackRef, XStatus Code);
|
|
||||||
#endif /* LWIP_XEMAC_USE_INTMODE */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* low_level_init function */
|
/* low_level_init function */
|
||||||
/* - hooks up the data structures and sets the mac options and mac */
|
/* - hooks up the data structures and sets the mac options and mac */
|
||||||
@ -115,13 +109,6 @@ low_level_init(struct netif *netif_ptr)
|
|||||||
Result = XEmac_Initialize(InstancePtr, DeviceId);
|
Result = XEmac_Initialize(InstancePtr, DeviceId);
|
||||||
if (Result != XST_SUCCESS) return ERR_MEM;
|
if (Result != XST_SUCCESS) return ERR_MEM;
|
||||||
|
|
||||||
/* Do self-test */
|
|
||||||
/* Result = XEmac_SelfTest(InstancePtr);
|
|
||||||
if (Result != XST_SUCCESS) {
|
|
||||||
return ERR_MEM;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Stop the EMAC hardware */
|
/* Stop the EMAC hardware */
|
||||||
XEmac_Stop(InstancePtr);
|
XEmac_Stop(InstancePtr);
|
||||||
|
|
||||||
@ -151,54 +138,6 @@ low_level_init(struct netif *netif_ptr)
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LWIP_XEMAC_USE_INTMODE
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* FifoSendHandler() */
|
|
||||||
/* */
|
|
||||||
/* Checks for Tx Errors */
|
|
||||||
/* TODO: Add actions. Nothing happens if an error is found. */
|
|
||||||
/* */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static void FifoSendHandler(void *CallBackRef)
|
|
||||||
{
|
|
||||||
struct netif *netif_ptr = (struct netif *) CallBackRef;
|
|
||||||
XEmac *EmacPtr = ((XEmacIf_Config*) netif_ptr->state)->instance_ptr;
|
|
||||||
XEmacStats Stats;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check stats for transmission errors (overrun or underrun errors are
|
|
||||||
* caught by the asynchronous error handler).
|
|
||||||
*/
|
|
||||||
XEmac_GetStats(EmacPtr, &Stats);
|
|
||||||
if (Stats.XmitLateCollisionErrors || Stats.XmitExcessDeferral)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* ErrorHandler() */
|
|
||||||
/* */
|
|
||||||
/* Resets the MAC hardware is an error occurs */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static void ErrorHandler(void *CallBackRef, XStatus Code)
|
|
||||||
{
|
|
||||||
struct netif *netif_ptr = (struct netif *) CallBackRef;
|
|
||||||
XEmac *EmacPtr = ((XEmacIf_Config*) netif_ptr->state)->instance_ptr;
|
|
||||||
|
|
||||||
if (Code == XST_RESET_ERROR) {
|
|
||||||
/*
|
|
||||||
* A reset error means the application should reset the device because
|
|
||||||
* it encountered a reset condition (most likely a FIFO overrun, but
|
|
||||||
* can be other reasons). You can look at the XEmac statistics to
|
|
||||||
* see what the error is.
|
|
||||||
*/
|
|
||||||
XEmac_Reset(EmacPtr);
|
|
||||||
(void)XEmac_SetMacAddress(EmacPtr, (Xuint8*) netif_ptr->hwaddr);
|
|
||||||
(void)XEmac_SetOptions(EmacPtr,XEM_UNICAST_OPTION|XEM_BROADCAST_OPTION);
|
|
||||||
(void)XEmac_Start(EmacPtr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* LWIP_XEMAC_USE_INTMODE */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* low_level_output() */
|
/* low_level_output() */
|
||||||
/* */
|
/* */
|
||||||
@ -230,20 +169,10 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LWIP_XEMAC_USE_INTMODE
|
|
||||||
|
|
||||||
Result = XEmac_FifoSend(xemacif_ptr->instance_ptr,
|
|
||||||
(Xuint8 *) frame_buffer,
|
|
||||||
payload_size);
|
|
||||||
|
|
||||||
#else /* LWIP_XEMAC_USE_INTMODE */
|
|
||||||
|
|
||||||
Result = XEmac_PollSend(xemacif_ptr->instance_ptr,
|
Result = XEmac_PollSend(xemacif_ptr->instance_ptr,
|
||||||
(Xuint8 *) frame_buffer,
|
(Xuint8 *) frame_buffer,
|
||||||
payload_size);
|
payload_size);
|
||||||
|
|
||||||
#endif /* LWIP_XEMAC_USE_INTMODE */
|
|
||||||
|
|
||||||
if (Result != XST_SUCCESS)
|
if (Result != XST_SUCCESS)
|
||||||
{
|
{
|
||||||
xil_printf("XEmac_PollSend: failed\r\n");
|
xil_printf("XEmac_PollSend: failed\r\n");
|
||||||
@ -299,11 +228,7 @@ static struct pbuf * low_level_input(XEmacIf_Config *xemacif_ptr)
|
|||||||
u8_t * frame_bytes = (u8_t *) RecvBuffer;
|
u8_t * frame_bytes = (u8_t *) RecvBuffer;
|
||||||
XStatus Result;
|
XStatus Result;
|
||||||
|
|
||||||
#ifdef LWIP_XEMAC_USE_INTMODE
|
|
||||||
Result = XEmac_FifoRecv(EmacPtr, (Xuint8 *)RecvBuffer, &FrameLen);
|
|
||||||
#else
|
|
||||||
Result = XEmac_PollRecv(EmacPtr, (Xuint8 *)RecvBuffer, &FrameLen);
|
Result = XEmac_PollRecv(EmacPtr, (Xuint8 *)RecvBuffer, &FrameLen);
|
||||||
#endif /* LWIP_XEMAC_USE_INTMODE */
|
|
||||||
|
|
||||||
if (Result != XST_SUCCESS)
|
if (Result != XST_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -401,11 +326,6 @@ err_t xemacif_input(void *CallBackRef)
|
|||||||
struct eth_hdr * ethernet_header;
|
struct eth_hdr * ethernet_header;
|
||||||
struct pbuf *p, *q;
|
struct pbuf *p, *q;
|
||||||
|
|
||||||
#ifdef LWIP_XEMAC_USE_INTMODE
|
|
||||||
/* Disable Interrupts */
|
|
||||||
XIntc_Disable(XIntc_GetInstance(0), XPAR_INTC_0_DEVICE_ID);
|
|
||||||
#endif /* LWIP_XEMAC_USE_INTMODE */
|
|
||||||
|
|
||||||
xemacif_ptr = netif_ptr->state;
|
xemacif_ptr = netif_ptr->state;
|
||||||
|
|
||||||
p = low_level_input(xemacif_ptr);
|
p = low_level_input(xemacif_ptr);
|
||||||
@ -434,10 +354,6 @@ err_t xemacif_input(void *CallBackRef)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LWIP_XEMAC_USE_INTMODE
|
|
||||||
/* Enable Interrupts again */
|
|
||||||
XIntc_Enable(XIntc_GetInstance(0), XPAR_INTC_0_DEVICE_ID);
|
|
||||||
#endif /* LWIP_XEMAC_USE_INTMODE */
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,9 +395,6 @@ err_t xemacif_init(struct netif *netif_ptr)
|
|||||||
{
|
{
|
||||||
XEmacIf_Config *xemacif_ptr;
|
XEmacIf_Config *xemacif_ptr;
|
||||||
|
|
||||||
//struct xemacif *xemacif_ptr;
|
|
||||||
//xemacif_ptr = mem_malloc(sizeof(struct xemacif));
|
|
||||||
|
|
||||||
xemacif_ptr = (XEmacIf_Config *) netif_ptr->state;
|
xemacif_ptr = (XEmacIf_Config *) netif_ptr->state;
|
||||||
|
|
||||||
netif_ptr->mtu = 1500;
|
netif_ptr->mtu = 1500;
|
||||||
|
Loading…
Reference in New Issue
Block a user