RZA Flexible Software Package Documentation  Release v1.1.0

 
Camera Data Receiving Unit (r_cru)

Functions

fsp_err_t R_CRU_Open (cru_ctrl_t *const p_api_ctrl, cru_cfg_t const *const p_cfg)
 
fsp_err_t R_CRU_Close (cru_ctrl_t *const p_api_ctrl)
 
fsp_err_t R_CRU_CaptureStart (cru_ctrl_t *const p_api_ctrl)
 
fsp_err_t R_CRU_CaptureStop (cru_ctrl_t *const p_api_ctrl)
 
fsp_err_t R_CRU_StatusGet (cru_ctrl_t *const p_api_ctrl, camera_status_t *p_status)
 

Detailed Description

Driver for the CRU peripheral on RZ MPUs. This module implements the Camera Interface.

Overview

The CRU supports interfacing with external cameras by accepting data signals in order to capture incoming data

Features

Feature Options
Input color formats RGB565, RGB888, YCbCr420(8bit), YCbCr420(10bit), YCbCr422(8bit), YCbCr422(10bit), RAW8, RAW10, RAW12, RAW12
Datalanes one, two, four
Maximum resolution Up to 2800 x 4095 pixels
Interrupts Frame Start, Frame End, Scan Line

Configuration

Build Time Configurations for r_cru

The following build time configurations are defined in fsp_cfg/r_cru_cfg.h:

ConfigurationOptionsDefaultDescription
Parameter Checking
  • Default (BSP)
  • Enabled
  • Disabled
Default (BSP) If selected code for parameter checking is included in the build.

Configurations for Graphics > CRU Driver on r_cru

This module can be added to the Stacks tab via New Stack > Graphics > CRU Driver on r_cru.

ConfigurationOptionsDefaultDescription
General > NameName must be a valid C symbolg_cru0 Module name.
Input > Capture Specifications > Number of pixels to capture horizontallyValue must be an integer greater than 01280 Specify the number of horizontal pixels to capture.
Input > Capture Specifications > Number of lines to capture verticallyValue must be an integer greater than 0720 Specify the number of vertical pixels to capture.
Input > Capture Specifications > Horizontal pixel to start capture fromValue must be an integer0 Specify the horizontal pixel to start capturing image data from. Allows an image smaller than the native resolution of a camera to be captured.
Input > Capture Specifications > Line to start capture fromValue must be an integer0 Specify the vertical line to start capturing image data from. Allows an image smaller than the native resolution of a camera to be captured.
Input > Color format
  • YUV420(8bit)
  • YUV420(10bit)
  • YUV422(8bit)
  • YUV422(10bit)
  • RGB565
  • RGB888
  • RAW8
  • RAW10
  • RAW12
  • RAW14
YUV422(8bit) Select the input color format.
Input > Number of datalanes
  • use 1 datalane
  • use 2 datalanes
  • use 4 datalanes
use 2 datalanes Select a number of datalanes.
Output > Buffer > Image buffer sectionThis property must be a valid section nameUNCACHED_BSS Specify the RAM section for the image data buffer. Typically .bss (internal RAM) or .sdram. When Arm Compiler 6 is used to place this memory in on-chip SRAM, the section name must be .bss or start with .bss. to avoid consuming unnecessary ROM space.
Output > Buffer > Number of image buffersValue must be an integer between 0 and 81 Specify the number of buffers to create.When user select 0,the buffer set in user application can be used.
Output > Color format
  • YUV420 (YUYV)
  • YUV420 (UYVY)
  • YUV422 (YUYV)
  • YUV422 (UYVY)
  • RGB888 24bit
  • RGB888 32bit(Upper 8bit is 0)
  • ARGB8888
  • BGRA8888
YUV422 (YUYV) Select the output color format.
Interrupts > Image Conversion > Enable Interrupt > Frame Start interrupt
  • Enable
  • Disable
Disable Enable or Disable Image Conversion interrupt
Interrupts > Image Conversion > Enable Interrupt > Frame End Interrupt
  • Enable
  • Disable
Disable Enable or Disable Image Conversion interrupt
Interrupts > Image Conversion > Enable Interrupt > Scan Line interrupt
  • Enable
  • Disable
Disable Enable or Disable Image Conversion interrupt
Interrupts > Image Conversion > Enable Interrupt > Scan Line NumberValue must be an integer between 0 and 40950 Line specification for generating a scan line interrupt.
Interrupts > Image Conversion > CallbackName must be a valid C symbolNULL Set the callback function name for Image Conversion interrupt
Interrupts > Image Conversion > Interrupt PriorityValue must be between 0 and 3124 Select the Image Conversion interrupt priority.

Usage Notes

Interrupt Configuration

CRU setup with external camera

Examples

Basic Example

This is a basic example of minimal use of the CRU 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.

void basic_example (void)
{
/* Open the CRU driver */
g_cru_on_cru.open(&g_cru_ctrl, &g_cru_cfg);
/* Start capture */
g_cru_on_cru.captureStart(&g_cru_ctrl);
}

Data Structures

struct  cru_extended_cfg_t
 
struct  cru_instance_ctrl_t
 

Enumerations

enum  cru_color_input_format_t
 
enum  cru_color_output_format_t
 
enum  cru_datalane_t
 
enum  cru_interrupt_enable_t
 
enum  cru_event_image_conv_int_t
 

Data Structure Documentation

◆ cru_extended_cfg_t

struct cru_extended_cfg_t

CRU hardware specific configuration

Data Fields
cru_datalane_t num_datalane select number of datalane
cru_color_input_format_t color_input input color format
cru_color_output_format_t color_output output color format
cru_interrupt_enable_t interrupt_enable Interrupt enable table.
uint16_t scan_line_num Line specification for generating a scan line interrupt.
uint8_t image_conv_int_ipl Image conversion interrupt priority.
IRQn_Type image_conv_int_irq Image conversion IRQ number.

◆ cru_instance_ctrl_t

struct cru_instance_ctrl_t

CRU instance control block.

Data Fields

cru_cfg_t const * p_cfg
 Status of LCDC module. More...
 
uint8_t capture_num
 The buffer number currently used by CRU.
 
void const * p_context
 Placeholder for user data. Passed to the user callback.
 
void(* p_callback )(camera_callback_args_t *p_args)
 Callback provided when a image conversion ISR occurs.
 

Field Documentation

◆ p_cfg

cru_cfg_t const* cru_instance_ctrl_t::p_cfg

Status of LCDC module.

Pointer to the configuration structure

Enumeration Type Documentation

◆ cru_color_input_format_t

CRU color format setting

Enumerator
CRU_COLOR_INPUT_FORMAT_YUV420_8BIT 

YUV420 8bit.

CRU_COLOR_INPUT_FORMAT_YUV420_10BIT 

YUV420 10bit.

CRU_COLOR_INPUT_FORMAT_YUV422_8BIT 

YUV422 8bit.

CRU_COLOR_INPUT_FORMAT_YUV422_10BIT 

YUV422 10bit.

CRU_COLOR_INPUT_FORMAT_RGB565 

RGB565.

CRU_COLOR_INPUT_FORMAT_RGB888 

RGB888.

CRU_COLOR_INPUT_FORMAT_RAW8 

RAW8.

CRU_COLOR_INPUT_FORMAT_RAW10 

RAW10.

CRU_COLOR_INPUT_FORMAT_RAW12 

RAW12.

CRU_COLOR_INPUT_FORMAT_RAW14 

RAW14.

◆ cru_color_output_format_t

Color order setting

Enumerator
CRU_COLOR_OUTPUT_FORMAT_YUV420_YUYV 

YUV420 YUYV.

CRU_COLOR_OUTPUT_FORMAT_YUV420_UYVY 

YUV420 UYVY.

CRU_COLOR_OUTPUT_FORMAT_YUV422_YUYV 

YUV422 YUYV.

CRU_COLOR_OUTPUT_FORMAT_YUV422_UYVY 

YUV422 UYVY.

CRU_COLOR_OUTPUT_FORMAT_RGB888_24BIT 

RGB888 24BIT.

CRU_COLOR_OUTPUT_FORMAT_RGB888_32BIT 

RGB888 32BIT (Upper 8bit is 0x00)

CRU_COLOR_OUTPUT_FORMAT_ARGB8888 

ARGB8888.

CRU_COLOR_OUTPUT_FORMAT_BGRA8888 

BGRA888.

◆ cru_datalane_t

Enumerator
CRU_DATALANE_1 

use one datalane

CRU_DATALANE_2 

use two datalane

CRU_DATALANE_4 

use four datalane

◆ cru_interrupt_enable_t

CRU interrupt enable

◆ cru_event_image_conv_int_t

CRU events table for image conv int

Enumerator
CRU_EVENT_FRAME_START 

Interrupt for Frame Start.

CRU_EVENT_FRAME_END 

Interrupt for Frame End.

CRU_EVENT_SCAN_LINE 

Interrupt for Scan Line.

Function Documentation

◆ R_CRU_Open()

fsp_err_t R_CRU_Open ( cru_ctrl_t *const  p_api_ctrl,
cru_cfg_t const *const  p_cfg 
)

 Initializes the CRU modules and enables interrupts

Return values
FSP_SUCCESSInitializes the CRU modules.
FSP_ERR_ASSERTIONPointer to the control block is NULL.
FSP_ERR_ALREADY_OPENCRU module is already open
FSP_ERR_INVALID_ARGUMENTInvalid argument error
FSP_ERR_INVALID_ALIGNMENTInput buffer alignment

◆ R_CRU_Close()

fsp_err_t R_CRU_Close ( cru_ctrl_t *const  p_api_ctrl)

Close the capture while the CRU module is operating

Return values
FSP_SUCCESSClose the CRU module
FSP_ERR_ASSERTIONPointer to the control block is NULL.
FSP_ERR_NOT_OPENCRU module is not open

◆ R_CRU_CaptureStart()

fsp_err_t R_CRU_CaptureStart ( cru_ctrl_t *const  p_api_ctrl)

Start a capture. It is only possible when CRU is open.

Return values
FSP_SUCCESSstart a capture.
FSP_ERR_ASSERTIONPointer to the control block is NULL.
FSP_ERR_INVALID_MODECRU module is not CAMERA_STATE_IN_PROGRESS

◆ R_CRU_CaptureStop()

fsp_err_t R_CRU_CaptureStop ( cru_ctrl_t *const  p_api_ctrl)

Stop a capture. It is only possible when CRU is running.

Return values
FSP_SUCCESSstop a capture.
FSP_ERR_ASSERTIONPointer to the control block is NULL.
FSP_ERR_INVALID_MODECRU module is not CAMERA_STATE_BUSY

◆ R_CRU_StatusGet()

fsp_err_t R_CRU_StatusGet ( cru_ctrl_t *const  p_api_ctrl,
camera_status_t p_status 
)

Get the camera status, CAMERA module status and buffer address. It is only possible when CRU is running.

Return values
FSP_SUCCESSstop a capture.
FSP_ERR_ASSERTIONPointer to the control block is NULL.
FSP_ERR_INVALID_MODECRU module is not CAMERA_STATE_BUSY