drivers: serial: add async API system calls
These were unintentionally omitted. We don't expose callback registration or callback response APIs for security reasons. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
7419f4f46f
commit
a51b125aba
2 changed files with 47 additions and 8 deletions
|
@ -41,6 +41,37 @@ static inline void z_vrfy_uart_poll_out(struct device *dev,
|
||||||
}
|
}
|
||||||
#include <syscalls/uart_poll_out_mrsh.c>
|
#include <syscalls/uart_poll_out_mrsh.c>
|
||||||
|
|
||||||
|
#ifdef CONFIG_UART_ASYNC_API
|
||||||
|
/* callback_set() excluded as we don't allow ISR callback installation from
|
||||||
|
* user mode
|
||||||
|
*
|
||||||
|
* rx_buf_rsp() excluded as it's designed to be called from ISR callbacks
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline int z_vrfy_uart_tx(struct device *dev, const u8_t *buf,
|
||||||
|
size_t len, u32_t timeout)
|
||||||
|
{
|
||||||
|
Z_OOPS(Z_SYSCALL_DRIVER_UART(dev, tx));
|
||||||
|
Z_OOPS(Z_SYSCALL_MEMORY_READ(buf, len));
|
||||||
|
return z_impl_uart_tx(dev, buf, len, timeout);
|
||||||
|
}
|
||||||
|
#include <syscalls/uart_tx_mrsh.c>
|
||||||
|
|
||||||
|
UART_SIMPLE(tx_abort);
|
||||||
|
#include <syscalls/uart_tx_abort_mrsh.c>
|
||||||
|
|
||||||
|
static inline int z_vrfy_uart_rx_enable(struct device *dev, u8_t *buf,
|
||||||
|
size_t len, u32_t timeout)
|
||||||
|
{
|
||||||
|
Z_OOPS(Z_SYSCALL_DRIVER_UART(dev, rx_enable));
|
||||||
|
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(buf, len));
|
||||||
|
return z_impl_uart_rx_enable(dev, buf, len, timeout);
|
||||||
|
}
|
||||||
|
#include <syscalls/uart_rx_enable_mrsh.c>
|
||||||
|
|
||||||
|
UART_SIMPLE(rx_disable);
|
||||||
|
#include <syscalls/uart_rx_disable_mrsh.c>
|
||||||
|
#endif /* CONFIG_UART_ASYNC_API */
|
||||||
|
|
||||||
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
||||||
UART_SIMPLE_VOID(irq_tx_enable)
|
UART_SIMPLE_VOID(irq_tx_enable)
|
||||||
|
|
|
@ -465,10 +465,11 @@ static inline int uart_callback_set(struct device *dev,
|
||||||
* @retval -EBUSY There is already an ongoing transfer.
|
* @retval -EBUSY There is already an ongoing transfer.
|
||||||
* @retval 0 If successful, negative errno code otherwise.
|
* @retval 0 If successful, negative errno code otherwise.
|
||||||
*/
|
*/
|
||||||
static inline int uart_tx(struct device *dev,
|
__syscall int uart_tx(struct device *dev, const u8_t *buf, size_t len,
|
||||||
const u8_t *buf,
|
u32_t timeout);
|
||||||
size_t len,
|
|
||||||
u32_t timeout)
|
static inline int z_impl_uart_tx(struct device *dev, const u8_t *buf,
|
||||||
|
size_t len, u32_t timeout)
|
||||||
|
|
||||||
{
|
{
|
||||||
const struct uart_driver_api *api =
|
const struct uart_driver_api *api =
|
||||||
|
@ -487,7 +488,9 @@ static inline int uart_tx(struct device *dev,
|
||||||
* @retval -EFAULT There is no active transmission.
|
* @retval -EFAULT There is no active transmission.
|
||||||
* @retval 0 If successful, negative errno code otherwise.
|
* @retval 0 If successful, negative errno code otherwise.
|
||||||
*/
|
*/
|
||||||
static inline int uart_tx_abort(struct device *dev)
|
__syscall int uart_tx_abort(struct device *dev);
|
||||||
|
|
||||||
|
static inline int z_impl_uart_tx_abort(struct device *dev)
|
||||||
{
|
{
|
||||||
const struct uart_driver_api *api =
|
const struct uart_driver_api *api =
|
||||||
(const struct uart_driver_api *)dev->driver_api;
|
(const struct uart_driver_api *)dev->driver_api;
|
||||||
|
@ -511,8 +514,11 @@ static inline int uart_tx_abort(struct device *dev)
|
||||||
* @retval 0 If successful, negative errno code otherwise.
|
* @retval 0 If successful, negative errno code otherwise.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static inline int uart_rx_enable(struct device *dev, u8_t *buf, size_t len,
|
__syscall int uart_rx_enable(struct device *dev, u8_t *buf, size_t len,
|
||||||
u32_t timeout)
|
u32_t timeout);
|
||||||
|
|
||||||
|
static inline int z_impl_uart_rx_enable(struct device *dev, u8_t *buf,
|
||||||
|
size_t len, u32_t timeout)
|
||||||
{
|
{
|
||||||
const struct uart_driver_api *api =
|
const struct uart_driver_api *api =
|
||||||
(const struct uart_driver_api *)dev->driver_api;
|
(const struct uart_driver_api *)dev->driver_api;
|
||||||
|
@ -557,7 +563,9 @@ static inline int uart_rx_buf_rsp(struct device *dev, u8_t *buf, size_t len)
|
||||||
* @retval -EFAULT There is no active reception.
|
* @retval -EFAULT There is no active reception.
|
||||||
* @retval 0 If successful, negative errno code otherwise.
|
* @retval 0 If successful, negative errno code otherwise.
|
||||||
*/
|
*/
|
||||||
static inline int uart_rx_disable(struct device *dev)
|
__syscall int uart_rx_disable(struct device *dev);
|
||||||
|
|
||||||
|
static inline int z_impl_uart_rx_disable(struct device *dev)
|
||||||
{
|
{
|
||||||
const struct uart_driver_api *api =
|
const struct uart_driver_api *api =
|
||||||
(const struct uart_driver_api *)dev->driver_api;
|
(const struct uart_driver_api *)dev->driver_api;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue