zephyr/include/drivers/console/uart_pipe.h
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00

58 lines
1.4 KiB
C

/** @file
* @brief Pipe UART driver header file.
*
* A pipe UART driver that allows applications to handle all aspects of
* received protocol data.
*/
/*
* Copyright (c) 2015 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/** @brief Received data callback.
*
* This function is called when new data is received on UART. The off parameter
* can be used to alter offset at which received data is stored. Typically,
* when the complete data is received and a new buffer is provided off should
* be set to 0.
*
* @param buf Buffer with received data.
* @param off Data offset on next received and accumulated data length.
*
* @return Buffer to be used on next receive.
*/
typedef uint8_t *(*uart_pipe_recv_cb)(uint8_t *buf, size_t *off);
/** @brief Register UART application.
*
* This function is used to register new UART application.
*
* @param buf Initial buffer for received data.
* @param len Size of buffer.
* @param cb Callback to be called on data reception.
*/
void uart_pipe_register(uint8_t *buf, size_t len, uart_pipe_recv_cb cb);
/** @brief Send data over UART.
*
* This function is used to send data over UART.
*
* @param data Buffer with data to be send.
* @param len Size of data.
*
* @return 0 on success or negative error
*/
int uart_pipe_send(const uint8_t *data, int len);
#ifdef __cplusplus
}
#endif