summaryrefslogtreecommitdiff
path: root/nuttx/arch
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-06-13 00:06:09 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-06-13 00:06:09 +0000
commita38027207ae9cf3689a7e9a782fa954cb1df3ea6 (patch)
treedcd04e4ae64077dc4e8fa222a61bc9dcc067c7a1 /nuttx/arch
parent40468f1d1ed8466265ea8680ed2de38ef4f89fca (diff)
downloadpx4-nuttx-a38027207ae9cf3689a7e9a782fa954cb1df3ea6.tar.gz
px4-nuttx-a38027207ae9cf3689a7e9a782fa954cb1df3ea6.tar.bz2
px4-nuttx-a38027207ae9cf3689a7e9a782fa954cb1df3ea6.zip
Add hello configuratin for AVR
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3699 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch')
-rw-r--r--nuttx/arch/avr/src/at90usb/at90usb_lowconsole.c17
-rw-r--r--nuttx/arch/avr/src/atmega/atmega_lowconsole.c22
-rw-r--r--nuttx/arch/avr/src/avr/up_dumpstate.c12
3 files changed, 36 insertions, 15 deletions
diff --git a/nuttx/arch/avr/src/at90usb/at90usb_lowconsole.c b/nuttx/arch/avr/src/at90usb/at90usb_lowconsole.c
index eb93dc5e2..053b053ca 100644
--- a/nuttx/arch/avr/src/at90usb/at90usb_lowconsole.c
+++ b/nuttx/arch/avr/src/at90usb/at90usb_lowconsole.c
@@ -56,7 +56,7 @@
* Private Definitions
******************************************************************************/
-/* Baud rate settings for normal and double speed settings */
+/* Baud rate settings for normal and double speed modes */
#define AVR_NORMAL_UBRR1 \
((((BOARD_CPU_CLOCK / 16) + (CONFIG_USART1_BAUD / 2)) / (CONFIG_USART1_BAUD)) - 1)
@@ -100,13 +100,20 @@
# define AVR_UBRR1 AVR_DBLSPEED_UBRR1
# define UART1_DOUBLE_SPEED 1
# endif
-#else
+#elif BOARD_CPU_CLOCK <= 16000000
# if CONFIG_USART1_BAUD <= 38400
# define AVR_UBRR1 AVR_NORMAL_UBRR1
# else
# define AVR_UBRR1 AVR_DBLSPEED_UBRR1
# define UART1_DOUBLE_SPEED 1
# endif
+#else
+# if CONFIG_USART1_BAUD <= 57600
+# define AVR_UBRR1 AVR_NORMAL_UBRR1
+# else
+# define AVR_UBRR1 AVR_DBLSPEED_UBRR1
+# define UART1_DOUBLE_SPEED 1
+# endif
#endif
/******************************************************************************
@@ -156,8 +163,8 @@ void usart1_reset(void)
PORTD &= ~(1 << 2);
/* Unconfigure BAUD divisor */
-
- UBRR1 = 0;
+
+ UBRR1 = 0;
}
#endif
@@ -237,7 +244,7 @@ void usart1_configure(void)
/* Set the baud rate divisor */
- UBRR1 = AVR_UBRR1;
+ UBRR1 = AVR_UBRR1;
}
#endif
diff --git a/nuttx/arch/avr/src/atmega/atmega_lowconsole.c b/nuttx/arch/avr/src/atmega/atmega_lowconsole.c
index af558faa0..e746f6e5d 100644
--- a/nuttx/arch/avr/src/atmega/atmega_lowconsole.c
+++ b/nuttx/arch/avr/src/atmega/atmega_lowconsole.c
@@ -55,7 +55,7 @@
* Private Definitions
******************************************************************************/
-/* USART0 Baud rate settings for normal and double speed settings */
+/* USART0 Baud rate settings for normal and double speed modes */
#define AVR_NORMAL_UBRR0 \
(((((BOARD_CPU_CLOCK / 16) + (CONFIG_USART0_BAUD / 2)) / (CONFIG_USART0_BAUD)) - 1)
@@ -99,16 +99,23 @@
# define AVR_UBRR0 AVR_DBLSPEED_UBRR0
# define UART0_DOUBLE_SPEED 1
# endif
-#else
+#elif BOARD_CPU_CLOCK <= 16000000
# if CONFIG_USART0_BAUD <= 38400
# define AVR_UBRR0 AVR_NORMAL_UBRR0
# else
# define AVR_UBRR0 AVR_DBLSPEED_UBRR0
# define UART0_DOUBLE_SPEED 1
# endif
+#else
+# if CONFIG_USART0_BAUD <= 57600
+# define AVR_UBRR0 AVR_NORMAL_UBRR0
+# else
+# define AVR_UBRR0 AVR_DBLSPEED_UBRR0
+# define UART0_DOUBLE_SPEED 1
+# endif
#endif
-/* USART1 Baud rate settings for normal and double speed settings */
+/* USART1 Baud rate settings for normal and double speed modes */
#define AVR_NORMAL_UBRR1 \
((((BOARD_CPU_CLOCK / 16) + (CONFIG_USART1_BAUD / 2)) / (CONFIG_USART1_BAUD)) - 1)
@@ -152,13 +159,20 @@
# define AVR_UBRR1 AVR_DBLSPEED_UBRR1
# define UART1_DOUBLE_SPEED 1
# endif
-#else
+#elif BOARD_CPU_CLOCK <= 16000000
# if CONFIG_USART1_BAUD <= 38400
# define AVR_UBRR1 AVR_NORMAL_UBRR1
# else
# define AVR_UBRR1 AVR_DBLSPEED_UBRR1
# define UART1_DOUBLE_SPEED 1
# endif
+#else
+# if CONFIG_USART1_BAUD <= 57600
+# define AVR_UBRR1 AVR_NORMAL_UBRR1
+# else
+# define AVR_UBRR1 AVR_DBLSPEED_UBRR1
+# define UART1_DOUBLE_SPEED 1
+# endif
#endif
/******************************************************************************
diff --git a/nuttx/arch/avr/src/avr/up_dumpstate.c b/nuttx/arch/avr/src/avr/up_dumpstate.c
index e9d0859e8..2e3af537b 100644
--- a/nuttx/arch/avr/src/avr/up_dumpstate.c
+++ b/nuttx/arch/avr/src/avr/up_dumpstate.c
@@ -123,35 +123,35 @@ static inline void up_registerdump(void)
if (current_regs)
{
- lldbg("R%d: %02x %02x %02x %02x %02x %02x %02x %02x\n",
+ lldbg("R%02d: %02x %02x %02x %02x %02x %02x %02x %02x\n",
0,
current_regs[REG_R0], current_regs[REG_R1],
current_regs[REG_R2], current_regs[REG_R3],
current_regs[REG_R4], current_regs[REG_R5],
current_regs[REG_R6], current_regs[REG_R7]);
- lldbg("R%d: %02x %02x %02x %02x %02x %02x %02x %02x\n",
+ lldbg("R%02d: %02x %02x %02x %02x %02x %02x %02x %02x\n",
8,
current_regs[REG_R8], current_regs[REG_R9],
current_regs[REG_R10], current_regs[REG_R11],
current_regs[REG_R12], current_regs[REG_R13],
current_regs[REG_R14], current_regs[REG_R15]);
- lldbg("R%d: %02x %02x %02x %02x %02x %02x %02x %02x\n",
+ lldbg("R%02d: %02x %02x %02x %02x %02x %02x %02x %02x\n",
16,
current_regs[REG_R16], current_regs[REG_R17],
current_regs[REG_R18], current_regs[REG_R19],
current_regs[REG_R20], current_regs[REG_R21],
current_regs[REG_R22], current_regs[REG_R23]);
- lldbg("R%d: %02x %02x %02x %02x %02x %02x %02x %02x\n",
+ lldbg("R%02d: %02x %02x %02x %02x %02x %02x %02x %02x\n",
24,
current_regs[REG_R24], current_regs[REG_R25],
current_regs[REG_R26], current_regs[REG_R27],
current_regs[REG_R28], current_regs[REG_R29],
current_regs[REG_R30], current_regs[REG_R31]);
- lldbg("PC: %02x%02x SP: %02x%02x SREG: %02x\n",
+ lldbg("PC: %02x%02x SP: %02x%02x SREG: %02x\n",
current_regs[REG_PCH], current_regs[REG_PCL],
current_regs[REG_SPH], current_regs[REG_SPL],
current_regs[REG_SREG]);
@@ -192,7 +192,7 @@ void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 0
istackbase = (uint16_t)&g_intstackbase;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4;