annotate network/Lib/Debug.c @ 110:4eb5a746d7af avr-http

Import avrusbmodem code minus the USB bits. Not built yet.
author Matt Johnston <matt@ucc.asn.au>
date Sat, 15 Sep 2012 21:49:05 +0800
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
110
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 /*
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 LUFA Powered Wireless 3G Modem Host
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
4 Copyright (C) Mike Alexander, 2010.
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
5 Copyright (C) Dean Camera, 2010.
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
6 */
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8 /*
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9 Copyright 2010 Mike Alexander (mike [at] mikealex [dot] com)
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10 Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
12 Permission to use, copy, modify, distribute, and sell this
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
13 software and its documentation for any purpose is hereby granted
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14 without fee, provided that the above copyright notice appear in
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15 all copies and that both that the copyright notice and this
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
16 permission notice and warranty disclaimer appear in supporting
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17 documentation, and that the name of the author not be used in
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
18 advertising or publicity pertaining to distribution of the
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
19 software without specific, written prior permission.
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
20
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
21 The author disclaim all warranties with regard to this
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
22 software, including all implied warranties of merchantability
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
23 and fitness. In no event shall the author be liable for any
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
24 special, indirect or consequential damages or any damages
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
25 whatsoever resulting from loss of use, data or profits, whether
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
26 in an action of contract, negligence or other tortious action,
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27 arising out of or in connection with the use or performance of
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
28 this software.
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
29 */
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
30
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
31 #include "Debug.h"
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
32
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
33 bool DebugModeEnabled = false;
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
34
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
35 void Debug_PrintChar(const char DebugChar)
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
36 {
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
37 if (DebugModeEnabled)
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
38 putchar(DebugChar);
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
39 }
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
40
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
41 void Debug_Print(const char* DebugText)
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
42 {
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
43 if (DebugModeEnabled)
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
44 {
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
45 while (*DebugText)
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
46 putchar(*(DebugText++));
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
47 }
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
48 }
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
49
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
50 void Debug_PrintHex(const uint8_t DebugChar)
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
51 {
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
52 if ((DebugChar >> 4) > 9)
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
53 Debug_PrintChar((DebugChar >> 4) + 'a' - 10);
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
54 else
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
55 Debug_PrintChar((DebugChar >> 4) + '0');
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
56
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
57 if ((DebugChar & 0x0f) > 9)
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
58 Debug_PrintChar((DebugChar & 0x0f) + 'a' - 10);
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
59 else
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
60 Debug_PrintChar((DebugChar & 0x0f) + '0');
4eb5a746d7af Import avrusbmodem code minus the USB bits. Not built yet.
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
61 }