LCOV - code coverage report
Current view: top level - util/can_rcv_buffer.c (source / functions) Coverage Total Hit
Test: coverage-filtered.info Lines: 32.0 % 25 8
Test Date: 2026-03-20 08:45:03 Functions: 50.0 % 8 4
Branches: 40.0 % 10 4
MC/DC: 40.0 % 10 4

             Branch data      MC/DC data    Line data    Source code
       1                 :              :             : #include <stddef.h>
       2                 :              :             : 
       3                 :              :             : #include "common.h"
       4                 :              :             : 
       5                 :              :             : #include "can.h"
       6                 :              :             : #include "can_rcv_buffer.h"
       7                 :              :             : #include "safe_ring_buffer.h"
       8                 :              :             : 
       9                 :              :             : static srb_ctx_t buf;
      10                 :              :             : static bool overflow_flag;
      11                 :              :             : 
      12                 :              :           1 : void rcvb_init(void *pool, size_t pool_size) {
      13         [ -  + ]:      [ t  F ]:           1 :         w_assert(pool);
      14                 :              :             : 
      15                 :              :           0 :         srb_init(&buf, pool, pool_size, sizeof(can_msg_t));
      16                 :              :           0 :         overflow_flag = false;
      17                 :              :           0 : }
      18                 :              :             : 
      19                 :              :           1 : void rcvb_push_message(const can_msg_t *msg) {
      20         [ -  + ]:      [ t  F ]:           1 :         w_assert(msg);
      21                 :              :             : 
      22         [ #  # ]:      [ t  f ]:           0 :         if (!srb_push(&buf, (void *)msg)) {
      23                 :              :           0 :                 overflow_flag = true;
      24                 :              :             :         }
      25                 :              :           0 : }
      26                 :              :             : 
      27                 :              :           0 : bool rcvb_has_overflowed(void) {
      28                 :              :           0 :         return overflow_flag;
      29                 :              :             : }
      30                 :              :             : 
      31                 :              :           0 : void rcvb_clear_overflow_flag(void) {
      32                 :              :           0 :         overflow_flag = false;
      33                 :              :           0 : }
      34                 :              :             : 
      35                 :              :           0 : bool rcvb_is_full(void) {
      36                 :              :           0 :         return srb_is_full(&buf);
      37                 :              :             : }
      38                 :              :             : 
      39                 :              :           0 : bool rcvb_is_empty(void) {
      40                 :              :           0 :         return srb_is_empty(&buf);
      41                 :              :             : }
      42                 :              :             : 
      43                 :              :           1 : bool rcvb_pop_message(can_msg_t *msg) {
      44         [ -  + ]:      [ t  F ]:           1 :         w_assert(msg);
      45                 :              :             : 
      46                 :              :           0 :         return srb_pop(&buf, (void *)msg);
      47                 :              :             : }
      48                 :              :             : 
      49                 :              :           1 : bool rcvb_peek_message(can_msg_t *msg) {
      50         [ -  + ]:      [ t  F ]:           1 :         w_assert(msg);
      51                 :              :             : 
      52                 :              :           0 :         return srb_peek(&buf, (void *)msg);
      53                 :              :             : }
        

Generated by: LCOV version 2.0-1