mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
updated UART flow control functionality (currently implemented only for STM32 and AVR32)
This commit is contained in:
parent
2b122b9b31
commit
f837740cfc
@ -84,7 +84,7 @@ You need to enable this if you want to use the link:refman_gen_term.html[term mo
|
||||
|
||||
#define BUILD_TERM
|
||||
|
||||
link:#static[Static configuration data dependencies]: *CON_UART_ID, CON_UART_SPEED, CON_TIMER_ID, TERM_LINES, TERM_COLS*
|
||||
link:#static[Static configuration data dependencies]: *CON_UART_ID, CON_UART_SPEED, CON_TIMER_ID, CON_FLOW_TYPE, TERM_LINES, TERM_COLS*
|
||||
|
||||
o|BUILD_UIP |<Enable TCP/IP networking support. You need to enable this if you want to use the link:refman_gen_net.html[net module].
|
||||
Also, your platform must implement the uIP support functions (see the link:arch_platform.html[platform interface documentation] for details).
|
||||
@ -110,7 +110,7 @@ input/output over your RS-232 connection. Don't enable this if you need console
|
||||
|
||||
#define BUILD_CON_GENERIC
|
||||
|
||||
link:#static[Static configuration data dependencies]: *CON_UART_ID, CON_UART_SPEED, CON_TIMER_ID*
|
||||
link:#static[Static configuration data dependencies]: *CON_UART_ID, CON_UART_SPEED, CON_TIMER_ID, CON_FLOW_TYPE*
|
||||
|
||||
o|BUILD_CON_TCP |Console input/output over TCP/IP connections only (details link:arch_con_term.html[here]). Enable this if you want to use
|
||||
your eLua board over a telnet session. Don't enable this if you need console input/output over serial transports (see the previous option). To enable:
|
||||
@ -195,9 +195,12 @@ at run-time. The table below lists the static configuration parameters and their
|
||||
^|Name ^|Meaning
|
||||
o|CON_UART_ID +
|
||||
CON_UART_SPEED +
|
||||
CON_TIMER_ID |Used to configure console input/output over UART. The specified UART id will be used for console input/output, at the
|
||||
CON_TIMER_ID +
|
||||
CON_FLOW_TYPE |Used to configure console input/output over UART. The specified UART id will be used for console input/output, at the
|
||||
specified speed. The data format is always 8N1 (8 data bits, no parity, 1 stop bits)t. The specified timer ID will be used for the console subsystem. These
|
||||
variables are also used by the XMODEM and TERM implementations.
|
||||
variables are also used by the XMODEM and TERM implementations. If CON_FLOW_TYPE is defined the specified flow control is applied to the console UART
|
||||
interface (see link:arch_platform_uart.html#platform_uart_set_flow_control[this link] to find out how to specify the flow control). If not defined it
|
||||
defaults to no flow control.
|
||||
|
||||
o|TERM_LINES +
|
||||
TERM_COLS |Used to configure the ANSI terminal support (if enabled in the build). Used to specify (respectively) the number of lines and
|
||||
|
@ -207,12 +207,8 @@ void cmn_uart_setup_sermux()
|
||||
|
||||
int platform_uart_set_flow_control( unsigned id, int type )
|
||||
{
|
||||
#ifndef PLATFORM_UART_SET_FLOW_CONTROL // the backend does not implement flow control
|
||||
return PLATFORM_ERR;
|
||||
#else // #ifndef PLATFORM_UART_SET_FLOW_CONTROL
|
||||
if( id >= SERMUX_SERVICE_ID_FIRST )
|
||||
return PLATFORM_ERR;
|
||||
return platform_s_uart_set_flow_control( id, type );
|
||||
#endif // #ifndef PLATFORM_UART_SET_FLOW_CONTROL
|
||||
}
|
||||
|
||||
|
@ -243,6 +243,11 @@ int platform_s_uart_recv( unsigned id, s32 timeout )
|
||||
return USART_Read( base, 0 );
|
||||
}
|
||||
|
||||
int platform_s_uart_set_flow_control( unsigned id, int type )
|
||||
{
|
||||
return PLATFORM_ERR;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Timer functions
|
||||
|
||||
|
@ -440,6 +440,18 @@ int platform_s_uart_recv( unsigned id, s32 timeout )
|
||||
return usart_getchar( pusart );
|
||||
}
|
||||
|
||||
int platform_s_uart_set_flow_control( unsigned id, int type )
|
||||
{
|
||||
volatile avr32_usart_t *pusart = ( volatile avr32_usart_t* )uart_base_addr[ id ];
|
||||
|
||||
// AVR32 only supports combined RTS/CTS flow control
|
||||
if( type != PLATFORM_UART_FLOW_NONE && type != ( PLATFORM_UART_FLOW_RTS | PLATFORM_UART_FLOW_CTS ) )
|
||||
return PLATFORM_ERR;
|
||||
pusart->mr &= ~AVR32_USART_MR_MODE_MASK;
|
||||
pusart->mr |= ( type == PLATFORM_UART_FLOW_NONE ? AVR32_USART_MR_MODE_NORMAL : AVR32_USART_MR_MODE_HARDWARE ) << AVR32_USART_MR_MODE_OFFSET;
|
||||
return PLATFORM_OK;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Timer functions
|
||||
|
||||
|
@ -155,6 +155,11 @@ int platform_s_uart_recv( unsigned id, s32 timeout )
|
||||
return -1;
|
||||
}
|
||||
|
||||
int platform_s_uart_set_flow_control( unsigned id, int type )
|
||||
{
|
||||
return PLATFORM_ERR;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// "Dummy" timer functions
|
||||
|
||||
|
@ -463,6 +463,11 @@ int platform_s_uart_recv( unsigned id, s32 timeout )
|
||||
return MAP_UARTCharGet( base );
|
||||
}
|
||||
|
||||
int platform_s_uart_set_flow_control( unsigned id, int type )
|
||||
{
|
||||
return PLATFORM_ERR;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Timers
|
||||
// Same on LM3S8962, LM3S6965, LM3S6918 and LM3S9B92 (4 timers)
|
||||
|
@ -230,6 +230,11 @@ int platform_s_uart_recv( unsigned id, s32 timeout )
|
||||
return ( int )buffer;
|
||||
}
|
||||
|
||||
int platform_s_uart_set_flow_control( unsigned id, int type )
|
||||
{
|
||||
return PLATFORM_ERR;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Timer section
|
||||
|
||||
|
@ -405,6 +405,11 @@ int platform_s_uart_recv( unsigned id, s32 timeout )
|
||||
return *UxRBR;
|
||||
}
|
||||
|
||||
int platform_s_uart_set_flow_control( unsigned id, int type )
|
||||
{
|
||||
return PLATFORM_ERR;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Timer section
|
||||
|
||||
|
@ -128,6 +128,11 @@ int platform_s_uart_recv( unsigned id, s32 timeout )
|
||||
return uart_read();
|
||||
}
|
||||
|
||||
int platform_s_uart_set_flow_control( unsigned id, int type )
|
||||
{
|
||||
return PLATFORM_ERR;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Timer
|
||||
|
||||
|
@ -137,6 +137,11 @@ int platform_s_uart_recv( unsigned id, s32 timeout )
|
||||
return -1;
|
||||
}
|
||||
|
||||
int platform_s_uart_set_flow_control( unsigned id, int type )
|
||||
{
|
||||
return PLATFORM_ERR;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// "Dummy" timer functions
|
||||
|
||||
|
@ -30,8 +30,6 @@
|
||||
#define BUILD_C_INT_HANDLERS
|
||||
#define BUILD_LUA_INT_HANDLERS
|
||||
|
||||
#define PLATFORM_UART_SET_FLOW_CONTROL
|
||||
|
||||
// *****************************************************************************
|
||||
// UART/Timer IDs configuration data (used in main.c)
|
||||
|
||||
|
@ -195,6 +195,11 @@ int platform_s_uart_recv( unsigned id, s32 timeout )
|
||||
return UART_ByteReceive( pport );
|
||||
}
|
||||
|
||||
int platform_s_uart_set_flow_control( unsigned id, int type )
|
||||
{
|
||||
return PLATFORM_ERR;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Timer
|
||||
|
||||
|
@ -285,6 +285,11 @@ int platform_s_uart_recv( unsigned id, s32 timeout )
|
||||
return UART_ReceiveData( p_uart );
|
||||
}
|
||||
|
||||
int platform_s_uart_set_flow_control( unsigned id, int type )
|
||||
{
|
||||
return PLATFORM_ERR;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Timer
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user