SCOM Serial Communication Protocol
0.5.2
|
Service utilities. More...
Go to the source code of this file.
Functions | |
SCOMResult | SCOM_SendServiceFrame (SCOMDataLink scom, uint8_t framePriority, uint8_t serviceID, uint8_t primitiveID, const void *frameData, uint8_t frameDataSize) |
SCOMResult | SCOM_SendServiceMultiFrame (SCOMDataLink scom, uint8_t framePriority, uint8_t serviceID, uint8_t primitiveID, const void *frameData, uint32_t frameDataSize, SCOMMultiFrameDesc *multiFrameDesc) |
SCOMResult | SCOM_ServiceTransaction (SCOMDataLink scom, const uint8_t framePriority, const uint8_t serviceID, const uint8_t primitiveID, const void *const txData, const uint8_t txDataSize, void *rxData, const size_t rxDataSize) |
Service utilities.
Definition in file scom_service.h.
SCOMResult SCOM_SendServiceFrame | ( | SCOMDataLink | scom, |
uint8_t | framePriority, | ||
uint8_t | serviceID, | ||
uint8_t | primitiveID, | ||
const void * | frameData, | ||
uint8_t | frameDataSize | ||
) |
Schedules the service frame transmission. The frame is copied (along with all the data) to the internal SCOM buffer. If there is no activity on the hardware interface then the frame will be sent at the next call to SCOM_Proc. However if there are other frames (older or with higher priority) the frame will wait for it's turn. This function may be called asynchronously with other SCOM functions and from ISRs.
scom | SCOM handle |
framePriority | priority of a frame |
serviceID | service ID |
primitiveID | primitive ID |
frameData | data associated with the frame or NULL if there is no data |
frameDataSize | size of data to be associated with frame |
Definition at line 22 of file scom_service.c.
References SCOMFrameQueueItem::frame, SCOMDataLinkDesc::frameBuffer, HAL_PACKED::payload, SCOM_ERROR, SCOM_FRAME_TX_READY_FOR_SEND, SCOM_RESULT_OK, SCOM_SOF_CHARACTER, SCOM_TX_FRAME_BUFFER_OVERRUN, SCOMFrame_SetPriority(), SCOMFrameQueue_Insert(), SCOMFrameQueue_Lock(), HAL_PACKED::serviceframe, HAL_PACKED::sof, SCOMFrameQueueItem::state, and SCOMFrameBuffer::txFrameQueue.
Referenced by SCOM_ServiceTransaction().
SCOMResult SCOM_SendServiceMultiFrame | ( | SCOMDataLink | scom, |
uint8_t | framePriority, | ||
uint8_t | serviceID, | ||
uint8_t | primitiveID, | ||
const void * | frameData, | ||
uint32_t | frameDataSize, | ||
SCOMMultiFrameDesc * | multiFrameDesc | ||
) |
Schedules sending of another part of multi-frame service packet. The resulting frame is copied (along with all the data) to the internal SCOM buffer, just like in the case of a standard SCOM frame.
scom | SCOM handle |
framePriority | priority of a frame |
serviceID | service ID |
primitiveID | primitive ID |
frameData | data associated with the frame or NULL if there is no data |
frameDataSize | total size of data to send in multi-frame packet |
multiFrameDesc | pointer to a SCOMMultiFrameDesc structure where the information about multi-frame sending progress will be stored - used to enable iterative sending of multi-frames. |
Definition at line 59 of file scom_service.c.
References HAL_PACKED::ctrl, SCOMFrameQueueItem::frame, SCOMDataLinkDesc::frameBuffer, SCOMMultiFrameDesc::multi_id, SCOMDataLinkDesc::multiCounter, HAL_PACKED::null, HAL_PACKED::payload, SCOMMultiFrameDesc::progress, SCOM_ERROR, SCOM_FRAME_CTRL_MULTI_ID_MASK, SCOM_FRAME_TX_READY_FOR_SEND, SCOM_RESULT_OK, SCOM_SOF_CHARACTER, SCOM_TX_FRAME_BUFFER_OVERRUN, SCOMFrame_SetPriority(), SCOMFrameQueue_Insert(), SCOMFrameQueue_Lock(), HAL_PACKED::servicemultiframe, HAL_PACKED::size, HAL_PACKED::sof, SCOMFrameQueueItem::state, SCOMFrameBuffer::txFrameQueue, and HAL_PACKED::type.
SCOMResult SCOM_ServiceTransaction | ( | SCOMDataLink | scom, |
const uint8_t | framePriority, | ||
const uint8_t | serviceID, | ||
const uint8_t | primitiveID, | ||
const void *const | txData, | ||
const uint8_t | txDataSize, | ||
void * | rxData, | ||
const size_t | rxDataSize | ||
) |
Schedules the service transaction - Sends frame using SCOM_SendServiceFrame, inits filter and waits for the response
scom | SCOM handle |
framePriority | priority of a frame |
serviceID | service ID |
primitiveID | primitive ID |
txData | data associated with the transmitted frame or NULL if there is no data |
txDataSize | size of data to be associated with the transmitted frame |
rxData | data pointer to memory address of the data to be received or NULL if there is no data |
rxDataSize | size of data to be received |
SCOM_RESULT_OK | if the frame was scheduled successfully |
SCOM_TX_FRAME_BUFFER_OVERRUN | if there is no more free space to buffer the frame |
SCOM_FILTER_TIMEOUT | if the message was sent but encountered a timeout on reception |
Definition at line 143 of file scom_service.c.
References SCOMServiceMatchFilter::filter, SCOM_DeinitializeServiceMatchFilter(), SCOM_ERROR, SCOM_InitializeServiceMatchFilter(), SCOM_InsertFilter(), SCOM_RemoveFilter(), SCOM_RESULT_OK, SCOM_SendServiceFrame(), SCOM_SetupServiceMatchFilter(), and SCOM_WaitForServiceFilter().