RA Flexible Software Package Documentation
Release v5.6.0
|
|
Functions | |
fsp_err_t | R_DOC_Open (doc_ctrl_t *const p_api_ctrl, doc_cfg_t const *const p_cfg) |
fsp_err_t | R_DOC_Close (doc_ctrl_t *const p_api_ctrl) |
fsp_err_t | R_DOC_Read (doc_ctrl_t *const p_api_ctrl, uint32_t *p_result) |
fsp_err_t | R_DOC_Write (doc_ctrl_t *const p_api_ctrl, uint32_t data) |
fsp_err_t | R_DOC_CallbackSet (doc_ctrl_t *const p_api_ctrl, void(*p_callback)(doc_callback_args_t *), void const *const p_context, doc_callback_args_t *const p_callback_memory) |
Driver for the DOC peripheral on RA MCUs. This module implements the DOC Interface.
The DOC HAL module peripheral is used to compare, add or subtract 16-bit or 32-bit1 data and can detect the following events:
A user-defined callback can be created to inform the CPU when any of above events occur.
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | Name must be a valid C symbol | g_doc0 | Module name. |
Event | MCU Specific Options | Select the event that will trigger the DOC interrupt. | |
Bit Width | MCU Specific Options | The bit width for DOC operations. | |
Reference/Initial Data | Value must be an integer greater than or equal to 0. | 0 | Enter Initial Value for Addition/Subtraction or enter reference value for comparison. |
Additional Reference Data | Value must be an integer greater than or equal to 0. | 0 | Additional reference data used for Window Compare modes. |
Callback | Name must be a valid C symbol | NULL | A user callback function must be provided. This will be called from the interrupt service routine (ISR) when the configured DOC event occurs. |
DOC Interrupt Priority | MCU Specific Options | Select the DOC interrupt priority. |
The DOC HAL module does not require a specific clock configuration.
The DOC HAL module does not require and specific pin configurations.
DOC can be used with Transfer (r_dmac) or Transfer (r_dtc) to write to the input register without CPU intervention. DMAC is more useful for most DOC applications because it can be started directly from software. To write DOC input data with DTC/DMAC, set transfer_info_t::p_dest to R_DOC->DODIR.
This is a basic example of minimal use of the R_DOC in an application. This example shows how this driver can be used for continuous 16 bit addition operation while reading the result at every overflow event.
fsp_err_t R_DOC_Open | ( | doc_ctrl_t *const | p_api_ctrl, |
doc_cfg_t const *const | p_cfg | ||
) |
Opens and configures the Data Operation Circuit (DOC) in comparison, addition or subtraction mode and sets initial data for addition or subtraction, or reference data for comparison.
Example:
FSP_SUCCESS | DOC successfully configured. |
FSP_ERR_ALREADY_OPEN | Module already open. |
FSP_ERR_ASSERTION | One or more pointers point to NULL or callback is NULL or the interrupt vector is invalid. |
fsp_err_t R_DOC_Close | ( | doc_ctrl_t *const | p_api_ctrl | ) |
Closes the module driver. Enables module stop mode.
FSP_SUCCESS | Module successfully closed. |
FSP_ERR_NOT_OPEN | Driver not open. |
FSP_ERR_ASSERTION | Pointer pointing to NULL. |
fsp_err_t R_DOC_Read | ( | doc_ctrl_t *const | p_api_ctrl, |
uint32_t * | p_result | ||
) |
Returns the result of addition/subtraction.
Example:
FSP_SUCCESS | Status successfully read. |
FSP_ERR_NOT_OPEN | Driver not open. |
FSP_ERR_ASSERTION | One or more pointers point to NULL. |
fsp_err_t R_DOC_Write | ( | doc_ctrl_t *const | p_api_ctrl, |
uint32_t | data | ||
) |
Writes to the DODIR - DOC Input Register.
Example:
FSP_SUCCESS | Values successfully written to the registers. |
FSP_ERR_NOT_OPEN | Driver not open. |
FSP_ERR_ASSERTION | One or more pointers point to NULL. |
fsp_err_t R_DOC_CallbackSet | ( | doc_ctrl_t *const | p_api_ctrl, |
void(*)(doc_callback_args_t *) | p_callback, | ||
void const *const | p_context, | ||
doc_callback_args_t *const | p_callback_memory | ||
) |
Updates the user callback and has option of providing memory for callback structure. Implements doc_api_t::callbackSet
FSP_SUCCESS | Callback updated successfully. |
FSP_ERR_ASSERTION | A required pointer is NULL. |
FSP_ERR_NOT_OPEN | The control block has not been opened. |
FSP_ERR_NO_CALLBACK_MEMORY | p_callback is non-secure and p_callback_memory is either secure or NULL. |