Made debug printfs optional

This commit is contained in:
adamdunkels 2010-02-23 18:49:58 +00:00
parent 0ab2ba433f
commit bb62749de7

View file

@ -28,32 +28,38 @@
*
* This file is part of the Contiki operating system.
*
* $Id: mac.c,v 1.1 2010/02/18 21:48:39 adamdunkels Exp $
* $Id: mac.c,v 1.2 2010/02/23 18:49:58 adamdunkels Exp $
*/
#include "net/mac/mac.h"
#define DEBUG 0
#if DEBUG
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#else /* DEBUG */
#define PRINTF(...)
#endif /* DEBUG */
/*---------------------------------------------------------------------------*/
void
mac_call_sent_callback(mac_callback_t sent, void *ptr, int status, int num_tx)
{
/* printf("mac_callback_t %p ptr %p status %d num_tx %d\n",
sent, ptr, status, num_tx);*/
/* switch(status) {
PRINTF("mac_callback_t %p ptr %p status %d num_tx %d\n",
sent, ptr, status, num_tx);
switch(status) {
case MAC_TX_COLLISION:
printf("mac: collision after %d tx\n", num_tx);
PRINTF("mac: collision after %d tx\n", num_tx);
break;
case MAC_TX_NOACK:
printf("mac: noack after %d tx\n", num_tx);
PRINTF("mac: noack after %d tx\n", num_tx);
break;
case MAC_TX_OK:
printf("mac: sent after %d tx\n", num_tx);
PRINTF("mac: sent after %d tx\n", num_tx);
break;
default:
printf("mac: error %d after %d tx\n", status, num_tx);
}*/
PRINTF("mac: error %d after %d tx\n", status, num_tx);
}
if(sent) {
sent(ptr, status, num_tx);