GCC Code Coverage Report


Directory: ./
File: firmware/console/binary/serial_can.h
Date: 2025-11-16 14:52:24
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 // CanStreamerState has non-sync fifo, unify?
29 fifo_buffer_sync<CanRxMessage, CAN_FIFO_FRAME_SIZE> rxFifo;
30 };
31
32 #if HAL_USE_CAN
33 class CanTransport : public ICanTransport {
34 public:
35 CanTransport(CanRxMessageSource *p_source) : source(p_source) {}
36 void init();
37
38 virtual can_msg_t transmit(CanTxMessage &ctfp, can_sysinterval_t timeout) override;
39 virtual can_msg_t receive(CANRxFrame *crfp, can_sysinterval_t timeout) override;
40 virtual void onTpFirstFrame() override;
41
42 CanRxMessageSource *source;
43 };
44
45 void tsOverCanInit();
46
47 // we don't have canStreamSendTimeout() because we need to "bufferize" the stream and send it in fixed-length packets
48 msg_t canStreamAddToTxTimeout(size_t *np, const uint8_t *txbuf, sysinterval_t timeout);
49 msg_t canStreamFlushTx(sysinterval_t timeout);
50
51 msg_t canStreamReceiveTimeout(size_t *np, uint8_t *rxbuf, sysinterval_t timeout);
52 #endif /* HAL_USE_CAN */
53