SCOM Serial Communication Protocol  0.5.2
Macros | Functions
scom_ack_frame.c File Reference

SCOMAckFrame definition. More...

#include "hal.h"
#include "scom_ack_frame.h"
#include "scom_crc.h"

Go to the source code of this file.

Macros

#define HAL_LOG_CHANNEL   SCOM
 
#define HAL_LOG_SUBCHANNEL   FRAME
 

Functions

bool SCOMAckFrame_Initialize (SCOMAckFrame *const ackFrame, const SCOMFrame *const frame)
 
bool SCOMAckFrame_IsValidAck (const SCOMAckFrame *const ackFrame, const SCOMFrame *const frame)
 
uint16_t SCOMAckFrame_CalculateCRC (const SCOMAckFrame *const ackFrame)
 

Detailed Description

SCOMAckFrame definition.

License: $License$
Version
Revision
426
Purpose: SCOM serial communication protocol

Definition in file scom_ack_frame.c.

Macro Definition Documentation

#define HAL_LOG_CHANNEL   SCOM

Definition at line 10 of file scom_ack_frame.c.

#define HAL_LOG_SUBCHANNEL   FRAME

Definition at line 11 of file scom_ack_frame.c.

Function Documentation

uint16_t SCOMAckFrame_CalculateCRC ( const SCOMAckFrame *const  ackFrame)

Calculates CRC for the given acknowledgement frame.

Parameters
[in]ackFrameacknowledgement frame
Returns
calculated CRC (0xffff is returned if NULL frame was passed)

Definition at line 54 of file scom_ack_frame.c.

References HAL_PACKED::crc, CRC16_InitCRC, CRC16_UpdateCRC_Byte, HAL_PACKED::soack, and HAL_PACKED::sync.

Referenced by SCOM_Proc().

bool SCOMAckFrame_Initialize ( SCOMAckFrame *const  ackFrame,
const SCOMFrame *const  frame 
)

Initializes an acknowledgement frame.

Parameters
[in,out]ackFrameacknowledgement frame
[in]frameSCOMFrame to acknowledge
Returns

Definition at line 20 of file scom_ack_frame.c.

References HAL_PACKED::crc, HAL_PACKED::ctrl, HAL_PACKED::sync, and HAL_PACKED::type.

Referenced by SCOM_Proc().

bool SCOMAckFrame_IsValidAck ( const SCOMAckFrame *const  ackFrame,
const SCOMFrame *const  frame 
)

Checks if a given acknowledgement frame matches the given SCOM frame.

Parameters
[in]ackFrameacknowledgement frame
[in]frameSCOMFrame
Return values
trueif ACK matches SCOM frame
falseif ACK does not matches the SCOM frame or other error occurred

Definition at line 39 of file scom_ack_frame.c.

References HAL_PACKED::crc, HAL_PACKED::ctrl, HAL_PACKED::frame_crc, SCOM_FRAME_CTRL_FRAME_NUMBER_MASK, and HAL_PACKED::type.

Referenced by SCOM_Proc().