From: batt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Date: Fri, 5 Sep 2008 15:42:24 +0000 (+0000)
Subject: Add debug support for ATMega32.
X-Git-Tag: 2.0.0~145
X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=c516445063717587f9c1524b050c475f59e6c36b;p=bertos.git

Add debug support for ATMega32.

git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1789 38d2e660-2303-0410-9eaa-f027e97ec537
---

diff --git a/bertos/cpu/avr/drv/kdebug_avr.c b/bertos/cpu/avr/drv/kdebug_avr.c
index 886b7d6d..53d91895 100644
--- a/bertos/cpu/avr/drv/kdebug_avr.c
+++ b/bertos/cpu/avr/drv/kdebug_avr.c
@@ -63,7 +63,7 @@
 	 */
 	#ifndef KDBG_UART0_BUS_INIT
 	#define KDBG_UART0_BUS_INIT  do { \
-			UCSR0B = BV(TXEN0); \
+			UCR = BV(TXEN0); \
 		} while (0)
 	#endif
 	#ifndef KDBG_UART0_BUS_RX
@@ -77,9 +77,14 @@
 		#define UCR UCSR0B
 		#define UDR UDR0
 		#define USR UCSR0A
-	#elif CPU_AVR_ATMEGA8
-		#define UCR UCSRB
-		#define USR UCSRA
+	#elif CPU_AVR_ATMEGA8 || CPU_AVR_ATMEGA32
+		#define UCR    UCSRB
+		#define USR    UCSRA
+		#define TXEN0  TXEN
+		#define UDRE0  UDRE
+		#define TXC0   TXC
+		#define TXCIE0 TXCIE
+		#define UDRIE0 UDRIE
 	#else
 		#error Unknown CPU
 	#endif
@@ -244,9 +249,10 @@ INLINE void kdbg_hw_init(void)
 			UBRR0H = (uint8_t)(period>>8);
 			UBRR0L = (uint8_t)period;
 			KDBG_UART0_BUS_INIT;
-		#elif CPU_AVR_ATMEGA8
+		#elif CPU_AVR_ATMEGA8 || CPU_AVR_ATMEGA32
 			UBRRH = (uint8_t)(period>>8);
 			UBRRL = (uint8_t)period;
+			KDBG_UART0_BUS_INIT;
 		#elif CPU_AVR_ATMEGA103
 			UBRR = (uint8_t)period;
 			KDBG_UART0_BUS_INIT;