1
0
mirror of https://github.com/elua/elua.git synced 2025-01-25 01:02:54 +08:00
elua/doc/eluadoc/arch_platform_uart.lua
Dado Sutter 17487f9ebe - doc folder replaced by some work done on Led Lab for the new doc and site
- This should actually be a merge but we made a mistake on the initial repo creation
  and a merge was not possible.
- Below there is a resumed log of the commit messages for the few steps, just for
  the record.

- The merged commit messages for this work are:

 - Removing Portuguese doc content
 - Ignore folder names fixed on .gitignore
 - Removed doc files which content migrated to the CMS
 - docdata.lua updated accordingly
 - Doc build checked ok
 - Overall doc structure and contents still being refined
 - Removing folder cache from git versioning
 - Removing folder dist from git versioning. The folders above are generated by the buildall.lua script and are not part of the sources
 - Adding .gitignore file with objects info to inform git what to ignore
 - Removed file
 - Merge branch 'master' of git@repos.giga.puc-rio.br:elua-doc.git
 - Moving all files and folders to a working doc folder
 - Css updated
 - Index page added and CSS adjusts
 - Merge branch 'master' of git@repos.giga.puc-rio.br:elua-doc.git
 - Signed-off-by: Guilherme Sanchez <guilhermesanchezpacheco@gmail.com>
 - Merge branch 'master' of git@repos.giga.puc-rio.br:elua-doc.git
 - files deleted
 - Changed function that creates functions submenus.
 - Menu inserted with árvore, CSS adjusts, google search
 - Changed past design to new design
 - CSS updated
 - initial import

- The commit ids were also preserved but they are related to this "other"
  work done on Led Lab. We'll keep the repo just in case.

4dce3f77c47b0c3001a2075a946e80ee52759b49 - Removing Portuguese doc content
78d8847525cacf045fe7e672cff6bd1e058a6a4b Ignore folder names fixed on .gitignore
48dee6b7962168ab1098bf709ead6f3cfe6b7964 - Removed doc files which content migrated to the CMS - docdata.lua updated accordingly - Doc build checked ok - Overall doc structure and contents still being refined
2aa2fe0c554db03dbc7029c34d0f4500fe625b37 - Removing folder cache from git versioning - Removing folder dist from git versioning   The folders above are generated by the buildall.lua script and are not part of the sources - Adding .gitignore file with objects info to inform git what to ignore
af6cc2890edf1855af319dc999a03feee5f9bee0 Removed file
6a180e72eb4f4860620cafc0685000e9f2174cfe Merge branch 'master' of git@repos.giga.puc-rio.br:elua-doc.git
eb430112e78ae537459ab315e228ebca84bdf2d4 Moving all files and folders to a working doc folder
d28a7c99489915630bd2625f3756fecf0d08ce37 Css updated
32836ffe382f04ab07c3e6f018c7b449a20d7a8d Index page added and CSS adjusts
1461d9957d9d25a1467cb57ab8717aa213a37e8d Merge branch 'master' of git@repos.giga.puc-rio.br:elua-doc.git
ae1934c04f35a29e25bb4495ae8a31cd9c000b5b Signed-off-by: Guilherme Sanchez <guilhermesanchezpacheco@gmail.com>
b5f31d70f1fac8d3fba325c9867a03f976775698 Merge branch 'master' of git@repos.giga.puc-rio.br:elua-doc.git
ec9ad8446b7ea38b252c6a416e70774349835e45 files deleted
bd7a80151b2030720ba8d8a303467d8c25a4b4b2 Changed function that creates functions submenus.
6a7494acaec694fadbb13520bcbccc51a6b95dfe Inserido menu com árvore, ajustes no CSS, busca do google
e979f1c259d425c9a3be83f9cda20eddffe073bb Changed past design to new design.
381459e95286886b052103a0253e60b29e064d7a CSS updated
4f81d2f1195efe733fe5f97517be325d75937bc3 initial import
2011-05-06 06:49:21 -03:00

194 lines
9.2 KiB
Lua

-- eLua platform interface - UART
data_en =
{
-- Title
title = "eLua platform interface - UART",
-- Menu name
menu_name = "UART",
-- Overview
overview = "This part of the platform interface groups functions related to the UART interface(s) of the MCU.",
-- Data structures, constants and types
structures =
{
{ text = [[// Parity
enum
{
PLATFORM_UART_PARITY_EVEN,
PLATFORM_UART_PARITY_ODD,
PLATFORM_UART_PARITY_NONE
};]],
name = "UART parity",
desc = "Constants used to specify the UART parity mode."
},
{ text = [[// Stop bits
enum
{
PLATFORM_UART_STOPBITS_1,
PLATFORM_UART_STOPBITS_1_5,
PLATFORM_UART_STOPBITS_2
};]],
name = "UART stop bits",
desc = "Constants used to specify the number of UART stop bits.",
},
{ text = [[// "Infinite timeout" constant for recv
#define PLATFORM_UART_INFINITE_TIMEOUT (-1)]],
name = "UART timeout",
desc = "This constant is used as a special timeout value (infinite timeout) in the UART functions that expect a timeout as argument.",
},
{ text = [[// Virtual UART IDs
#define SERMUX_SERVICE_ID_FIRST 0xD0
#define SERMUX_SERVICE_ID_LAST 0xD7
]],
name = "Virtual UART IDs",
desc = "If @sermux.html@virtual UART@ support is enabled these constants define the IDs of the virtual UARTs in the system (defined in %inc/sermux.h%).",
},
{ text = [[// Flow control type
#define PLATFORM_UART_FLOW_NONE 0
#define PLATFORM_UART_FLOW_RTS 1
#define PLATFORM_UART_FLOW_CTS 2
]],
name = "Flow control type",
desc = "Used to set the flow control type on a serial interface. These constans can be ORed together ($PLATFORM_UART_FLOW_RTS | PLATFORM_UART_FLOW_CTS$)",
},
},
-- Functions
funcs =
{
{ sig = "int #platform_uart_exists#( unsigned id );",
desc = [[Checks if the platform has the hardware UART specified as argument. Implemented in %src/common.c%, it uses the $NUM_UART$ macro that must be defined in the
platform's $platform_conf.h$ file (see @arch_overview.html#platforms@here@ for details). For example:</p>
~#define NUM_UART 2 $// The platform has 2 UART interfaces$~<p>]],
args = "$id$ - UART interface ID",
ret = "1 if the specified UART exists, 0 otherwise"
},
{ sig = "u32 #platform_uart_setup#( unsigned id, u32 baud, int databits, int parity, int stopbits );",
desc = "This function is used to initialize the parameters of the UART interface.",
args =
{
"$id$ - UART interface ID.",
"$baud$ - baud rate.",
"$databits$ - number of databits (maximum 8).",
"$parity$ - parity type (can be either $PLATFORM_UART_PARITY_EVEN$, $PLATFORM_UART_PARITY_ODD$ or $PLATFORM_UART_PARITY_NONE$, see @#uart_parity@here@).",
[[$stopbits$ - number of stop bits (can be either $PLATFORM_UART_STOPBITS_1$, $PLATFORM_UART_STOPBITS_1_5$ or $PLATFORM_UART_STOPBITS_2$, see
@#uart_stop_bits@here@).]],
},
ret = "the actual baud rate. Depending on the hardware, this may have a different value than the $baud$ argument.",
},
{ sig = "void #platform_uart_send#( unsigned id, u8 data );",
desc = [[Send data to an UART interface. This is a blocking operation (it doesn't return until the data was sent).<br>
This function is "split" in two parts: a platform-independent part that is implemented in %src/common.c% and a platform-dependent part that must be implemented
by each platform in a function named @#platform_s_uart_send@platform_s_uart_send@.]],
args =
{
"$id$ - UART interface ID.",
"$data$ - data to be sent.",
},
},
{ sig = "void #platform_s_uart_send#( unsigned id, u8 data );",
desc = [[This is the platform-dependent part of @#platform_uart_send@platform_uart_send@. It doesn't need to take care of @sermux.html@virtual UARTs@ or other system
configuration parameters, it just needs to instruct the CPU to send the data on the specified ID. This function will always be called with a physical uart ID.]],
args =
{
"$id$ - UART interface ID.",
"$data$ - data to be sent.",
},
},
{ sig = "int #platform_uart_recv#( unsigned id, unsigned timer_id, s32 timeout );",
link = "platform_uart_recv",
desc = [[Receive data from the UART interface (blocking/non blocking with timeout/immediate).<br>
This function is "split" in two parts: a platform-independent part that is implemented in %src/common.c% and a platform-dependent part that must be implemented by each
platform in a function named @#platform_s_uart_recv@platform_s_uart_recv@.]],
args =
{
"$id$ - UART interface ID.",
"$timer_id$ - the ID of the timer used in this operation (see @arch_platform_timers.html@here@ for details). See also the description of the $timeout$ argument.",
[[$timeout$ - specifies a timeout for the receive operation as follows:
<ul>
<li>$timeout > 0$: the timer with the specified $timer_id$ will be used to timeout the receive operation after $timeout$ microseconds.</li>
<li>$timeout = 0$: the function returns immediately regardless of data being available or not. $timer_id$ is ignored.</li>
<li>$timeout$ = @#uart_timeout@PLATFORM_UART_INFINITE_TIMEOUT@: the function waits indefinitely for UART data to be available and returns it. In this mode the function doesn't
time out, so $timer_id$ is ignored.</li>
</ul>]],
},
ret =
{
"if $timeout > 0$ and data from the UART is available in $timeout$ microseconds of less it is returned, otherwise -1 is returned",
"if $timeout = 0$ and data from the UART is available when the function is called it is returned, otherwise -1 is returned",
"if $timeout$ = @#uart_timeout@PLATFORM_UART_INIFINITE_TIMEOUT@ it returns the data read from the UART after it becomes available"
}
},
{ sig = "int #platform_s_uart_recv#( unsigned id, s32 timeout );",
link = "platform_s_uart_recv",
desc = [[This is the platform-dependent part of the UART receive function @#platform_uart_recv@platform_uart_recv@ and is in fact a "subset" of the full function
(thus being easier to implement by each platform in part). In particular, it never needs to deal with the $timeout &gt; 0$ case, which is handled by @#platform_uart_recv@platform_uart_recv@.]],
args =
{
"$id$ - UART interface ID.",
[[$timeout$ - specifies a timeout for the receive operation as follows:
<ul>
<li>$timeout = 0$: the function returns immediately regardless of data being available or not.</li>
<li>$timeout$ = @#uart_timeout@PLATFORM_UART_INFINITE_TIMEOUT@: the function waits indefinitely for UART data to be available and returns it.</li>
</ul>]],
},
ret =
{
"if $timeout = 0$ and data from the UART is available when the function is called it is returned, otherwise -1 is returned",
"if $timeout$ = @#uart_timeout@PLATFORM_UART_INIFINITE_TIMEOUT@ it returns the data read from the UART after it becomes available"
}
},
{ sig = "int #platform_uart_set_buffer#( unsigned id, unsigned log2size );",
desc = "Sets the buffer for the specified UART. This function is fully implemented in %src/common.c%.",
args =
{
"$id$ - UART interface ID.",
"$data$ - the base 2 logarithm of the buffer size or 0 to disable buffering on the UART. Note that disabling buffering on a virtual UART is an invalid operation."
},
ret = "$PLATFORM_OK$ if the operation succeeded, $PLATFORM_ERR$ otherwise."
},
{ sig = "int #platform_uart_set_flow_control#( unsigned id, int type );",
desc = [[Sets the flow control type.<br>
This function is "split" in two parts: a platform independent part that is implemented in %src/common.c% and a platform-dependent part that must be implemented by each
platform in a function named @#platform_s_uart_set_flow_control@platform_s_uart_set_flow_control@.]],
args =
{
"$id$ - UART interface ID.",
[[$type$ - the desired flow control. It can be either $PLATFORM_UART_FLOW_NONE$, $PLATFORM_UART_FLOW_RTS$ or $PLATFORM_UART_FLOW_CTS$ or a bitwise combination of these constants
(see @#flow_control_type@here@ for details).]]
},
ret = "$PLATFORM_OK$ if the operation succeeded, $PLATFORM_ERR$ otherwise."
},
{ sig = "int #platform_s_uart_set_flow_control#( unsigned id, int type );",
desc = [[This is the platform-dependent part of the UART set flow control function @#platform_uart_set_flow_control@platform_uart_set_flow_control@ and is in fact a "subset" of the
full function (thus being easier to implement by each platform in part). In particular, it never needs to deal with virtual UARTs.]],
args =
{
"$id$ - UART interface ID.",
[[$type$ - the desired flow control. It can be either $PLATFORM_UART_FLOW_NONE$, $PLATFORM_UART_FLOW_RTS$ or $PLATFORM_UART_FLOW_CTS$ or a bitwise combination of these constants
(see @#flow_control_type@here@ for details).]]
},
ret = "$PLATFORM_OK$ if the operation succeeded, $PLATFORM_ERR$ otherwise."
},
}
}