1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 Fabian Schmieder
//! TP-UART command and indication byte constants.
/// Reset the TP-UART chip.
pub const U_RESET_REQ: u8 = 0x01;
/// Request chip state.
pub const U_STATE_REQ: u8 = 0x02;
/// Enter bus monitor mode.
pub const U_BUSMON_REQ: u8 = 0x05;
/// System state request (NCN5120).
pub const U_SYSTEM_STATE_REQ: u8 = 0x0D;
/// Enter stop mode.
pub const U_STOP_MODE_REQ: u8 = 0x0E;
/// Exit stop mode.
pub const U_EXIT_STOP_MODE_REQ: u8 = 0x0F;
/// ACK request base.
pub const U_ACK_REQ: u8 = 0x10;
/// ACK flag: addressed.
pub const ACK_ADDRESSED: u8 = 0x01;
/// ACK flag: busy.
pub const ACK_BUSY: u8 = 0x02;
/// ACK flag: nack.
pub const ACK_NACK: u8 = 0x04;
/// Start of frame transmission.
pub const U_L_DATA_START_REQ: u8 = 0x80;
/// Continuation of frame transmission.
///
/// Shares the start opcode: the TP-UART encodes start and continuation as
/// `0x80 | index`, so this intentionally aliases [`U_L_DATA_START_REQ`].
pub const U_L_DATA_CONT_REQ: u8 = U_L_DATA_START_REQ;
/// End of frame transmission.
pub const U_L_DATA_END_REQ: u8 = 0x40;
/// Mask for the 6-bit byte index carried in `U_L_DATA_*` opcodes.
pub const U_L_DATA_INDEX_MASK: u8 = 0x3F;
/// NCN5120: set individual address.
pub const U_NCN5120_SET_ADDRESS_REQ: u8 = 0xF1;
/// TP-UART 2: set individual address.
pub const U_TPUART2_SET_ADDRESS_REQ: u8 = 0x28;
/// Reset indication.
pub const U_RESET_IND: u8 = 0x03;
/// State indication.
pub const U_STATE_IND: u8 = 0x07;
/// State mask.
pub const U_STATE_MASK: u8 = 0x07;
/// Frame state indication.
pub const U_FRAME_STATE_IND: u8 = 0x13;
/// Frame state mask.
pub const U_FRAME_STATE_MASK: u8 = 0x17;
/// Standard frame indication.
pub const L_DATA_STANDARD_IND: u8 = 0x90;
/// Extended frame indication.
pub const L_DATA_EXTENDED_IND: u8 = 0x10;
/// Frame type mask.
pub const L_DATA_MASK: u8 = 0xD3;
/// `L_Data.con` success bit: when clear (`& 0x80 == 0`), transmission succeeded.
pub const L_DATA_CON_SUCCESS_MASK: u8 = 0x80;
/// Supported transceiver types.