Kinetis: Resolve issue with duplicate definitions of up_putc. Addition conditional logic to pick just one.

This commit is contained in:
Gregory Nutt 2017-02-25 16:36:47 -06:00
parent 3112292ab0
commit 1e1714b061
3 changed files with 33 additions and 0 deletions

View File

@ -203,6 +203,31 @@
# endif
#endif
/* Which version of up_putc() should be built?
*
* --------------------+-------------------+-----------------+------------------
* HAVE_UART_DEVICE && HAVE_UART_DEVICE HAVE_LPUART_DEVICE
* HAVE_LPUART_DEVICE (only) (only)
* --------------------+-------------------+-----------------+------------------
* HAVE_UART_CONSOLE kinetis_serial kinetis_serial (impossible)
* HAVE_LPUART_CONSOLE kinetis_lpserial (impossible) kinetis_lpserial
* No serial console kinetis_serial kinetis_serial kinetis_lpserial
* --------------------+-------------------+-----------------+------------------
*/
#undef HAVE_UART_PUTC
#undef HAVE_LPUART_PUTC
#if defined(HAVE_LPUART_CONSOLE)
# define HAVE_LPUART_PUTC 1
#elif defined(HAVE_UART_CONSOLE)
# define HAVE_UART_PUTC 1
#elif define(HAVE_UART_DEVICE)
# define HAVE_UART_PUTC 1
#elif define(HAVE_LPUART_DEVICE)
# define HAVE_LPUART_PUTC 1
#endif
/* Check UART flow control (Not yet supported) */
# undef CONFIG_UART0_FLOWCONTROL

View File

@ -853,6 +853,7 @@ void up_serialinit(void)
*
****************************************************************************/
#ifdef HAVE_LPUART_PUTC
int up_putc(int ch)
{
#ifdef HAVE_LPUART_CONSOLE
@ -875,6 +876,7 @@ int up_putc(int ch)
#endif
return ch;
}
#endif
#else /* USE_SERIALDRIVER */
@ -886,6 +888,7 @@ int up_putc(int ch)
*
****************************************************************************/
#ifdef HAVE_LPUART_PUTC
int up_putc(int ch)
{
#ifdef HAVE_LPUART_CONSOLE
@ -902,5 +905,6 @@ int up_putc(int ch)
#endif
return ch;
}
#endif
#endif /* USE_SERIALDRIVER */

View File

@ -1315,6 +1315,7 @@ void up_serialinit(void)
*
****************************************************************************/
#ifndef HAVE_UART_PUTC
int up_putc(int ch)
{
#ifdef HAVE_UART_CONSOLE
@ -1337,6 +1338,7 @@ int up_putc(int ch)
#endif
return ch;
}
#endif
#else /* USE_SERIALDRIVER */
@ -1348,6 +1350,7 @@ int up_putc(int ch)
*
****************************************************************************/
#ifndef HAVE_UART_PUTC
int up_putc(int ch)
{
#ifdef HAVE_UART_CONSOLE
@ -1364,6 +1367,7 @@ int up_putc(int ch)
#endif
return ch;
}
#endif
#endif /* USE_SERIALDRIVER */