Add hello configuratin for AVR

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3699 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-06-13 00:06:09 +00:00
parent 55cab11847
commit 22e2c3dd6a
3 changed files with 36 additions and 15 deletions

View File

@ -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

View File

@ -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
/******************************************************************************

View File

@ -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;