64 return (Frame->
Flags >> 29) & 1;
69 return (Frame->
Flags >> 30) & 1;
76 Frame->
Flags |= (1 << 31);
79 static inline uint32_t
82 return (Frame->
Flags >> 31) & 1;
86 static inline uint32_t
89 if (temu_canIsExtendedFrame(Frame)) {
90 return Frame->
Flags & 0x1fffffff;
92 return (Frame->
Flags >> 18) & 0x7ff;
97 temu_canMakeBasicFrame(
temu_CanFrame *Frame, uint32_t Ident, uint32_t RTR,
98 uint32_t Length, uint8_t *Data)
100 Frame->
Flags = (Ident << 18) | (RTR << 30);
101 Frame->
Length = (uint8_t)Length;
103 if (Length && !RTR) {
104 memcpy(Frame->
Data, Data, Length > 8 ? 8 : Length);
109 temu_canMakeExtFrame(
temu_CanFrame *Frame, uint32_t Ident, uint32_t RTR,
110 uint32_t Length, uint8_t *Data)
112 Frame->
Flags = Ident | (RTR << 30) | (1 << 29);
113 Frame->
Length = (uint8_t)Length;
115 if (Length && !RTR) {
116 memcpy(Frame->
Data, Data, Length > 8 ? 8 : Length);
120 static inline uint32_t
123 if (temu_canIsExtendedFrame(Frame)) {
124 uint32_t DataLen = (Frame->
Length > 8 ? 8 : Frame->
Length) * 8;
125 if (temu_canIsRemoteTransmissionRequest(Frame)) {
129 return 1 + 11 + 1 + 1 + 18 + 1 + 2 + 4 + 15 + 1 + 1 + 1 + 7 + DataLen;
132 uint32_t DataLen = (Frame->
Length > 8 ? 8 : Frame->
Length) * 8;
133 if (temu_canIsRemoteTransmissionRequest(Frame)) {
136 return 1 + 11 + 1 + 1 + 1 + 4 + 15 + 1 + 1 + 1 + 7 + DataLen;
150 #define TEMU_CAN_DEV_IFACE_TYPE "CanDevIface"
151 #define TEMU_CAN_BUS_IFACE_TYPE "CanBusIface"
163 void (*
connect)(
void *Bus, temu_CanDevIfaceRef Dev);
182 void (*
setFilter)(
void *Bus, temu_CanDevIfaceRef Dev,
int FilterID,
183 uint32_t Mask, uint32_t Code);
void(* connect)(void *Bus, temu_CanDevIfaceRef Dev)
void(* disconnected)(void *Dev)
#define TEMU_IFACE_REFERENCE_TYPE(N)
uint64_t LastReportSentBits
void(* reportStats)(void *Bus)
void(* connected)(void *Dev, temu_CanBusIfaceRef Bus)
void(* disableSendEvents)(void *Bus)
void(* send)(void *Bus, void *Sender, temu_CanFrame *Frame)
void(* receive)(void *Dev, temu_CanFrame *Frame)
void(* enableSendEvents)(void *Bus)
void(* disconnect)(void *Bus, temu_CanDevIfaceRef Dev)
void(* setFilter)(void *Bus, temu_CanDevIfaceRef Dev, int FilterID, uint32_t Mask, uint32_t Code)