Synergy Software Package User's Manual

Driver for the Data Operation Circuit (DOC). More...

Data Structures

struct  doc_instance_ctrl_t
 

Functions

ssp_err_t R_DOC_Open (doc_ctrl_t *const p_api_ctrl, doc_cfg_t const *const p_cfg)
 Configure the Data Operation Circuit (DOC) in comparison, addition or subtraction mode. Implements doc_api_t::open. More...
 
ssp_err_t R_DOC_Close (doc_ctrl_t *const p_api_ctrl)
 Close the module driver. Enable module stop mode. Implements doc_api_t::close. More...
 
ssp_err_t R_DOC_StatusGet (doc_ctrl_t *const p_api_ctrl, doc_status_t *p_status)
 Return the comparison/addition/subtraction status. Implements doc_api_t::statusGet. More...
 
ssp_err_t R_DOC_StatusClear (doc_ctrl_t *const p_api_ctrl)
 Clear the DOPCF status flag at the hardware layer. This flag indicates the result of a DOC operation. Implements doc_api_t::statusClear. More...
 
ssp_err_t R_DOC_Write (doc_ctrl_t *const p_api_ctrl, doc_data_t *const p_data)
 Write to the DODIR and DODSR registers. Implements doc_api_t::write,. More...
 
ssp_err_t R_DOC_InputRegisterWrite (doc_ctrl_t *const p_api_ctrl, doc_size_t data)
 Write to the DODIR register. Implements doc_api_t::inputRegisterWrite,. More...
 
ssp_err_t R_DOC_VersionGet (ssp_version_t *const p_version)
 Return DOC HAL driver version. Implements doc_api_t::versionGet. More...
 

Detailed Description

Driver for the Data Operation Circuit (DOC).

Summary

This module implements the DOC Interface using the Data Operation Circuit (DOC).

Function Documentation

◆ R_DOC_Close()

ssp_err_t R_DOC_Close ( doc_ctrl_t *const  p_api_ctrl)

Close the module driver. Enable module stop mode. Implements doc_api_t::close.

To close the DOC it must have been opened via the open API. When opened a control structure of type doc_ctrl_t is passed to the open API. The same control structure must be passed to the close API.

Return values
SSP_SUCCESSModule successfully closed.
SSP_ERR_NOT_OPENDriver not open.
SSP_ERR_ASSERTIONPointer pointing to NULL.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:
Note
This function is reentrant.
This function will disable the DOC interrupt in the NVIC.

Validate the parameter and check if the module is initialized

Disable the IRQ in the NVIC in case it has been left enabled.

Clear DOPCF in DOCR

Mark driver as closed.

Unlock the DOC Hardware Resource

◆ R_DOC_InputRegisterWrite()

ssp_err_t R_DOC_InputRegisterWrite ( doc_ctrl_t *const  p_api_ctrl,
doc_size_t  data 
)

Write to the DODIR register. Implements doc_api_t::inputRegisterWrite,.

Writes to the DODIR register only.

Return values
SSP_SUCCESSValue successfully written to the DODIR register.
SSP_ERR_NOT_OPENDriver not open.
SSP_ERR_ASSERTIONOne or more pointers point to NULL.
Note
This function is reentrant.

Validate the parameter and check if the module is intialized

Writes the user supplied data to the DODIR register for data operation in Comparison, Addition and subtraction modes

◆ R_DOC_Open()

ssp_err_t R_DOC_Open ( doc_ctrl_t *const  p_api_ctrl,
doc_cfg_t const *const  p_cfg 
)

Configure the Data Operation Circuit (DOC) in comparison, addition or subtraction mode. Implements doc_api_t::open.

If callback is not NULL in the configuration structure the DOC IRQ will be enabled.

Return values
SSP_SUCCESSDOC successfully configured.
SSP_ERR_IN_USEModule already open.
SSP_ERR_ASSERTIONOne or more pointers point to NULL.
SSP_ERR_INVALID_ARGUMENTISR is not enabled. Enable the ISR in bsp_irq_cfg.h.
SSP_ERR_HW_LOCKEDDOC resource is locked.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:
Note
This function is reentrant.

Validate the parameters and check if the module is initialized

Make sure the DOC exists on this part.

Lock the DOC Hardware Resource

Configure the DOC via DOCR register.

If callback parameter is not NULL configure the IRQ

Mark driver as open by initializing it to "DOCO" in its ASCII equivalent.

◆ R_DOC_StatusClear()

ssp_err_t R_DOC_StatusClear ( doc_ctrl_t *const  p_api_ctrl)

Clear the DOPCF status flag at the hardware layer. This flag indicates the result of a DOC operation. Implements doc_api_t::statusClear.

Return values
SSP_SUCCESSInterrupt successfully cleared.
SSP_ERR_NOT_OPENDriver not open.
SSP_ERR_ASSERTIONPointer pointing to NULL.
Note
This function is reentrant.

Validate the parameter and check if the module is initialized

Clear the hardware status flag

◆ R_DOC_StatusGet()

ssp_err_t R_DOC_StatusGet ( doc_ctrl_t *const  p_api_ctrl,
doc_status_t p_status 
)

Return the comparison/addition/subtraction status. Implements doc_api_t::statusGet.

The status is read from the Data Operation Circuit Flag (DOPCF).

Return values
SSP_SUCCESSStatus successfully read.
SSP_ERR_NOT_OPENDriver not open.
SSP_ERR_ASSERTIONOne or more pointers point to NULL.
Note
This function is reentrant.

Validate the parameters and check if the module is intialized

Read the comparison or addition or subtraction status from the register and store in the user supplied location

◆ R_DOC_VersionGet()

ssp_err_t R_DOC_VersionGet ( ssp_version_t *const  p_version)

Return DOC HAL driver version. Implements doc_api_t::versionGet.

Return values
SSP_SUCCESSVersion information successfully read.
SSP_ERR_ASSERTIONPointer pointing to NULL.
Note
This function is reentrant.

Validate the parameter

Store the version id from version data structure to the user supplied location

◆ R_DOC_Write()

ssp_err_t R_DOC_Write ( doc_ctrl_t *const  p_api_ctrl,
doc_data_t *const  p_data 
)

Write to the DODIR and DODSR registers. Implements doc_api_t::write,.

In comparison mode the 16-bit reference data is written to the DODSR register and the data for the comparison written to the DODIR. In addition mode the initial data is written to the DODSR and the data to be added to the DODIR. In subtraction mode the initial data is written to the DODSR and the data to be subtracted to the DODIR.

When changing both the DODSR and DODIR the DODSR should be updated first.

Return values
SSP_SUCCESSValues successfully written to the registers.
SSP_ERR_NOT_OPENDriver not open.
SSP_ERR_ASSERTIONOne or more pointers point to NULL.
Note
This function is reentrant.

Validate the parameters and check if the module is initialized

Writes the user supplied data to the DODIR(DOC Data Input Register) and DODSR(DOC Data Setting Register) registers