fixex formatting

This commit is contained in:
Markus Fröschle
2013-12-30 12:19:42 +00:00
parent 3ce420e01d
commit 2416073a41
3 changed files with 19 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* File: arp.c * File: bootp.c
* Purpose: Address Resolution Protocol routines. * Purpose: Address Resolution Protocol routines.
* *
* Notes: * Notes:
@@ -11,7 +11,14 @@
#include <stddef.h> #include <stddef.h>
#include "bas_printf.h" #include "bas_printf.h"
#define TIMER_NETWORK 3 #define DBG_BOOTP
#ifdef DBG_BOOTP
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0)
#else
#define dbg(format, arg...) do { ; } while (0)
#endif /* DBG_BOOTP */
#define TIMER_NETWORK 3 /* defines GPT3 as timer for this function */
static struct bootp_connection connection; static struct bootp_connection connection;
#define XID 0x1234 /* this is arbitrary */ #define XID 0x1234 /* this is arbitrary */
@@ -52,6 +59,7 @@ void bootp_request(NIF *nif, uint8_t *pa)
connection.nif = nif; connection.nif = nif;
addr = &nif->hwa[0]; addr = &nif->hwa[0];
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
p->ch_addr[i] = addr[i]; p->ch_addr[i] = addr[i];
@@ -65,7 +73,7 @@ void bootp_request(NIF *nif, uint8_t *pa)
/* Send the BOOTP request */ /* Send the BOOTP request */
result = udp_send(connection.nif, broadcast, BOOTP_CLIENT_PORT, result = udp_send(connection.nif, broadcast, BOOTP_CLIENT_PORT,
BOOTP_SERVER_PORT, nbuf); BOOTP_SERVER_PORT, nbuf);
xprintf("sent bootp request\r\n"); dbg("sent bootp request\r\n");
if (result == true) if (result == true)
break; break;
} }
@@ -86,6 +94,8 @@ void bootp_handler(NIF *nif, NBUF *nbuf)
struct bootp_packet *rx_p; struct bootp_packet *rx_p;
udp_frame_hdr *udpframe; udp_frame_hdr *udpframe;
dbg("%s\n", __FUNCTION__);
rx_p = (struct bootp_packet *) &nbuf->data[nbuf->offset]; rx_p = (struct bootp_packet *) &nbuf->data[nbuf->offset];
udpframe = (udp_frame_hdr *) &nbuf->data[nbuf->offset - UDP_HDR_SIZE]; udpframe = (udp_frame_hdr *) &nbuf->data[nbuf->offset - UDP_HDR_SIZE];
@@ -93,7 +103,7 @@ void bootp_handler(NIF *nif, NBUF *nbuf)
if (rx_p->type == BOOTP_TYPE_BOOTREPLY && rx_p->xid == XID) if (rx_p->type == BOOTP_TYPE_BOOTREPLY && rx_p->xid == XID)
{ {
xprintf("received bootp reply\r\n"); dbg("received bootp reply\r\n");
/* seems to be valid */ /* seems to be valid */
} }
@@ -102,6 +112,4 @@ void bootp_handler(NIF *nif, NBUF *nbuf)
/* not valid */ /* not valid */
return; return;
} }
return;
} }

View File

@@ -11,12 +11,12 @@
#include "net.h" #include "net.h"
#include <stddef.h> #include <stddef.h>
#define UDP_DEBUG #define DBG_UDP
#if defined(UDP_DEBUG) #if defined(DBG_UDP)
#define dbg(format, arg...) do { xprintf("DEBUG: " format "\r\n", ##arg); } while (0) #define dbg(format, arg...) do { xprintf("DEBUG: " format "\r\n", ##arg); } while (0)
#else #else
#define dbg(format, arg...) do { ; } while (0) #define dbg(format, arg...) do { ; } while (0)
#endif #endif /* DBG_UDP */
typedef struct typedef struct
{ {

View File

@@ -65,7 +65,7 @@
#ifdef DBG_RADEON #ifdef DBG_RADEON
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0) #define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0)
#else #else
#defind dbg(format, arg...) do { ; } while (0) #define dbg(format, arg...) do { ; } while (0)
#endif /* DBG_RADEON */ #endif /* DBG_RADEON */
extern void run_bios(struct radeonfb_info *rinfo); extern void run_bios(struct radeonfb_info *rinfo);