Add an NSH configuration for the NuTiny-SDK-NUC120. Still does not work

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5678 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2013-02-26 21:53:12 +00:00
parent 00143c4401
commit c254d0bb3e
5 changed files with 122 additions and 154 deletions

View File

@ -303,12 +303,22 @@ config ARCH_RAMFUNCS
comment "Board Settings" comment "Board Settings"
config BOARD_LOOPSPERMSEC config BOARD_LOOPSPERMSEC
int "Loops per millisecond" int "Delay loops per millisecond"
help default 5000
Must be calibrated for correct operation of delay loops. ---help---
You simply use a stop watch to measure the 100 second delay Simple delay loops are used by some logic, especially during boot-up,
then adjust CONFIG_BOARD_LOOPSPERMSEC until it is actually driver initialization. These delay loops must be calibrated for each
is 100 seconds. board in order to assure accurate timing by the delay loops.
config ARCH_CALIBRATION
bool "Calibrate delay loop"
default n
---help---
Enables some built in instrumentation that causes a 100 second delay
during boot-up. This 100 second delay serves no purpose other than it
allows you to calibratre BOARD_LOOPSPERMSEC. You simply use a stop
watch to measure the actual delay then adjust BOARD_LOOPSPERMSEC until
the actual delay is 100 seconds.
config DRAM_START config DRAM_START
hex "DRAM start physical address" hex "DRAM start physical address"

View File

@ -251,22 +251,6 @@ config PAGING
If set =y in your configation file, this setting will enable the on-demand If set =y in your configation file, this setting will enable the on-demand
paging feature as described in http://www.nuttx.org/NuttXDemandPaging.html. paging feature as described in http://www.nuttx.org/NuttXDemandPaging.html.
config BOARD_LOOPSPERMSEC
int "Delay loops per millisecond"
default 5000
---help---
Delay loops nust be calibrated for correct operation.
config ARCH_CALIBRATION
bool "Calibrate delay loop"
default n
---help---
Enables some built in instrumentation that causes a 100 second delay
during boot-up. This 100 second delay serves no purpose other than it
allows you to calibratre BOARD_LOOPSPERMSEC. You simply use a stop
watch to measure the 100 second delay then adjust BOARD_LOOPSPERMSEC until
the delay actually is 100 seconds.
config DEBUG_HARDFAULT config DEBUG_HARDFAULT
bool "Verbose Hard-Fault Debug" bool "Verbose Hard-Fault Debug"
default n default n

View File

@ -299,7 +299,7 @@ void nuc_lowsetup(void)
#endif #endif
#if NUC_CONSOLE_2STOP != 0 #if NUC_CONSOLE_2STOP != 0
revgval |= UART_LCR_NSB; regval |= UART_LCR_NSB;
#endif #endif
putreg32(regval, NUC_CONSOLE_BASE + NUC_UART_LCR_OFFSET); putreg32(regval, NUC_CONSOLE_BASE + NUC_UART_LCR_OFFSET);

View File

@ -242,86 +242,64 @@ static uart_dev_t g_uart2port =
}; };
#endif /* CONFIG_NUC_UART2 */ #endif /* CONFIG_NUC_UART2 */
/* Which UART with be tty0/console and which tty1? tty2? */ /* Which UART with be tty0/console and which tty1? tty2? The console, if it
* exists, will always be ttyS0. If there is no console then will use the
* lowest numbered UART.
*/
#ifdef HAVE_CONSOLE /* First pick the console and ttys0. This could be any of UART0-2 */
# if defined(CONFIG_UART0_SERIAL_CONSOLE)
# define CONSOLE_DEV g_uart0port /* UART0=console */ #if defined(CONFIG_UART0_SERIAL_CONSOLE)
# define TTYS0_DEV g_uart0port /* UART0=ttyS0 */ # define CONSOLE_DEV g_uart0port /* UART0 is console */
# ifdef CONFIG_NUC_UART1 # define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */
# define TTYS1_DEV g_uart1port /* UART0=ttyS0;UART1=ttyS1 */ # define UART0_ASSIGNED 1
# ifdef CONFIG_NUC_UART2 #elif defined(CONFIG_UART1_SERIAL_CONSOLE)
# define TTYS2_DEV g_uart2port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2 */ # define CONSOLE_DEV g_uart1port /* UART1 is console */
# else # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */
# undef TTYS2_DEV /* UART0=ttyS0;UART1=ttyS1;No ttyS2*/ # define UART1_ASSIGNED 1
#elif defined(CONFIG_UART2_SERIAL_CONSOLE)
# define CONSOLE_DEV g_uart2port /* UART2 is console */
# define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */
# define UART2_ASSIGNED 1
#else
# undef CONSOLE_DEV /* No console */
# if defined(CONFIG_NUC_UART0)
# define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */
# define UART0_ASSIGNED 1
# elif defined(CONFIG_NUC_UART1)
# define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */
# define UART1_ASSIGNED 1
# elif defined(CONFIG_NUC_UART2)
# define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */
# define UART2_ASSIGNED 1
# endif # endif
# else #endif
# ifdef CONFIG_NUC_UART2
# define TTYS1_DEV g_uart2port /* UART0=ttyS0;UART2=ttyS1 */ /* Pick ttys1. This could be any two of UART0-2 excluding the console UART. */
# undef TTYS2_DEV /* UART0=ttyS0;UART2=ttyS1;No ttyS2*/
# else #if defined(CONFIG_NUC_UART0) && !defined(UART0_ASSIGNED)
# undef TTYS1_DEV /* UART0=ttyS0;No ttyS1;No ttyS2 */ # define TTYS1_DEV g_uart0port /* UART0 is ttyS1 */
# undef TTYS2_DEV /* No ttyS2 */ # define UART0_ASSIGNED 1
# endif #elif defined(CONFIG_NUC_UART1) && !defined(UART1_ASSIGNED)
# endif # define TTYS1_DEV g_uart1port /* UART1 is ttyS1 */
# elif defined(CONFIG_UART1_SERIAL_CONSOLE) # define UART1_ASSIGNED 1
# define CONSOLE_DEV g_uart1port /* UART1=console */ #elif defined(CONFIG_NUC_UART2) && !defined(UART2_ASSIGNED)
# define TTYS0_DEV g_uart1port /* UART1=ttyS0 */ # define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */
# ifdef CONFIG_NUC_UART0 # define UART2_ASSIGNED 1
# define TTYS1_DEV g_uart0port /* UART1=ttyS0;UART0=ttyS1 */ #endif
# ifdef CONFIG_NUC_UART2
# define TTYS2_DEV g_uart2port /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS2 */ /* Pick ttys2. This could be one of UART1-2. It can't be UART0 because that
# else * was either assigned as ttyS0 or ttys1. One of UART 1-2 could also be the
# undef TTYS2_DEV /* UART1=ttyS0;UART0=ttyS1;No ttyS2 */ * console.
# endif */
# else
# ifdef CONFIG_NUC_UART2 #if defined(CONFIG_NUC_UART1) && !defined(UART1_ASSIGNED)
# define TTYS1_DEV g_uart2port /* UART1=ttyS0;UART2=ttyS1 */ # define TTYS2_DEV g_uart1port /* UART1 is ttyS2 */
# undef TTYS2_DEV /* UART1=ttyS0;UART2=ttyS1;No ttyS2 */ # define UART1_ASSIGNED 1
# else #elif defined(CONFIG_NUC_UART2) && !defined(UART2_ASSIGNED)
# undef TTYS1_DEV /* UART1=ttyS0;No ttyS1;No ttyS2 */ # define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */
# undef TTYS2_DEV /* No ttyS2 */ # define UART2_ASSIGNED 1
# endif #endif
# endif
# elif defined(CONFIG_UART2_SERIAL_CONSOLE)
# define CONSOLE_DEV g_uart2port /* UART2=console */
# define TTYS0_DEV g_uart2port /* UART2=ttyS0 */
# ifdef CONFIG_NUC_UART2
# define TTYS1_DEV g_uart0port /* UART2=ttyS0;UART0=ttyS1 */
# ifdef CONFIG_NUC_UART1
# define TTYS2_DEV g_uart1port /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS2 */
# else
# undef TTYS2_DEV /* UART2=ttyS0;UART0=ttyS1;No ttyS2 */
# endif
# else
# ifdef CONFIG_NUC_UART1
# define TTYS1_DEV g_uart1port /* UART2=ttyS0;UART1=ttyS1 */
# undef TTYS2_DEV /* UART2=ttyS0;UART1=ttyS1;No ttyS2 */
# else
# undef TTYS1_DEV /* UART2=ttyS0;No ttyS1;No ttyS2 */
# undef TTYS2_DEV /* No ttyS2 */
# endif
# endif
# endif
#else /* No console */
# define TTYS0_DEV g_uart0port /* UART0=ttyS0 */
# ifdef CONFIG_NUC_UART1
# define TTYS1_DEV g_uart1port /* UART0=ttyS0;UART1=ttyS1 */
# ifdef CONFIG_NUC_UART2
# define TTYS2_DEV g_uart2port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2 */
# else
# undef TTYS2_DEV /* UART0=ttyS0;UART1=ttyS1;No ttyS2 */
# endif
# else
# ifdef CONFIG_NUC_UART2
# define TTYS1_DEV g_uart2port /* UART0=ttyS0;UART2=ttyS1 */
# undef TTYS2_DEV /* UART0=ttyS0;UART2=ttyS1;No ttyS2 */
# else
# undef TTYS1_DEV /* UART0=ttyS0;No ttyS1;No ttyS2 */
# undef TTYS2_DEV /* No ttyS2 */
# endif
# endif
#endif /* HAVE_CONSOLE */
/**************************************************************************** /****************************************************************************
* Inline Functions * Inline Functions
@ -391,46 +369,61 @@ static int up_setup(struct uart_dev_s *dev)
/* Reset the TX FIFO */ /* Reset the TX FIFO */
regval = up_serialin(priv, NUC_UART_FCR_OFFSET regval = up_serialin(priv, NUC_UART_FCR_OFFSET);
regval |= UART_FCR_TFR up_serialout(priv, NUC_UART_FCR_OFFSET, regval | UART_FCR_TFR);
up_serialout(priv, NUC_UART_FCR_OFFSET, regval);
/* Reset the RX FIFO */ /* Reset the RX FIFO */
regval = up_serialin(priv, NUC_UART_FCR_OFFSET up_serialout(priv, NUC_UART_FCR_OFFSET, regval | UART_FCR_RFR);
regval |= UART_FCR_RFR
up_serialout(priv, NUC_UART_FCR_OFFSET, regval);
/* Set Rx Trigger Level */ /* Set Rx Trigger Level */
regval &= ~UART_FCR_FRITL_MASK; regval &= ~(UART_FCR_FRITL_MASK | UART_FCR_TFR | UART_FCR_RFR);
regval |= UART_FCR_FRITL_4; regval |= UART_FCR_FRITL_4;
up_serialout(priv, NUC_UART_FCR_OFFSET, regval); up_serialout(priv, NUC_UART_FCR_OFFSET, regval);
/* Set Parity & Data bits and Stop bits */ /* Set Parity & Data bits and Stop bits */
regval = 0; regval = 0;
#if NUC_CONSOLE_BITS == 5 switch (priv->bits)
{
case 5:
regval |= UART_LCR_WLS_5; regval |= UART_LCR_WLS_5;
#elif NUC_CONSOLE_BITS == 6 break;
case 6:
regval |= UART_LCR_WLS_6; regval |= UART_LCR_WLS_6;
#elif NUC_CONSOLE_BITS == 7 break;
case 7:
regval |= UART_LCR_WLS_7; regval |= UART_LCR_WLS_7;
#elif NUC_CONSOLE_BITS == 8 break;
default:
case 8:
regval |= UART_LCR_WLS_8; regval |= UART_LCR_WLS_8;
#else break;
error "Unknown console UART data width" }
#endif
#if NUC_CONSOLE_PARITY == 1 switch (priv->parity)
{
default:
case 0:
break;
case 1:
regval |= UART_LCR_PBE; regval |= UART_LCR_PBE;
#elif NUC_CONSOLE_PARITY == 2 break;
regval |= (UART_LCR_PBE | UART_LCR_EPE);
#endif
#if NUC_CONSOLE_2STOP != 0 case 2:
revgval |= UART_LCR_NSB; regval |= (UART_LCR_PBE | UART_LCR_EPE);
#endif break;
}
if (priv->stopbits2)
{
regval |= UART_LCR_NSB;
}
up_serialout(priv, NUC_UART_LCR_OFFSET, regval); up_serialout(priv, NUC_UART_LCR_OFFSET, regval);
@ -441,7 +434,7 @@ static int up_setup(struct uart_dev_s *dev)
/* Set the baud */ /* Set the baud */
nuc_setbaud(CONSOLE_BASE, CONSOLE_BAUD); nuc_setbaud(priv->uartbase, priv->baud);
/* Set up the IER */ /* Set up the IER */
@ -597,28 +590,25 @@ static int up_interrupt(int irq, void *context)
{ {
/* REVISIT: Do we clear this be reading the modem status register? */ /* REVISIT: Do we clear this be reading the modem status register? */
volatile uint32_t status = up_serialin(priv, NUC_UART_MSR_OFFSET); (void)up_serialin(priv, NUC_UART_MSR_OFFSET);
vdbg("MSR: %08x\n", status);
} }
/* Check for line status */ /* Check for line status */
if ((status & UART_ISR_RLS_INT) != 0) if ((status & UART_ISR_RLS_INT) != 0)
{ {
/* REVISIT: Do we clear this be reading the line status register? */ /* REVISIT: Do we clear this be reading the FIFO status register? */
volatile uint32_t status = up_serialin(priv, NUC_UART_FSR_OFFSET); (void)up_serialin(priv, NUC_UART_FSR_OFFSET);
vdbg("LSR: %08x\n", status);
} }
/* Check for buffer errors */ /* Check for buffer errors */
if ((status & UART_ISR_BUF_ERR_INT) != 0) if ((status & UART_ISR_BUF_ERR_INT) != 0)
{ {
/* REVISIT: Do we clear this be reading the line status register? */ /* REVISIT: Do we clear this by reading the FIFO status register? */
volatile uint32_t status = up_serialin(priv, NUC_UART_MSR_OFFSET); (void)up_serialin(priv, NUC_UART_FSR_OFFSET);
vdbg("MSR: %08x\n", status);
} }
} }
@ -651,7 +641,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
} }
else else
{ {
memcpy(user, dev, sizeof(struct nuc_dev_s)); memcpy(user, priv, sizeof(struct nuc_dev_s));
} }
} }
break; break;
@ -754,7 +744,7 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
{ {
#ifndef CONFIG_SUPPRESS_SERIAL_INTS #ifndef CONFIG_SUPPRESS_SERIAL_INTS
priv->ier |= (UART_IER_RDA_IEN | UART_IER_RLS_IEN | UART_IER_RTO_IEN | priv->ier |= (UART_IER_RDA_IEN | UART_IER_RLS_IEN | UART_IER_RTO_IEN |
UART_IER_BUF_ERR_IEN UART_IER_TIME_OUT_EN); UART_IER_BUF_ERR_IEN | UART_IER_TIME_OUT_EN);
#endif #endif
} }
else else

View File

@ -32,22 +32,6 @@ config ARCH_CHIP
string string
default "pic32mx" if ARCH_CHIP_PIC32MX default "pic32mx" if ARCH_CHIP_PIC32MX
config BOARD_LOOPSPERMSEC
int "Delay loops per millisecond"
default 5000
---help---
Delay loops nust be calibrated for correct operation.
config ARCH_CALIBRATION
bool "Calibrate delay loop"
default n
---help---
Enables some built in instrumentation that causes a 100 second delay
during boot-up. This 100 second delay serves no purpose other than it
allows you to calibratre BOARD_LOOPSPERMSEC. You simply use a stop
watch to measure the 100 second delay then adjust BOARD_LOOPSPERMSEC until
the delay actually is 100 seconds.
source arch/mips/src/common/Kconfig source arch/mips/src/common/Kconfig
source arch/mips/src/mips32/Kconfig source arch/mips/src/mips32/Kconfig
source arch/mips/src/pic32mx/Kconfig source arch/mips/src/pic32mx/Kconfig