GCC Code Coverage Report


Directory: ./
File: firmware/console/binary/serial_can.h
Date: 2025-10-24 14:26:41
Coverage Exec Excl Total
Lines: 0.0% 0 0 2
Functions: 0.0% 0 0 1
Branches: -% 0 0 0
Decisions: -% 0 - 0

Line Branch Decision Exec Source
1 /**
2 * @file serial_can.h
3 *
4 * @date Aug 1, 2020
5 * @author andreika <prometheus.pcb@gmail.com>
6 * @author Andrey Belomutskiy, (c) 2012-2020
7 */
8
9 #pragma once
10
11 #include "isotp.h"
12 #include "can_listener.h"
13
14 class CanTsListener : public CanListener, public CanRxMessageSource {
15 public:
16 CanTsListener()
17 : CanListener(CAN_ECU_SERIAL_RX_ID)
18 {
19 }
20
21 virtual void decodeFrame(const CANRxFrame& frame, efitick_t nowNt);
22
23 bool get(CanRxMessage &item, int timeout) {
24 return rxFifo.get(item, timeout);
25 }
26
27 protected:
28 fifo_buffer_sync<CanRxMessage, CAN_FIFO_FRAME_SIZE> rxFifo;
29 };
30
31 #if HAL_USE_CAN
32 class CanTransport : public ICanTransport {
33 public:
34 CanTransport(CanRxMessageSource *p_source) : source(p_source) {}
35 void init();
36
37 virtual can_msg_t transmit(const CanTxMessage *ctfp, can_sysinterval_t timeout) override;
38 virtual can_msg_t receive(CANRxFrame *crfp, can_sysinterval_t timeout) override;
39
40 CanRxMessageSource *source;
41 };
42
43 void tsOverCanInit();
44
45 // we don't have canStreamSendTimeout() because we need to "bufferize" the stream and send it in fixed-length packets
46 msg_t canStreamAddToTxTimeout(size_t *np, const uint8_t *txbuf, sysinterval_t timeout);
47 msg_t canStreamFlushTx(sysinterval_t timeout);
48
49 msg_t canStreamReceiveTimeout(size_t *np, uint8_t *rxbuf, sysinterval_t timeout);
50 #endif /* HAL_USE_CAN */
51