mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-06-11 09:29:40 +00:00
Added LWIP_PLATFORM_ macros.
This commit is contained in:
parent
7d1204e144
commit
a8d105875b
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
/* memset(), memcpy() */
|
/* memset(), memcpy() */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
/* printf() and abort() */
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
typedef unsigned char u8_t;
|
typedef unsigned char u8_t;
|
||||||
typedef signed char s8_t;
|
typedef signed char s8_t;
|
||||||
|
@ -13,10 +16,23 @@ typedef signed long s32_t;
|
||||||
|
|
||||||
typedef u32_t mem_ptr_t;
|
typedef u32_t mem_ptr_t;
|
||||||
|
|
||||||
// LW: Supported in at least >=v7.5 r2, but lwIP worked without the "_packed" attribute already
|
/* LW: Supported in at least >=v7.5 r2, but lwIP worked without the "_packed" attribute already */
|
||||||
#define PACK_STRUCT_BEGIN _packed
|
#define PACK_STRUCT_BEGIN _packed
|
||||||
#define PACK_STRUCT_STRUCT
|
#define PACK_STRUCT_STRUCT
|
||||||
#define PACK_STRUCT_END
|
#define PACK_STRUCT_END
|
||||||
#define PACK_STRUCT_FIELD(x) x
|
#define PACK_STRUCT_FIELD(x) x
|
||||||
|
|
||||||
|
#ifdef LWIP_DEBUG
|
||||||
|
|
||||||
|
/* LW: forward declaration */
|
||||||
|
void debug_printf(char *format, ...);
|
||||||
|
|
||||||
|
/* Plaform specific diagnostic output */
|
||||||
|
#define LWIP_PLATFORM_DIAG(x) {debug_printf x;}
|
||||||
|
|
||||||
|
#define LWIP_PLATFORM_ASSERT(x) { debug_printf("Assertion \"%s\" failed at line %d in %s\n", \
|
||||||
|
x, __LINE__, __FILE__); while(1);}
|
||||||
|
|
||||||
|
#endif/* LWIP_DEBUG */
|
||||||
|
|
||||||
#endif /* __CC_H__ */
|
#endif /* __CC_H__ */
|
||||||
|
|
|
@ -122,9 +122,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cs8900if.h"
|
#include "cs8900if.h"
|
||||||
#if LWIP_SNMP > 0
|
#include "snmp.h"
|
||||||
# include "snmp.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Define those to better describe your network interface
|
// Define those to better describe your network interface
|
||||||
#define IFNAME0 'e'
|
#define IFNAME0 'e'
|
||||||
|
@ -328,14 +326,13 @@ static err_t cs8900_output(struct netif *netif, struct pbuf *p)
|
||||||
// variable.
|
// variable.
|
||||||
for(i = 0; i < q->len; i += 2)
|
for(i = 0; i < q->len; i += 2)
|
||||||
{
|
{
|
||||||
|
/** TODO: this routine assumes 16-bit boundary pbufs... */
|
||||||
RXTXREG = *ptr++;
|
RXTXREG = *ptr++;
|
||||||
}
|
}
|
||||||
#if (CS8900_STATS > 0)
|
#if (CS8900_STATS > 0)
|
||||||
((struct cs8900if *)netif->state)->sentbytes += q->len;
|
((struct cs8900if *)netif->state)->sentbytes += q->len;
|
||||||
#endif
|
#endif
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_add_ifoutoctets(p->tot_len);
|
snmp_add_ifoutoctets(p->tot_len);
|
||||||
#endif
|
|
||||||
#if (CS8900_STATS > 0)
|
#if (CS8900_STATS > 0)
|
||||||
((struct cs8900if *)netif->state)->sentpackets++;
|
((struct cs8900if *)netif->state)->sentpackets++;
|
||||||
#endif
|
#endif
|
||||||
|
@ -344,9 +341,7 @@ static err_t cs8900_output(struct netif *netif, struct pbuf *p)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// { not ready to transmit!? }
|
// { not ready to transmit!? }
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_ifoutdiscards();
|
snmp_inc_ifoutdiscards();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
@ -393,9 +388,7 @@ static struct pbuf *cs8900_input(struct netif *netif)
|
||||||
// read RxLength
|
// read RxLength
|
||||||
len = RXTXREG;
|
len = RXTXREG;
|
||||||
DEBUGF(NETIF_DEBUG, ("cs8900_input: packet len %u\n", len));
|
DEBUGF(NETIF_DEBUG, ("cs8900_input: packet len %u\n", len));
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_add_ifinoctets(len);
|
snmp_add_ifinoctets(len);
|
||||||
#endif
|
|
||||||
// positive length?
|
// positive length?
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
|
@ -425,9 +418,7 @@ static struct pbuf *cs8900_input(struct netif *netif)
|
||||||
#if (CS8900_STATS > 0)
|
#if (CS8900_STATS > 0)
|
||||||
((struct cs8900if *)netif->state)->dropped++;
|
((struct cs8900if *)netif->state)->dropped++;
|
||||||
#endif
|
#endif
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_ifindiscards();
|
snmp_inc_ifindiscards();
|
||||||
#endif
|
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user