RA Flexible Software Package Documentation
Release v5.6.0
|
|
Functions | |
fsp_err_t | R_PDC_Open (capture_ctrl_t *const p_ctrl, capture_cfg_t const *const p_cfg) |
Powers on PDC, handles required initialization described in the hardware manual. More... | |
fsp_err_t | R_PDC_Close (capture_ctrl_t *const p_ctrl) |
Stops and closes the transfer interface, disables and powers off the PDC, clears internal driver data and disables interrupts. More... | |
fsp_err_t | R_PDC_CaptureStart (capture_ctrl_t *const p_ctrl, uint8_t *const p_buffer) |
Starts a capture. Enables interrupts. More... | |
fsp_err_t | R_PDC_StatusGet (capture_ctrl_t *const p_ctrl, capture_status_t *p_status) |
fsp_err_t | R_PDC_CallbackSet (capture_ctrl_t *const p_ctrl, void(*p_callback)(capture_callback_args_t *), void const *const p_context, capture_callback_args_t *const p_callback_memory) |
Driver for the PDC peripheral on RA MCUs. This module implements the CAPTURE Interface.
The PDC peripheral supports interfacing with external cameras by accepting timing and data signals in order to capture incoming data. A callback is invoked every time a frame of data is accepted.
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Configuration | Options | Default | Description |
---|---|---|---|
General | |||
Name | Name must be a valid C symbol | g_pdc0 | Module name. |
Input | |||
Input > Signal polarity | |||
HSYNC |
| High | Specify the active polarity of the HSYNC signal. |
VSYNC |
| High | Specify the active polarity of the VSYNC signal. |
Input > Capture Specifications | |||
Number of pixels to capture horizontally | Value must be an integer greater than 0 | 640 | Specify the number of horizontal pixels to capture. |
Number of lines to capture vertically | Value must be an integer greater than 0 | 480 | Specify the number of vertical pixels to capture. |
Horizontal pixel to start capture from | Value must be an integer | 0 | Specify the horizontal pixel to start capturing image data from. Allows an image smaller than the native resolution of a camera to be captured. |
Line to start capture from | Value must be an integer | 0 | Specify the vertical line to start capturing image data from. Allows an image smaller than the native resolution of a camera to be captured. |
Bytes per pixel | Value must be an integer greater than 0 | 2 | Specify the number of bytes per pixel of the captured image data. |
Clock divider |
| CLK/2 | Specify the clock divider for clock frequency of the clock input PCKO to the PDC peripheral. |
Endianess |
| Little | Specify the endianness of the captured image data. |
Output | |||
Output > Buffer | |||
Number of image buffers | Value must be an integer greater than 0 | 1 | Specify the number of buffers to create. |
Interrupts | |||
Callback | Name must be a valid C symbol | g_pdc_user_callback | A user callback function must be provided. This callback is invoked for every successful frame capture and any error conditions |
PDC Interrupt Priority | MCU Specific Options | Select the PDC interrupt priority. | |
DTC Interrupt Priority | MCU Specific Options | Select the DTC interrupt priority. |
The PDC peripheral module uses the PCLKB as its clock source. The maximum clock to the camera module is PCLKB / 2.
The PCKO pin is a clock output and should be connected to the clock input of the camera. The PIXCLK pin is a clock input and should be connected to the output pixel clock of the camera. Likewise, the HSYNC and VSYNC pins must be connected to the horizontal and vertical sync signals of the camera, respectively. The PIXD0-PIXD7 pins are the 8-bit data bus input and should be connected to the relevant output pins of the camera.
This is a basic example of minimal use of the PDC in an application. This example shows how this driver can be used for capturing data from an external I/O device such as an image sensor.
Data Structures | |
struct | pdc_extended_cfg_t |
struct | pdc_instance_ctrl_t |
Enumerations | |
enum | pdc_event_t |
enum | pdc_clock_division_t |
enum | pdc_endian_t |
enum | pdc_hsync_polarity_t |
enum | pdc_vsync_polarity_t |
struct pdc_extended_cfg_t |
Extended configuration structure for PDC.
Data Fields | ||
---|---|---|
pdc_clock_division_t | clock_division | Clock divider. |
pdc_endian_t | endian | Endian of capture data. |
pdc_hsync_polarity_t | hsync_polarity | Polarity of HSYNC input. |
pdc_vsync_polarity_t | vsync_polarity | Polarity of VSYNC input. |
uint8_t | pdc_ipl | PDC interrupt priority. |
uint8_t | transfer_req_ipl | Transfer interrupt priority. |
IRQn_Type | pdc_irq | PDC IRQ number. |
IRQn_Type | transfer_req_irq | Transfer request IRQ number. |
transfer_instance_t const * | p_lower_lvl_transfer | Pointer to the transfer instance the PDC should use. |
struct pdc_instance_ctrl_t |
PDC instance control block. DO NOT INITIALIZE.
enum pdc_event_t |
PDC events
enum pdc_clock_division_t |
Clock divider applied to PDC clock to provide PCKO output frequency
enum pdc_endian_t |
enum pdc_hsync_polarity_t |
enum pdc_vsync_polarity_t |
fsp_err_t R_PDC_Open | ( | capture_ctrl_t *const | p_ctrl, |
capture_cfg_t const *const | p_cfg | ||
) |
Powers on PDC, handles required initialization described in the hardware manual.
Implements capture_api_t::open.
The Open function provides initial configuration for the PDC module. It powers on the module and enables the PCLKO output and the PIXCLK input. Further initialization requires the PIXCLK input to be running in order to be able to reset the PDC as part of its initialization. This clock is input from a camera module and so the reset and further initialization is performed in capture_api_t::captureStart. This function should be called once prior to calling any other PDC API functions. After the PDC is opened the Open function should not be called again without first calling the Close function.
Example:
FSP_SUCCESS | Initialization was successful. |
FSP_ERR_ASSERTION | One or more of the following parameters is NULL
|
FSP_ERR_INVALID_ARGUMENT | One or more of the following parameters is incorrect
|
FSP_ERR_ALREADY_OPEN | Module is already open. |
fsp_err_t R_PDC_Close | ( | capture_ctrl_t *const | p_ctrl | ) |
Stops and closes the transfer interface, disables and powers off the PDC, clears internal driver data and disables interrupts.
Implements capture_api_t::close.
FSP_SUCCESS | Successful close. |
FSP_ERR_ASSERTION | p_api_ctrl is NULL |
FSP_ERR_NOT_OPEN | Open has not been successfully called. |
fsp_err_t R_PDC_CaptureStart | ( | capture_ctrl_t *const | p_ctrl, |
uint8_t *const | p_buffer | ||
) |
Starts a capture. Enables interrupts.
Implements capture_api_t::captureStart.
Sets up the transfer interface to transfer data from the PDC into the specified buffer. Configures the PDC settings as previously set by the capture_api_t::open API. These settings are configured here as the PIXCLK input must be active for the PDC reset operation. When a capture is complete the callback registered during capture_api_t::open API call will be called.
Example:
FSP_SUCCESS | Capture start successful. |
FSP_ERR_ASSERTION | One or more of the following parameters is NULL
|
FSP_ERR_NOT_OPEN | Open has not been successfully called. |
FSP_ERR_IN_USE | PDC transfer is already in progress. |
FSP_ERR_TIMEOUT | Reset operation timed out. |
FSP_ERR_NOT_INITIALIZED | Callback function has not been set |
fsp_err_t R_PDC_StatusGet | ( | capture_ctrl_t *const | p_ctrl, |
capture_status_t * | p_status | ||
) |
Provides the pdc operating status.
Implements capture_api_t::statusGet.
FSP_SUCCESS | Initialization was successful. |
FSP_ERR_ASSERTION | One or more parameters is NULL. |
FSP_ERR_NOT_OPEN | Open has not been successfully called. |
fsp_err_t R_PDC_CallbackSet | ( | capture_ctrl_t *const | p_ctrl, |
void(*)(capture_callback_args_t *) | p_callback, | ||
void const *const | p_context, | ||
capture_callback_args_t *const | p_callback_memory | ||
) |
Updates the user callback and has option of providing memory for callback structure.
Implements capture_api_t::callbackSet.
FSP_ERR_UNSUPPORTED | This is just a stub at present |