Added low-level console driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@585 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
5159d38f75
commit
241f70de7a
@ -160,7 +160,13 @@ void up_initialize(void)
|
|||||||
|
|
||||||
/* Initialize the serial device driver */
|
/* Initialize the serial device driver */
|
||||||
|
|
||||||
|
#ifdef CONFIG_USE_SERIALDRIVER
|
||||||
up_serialinit();
|
up_serialinit();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_USE_LOWCONSOLE
|
||||||
|
lowconsole_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Initialize the netwok */
|
/* Initialize the netwok */
|
||||||
|
|
||||||
|
@ -58,6 +58,17 @@
|
|||||||
#undef CONFIG_SUPPRESS_UART_CONFIG /* Do not reconfig UART */
|
#undef CONFIG_SUPPRESS_UART_CONFIG /* Do not reconfig UART */
|
||||||
#undef CONFIG_DUMP_ON_EXIT /* Dump task state on exit */
|
#undef CONFIG_DUMP_ON_EXIT /* Dump task state on exit */
|
||||||
|
|
||||||
|
/* Determine which (if any) console driver to use */
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_LOWPUTC) || defined(CONFIG_ARCH_LOWGETC) || \
|
||||||
|
CONFIG_NFILE_DESCRIPTORS == 0 || defined(CONFIG_DEV_LOWCONSOLE)
|
||||||
|
# define CONFIG_USE_LOWCONSOLE 1
|
||||||
|
# define CONFIG_USE_LOWUARTINIT 1
|
||||||
|
#elif defined(CONFIG_DEV_CONSOLE) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||||
|
# define CONFIG_USE_SERIALDRIVER 1
|
||||||
|
# define CONFIG_USE_EARLYSERIALINIT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Macros for portability */
|
/* Macros for portability */
|
||||||
|
|
||||||
#define IN_INTERRUPT (current_regs != NULL)
|
#define IN_INTERRUPT (current_regs != NULL)
|
||||||
@ -118,12 +129,13 @@ void up_addregion(void);
|
|||||||
|
|
||||||
/* Defined in up_serial.c */
|
/* Defined in up_serial.c */
|
||||||
|
|
||||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
#ifdef CONFIG_USE_SERIALDRIVER
|
||||||
extern void up_earlyserialinit(void);
|
extern void up_earlyserialinit(void);
|
||||||
extern void up_serialinit(void);
|
extern void up_serialinit(void);
|
||||||
#else
|
#endif
|
||||||
# define up_earlyserialinit()
|
|
||||||
# define up_serialinit()
|
#ifdef CONFIG_USE_LOWCONSOLE
|
||||||
|
extern void lowconsole_init(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Defined in up_timerisr.c */
|
/* Defined in up_timerisr.c */
|
||||||
|
@ -40,6 +40,11 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
|
#include "common/up_internal.h"
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* Definitions
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* External References / External Definitions
|
* External References / External Definitions
|
||||||
@ -50,10 +55,9 @@
|
|||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
xref _up_ledinit:EROM
|
xref _up_ledinit:EROM
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_ARCH_LOWPUTC) || defined(CONFIG_ARCH_LOWGETC) || CONFIG_NFILE_DESCRIPTORS == 0
|
#if defined(CONFIG_USE_LOWUARTINIT)
|
||||||
xref _z16f_lowuartinit:EROM
|
xref _z16f_lowuartinit:EROM
|
||||||
#endif
|
#elif defined(CONFIG_USE_EARLYSERIALINIT)
|
||||||
#if defined(CONFIG_DEV_CONSOLE) && CONFIG_NFILE_DESCRIPTORS > 0
|
|
||||||
xref _up_earlyserialinit:EROM
|
xref _up_earlyserialinit:EROM
|
||||||
#endif
|
#endif
|
||||||
xref _os_start:EROM
|
xref _os_start:EROM
|
||||||
@ -157,7 +161,7 @@ _z16f_reset:
|
|||||||
#endif
|
#endif
|
||||||
/* Perform VERY early UART initialization so that we can use it here */
|
/* Perform VERY early UART initialization so that we can use it here */
|
||||||
|
|
||||||
#if defined(CONFIG_ARCH_LOWPUTC) || defined(CONFIG_ARCH_LOWGETC) || CONFIG_NFILE_DESCRIPTORS == 0
|
#ifdef CONFIG_USE_LOWUARTINIT
|
||||||
call _z16f_lowuartinit /* Initialize the UART for debugging */
|
call _z16f_lowuartinit /* Initialize the UART for debugging */
|
||||||
#endif
|
#endif
|
||||||
/* Initialize the hardware stack overflow register */
|
/* Initialize the hardware stack overflow register */
|
||||||
@ -210,7 +214,7 @@ _z16f_reset8:
|
|||||||
|
|
||||||
call _z16f_lowinit /* Perform low-level hardware initialization */
|
call _z16f_lowinit /* Perform low-level hardware initialization */
|
||||||
|
|
||||||
#if defined(CONFIG_DEV_CONSOLE) && CONFIG_NFILE_DESCRIPTORS > 0
|
#ifdef CONFIG_USE_EARLYSERIALINIT
|
||||||
/* Perform early serial initialization */
|
/* Perform early serial initialization */
|
||||||
|
|
||||||
call _up_earlyserialinit
|
call _up_earlyserialinit
|
||||||
|
@ -40,8 +40,9 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include "chip/chip.h"
|
#include "chip/chip.h"
|
||||||
|
#include "common/up_internal.h"
|
||||||
|
|
||||||
#if defined(CONFIG_ARCH_LOWPUTC) || defined(CONFIG_ARCH_LOWGETC) || CONFIG_NFILE_DESCRIPTORS == 0
|
#ifdef CONFIG_USE_LOWUARTINIT
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* External References / External Definitions
|
* External References / External Definitions
|
||||||
@ -120,6 +121,7 @@ _z16f_lowuartinit:
|
|||||||
ld.b Z16F_UART0_CTL0, r0 /* Z16F_UART0_CTL0 = %c0 */
|
ld.b Z16F_UART0_CTL0, r0 /* Z16F_UART0_CTL0 = %c0 */
|
||||||
#endif
|
#endif
|
||||||
ret /* Return */
|
ret /* Return */
|
||||||
|
#endif /* CONFIG_USE_LOWUARTINIT */
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* Name: _up_lowputc
|
* Name: _up_lowputc
|
||||||
@ -222,7 +224,5 @@ _up_lowgetc3: /* Return value in r0 */
|
|||||||
ret /* Return */
|
ret /* Return */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_ARCH_LOWPUTC || CONFIG_ARCH_LOWGETC */
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -55,14 +55,12 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
#ifdef CONFIG_USE_SERIALDRIVER
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define BASE_BAUD 115200
|
|
||||||
|
|
||||||
/* System clock frequency value from ZDS target settings */
|
/* System clock frequency value from ZDS target settings */
|
||||||
|
|
||||||
extern _Erom unsigned long SYS_CLK_FREQ;
|
extern _Erom unsigned long SYS_CLK_FREQ;
|
||||||
@ -737,7 +735,7 @@ int up_putc(int ch)
|
|||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* CONFIG_NFILE_DESCRIPTORS > 0 */
|
#else /* CONFIG_USE_SERIALDRIVER */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
@ -755,11 +753,23 @@ int up_putc(int ch)
|
|||||||
putreg8((ubyte)(ch), Z16F_UART0_TXD)
|
putreg8((ubyte)(ch), Z16F_UART0_TXD)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Variables
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void _up_putc(int ch)
|
/****************************************************************************
|
||||||
|
* Name: z16f_putc
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void z16f_putc(int ch)
|
||||||
{
|
{
|
||||||
int tmp;
|
int tmp;
|
||||||
for (tmp = 1000 ; tmp > 0 && !z16f_contrde(); tmp--);
|
for (tmp = 1000 ; tmp > 0 && !z16f_contrde(); tmp--);
|
||||||
@ -770,6 +780,10 @@ static void _up_putc(int ch)
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_putc
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
int up_putc(int ch)
|
int up_putc(int ch)
|
||||||
{
|
{
|
||||||
/* Check for LF */
|
/* Check for LF */
|
||||||
@ -778,13 +792,13 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Output CR before LF */
|
/* Output CR before LF */
|
||||||
|
|
||||||
_up_putc('\r');
|
z16f_putc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output character */
|
/* Output character */
|
||||||
|
|
||||||
_up_putc(ch);
|
z16f_putc(ch);
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 */
|
#endif /* CONFIG_USE_SERIALDRIVER */
|
||||||
|
Loading…
Reference in New Issue
Block a user