RZT Flexible Software Package Documentation
Release v2.2.0
|
|
Functions | |
fsp_err_t | R_DOC_Open (doc_ctrl_t *const p_ctrl, doc_cfg_t const *const p_cfg) |
fsp_err_t | R_DOC_Close (doc_ctrl_t *const p_ctrl) |
fsp_err_t | R_DOC_Read (doc_ctrl_t *const p_ctrl, uint32_t *p_result) |
fsp_err_t | R_DOC_Write (doc_ctrl_t *const p_ctrl, uint32_t data) |
fsp_err_t | R_DOC_CallbackSet (doc_ctrl_t *const p_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 RZ microprocessor. This module implements the DOC Interface.
The DOC HAL module peripheral is used to compare, add or subtract 16-bit 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. |
Multiplex Interrupt |
| Disabled | Enable multiplex interrupt for a single driver. |
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 a 16 bit integer between 0 and 65535 | 0 | Enter Initial Value for Addition/Subtraction or enter reference value for comparison. |
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. |
The DOC HAL module does not require a specific clock configuration.
The DOC HAL module does not require and specific pin configurations.
The DOC outputs an error signal to the ICU. ICU can output PERI_ERRn interrupt (Peripherals error event n) to GIC or cause error reset when ICU accepts error signal from DOC. To use PERI_ERRn interrupt or reset at DOC, Interrupt Controller Unit (ICU) ERROR (r_icu_error) need to be configured. When the PERI_ERRn interrupt is configured to use interrupt and triggered, the callback function registered during open is called.
DOC can be used with Direct Memory Access Controller (r_dmac) 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 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_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.
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_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_ctrl, |
uint32_t * | p_result | ||
) |
Returns the result of addition/subtraction.
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_ctrl, |
uint32_t | data | ||
) |
Writes to the DODIR - DOC Input Register.
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_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. |