cleaned up

This commit is contained in:
Markus Fröschle
2014-01-07 05:57:17 +00:00
parent 30ceaacc0f
commit f3797f1919
8 changed files with 24 additions and 18 deletions

View File

@@ -47,8 +47,8 @@ static struct xhdi_driver_interface xhdi_call_interface =
static struct dma_driver_interface dma_interface = static struct dma_driver_interface dma_interface =
{ {
.version = 0x0101, .version = 0x0101,
.magic = 'DMAC', .magic = 0x444d4143, /* 'DMAC' */
.dma_set_initiator = &dma_set_initiator, .dma_set_initiator = dma_set_initiator,
.dma_get_initiator = dma_get_initiator, .dma_get_initiator = dma_get_initiator,
.dma_free_initiator = dma_free_initiator, .dma_free_initiator = dma_free_initiator,
.dma_set_channel = dma_set_channel, .dma_set_channel = dma_set_channel,

View File

@@ -35,6 +35,7 @@ extern char *strncat(char *dst, const char *src, size_t max);
extern int atoi(const char *c); extern int atoi(const char *c);
extern void *memcpy(void *dst, const void *src, size_t n); extern void *memcpy(void *dst, const void *src, size_t n);
extern void *memset(void *s, int c, size_t n); extern void *memset(void *s, int c, size_t n);
extern int memcmp(const char *s1, const char *s2, size_t max);
extern void bzero(void *s, size_t n); extern void bzero(void *s, size_t n);
#define isdigit(c) (((c) >= '0') && ((c) <= '9')) #define isdigit(c) (((c) >= '0') && ((c) <= '9'))

View File

@@ -50,17 +50,17 @@ struct dma_driver_interface
{ {
int32_t version; int32_t version;
int32_t magic; int32_t magic;
int32_t (*dma_set_initiator)(int32_t initiator); int (*dma_set_initiator)(int initiator);
uint32_t (*dma_get_initiator)(int32_t requestor); uint32_t (*dma_get_initiator)(int requestor);
void (*dma_free_initiator)(int32_t requestor); void (*dma_free_initiator)(int requestor);
int32_t (*dma_set_channel)(int32_t requestor, void (*handler)(void)); int (*dma_set_channel)(int requestor, void (*handler)(void));
int32_t (*dma_get_channel)(int32_t requestor); int (*dma_get_channel)(int requestor);
void (*dma_free_channel)(int32_t requestor); void (*dma_free_channel)(int requestor);
void (*dma_clear_channel)(int32_t channel); void (*dma_clear_channel)(int channel);
int32_t (*MCD_startDma)(long channel, int (*MCD_startDma)(long channel,
int8_t *srcAddr, uint32_t srcIncr, int8_t *destAddr, uint32_t destIncr, int8_t *srcAddr, unsigned int srcIncr, int8_t *destAddr, unsigned int destIncr,
uint32_t dmaSize, uint32_t xferSize, uint32_t initiator, int32_t priority, unsigned int dmaSize, unsigned int xferSize, unsigned int initiator, int priority,
uint32_t flags, uint32_t funcDesc); unsigned int flags, unsigned int funcDesc);
int32_t (*MCD_dmaStatus)(int32_t channel); int32_t (*MCD_dmaStatus)(int32_t channel);
int32_t (*MCD_XferProgrQuery)(int32_t channel, MCD_XferProg *progRep); int32_t (*MCD_XferProgrQuery)(int32_t channel, MCD_XferProg *progRep);
int32_t (*MCD_killDma)(int32_t channel); int32_t (*MCD_killDma)(int32_t channel);

View File

@@ -11,7 +11,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#define DBG_ARP //#define DBG_ARP
#ifdef DBG_ARP #ifdef DBG_ARP
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0) #define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0)
#else #else

View File

@@ -11,7 +11,7 @@
#include <stddef.h> #include <stddef.h>
#include "bas_printf.h" #include "bas_printf.h"
#define DBG_BOOTP //#define DBG_BOOTP
#ifdef DBG_BOOTP #ifdef DBG_BOOTP
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0) #define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0)
#else #else

View File

@@ -18,7 +18,7 @@
#include "bas_printf.h" #include "bas_printf.h"
#include "util.h" #include "util.h"
#include "am79c874.h" #include "am79c874.h"
#include "bcm5222.h" //#include "bcm5222.h"
#include <stdbool.h> #include <stdbool.h>
#if defined(MACHINE_FIREBEE) #if defined(MACHINE_FIREBEE)

View File

@@ -289,6 +289,8 @@ void ip_handler(NIF *nif, NBUF *pNbuf)
*/ */
if (!validate_ip_hdr(nif, ipframe)) if (!validate_ip_hdr(nif, ipframe))
{ {
dbg("%s: not a valid IP packet!\r\n", __FUNCTION__);
nbuf_free(pNbuf); nbuf_free(pNbuf);
return; return;
} }
@@ -308,6 +310,8 @@ void ip_handler(NIF *nif, NBUF *pNbuf)
udp_handler(nif,pNbuf); udp_handler(nif,pNbuf);
break; break;
default: default:
dbg("%s: no protocol handler registered for protocol %d\r\n",
__FUNCTION__, IP_PROTOCOL(ipframe));
nbuf_free(pNbuf); nbuf_free(pNbuf);
break; break;
} }

View File

@@ -39,6 +39,7 @@ void udp_init(void)
for (index = 0; index < UDP_MAX_PORTS; ++index) for (index = 0; index < UDP_MAX_PORTS; ++index)
{ {
udp_port_table[index].port = 0; udp_port_table[index].port = 0;
udp_port_table[index].handler = 0;
} }
udp_port = DEFAULT_UDP_PORT; /* next free port */ udp_port = DEFAULT_UDP_PORT; /* next free port */
@@ -88,7 +89,7 @@ static void *udp_port_handler(uint16_t port)
{ {
if (udp_port_table[index].port == port) if (udp_port_table[index].port == port)
{ {
return (void *)udp_port_table[index].handler; return (void *) udp_port_table[index].handler;
} }
} }
return NULL; return NULL;
@@ -116,7 +117,7 @@ int udp_send(NIF *nif, uint8_t *dest, int sport, int dport, NBUF *pNbuf)
} }
/* /*
* This function takes data and creates a UDP frame and * This function takes data, creates a UDP frame from it and
* passes it onto the IP layer * passes it onto the IP layer
*/ */
udp_frame_hdr *udpframe; udp_frame_hdr *udpframe;