added debug output

This commit is contained in:
Markus Fröschle
2013-12-24 16:40:23 +00:00
parent ca041d331b
commit 75677cf1a7
4 changed files with 315 additions and 299 deletions

View File

@@ -11,6 +11,13 @@
#include "net.h"
#include <stddef.h>
#define UDP_DEBUG
#if defined(UDP_DEBUG)
#define dbg(format, arg...) do { xprintf("DEBUG: " format "\r\n", ##arg); } while (0)
#else
#define dbg(format, arg...) do { ; } while (0)
#endif
typedef struct
{
uint16_t port;
@@ -99,6 +106,12 @@ uint16_t udp_obtain_free_port(void)
int udp_send(NIF *nif, uint8_t *dest, int sport, int dport, NBUF *pNbuf)
{
if (nif == NULL)
{
dbg("%s: nif is NULL\r\n", __FUNCTION__);
return 0;
}
/*
* This function takes data and creates a UDP frame and
* passes it onto the IP layer