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

Service filters. More...

#include "hal.h"
#include "scom_service_filter.h"
#include <string.h>

Go to the source code of this file.

Macros

#define HAL_LOG_CHANNEL   SCOM
 
#define HAL_LOG_SUBCHANNEL   SERVICE
 

Functions

SCOMResult SCOM_InitializeServiceMatchFilter (SCOMServiceMatchFilter *serviceMatchFilter, void *data, size_t max_data_size)
 
SCOMResult SCOM_DeinitializeServiceMatchFilter (SCOMServiceMatchFilter *serviceMatchFilter)
 
SCOMResult SCOM_SetupServiceMatchFilter (SCOMServiceMatchFilter *serviceMatchFilter, uint8_t serviceID, uint8_t primitiveID)
 
SCOMResult SCOM_WaitForServiceFilter (SCOMServiceMatchFilter *serviceMatchFilter, OSTime timeout)
 

Detailed Description

Service filters.

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

Definition in file scom_service_filter.c.

Macro Definition Documentation

#define HAL_LOG_CHANNEL   SCOM

Definition at line 9 of file scom_service_filter.c.

#define HAL_LOG_SUBCHANNEL   SERVICE

Definition at line 10 of file scom_service_filter.c.

Function Documentation

SCOMResult SCOM_DeinitializeServiceMatchFilter ( SCOMServiceMatchFilter serviceMatchFilter)

Deinitializes a service match filter.

Parameters
serviceMatchFilterpointer to the SCOMServiceMatchFilter structure, describing the filter
Return values
SCOM_RESULT_OK
SCOM_FILTER_ERRORif the filter not exist

Definition at line 142 of file scom_service_filter.c.

References SCOM_FILTER_ERROR, SCOM_RESULT_OK, and SCOMServiceMatchFilter::sem.

Referenced by SCOM_ServiceTransaction().

SCOMResult SCOM_InitializeServiceMatchFilter ( SCOMServiceMatchFilter serviceMatchFilter,
void *  data,
size_t  max_data_size 
)

Initializes a service match filter.

Parameters
serviceMatchFilterpointer to the SCOMServiceMatchFilter structure, describing the filter
datapointer to the buffer, where to store received data from the matching frame
max_data_sizecapacity of the buffer
Return values
SCOM_RESULT_OKwhen the filter is set up successfully
SCOM_FILTER_ERRORif the filter could not be initializes properly

Definition at line 121 of file scom_service_filter.c.

References SCOMServiceMatchFilter::data, SCOMServiceMatchFilter::filter, SCOMFilterDesc::filter_match_function, SCOMServiceMatchFilter::max_data_size, SCOMServiceMatchFilter::multi_id, SCOMServiceMatchFilter::offset, SCOM_FILTER_ERROR, SCOM_RESULT_OK, and SCOMServiceMatchFilter::sem.

Referenced by SCOM_ServiceTransaction().

SCOMResult SCOM_SetupServiceMatchFilter ( SCOMServiceMatchFilter serviceMatchFilter,
uint8_t  serviceID,
uint8_t  primitiveID 
)

Sets up a previously initialized service match filter.

Parameters
serviceMatchFilterpointer to the SCOMServiceMatchFilter structure, describing the filter
serviceIDservice ID to match
primitiveIDprimitive ID within given service to match
Return values
SCOM_RESULT_OKwhen the filter is set up successfully
SCOM_FILTER_ERRORif the filter could not be set up properly

Definition at line 155 of file scom_service_filter.c.

References SCOMServiceMatchFilter::primitiveID, SCOM_FILTER_ERROR, SCOM_RESULT_OK, SCOMServiceMatchFilter::sem, and SCOMServiceMatchFilter::serviceID.

Referenced by SCOM_ServiceTransaction().

SCOMResult SCOM_WaitForServiceFilter ( SCOMServiceMatchFilter serviceMatchFilter,
OSTime  timeout 
)

Performs a blocking call and waits for the specified filter to catch a matching frame. The blocking relies on the os_sem implementation.

Parameters
serviceMatchFilterpointer to the SCOMServiceMatchFilter structure, describing the filter
timeoutmaximum time to wait for the matching frame reception
Return values
SCOM_RESULT_OKwhen the filter caught the matching frame. The frame data is available in the serviceMatchFilter structure
SCOM_FILTER_TIMEOUTwhen the timeout was reached and the filter did not catch any matching frame
SCOM_FILTER_ERRORwhen the filter is invalid

Definition at line 174 of file scom_service_filter.c.

References SCOM_FILTER_ERROR, SCOM_FILTER_TIMEOUT, SCOM_RESULT_OK, and SCOMServiceMatchFilter::sem.

Referenced by SCOM_ServiceTransaction().