![]() |
RA Flexible Software Package Documentation
Release v6.3.1
|
|
Functions | |
| fsp_err_t | R_CEU_Open (capture_ctrl_t *const p_ctrl, capture_cfg_t const *const p_cfg) |
| fsp_err_t | R_CEU_Close (capture_ctrl_t *const p_ctrl) |
| fsp_err_t | R_CEU_CaptureStart (capture_ctrl_t *const p_ctrl, uint8_t *const p_buffer) |
| fsp_err_t | R_CEU_CallbackSet (capture_ctrl_t *const p_ctrl, void(*p_callback)(capture_callback_args_t *), void *const p_context, capture_callback_args_t *const p_callback_memory) |
| fsp_err_t | R_CEU_StatusGet (capture_ctrl_t *const p_ctrl, capture_status_t *p_status) |
Driver for the CEU peripheral on RA MCUs. This module implements the CAPTURE Interface.
The CEU peripheral supports interfacing with external cameras by accepting timing and data signals in order to capture incoming data. A callback is invoked for each V-Sync event, frame of data accepted, or when certain errors occur.
| 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_ceu0 | Module name. |
| Input | |||
| Input > Data Bus Specifications | |||
| Data Bus Size | MCU Specific Options | Data bus-width of CEU physical connection. | |
| HSYNC Polarity |
| High | Specify the active polarity of the HSYNC signal. |
| VSYNC Polarity |
| High | Specify the active polarity of the VSYNC signal. |
| Input > Capture Specifications | |||
| Input > Capture Specifications > Sample Points | |||
| Data Sample Point |
| Rising edge of the camera clock | Specify the external camera clock transition state for fetching the image data (D15 to D0) from the external module. |
| H-Sync Sample Point |
| Rising edge of the camera clock | Specify the external camera clock transition state for capturing H-Sync from the external module. |
| V-Sync Sample Point |
| Rising edge of the camera clock | Specify the external camera clock transition state for capturing V-Sync from the external module. |
| Horizontal capture resolution | Value must be an integer. | 640 | Specify the number of horizontal pixels to capture. |
| Vertical capture resolution | Value must be an integer. | 480 | Specify the number of vertical pixels to capture. |
| Horizontal pixel offset | Value must be an integer. | 0 | Number of pixels from H-sync signal up to the start of a valid data period. |
| Vertical pixel offset | Value must be an integer. | 0 | Specify the vertical line to start capturing image data. |
| Capture Mode |
| Data Synchronous Fetch | Capture mode of incoming data. |
| Image Component Input Order (Image Capture Mode Only) |
| Cb0, Y0, Cr0, Y1 | Set the input order of the luminance component and chrominance component (Image Capture Mode only). This setting must match your camera's output format. |
| Output | |||
| Output > Format | |||
| Conversion |
| YCbCr422 (No Conversion) | Set the output format for captured CEU data. This setting is applicable in Image Capture Mode only. |
| Output > Scale-Down | |||
| Horizontal Size | Value must be an integer. | 0 | Specify the scaled down output image horizontal size (pixels). This setting is applicable in Image Capture Mode only. If set to 0, horizontal scale-down is disabled. |
| Vertical Size | Value must be an integer. | 0 | Specify the scaled down output image vertical size (lines). This setting is applicable in Image Capture Mode only. If set to 0, vertical scale-down is disabled. |
| Output > Buffer | |||
| Data Enable Buffer Size | Value must be a positive integer. | 0 | Specify size of image region available for use by CEU data bus. (Only applicable to Data Enable Fetch capture mode) |
| Byte Swapping |
| Byte swapping configuration. Bytes may be swapped in 8-bit, 16-bit, or 32-bit units. | |
| Burst Transfer Mode |
| Transfer in 256-byte units | Specify the unit for transferring data to the bus bridge module. |
| Interrupts | |||
| Interrupts > Selectable CEU Events | |||
| One-Frame Capture End Event |
| Enabled | Capturing one frame from an external module has finished. |
| Horizontal Sync Event |
| Disabled | Horizontal sync signal was input from an external module. |
| Vertical Sync Event |
| Enabled | Vertical sync signal was input from an external module. |
| CRAM Buffer Overflow Error |
| Enabled | Data overflowed in the CRAM write buffer. |
| H-Sync Validation Error |
| Disabled | The number of configured H-sync cycles is different than the H-sync cycles input from the external module. |
| V-Sync Validation Error |
| Disabled | The number of configured V-sync cycles is different than the V-sync cycles input from the external module. |
| V-Sync Error |
| Enabled | V-sync has been input while CEU holds data (insufficient vertical-sync front porch). |
| No H-Sync error |
| Enabled | No H-sync signal was input. |
| No V-Sync error |
| Enabled | No V-sync signal was input. |
| Callback | Name must be a valid C symbol. | g_ceu0_user_callback | A user callback function must be provided. This callback is invoked for every successful frame capture as well as other status or error conditions. |
| CEU Interrupt Priority | MCU Specific Options | Select the CEU interrupt priority. | |
The CEU peripheral is clocked both from PCLKA and externally, from the camera module (VIO_CLK). The external input clock (VIO_CLK) should have a frequency at most the same as the CEU operating clock (PCLKA) frequency, with jitter on both sides included. The PCLKA frequency may be set using the Clocks tab of the RA Configuration editor or by using the CGC Interface at run-time.
The VIO_CLK pin is a clock input to the MCU and should be connected to the clock output from the camera. The VIO_HD and VIO_VD pins must be connected to the horizontal and vertical sync signal output of the camera respectively. The VIO_D0 to VIO_D15 pins are the data bus input pins and should be connected to the relevant output pins of the camera. For 8-bit camera data bus VIO_D0 to VIO_D7 should be used.
The blanking period from a horizontal or vertical sync signal differs among external modules. Therefore, the capture start location must be specified in terms of external cycles from the sync signal so that an image can be captured from the valid image area. Some external modules output a horizontal sync signal as a data enable signal. In this case, there is no blanking period so the configured offsets must be cleared to 0.
Scale down is configured by setting Output > Scale-Down properties to the desired output image dimensions in the configurator. When the configured output image size is less than the output input image size, the image will be scaled down to the output size before writing the data to memory.
The configurator automatically calculates the appropriate capture filter register scaling settings based on the requested output size. The filter output must be a multiple of 4 (vertical lines) or 8 (horizontal pixels).
Image Capture Mode captures luminance (Y) and chrominance (Cb/Cr) components of the image in separate memory locations and can be selected by the Input > Capture Mode property.
image width (pixels) * image height (lines) * 2.R_CEU_CaptureStart. The firmware will automatically calculate the chrominance buffer address based on the expected luminance data size.This is a basic example of minimal use of the CEU 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 | ceu_byte_swapping_t |
| struct | ceu_edge_info_t |
| struct | ceu_extended_cfg_t |
| struct | ceu_instance_ctrl_t |
Enumerations | |
| enum | ceu_capture_mode_t |
| enum | ceu_data_bus_size_t |
| enum | ceu_hsync_polarity_t |
| enum | ceu_vsync_polarity_t |
| enum | ceu_burst_transfer_mode_t |
| enum | ceu_event_t |
| enum | ceu_capture_format_t |
| enum | ceu_input_order_t |
| enum | ceu_output_format_t |
| struct ceu_byte_swapping_t |
| struct ceu_edge_info_t |
| struct ceu_extended_cfg_t |
Extended configuration structure for CEU.
| Data Fields | ||
|---|---|---|
| ceu_capture_format_t | capture_format | Capture format for incoming data. |
| ceu_input_order_t | input_order | Input Y and CbCr order (Used for image capture mode) |
| ceu_output_format_t | output_format | Output format for storing to memory (Used for image capture mode) |
| ceu_data_bus_size_t | data_bus_width | Size of camera data bus. |
| ceu_edge_info_t | edge_info | |
| ceu_hsync_polarity_t | hsync_polarity | Polarity of HSYNC input. |
| ceu_vsync_polarity_t | vsync_polarity | Polarity of VSYNC input. |
| uint32_t | image_area_size | Image capture size. Used when setting firewall address for Data Enable Fetch mode. |
| ceu_byte_swapping_t | byte_swapping | Controls byte swapping in 8-bit, 16-bit and 32-bit units. |
| ceu_burst_transfer_mode_t | burst_mode | Bus transfer data size. |
| uint32_t | scale_down_factor | Scale down capture filter register setting (Used for image capture mode) |
| uint16_t | h_output_size | Output image horizontal size, in pixels (Used for image capture mode) |
| uint16_t | v_output_size | Output image vertical size, in lines (Used for image capture mode) |
| uint32_t | interrupts_enabled | Enabled interrupt events bit mask. |
| uint8_t | ceu_ipl | PDC interrupt priority. |
| IRQn_Type | ceu_irq | PDC IRQ number. |
| struct ceu_instance_ctrl_t |
CEU instance control block. DO NOT INITIALIZE.
| enum ceu_capture_mode_t |
| enum ceu_data_bus_size_t |
| enum ceu_hsync_polarity_t |
| enum ceu_vsync_polarity_t |
| enum ceu_event_t |
| enum ceu_capture_format_t |
| enum ceu_input_order_t |
Set the input order of the luminance component and chrominance component (Y and CbCr). Used for image capture mode only.
| enum ceu_output_format_t |
| fsp_err_t R_CEU_Open | ( | capture_ctrl_t *const | p_ctrl, |
| capture_cfg_t const *const | p_cfg | ||
| ) |
CEU module initialization.
Implements capture_api_t::open
The function provides initial configuration for the CEU module. Further initialization may be performed in capture_api_t::captureStart. This function should be called once prior to calling any other CEU API functions. After the CEU 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 parameters is NULL. |
| FSP_ERR_ALREADY_OPEN | Module is already open. |
| fsp_err_t R_CEU_Close | ( | capture_ctrl_t *const | p_ctrl | ) |
Stops and closes the transfer interface.
Implements capture_api_t::close
Stops any active captures, clears internal driver state-data, disables interrupts, and powers off the CEU peripheral.
Example:
| 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_CEU_CaptureStart | ( | capture_ctrl_t *const | p_ctrl, |
| uint8_t *const | p_buffer | ||
| ) |
Starts a capture.
Implements capture_api_t::captureStart.
Sets up the interface to transfer data from the CEU into the specifiec buffer. Configures the CEU settings as previously set by the capture_api_t::open API. When a capture is complete the callback registered during capture_api_t::open API call or by capture_api_t::callbackSet API will be called.
Example:
| 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_INVALID_ADDRESS | Invalid buffer address alignment. |
| FSP_ERR_IN_USE | Capture is in progress. |
| FSP_ERR_INVALID_STATE | Capture is pending. |
| FSP_ERR_NOT_INITIALIZED | Callback function has not been set. |
| fsp_err_t R_CEU_CallbackSet | ( | capture_ctrl_t *const | p_ctrl, |
| void(*)(capture_callback_args_t *) | p_callback, | ||
| void *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_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_NO_CALLBACK_MEMORY | p_callback is non-secure and p_callback_memory is either secure or NULL. |
| fsp_err_t R_CEU_StatusGet | ( | capture_ctrl_t *const | p_ctrl, |
| capture_status_t * | p_status | ||
| ) |
Provides the ceu 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. |