projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add support for ATmega168p CPU
[pub/USBasp.git]
/
firmware
/
usbdrv
/
oddebug.h
diff --git
a/firmware/usbdrv/oddebug.h
b/firmware/usbdrv/oddebug.h
index
28d5f94
..
851f84d
100644
(file)
--- a/
firmware/usbdrv/oddebug.h
+++ b/
firmware/usbdrv/oddebug.h
@@
-4,15
+4,12
@@
* Creation Date: 2005-01-16
* Tabsize: 4
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
* Creation Date: 2005-01-16
* Tabsize: 4
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
- * License: Proprietary, free under certain conditions. See Documentation.
- * This Revision: $Id: oddebug.h 52 2005-04-12 16:57:29Z cs $
+ * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
*/
#ifndef __oddebug_h_included__
#define __oddebug_h_included__
*/
#ifndef __oddebug_h_included__
#define __oddebug_h_included__
-#include <avr/io.h>
-
/*
General Description:
This module implements a function for debug logs on the serial line of the
/*
General Description:
This module implements a function for debug logs on the serial line of the
@@
-27,82
+24,97
@@
the output and a memory block to dump in hex ('data' and 'len').
#ifndef F_CPU
#ifndef F_CPU
-#
define F_CPU 12000000
/* 12 MHz */
+#
define F_CPU 12000000
/* 12 MHz */
#endif
#endif
+/* make sure we have the UART defines: */
+#include "usbportability.h"
+
#ifndef uchar
#ifndef uchar
-#
define uchar unsigned char
+# define uchar unsigned char
#endif
#endif
-#if DEBUG_LEVEL > 0 && !
defined TXEN
/* no UART in device */
-#
warning "Debugging disabled because device has no UART"
-#
undef DEBUG_LEVEL
+#if DEBUG_LEVEL > 0 && !
(defined TXEN || defined TXEN0)
/* no UART in device */
+# warning "Debugging disabled because device has no UART"
+# undef DEBUG_LEVEL
#endif
#ifndef DEBUG_LEVEL
#endif
#ifndef DEBUG_LEVEL
-#
define DEBUG_LEVEL
0
+#
define DEBUG_LEVEL
0
#endif
/* ------------------------------------------------------------------------- */
#if DEBUG_LEVEL > 0
#endif
/* ------------------------------------------------------------------------- */
#if DEBUG_LEVEL > 0
-#
define DBG1(prefix, data, len) odDebug(prefix, data, len)
+# define DBG1(prefix, data, len) odDebug(prefix, data, len)
#else
#else
-#
define DBG1(prefix, data, len)
+# define DBG1(prefix, data, len)
#endif
#if DEBUG_LEVEL > 1
#endif
#if DEBUG_LEVEL > 1
-#
define DBG2(prefix, data, len) odDebug(prefix, data, len)
+# define DBG2(prefix, data, len) odDebug(prefix, data, len)
#else
#else
-#
define DBG2(prefix, data, len)
+# define DBG2(prefix, data, len)
#endif
/* ------------------------------------------------------------------------- */
#endif
/* ------------------------------------------------------------------------- */
-#if
DEBUG_LEVEL > 0
-extern void
odDebug(uchar prefix, uchar *data, uchar len);
+#if DEBUG_LEVEL > 0
+extern void odDebug(uchar prefix, uchar *data, uchar len);
/* Try to find our control registers; ATMEL likes to rename these */
#if defined UBRR
/* Try to find our control registers; ATMEL likes to rename these */
#if defined UBRR
-#
define ODDBG_UBRR
UBRR
+#
define ODDBG_UBRR
UBRR
#elif defined UBRRL
#elif defined UBRRL
-#
define ODDBG_UBRR
UBRRL
-#elif defined UBRR
1
-#
define ODDBG_UBRR UBRR1
-#elif defined UBRR
1
L
-#
define ODDBG_UBRR UBRR1
L
+#
define ODDBG_UBRR
UBRRL
+#elif defined UBRR
0
+#
define ODDBG_UBRR UBRR0
+#elif defined UBRR
0
L
+#
define ODDBG_UBRR UBRR0
L
#endif
#if defined UCR
#endif
#if defined UCR
-#
define ODDBG_UCR
UCR
+#
define ODDBG_UCR
UCR
#elif defined UCSRB
#elif defined UCSRB
-#
define ODDBG_UCR
UCSRB
-#elif defined UCSR
1
B
-#
define ODDBG_UCR UCSR1
B
+#
define ODDBG_UCR
UCSRB
+#elif defined UCSR
0
B
+#
define ODDBG_UCR UCSR0
B
#endif
#endif
-#if defined USR
-# define ODDBG_USR USR
+#if defined TXEN
+# define ODDBG_TXEN TXEN
+#else
+# define ODDBG_TXEN TXEN0
+#endif
+
+#if defined USR
+# define ODDBG_USR USR
#elif defined UCSRA
#elif defined UCSRA
-# define ODDBG_USR UCSRA
-#elif defined UCSR1A
-# define ODDBG_USR UCSR1A
+# define ODDBG_USR UCSRA
+#elif defined UCSR0A
+# define ODDBG_USR UCSR0A
+#endif
+
+#if defined UDRE
+# define ODDBG_UDRE UDRE
+#else
+# define ODDBG_UDRE UDRE0
#endif
#if defined UDR
#endif
#if defined UDR
-#
define ODDBG_UDR
UDR
-#elif defined UDR
1
-#
define ODDBG_UDR UDR1
+#
define ODDBG_UDR
UDR
+#elif defined UDR
0
+#
define ODDBG_UDR UDR0
#endif
#endif
-static inline void
odDebugInit(void)
+static inline void odDebugInit(void)
{
{
-
ODDBG_UCR |= (1<<
TXEN);
-
ODDBG_UBRR = F_CPU / (19200 * 16L) - 1;
+
ODDBG_UCR |= (1<<ODDBG_
TXEN);
+ ODDBG_UBRR = F_CPU / (19200 * 16L) - 1;
}
#else
}
#else
-#
define odDebugInit()
+# define odDebugInit()
#endif
/* ------------------------------------------------------------------------- */
#endif
/* ------------------------------------------------------------------------- */