LCOV - code coverage report
Current view: top level - zephyr/sys - mpsc_packet.h Coverage Total Hit
Test: new.info Lines: 38.5 % 13 5
Test Date: 2025-09-05 16:43:28

            Line data    Source code
       1            0 : /*
       2              :  * Copyright (c) 2021 Nordic Semiconductor ASA
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : #ifndef ZEPHYR_INCLUDE_SYS_MPSC_PACKET_H_
       7              : #define ZEPHYR_INCLUDE_SYS_MPSC_PACKET_H_
       8              : 
       9              : #include <string.h>
      10              : #include <stdint.h>
      11              : #include <stdbool.h>
      12              : 
      13              : #ifdef __cplusplus
      14              : extern "C" {
      15              : #endif
      16              : 
      17              : /**
      18              :  * @brief Multi producer, single consumer packet header
      19              :  * @defgroup mpsc_packet MPSC (Multi producer, single consumer) packet header
      20              :  * @ingroup mpsc_buf
      21              :  * @{
      22              :  */
      23              : 
      24              : /** @brief Number of bits in the first word which are used by the buffer. */
      25            1 : #define MPSC_PBUF_HDR_BITS 2
      26              : 
      27              : /** @brief Header that must be added to the first word in each packet.
      28              :  *
      29              :  * This fields are controlled by the packet buffer and unless specified must
      30              :  * not be used. Fields must be added at the top of the packet header structure.
      31              :  */
      32            1 : #define MPSC_PBUF_HDR \
      33              :         uint32_t valid: 1; \
      34              :         uint32_t busy: 1
      35              : 
      36              : /** @brief Generic packet header. */
      37            1 : struct mpsc_pbuf_hdr {
      38            0 :         MPSC_PBUF_HDR;
      39            0 :         uint32_t data: 32 - MPSC_PBUF_HDR_BITS;
      40              : };
      41              : 
      42              : /** @brief Skip packet used internally by the packet buffer. */
      43            1 : struct mpsc_pbuf_skip {
      44            0 :         MPSC_PBUF_HDR;
      45            0 :         uint32_t len: 32 - MPSC_PBUF_HDR_BITS;
      46              : };
      47              : 
      48              : /** @brief Generic packet header. */
      49            1 : union mpsc_pbuf_generic {
      50            0 :         struct mpsc_pbuf_hdr hdr;
      51            0 :         struct mpsc_pbuf_skip skip;
      52            0 :         uint32_t raw;
      53              : };
      54              : 
      55              : /**
      56              :  * @}
      57              :  */
      58              : 
      59              : #ifdef __cplusplus
      60              : }
      61              : #endif
      62              : 
      63              : #endif /* ZEPHYR_INCLUDE_SYS_MPSC_PACKET_H_ */
        

Generated by: LCOV version 2.0-1