LCOV - code coverage report
Current view: top level - zephyr/drivers - uart_pipe.h Hit Total Coverage
Test: new.info Lines: 4 4 100.0 %
Date: 2024-12-22 00:14:23

          Line data    Source code
       1           1 : /** @file
       2             :  *  @brief Pipe UART driver header file.
       3             :  *
       4             :  *  A pipe UART driver that allows applications to handle all aspects of
       5             :  *  received protocol data.
       6             :  */
       7             : 
       8             : /*
       9             :  * Copyright (c) 2015 Intel Corporation
      10             :  *
      11             :  * SPDX-License-Identifier: Apache-2.0
      12             :  */
      13             : 
      14             : #ifndef ZEPHYR_INCLUDE_DRIVERS_UART_PIPE_H_
      15             : #define ZEPHYR_INCLUDE_DRIVERS_UART_PIPE_H_
      16             : 
      17             : #include <stdlib.h>
      18             : 
      19             : #ifdef __cplusplus
      20             : extern "C" {
      21             : #endif
      22             : 
      23             : /** @brief Received data callback.
      24             :  *
      25             :  *  This function is called when new data is received on UART. The off parameter
      26             :  *  can be used to alter offset at which received data is stored. Typically,
      27             :  *  when the complete data is received and a new buffer is provided off should
      28             :  *  be set to 0.
      29             :  *
      30             :  *  @param buf Buffer with received data.
      31             :  *  @param off Data offset on next received and accumulated data length.
      32             :  *
      33             :  *  @return Buffer to be used on next receive.
      34             :  */
      35           1 : typedef uint8_t *(*uart_pipe_recv_cb)(uint8_t *buf, size_t *off);
      36             : 
      37             : /** @brief Register UART application.
      38             :  *
      39             :  *  This function is used to register new UART application.
      40             :  *
      41             :  *  @param buf Initial buffer for received data.
      42             :  *  @param len Size of buffer.
      43             :  *  @param cb Callback to be called on data reception.
      44             :  */
      45           1 : void uart_pipe_register(uint8_t *buf, size_t len, uart_pipe_recv_cb cb);
      46             : 
      47             : /** @brief Send data over UART.
      48             :  *
      49             :  *  This function is used to send data over UART.
      50             :  *
      51             :  *  @param data Buffer with data to be send.
      52             :  *  @param len Size of data.
      53             :  *
      54             :  *  @return 0 on success or negative error
      55             :  */
      56           1 : int uart_pipe_send(const uint8_t *data, int len);
      57             : 
      58             : #ifdef __cplusplus
      59             : }
      60             : #endif
      61             : 
      62             : #endif /* ZEPHYR_INCLUDE_DRIVERS_UART_PIPE_H_ */

Generated by: LCOV version 1.14