Contiki 2.6

debug.c

Go to the documentation of this file.
00001 /**
00002  * \file
00003  *
00004  *   Definition of some debugging functions.
00005  *
00006  *   putstring() and puthex() are from msp430/watchdog.c
00007  *
00008  * \author
00009  *         George Oikonomou - <oikonomou@users.sourceforge.net>
00010  */
00011 
00012 #include "8051def.h"
00013 #include "debug.h"
00014 
00015 static const char hexconv[] = "0123456789abcdef";
00016 static const char binconv[] = "01";
00017 /*---------------------------------------------------------------------------*/
00018 void
00019 putstring(char *s)
00020 {
00021   while(*s) {
00022     putchar(*s++);
00023   }
00024 }
00025 /*---------------------------------------------------------------------------*/
00026 void
00027 puthex(uint8_t c)
00028 {
00029   putchar(hexconv[c >> 4]);
00030   putchar(hexconv[c & 0x0f]);
00031 }
00032 /*---------------------------------------------------------------------------*/
00033 void
00034 putbin(uint8_t c)
00035 {
00036   unsigned char i = 0x80;
00037   while(i) {
00038     putchar(binconv[(c & i) != 0]);
00039     i >>= 1;
00040   }
00041 }
00042 /*---------------------------------------------------------------------------*/