mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
Improve console configuration settings
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1518 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -90,6 +90,12 @@
|
|||||||
# undef HAVE_SERIALCONSOLE
|
# undef HAVE_SERIALCONSOLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_SERIALCONSOLE) && defined(CONFIG_LCD_CONSOLE)
|
||||||
|
# error "Both serial and LCD consoles are defined"
|
||||||
|
#elif !defined(HAVE_SERIALCONSOLE) && !defined(CONFIG_LCD_CONSOLE)
|
||||||
|
# warning "No console is defined"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Select UART parameters for the selected console */
|
/* Select UART parameters for the selected console */
|
||||||
|
|
||||||
#ifdef HAVE_SERIALCONSOLE
|
#ifdef HAVE_SERIALCONSOLE
|
||||||
@@ -292,7 +298,7 @@ static inline void up_lowserialsetup(void)
|
|||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifdef HAVE_SERIAL /* Assume needed if we have serial. See for e.g., up_lcd.c */
|
#if defined(HAVE_SERIAL) && !defined(CONFIG_LCD_CONSOLE)
|
||||||
void up_lowputc(char ch)
|
void up_lowputc(char ch)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SERIALCONSOLE
|
#ifdef HAVE_SERIALCONSOLE
|
||||||
|
|||||||
@@ -106,27 +106,33 @@
|
|||||||
/* Is there a serial console? */
|
/* Is there a serial console? */
|
||||||
|
|
||||||
#if defined(CONFIG_UART0_SERIAL_CONSOLE) && !defined(CONFIG_UART0_DISABLE)
|
#if defined(CONFIG_UART0_SERIAL_CONSOLE) && !defined(CONFIG_UART0_DISABLE)
|
||||||
# define HAVE_CONSOLE 1
|
# define HAVE_SERIALCONSOLE 1
|
||||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||||
#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && !defined(CONFIG_UART1_DISABLE)
|
#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && !defined(CONFIG_UART1_DISABLE)
|
||||||
# define HAVE_CONSOLE 1
|
# define HAVE_SERIALCONSOLE 1
|
||||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||||
#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && !defined(CONFIG_UART2_DISABLE)
|
#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && !defined(CONFIG_UART2_DISABLE)
|
||||||
# define HAVE_CONSOLE 1
|
# define HAVE_SERIALCONSOLE 1
|
||||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||||
#else
|
#else
|
||||||
# if defined(CONFIG_UART0_SERIAL_CONSOLE) || defined(CONFIG_UART1_SERIAL_CONSOLE)|| defined(CONFIG_UART2_SERIAL_CONSOLE)
|
# if defined(CONFIG_UART0_SERIAL_CONSOLE) || defined(CONFIG_UART1_SERIAL_CONSOLE)|| defined(CONFIG_UART2_SERIAL_CONSOLE)
|
||||||
# error "Serial console selected, but corresponding UART not enabled"
|
# error "Serial console selected, but corresponding UART not enabled"
|
||||||
# endif
|
# endif
|
||||||
# undef HAVE_CONSOLE
|
# undef HAVE_SERIALCONSOLE
|
||||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_SERIALCONSOLE) && defined(CONFIG_LCD_CONSOLE)
|
||||||
|
# error "Both serial and LCD consoles are defined"
|
||||||
|
#elif !defined(HAVE_SERIALCONSOLE) && !defined(CONFIG_LCD_CONSOLE)
|
||||||
|
# warning "No console is defined"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_USE_SERIALDRIVER
|
#ifdef CONFIG_USE_SERIALDRIVER
|
||||||
|
|
||||||
/* Which UART with be tty0/console and which tty1 and tty2? */
|
/* Which UART with be tty0/console and which tty1 and tty2? */
|
||||||
@@ -469,7 +475,7 @@ static inline void up_restoreuartint(struct up_dev_s *priv, ubyte enables)
|
|||||||
* Name: up_waittxready
|
* Name: up_waittxready
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef HAVE_CONSOLE
|
#ifdef HAVE_SERIALCONSOLE
|
||||||
static inline void up_waittxready(struct up_dev_s *priv)
|
static inline void up_waittxready(struct up_dev_s *priv)
|
||||||
{
|
{
|
||||||
int tmp;
|
int tmp;
|
||||||
@@ -1091,7 +1097,7 @@ void up_earlyconsoleinit(void)
|
|||||||
|
|
||||||
/* Configuration whichever one is the console */
|
/* Configuration whichever one is the console */
|
||||||
|
|
||||||
#ifdef HAVE_CONSOLE
|
#ifdef HAVE_SERIALCONSOLE
|
||||||
CONSOLE_DEV.isconsole = TRUE;
|
CONSOLE_DEV.isconsole = TRUE;
|
||||||
up_setup(&CONSOLE_DEV);
|
up_setup(&CONSOLE_DEV);
|
||||||
#endif
|
#endif
|
||||||
@@ -1110,7 +1116,7 @@ void up_consoleinit(void)
|
|||||||
{
|
{
|
||||||
/* Register the console */
|
/* Register the console */
|
||||||
|
|
||||||
#ifdef HAVE_CONSOLE
|
#ifdef HAVE_SERIALCONSOLE
|
||||||
(void)uart_register("/dev/console", &CONSOLE_DEV);
|
(void)uart_register("/dev/console", &CONSOLE_DEV);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1137,7 +1143,7 @@ void up_consoleinit(void)
|
|||||||
|
|
||||||
int up_putc(int ch)
|
int up_putc(int ch)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CONSOLE
|
#ifdef HAVE_SERIALCONSOLE
|
||||||
struct up_dev_s *priv = (struct up_dev_s*)CONSOLE_DEV.priv;
|
struct up_dev_s *priv = (struct up_dev_s*)CONSOLE_DEV.priv;
|
||||||
ubyte ucon;
|
ubyte ucon;
|
||||||
|
|
||||||
@@ -1174,7 +1180,7 @@ int up_putc(int ch)
|
|||||||
|
|
||||||
int up_putc(int ch)
|
int up_putc(int ch)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CONSOLE
|
#ifdef HAVE_SERIALCONSOLE
|
||||||
/* Check for LF */
|
/* Check for LF */
|
||||||
|
|
||||||
if (ch == '\n')
|
if (ch == '\n')
|
||||||
|
|||||||
Reference in New Issue
Block a user