10 #define HAL_LOG_CHANNEL SCOM
18 #ifndef SCOM_MAX_FRAME_REPEAT
19 #define SCOM_MAX_FRAME_REPEAT 2
23 #ifndef SCOM_ACCESS_GUARD_TIMEOUT
25 #define SCOM_ACCESS_GUARD_TIMEOUT 5000
37 static uint32_t SCOM_GetDeltaTime(
const uint32_t t1,
const uint32_t t2);
121 static void SCOM_ProcessReceivedFrame(
SCOMDataLink scom);
147 #ifndef SCOM_DO_NOT_USE_HEAP
162 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
163 #ifndef SCOM_DO_NOT_USE_HEAP
175 #ifndef SCOM_DO_NOT_USE_HEAP
182 } SCOMFrameQueuePrivate;
185 SCOMFrameQueuePrivate *rxQueuePool;
186 SCOMFrameQueuePrivate *txQueuePool;
192 uint8_t *allocatedDataPtr = (uint8_t*)HEAP_Alloc(rxBuffSizeToAlloc + txBuffSizeToAlloc + frameBuffSizeToAlloc);
196 allocatedDataPtr += frameBuffSizeToAlloc;
198 rxQueuePool = (SCOMFrameQueuePrivate*)&frameBuffer->
rxFrameQueue;
200 rxQueuePool->size = rxBuffSize;
202 allocatedDataPtr += rxBuffSizeToAlloc;
204 txQueuePool = (SCOMFrameQueuePrivate*)&frameBuffer->
txFrameQueue;
206 txQueuePool->size = txBuffSize;
219 HAL_ASSERT_AND_EXECUTE(frameBuffer != NULL) {
220 #ifndef SCOM_DO_NOT_USE_HEAP
221 HEAP_Free(frameBuffer);
232 uint32_t deviceClass, uint8_t* deviceUID,
233 uint8_t numberOfServices, uint8_t* serviceIDs
236 #if defined SCOM_MAX_SERVICES && (SCOM_MAX_SERVICES > 0)
239 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
240 HAL_ASSERT_AND_EXECUTE(iodevice != NULL) {
241 HAL_ASSERT_AND_EXECUTE(frameBuffer != NULL) {
242 HAL_ASSERT_AND_EXECUTE(clockSource != NULL) {
286 #if defined SCOM_MAX_SERVICES && (SCOM_MAX_SERVICES > 0)
288 if ((numberOfServices) && (serviceIDs)) {
293 memcpy(scom->
id.serviceID, serviceIDs, numberOfServices);
295 for (serviceIndex = 0; serviceIndex < numberOfServices; serviceIndex++) {
296 scom->serviceHandler[serviceIndex].serviceID = serviceIDs[serviceIndex];
297 scom->serviceHandler[serviceIndex].handler = NULL;
318 #if SCOM_MAX_FRAME_FILTERS > 0
323 #if 1 == HAL_ENABLE_OS
344 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
349 #if 1 == HAL_ENABLE_OS
364 SCOMResult result =
SCOM_Init(scom, iodevice, frameBuffer, clockSource, ackTimeout, 0, NULL, 0, NULL);
376 static int SCOM_ProcThread(
void* param) {
378 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
379 while (
true == OSTASK_IsAlive()) {
404 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
405 #if 1 == HAL_ENABLE_OS
407 scom->
procTask = OSTASK_Create(SCOM_ProcThread, HAL_OSTASK_JOINABLE | HAL_OSTASK_MORTAL, HAL_OSTASK_PRIORITY_NORMAL, 0, scom);
408 if(
true == OSTASK_IsValid(scom->
procTask)) {
421 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
422 #if defined HAL_ENABLE_OS && (HAL_ENABLE_OS == 1)
426 if (!OSTASK_Join(scom->
procTask, 10000, NULL)) {
427 HAL_LOG_ERROR(
"Unable to stop SCOM processing thread");
438 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
439 HAL_ASSERT_AND_EXECUTE(checkPeriod > 0) {
451 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
462 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
463 #if 1 == HAL_ENABLE_OS
483 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
494 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
495 HAL_ASSERT_AND_EXECUTE(scom->
frameBuffer != NULL) {
496 HAL_ASSERT_AND_EXECUTE((frameData != NULL && frameDataSize > 0) || (NULL == frameData && 0 == frameDataSize)) {
498 if (frameQueueItem != NULL) {
502 frame->
type = frameType;
507 frame->
size = frameDataSize;
508 if(frameDataSize > 0){
535 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
536 HAL_ASSERT_AND_EXECUTE(scom->
frameBuffer != NULL) {
541 if (frameQueueItem) {
542 frame = &frameQueueItem->
frame;
545 frame->
type = frameType;
552 frame->
size = frameDataSize;
581 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
582 HAL_ASSERT_AND_EXECUTE(scom->
frameBuffer != NULL) {
583 HAL_ASSERT_AND_EXECUTE(multiFrameDesc != NULL) {
587 if (frameQueueItem) {
588 frame = &frameQueueItem->
frame;
591 frame->
type = frameType;
599 if (0 == multiFrameDesc->
multi_id) {
615 if ((frameData) && (frameDataSize)) {
617 uint32_t size = frameDataSize - multiFrameDesc->
progress;
618 if (size > SCOMFrame_GetMaxMultiframePayloadSize()) {
619 size = SCOMFrame_GetMaxMultiframePayloadSize();
622 frame->
size = (uint8_t)size;
655 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
656 HAL_ASSERT_AND_EXECUTE(frame != NULL) {
657 HAL_ASSERT_AND_EXECUTE(scom->
frameBuffer != NULL) {
658 HAL_ASSERT_AND_EXECUTE(multiFrameDesc != NULL) {
661 if (frameQueueItem) {
667 if (0 == multiFrameDesc->
multi_id) {
709 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
710 HAL_ASSERT_AND_EXECUTE(scom->
frameBuffer != NULL) {
711 HAL_ASSERT_AND_EXECUTE(framePtr != NULL) {
716 if (frameQueueItem) {
717 *framePtr = &frameQueueItem->
frame;
740 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
741 HAL_ASSERT_AND_EXECUTE(frame != NULL) {
742 HAL_ASSERT_AND_EXECUTE(scom->
frameBuffer != NULL) {
745 if (frameQueueItem) {
771 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
772 HAL_ASSERT_AND_EXECUTE(frame != NULL) {
773 HAL_ASSERT_AND_EXECUTE(scom->
frameBuffer != NULL) {
776 if (frameQueueItem) {
803 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
804 #if 1 == HAL_ENABLE_OS
823 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
824 #if 1 == HAL_ENABLE_OS
842 #if SCOM_MAX_SERVICES > 0
844 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
846 if (scom->serviceHandler[i].serviceID == serviceID) {
847 scom->serviceHandler[i].handler = serviceHandlerFunc;
864 uint32_t current_time;
865 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
867 #if defined HAL_ENABLE_OS && (HAL_ENABLE_OS == 1)
876 if(IODEV_Read(scom->
iodevice, &byte, 1, 0) >= 1){
895 switch(SCOM_ReceiveACK(scom)){
902 HAL_LOG_INFO(
"Received valid ACK");
906 HAL_LOG_WARNING(
"Received weird ACK, type: %" PRIu8, scom->
rxAck.
frame.
type);
923 switch(SCOM_ReceiveFrame(scom)){
936 SCOM_ProcessReceivedFrame(scom);
947 HAL_LOG_ERROR(
"Error in receiving frame");
1007 SCOM_ConnectivityCheck(scom);
1010 SCOM_ReceiverTimeOutCheck(scom);
1022 #if defined HAL_ENABLE_OS && (HAL_ENABLE_OS == 1)
1069 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
1070 HAL_ASSERT_AND_EXECUTE(scom->
frameBuffer != NULL) {
1073 if (frameQueueItem) {
1074 return &frameQueueItem->
frame;
1090 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
1091 HAL_ASSERT_AND_EXECUTE(scom->
frameBuffer != NULL) {
1094 if (frameQueueItem) {
1111 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
1112 #if 1 == HAL_ENABLE_OS
1116 result = scom->
stats;
1118 #if 1 == HAL_ENABLE_OS
1132 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
1133 #if 1 == HAL_ENABLE_OS
1139 #if 1 == HAL_ENABLE_OS
1150 static uint32_t SCOM_GetDeltaTime(
const uint32_t t1,
const uint32_t t2) {
1151 return (t1 >= t2) ? (t1 - t2) : (UINT32_MAX - t2 + t1);
1159 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
1164 HAL_LOG_INFO(
"Connectivity check (PING) scheduled");
1169 HAL_LOG_ERROR(
"Unable to send PING. SCOMResult: %d", result);
1181 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
1194 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
1209 if(frameQueueItem != NULL) {
1212 HAL_LOG_INFO(
"Starting sending [type=%" PRIu8
", prio=%" PRIu8
", size=%" PRIu8
"]", frame->
type,
SCOMFrame_GetPriority(frame), frame->
size);
1219 SCOM_WriteFrameToIODevice(scom, frameQueueItem);
1231 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
1232 HAL_ASSERT_AND_EXECUTE(frameQueueItem != NULL) {
1237 HAL_LOG_WARNING(
"Retransmission of [type=%" PRIu8
", prio=%" PRIu8
", size=%" PRIu8
"]", (&(frameQueueItem->
frame))->type,
SCOMFrame_GetPriority(&frameQueueItem->
frame), (&(frameQueueItem->
frame))->size);
1240 SCOM_WriteFrameToIODevice(scom, frameQueueItem);
1270 const size_t firstPartSize =
sizeof(frameQueueItem->
frame.
sync) +
sizeof(frameQueueItem->
frame.
sof) + SCOMFrame_GetPacketControlSize() -
sizeof(frameQueueItem->
frame.
crc);
1274 IODEV_Write(scom->
iodevice, &frameQueueItem->
frame, firstPartSize, 0);
1288 size_t available_bytes;
1293 HAL_LOG_INFO(
"SCOMFrameQueue_Lock failed in SCOM_ReceiveFrame");
1301 available_bytes = IODEV_GetReadCount(scom->
iodevice);
1306 const uint8_t packetControlSize = SCOMFrame_GetPacketControlSize();
1308 if (available_bytes >= packetControlSize) {
1309 #if true == SCOM_RECEIVED_FRAME_TIMESTAMP
1313 IODEV_Read(scom->
iodevice, &frame->
ctrl, packetControlSize -
sizeof(frame->
crc), 0);
1316 available_bytes -= packetControlSize;
1319 #if defined SCOM_RECEPTION_TIMEOUT_AFTER_FRAME_START
1329 uint8_t size_to_read;
1333 size_to_read = frame->
size;
1336 if(available_bytes >= size_to_read) {
1344 #if defined SCOM_HANDICAP && (SCOM_HANDICAP > 0)
1345 static int handicap_count = 0;
1348 if (handicap_count >= SCOM_HANDICAP) {
1352 HAL_LOG_INFO(
"Frame discarded by implicit handicap [type=%" PRIu8
", prio=%" PRIu8
", size=%" PRIu8
"]", frame->
type,
SCOMFrame_GetPriority(frame), frame->
size);
1364 HAL_LOG_INFO(
"Frame discarded due to CRC mismatch [type=%" PRIu8
", prio=%" PRIu8
", size=%" PRIu8
"]", frame->
type,
SCOMFrame_GetPriority(frame), frame->
size);
1370 #if defined SCOM_RECEPTION_TIMEOUT_AFTER_FRAME_START
1372 if (SCOM_GetDeltaTime(scom->
clockSource(), scom->receptionStartTime) > SCOM_RECEPTION_TIMEOUT_AFTER_FRAME_START) {
1375 HAL_LOG_INFO(
"Frame discarded due to timeout after start of reception [type=%" PRIu8
", prio=%" PRIu8
", size=%" PRIu8
"]", frame->
type,
SCOMFrame_GetPriority(frame), frame->
size);
1392 #if SCOM_MAX_SERVICES > 0
1398 if (scom->serviceHandler[i].handler) {
1400 HAL_LOG_DEBUG(
"Found service frame handler for serviceID=%d. Executing.", scom->serviceHandler[i].serviceID);
1419 bool frameProcessed;
1431 HAL_LOG_WARNING(
"Frame retransmission detected [type=%" PRIu8
", prio=%" PRIu8
", size=%" PRIu8
"]", frame->
type,
SCOMFrame_GetPriority(frame), frame->
size);
1442 HAL_LOG_WARNING(
"Frame discarded [type=%" PRIu8
", prio=%" PRIu8
", size=%" PRIu8
"]", frame->
type,
SCOMFrame_GetPriority(frame), frame->
size);
1453 HAL_LOG_INFO(
"Multi-frame received [type=%" PRIu8
", prio=%" PRIu8
", size=%" PRIu8
", mid=%" PRIu32
", offs=%" PRIu32
", totl=%" PRIu32
"]", frame->
type,
SCOMFrame_GetPriority(frame), frame->
size, frame->
payload.
multiframe.multi_id, frame->
payload.
multiframe.offset, frame->
payload.
multiframe.total_size);
1458 frameProcessed =
true;
1463 switch (frame->
type) {
1471 HAL_LOG_WARNING(
"Unable to send PONG, result code=%d", tempResult);
1488 if (frame->
size == 0) {
1494 HAL_LOG_WARNING(
"Detected loopback connection");
1500 HAL_LOG_ERROR(
"Unable to send IDENTIFY confirmation, result code=%d", tempResult);
1502 HAL_LOG_INFO(
"IDENTIFY confirmation sent");
1507 frameProcessed =
false;
1511 frameProcessed =
false;
1516 if(frameProcessed ==
true){
1522 if (frameProcessed ==
false) {
1525 if (!SCOM_ProcessServiceFrame(scom)) {
1530 HAL_LOG_INFO(
"Frame was processed and stored in reception queue");
1532 HAL_LOG_INFO(
"Frame was processed and deleted");
1537 HAL_LOG_WARNING(
"Frame was processed but storing it in reception queue failed");
1543 HAL_LOG_WARNING(
"Reception handler is missing. Frame stored in reception queue");
1545 HAL_LOG_WARNING(
"Reception handler is missing. Storing frame in reception queue failed");
1563 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
1576 HAL_ASSERT_AND_EXECUTE(scom != NULL) {
1578 if (IODEV_GetReadCount(scom->
iodevice) >= ackSize) {
uint16_t SCOMAckFrame_CalculateCRC(const SCOMAckFrame *const ackFrame)
Definition of multiframe descriptor structure.
SCOMFrameQueue rxFrameQueue
descriptor of the frame queue used for receiving
uint8_t null
TODO: XOR from sof, ctrl, type, size.
SCOMConnectionState SCOM_GetConnectionState(const SCOMDataLinkDesc *const scom)
SCOMResult SCOM_SetFrameReceptionHandlerFunc(SCOMDataLinkDesc *const scom, SCOMFrameReceptionHandler frameReceptionFunc)
uint8_t sync
synchronization field: always 0xFF
Packet type definition: IDENTIFY.
bool SCOMFrame_IsAcknowledged(const SCOMFrame *const frame)
SCOMFrameQueue txFrameQueue
descriptor of the frame queue used for sending
struct HAL_PACKED SCOMAckFrame
Definition of an SCOM acknowledgment frame.
SCOMVersion version
SCOM version record.
SCOMResult SCOM_Deinit(SCOMDataLinkDesc *const scom)
uint32_t timeout
Clock source provider function.
SCOM Data Link descriptor.
Descriptor of the SCOM statistics.
#define SCOM_MAX_SERVICES
#define SCOM_ACCESS_GUARD_TIMEOUT
uint32_t progress
multiframe id
#define SCOM_FRAME_CTRL_FRAME_NUMBER_MASK
SCOMResult SCOM_SendMultiFrame(SCOMDataLink scom, uint8_t framePriority, uint8_t frameType, const void *frameData, uint32_t frameDataSize, SCOMMultiFrameDesc *multiFrameDesc)
SCOMResult SCOM_SendAllocatedFrameWithoutACK(SCOMDataLink scom, SCOMFrame *frame)
bool SCOMAckFrame_Initialize(SCOMAckFrame *const ackFrame, const SCOMFrame *const frame)
SCOMResult SCOM_SendFrame(SCOMDataLinkDesc *const scom, uint8_t framePriority, uint8_t frameType, const void *frameData, uint8_t frameDataSize)
void SCOM_DestroyFrameBuffer(SCOMFrameBuffer *const frameBuffer)
OSTask procTask
mutex guarding access to this object
#define SCOM_DEVICE_INFO_LEN
SCOMACKState txAck
Descriptor holding the received ACK.
uint32_t multiCounter
Counter increased after every frame scheduled to send.
bool SCOMFrame_SetPriority(SCOMFrame *const frame, const uint8_t priority)
uint32_t connectivityCheckIncommingCounter
Time at which last connectivity check was performed.
uint8_t deviceUID[16]
Device unique identifier.
Definition of a single SCOM frame queue item.
SCOMFrameQueueItem * SCOMFrameQueue_GetItemByFrame(const SCOMFrameQueue *frameQueue, const SCOMFrame *frame)
Start of frame character.
IODevice SCOM_GetIODevice(const SCOMDataLinkDesc *const scom)
Definition of SCOM CRC functions.
uint32_t retransmissionsReceived
Number of retransmissions detected when receiving frames.
bool SCOMFrame_SetAcknowledgement(SCOMFrame *const frame, const bool ack)
void(* SCOMAckReceptionHandler)(SCOMDataLink scom, uint8_t frame_type)
SCOMDataLinkDesc * SCOM_Create(void)
bool monitorMode
State of the SCOM receiver.
SCOMResult SCOM_AllocFrame(SCOMDataLink scom, SCOMFrame **framePtr)
uint32_t lastConnectivityCheckTime
Time period for checking connection status.
SCOMFrameBuffer * SCOM_CreateFrameBuffer(size_t rxBuffSize, size_t txBuffSize)
uint8_t type
frame type field
uint32_t received_timestamp
time stamp of received frame - value should be set as soon as possible
SCOMConnectionState
Possible SCOM connection states.
#define SCOM_FRAME_CTRL_MULTI_ID_MASK
#define SCOM_SOF_CHARACTER
uint8_t size
frame type field
SCOMClockSource clockSource
IODevice object implementing the hardware interface.
SCOMACKState rxAck
frame buffer - holds the queues used for sending and receiving SCOM frames
uint16_t lastFrameCrc
Number of the last received frame.
struct HAL_PACKED::@1::@3 multiframe
payload definition for a multi frame
bool SCOM_IsBusy(SCOMDataLink scom)
uint8_t soack
start of ACK frame field
SCOMFrameQueueItem * frameBeingTransmitted
Frame buffer item that is being used as a place for a currently receiving frame.
struct SCOMDataLinkDesc SCOMDataLinkDesc
SCOM Data Link descriptor.
SCOMResult SCOM_Proc(SCOMDataLink scom)
bool(* SCOMFrameReceptionHandler)(SCOMDataLink scom, SCOMFrame *frame)
bool SCOMFrameQueue_Delete(SCOMFrameQueue *frameQueue, SCOMFrameQueueItem *frame)
SCOMResult SCOM_EnableConnectivityCheck(SCOMDataLinkDesc *const scom, const uint32_t checkPeriod)
uint32_t retransmissionsSent
Number of retransmissions needed when sending frames.
uint32_t deviceClass
Device class.
bool SCOMAckFrame_IsValidAck(const SCOMAckFrame *const ackFrame, const SCOMFrame *const frame)
uint8_t retransmissionCounter
Frame buffer item that is currently being sent.
SCOMResult SCOM_InitAsMonitor(SCOMDataLink scom, IODevice iodevice, SCOMFrameBuffer *frameBuffer, SCOMClockSource clockSource, uint32_t ackTimeout)
bool(* receptionHandler)(struct SCOMDataLinkDesc *scom, SCOMFrame *frame)
Outgoing PING counter.
SCOMFrameQueueItem * frameBeingReceived
Descriptor holding the ACK to transmit.
uint32_t connectivityCheckOutgoingCounter
Incomming PING counter.
struct SCOMFrameQueueItem SCOMFrameQueueItem
Type representing a SCOM frame queue item.
uint8_t ctrl
frame control field
SCOMFrameState state
SCOM frame state.
SCOMResult SCOM_Init(SCOMDataLink scom, IODevice iodevice, SCOMFrameBuffer *frameBuffer, SCOMClockSource clockSource, uint32_t ackTimeout, uint32_t deviceClass, uint8_t *deviceUID, uint8_t numberOfServices, uint8_t *serviceIDs)
uint32_t txCounter
Received frame time.
bool SCOMFrameQueue_Init(SCOMFrameQueue *frameQueue)
SCOMFrameQueueItem * SCOMFrameQueue_Lock(SCOMFrameQueue *frameQueue)
SCOMFrameState state
ACK frame.
uint8_t SCOMFrame_GetPriority(const SCOMFrame *const frame)
uint32_t connectivityCheckPeriod
Counter increased after every first frame of a multi-frame is scheduled to send.
SCOMIdentity id
Packet timeout.
void SCOM_StopProcessingThread(SCOMDataLink scom)
Packet type definition: PING.
bool SCOMFrameQueue_Append(SCOMFrameQueue *frameQueue, SCOMFrameQueueItem *frame)
uint16_t SCOMFrame_CalculateCRC(const SCOMFrame *const frame)
uint16_t revision
protocol revision
uint8_t SCOMFrame_GetFrameNumber(const SCOMFrame *const frame)
SCOMResult SCOM_SendFrameWithoutAck(SCOMDataLink scom, uint8_t framePriority, uint8_t frameType, const void *frameData, uint8_t frameDataSize)
OSTime(* SCOMClockSource)(void)
uint32_t framesReceived
Number of frames that were received since the SCOM connection was opened. In case of multi-frames...
uint32_t framesSent
Number of frames that were sent since the SCOM connection was opened. In case of multi-frames, each sub-frame is counted.
Packet type definition: PONG.
void SCOM_UnlockFrame(SCOMDataLink scom, SCOMFrame *frame)
SCOMResult SCOM_DisableConnectivityCheck(SCOMDataLinkDesc *const scom)
uint8_t lastFrameNumber
Counter holding the number of retransmission for a frame that is being currently sent.
void(* ackHandler)(struct SCOMDataLinkDesc *scom, uint8_t frame_type)
Frame reception handler function.
SCOMStatistics SCOM_GetStatistics(const SCOMDataLinkDesc *const scom)
union HAL_PACKED::@1 payload
payload field
struct HAL_PACKED::@1::@2 singleframe
payload definition for a single frame
uint8_t verHi
version high number
uint32_t sendTime
CRC of the last received frame.
SCOMResult SCOM_SendAllocatedMultiFrame(SCOMDataLink scom, SCOMFrame *frame, SCOMMultiFrameDesc *multiFrameDesc)
uint8_t serviceCount
SCOM device identity.
bool SCOMFrame_IsMultiframe(const SCOMFrame *const frame)
void SCOM_ResetStatistics(SCOMDataLinkDesc *const scom)
uint32_t receptionTime
Transmitted frame send time.
uint8_t sof
synchronization field: always 0xFF
SCOMFrameQueueItem *const pool
Frame pool items.
bool SCOMFrame_SetFrameNumber(SCOMFrame *const frame, const uint8_t number)
void SCOMFrameQueue_Unlock(SCOMFrameQueue *frameQueue, SCOMFrameQueueItem *frameQueueItem)
OSMutex accessGuard
SCOM statistics.
void(* SCOMServiceHandler)(SCOMDataLinkDesc *scom, SCOMFrame *frame)
void SCOM_Destroy(SCOMDataLinkDesc *const scom)
SCOMFrame * SCOM_GetReceivedFrame(SCOMDataLink scom)
#define SCOM_MAX_FRAME_REPEAT
Maximum number of retransmissions, before communication error is raised.
SCOMFrameQueueItem * SCOMFrameQueue_GetFirstInQueue(SCOMFrameQueue *frameQueue)
SCOMResult SCOM_SendAllocatedFrame(SCOMDataLink scom, SCOMFrame *frame)
SCOMResult SCOM_RunProcessingThread(SCOMDataLinkDesc *const scom)
Definition of the frame buffer used by SCOM.
SCOMFrame frame
SCOM frame.
SCOMResult SCOM_SetAckReceptionHandlerFunc(SCOMDataLinkDesc *const scom, SCOMAckReceptionHandler ackReceptionFunc)
SCOMStatistics stats
ACK reception handler function (used only in monitor mode)
uint16_t SCOMFrame_GetTotalFrameSize(const SCOMFrame *const frame)
bool SCOMFrameQueue_Insert(SCOMFrameQueue *frameQueue, SCOMFrameQueueItem *frame)
uint8_t verLo
version low number
SCOMFrameBuffer * frameBuffer
monitor mode indication (when true - monitor mode is on, the device does not transmit anything...
SCOMReceiverState rxState
Overall state of the connection.
#define SCOM_MAX_FRAME_FILTERS
SCOMResult SCOM_SetServiceHandler(SCOMDataLink scom, uint8_t serviceID, SCOMServiceHandler serviceHandlerFunc)
void SCOMFrameQueue_Deinit(SCOMFrameQueue *frameQueue)
SCOMConnectionState connectionState
Number of services supported by this instance of SCOM.