Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
SAMV71/V70/E70/S70 Image Sensor Interface Driver

This driver for Atmel® | SMART ARM®-based SAM Image Sensor Interface (ISI) connects a CMOS-type image sensor to the processor and provides image capture in various formats.

Devices from the following series can use this module:

Data Structures

struct  isi_config_t
 ISI configuration structure. More...
 
struct  isi_frame_buffer_descriptors
 Frame buffer descriptors. More...
 
struct  isi_R2Y
 ISI Matrix Color Space Conversion RGB to YCrCb. More...
 
struct  isi_Y2R
 ISI Matrix Color Space Conversion YCrCb to RGB. More...
 

Enumerations

enum  isi_input_image_format {
  ISI_INPUT_YUV = 0,
  ISI_INPUT_RGB565 = 1,
  ISI_INPUT_RGB888 = 2,
  ISI_INPUT_GS_12BIT = 3,
  ISI_INPUT_GS_8BIT = 4
}
 Enum for the possible image format for the ISI module. More...
 

Functions

static void isi_capture (Isi *p_isi)
 Enable the codec datapath and capture a full resolution frame. More...
 
static void isi_disable (Isi *p_isi)
 Disable ISI. More...
 
static void isi_disable_interrupt (Isi *p_isi, uint32_t flag)
 Disable ISI interrupt. More...
 
static void isi_dma_channel_disable (Isi *p_isi, uint32_t channel)
 Disable ISI Dma channel. More...
 
static void isi_dma_channel_enable (Isi *p_isi, uint32_t channel)
 Enable ISI Dma channel. More...
 
static void isi_enable (Isi *p_isi)
 Enable ISI. More...
 
static void isi_enable_interrupt (Isi *p_isi, uint32_t flag)
 Enable ISI interrupt. More...
 
static uint32_t isi_get_status (Isi *p_isi)
 Return ISI status register. More...
 
static uint32_t isi_get_writeprotect_status (Isi *p_isi)
 Indicate write protect status. More...
 
void isi_gs_configue (Isi *p_isi, uint8_t mode)
 Input image is assumed to be grayscale-coded. More...
 
void isi_init (Isi *p_isi, struct isi_config_t *isi_cfg)
 Initialize the ISI module. More...
 
static void isi_reset (Isi *p_isi)
 Reset ISI. More...
 
void isi_rgb_configue (Isi *p_isi, uint8_t patten, uint8_t swap)
 Configue RGB swap mode and RGB pattern when RGB_MODE is set to 1. More...
 
void isi_set_dma_codec_path (Isi *p_isi, uint8_t full_mode, uint8_t discr, uint32_t base_buf_desc, uint32_t dma_ctrl, uint32_t frame_buf_start_addr)
 Configure DMA for codec path. More...
 
void isi_set_dma_preview_path (Isi *p_isi, uint8_t frate, uint32_t base_buf_desc, uint32_t dma_ctrl, uint32_t frame_buf_start_addr)
 Configure DMA for preview path. More...
 
void isi_set_matrix_rgb2yuv (Isi *p_isi, isi_R2Y *rgb2yuv)
 ISI set matrix for RGB to YUV color space for codec path. More...
 
void isi_set_matrix_yuv2rgb (Isi *p_isi, isi_Y2R *yuv2rgb)
 ISI set matrix for YUV to RGB color space for preview path. More...
 
static void isi_set_writeprotect (Isi *p_isi, const bool is_enable)
 Enable or disable write protection of ADC registers. More...
 
void isi_size_configure (Isi *p_isi, uint32_t image_hsize, uint32_t image_vsize, uint32_t preview_hsize, uint32_t preview_vsize)
 Set image and preview size, then calculate scaler factor automatically. More...
 
void isi_yuv_configue (Isi *p_isi, uint8_t swap)
 Defines YCrCb swap format. More...
 

Variables

uint8_t isi_R2Y::Boff
 Color Space Conversion Blue Component Offset. More...
 
uint8_t isi_Y2R::C0
 Color Space Conversion Matrix Coefficient C0. More...
 
uint8_t isi_R2Y::C0
 Color Space Conversion Matrix Coefficient C0. More...
 
uint8_t isi_Y2R::C1
 Color Space Conversion Matrix Coefficient C1. More...
 
uint8_t isi_R2Y::C1
 Color Space Conversion Matrix Coefficient C1. More...
 
uint8_t isi_Y2R::C2
 Color Space Conversion Matrix Coefficient C2. More...
 
uint8_t isi_R2Y::C2
 Color Space Conversion Matrix Coefficient C2. More...
 
uint8_t isi_Y2R::C3
 Color Space Conversion Matrix Coefficient C3. More...
 
uint8_t isi_R2Y::C3
 Color Space Conversion Matrix Coefficient C3. More...
 
uint16_t isi_Y2R::C4
 Color Space Conversion Matrix Coefficient C4. More...
 
uint8_t isi_R2Y::C4
 Color Space Conversion Matrix Coefficient C4. More...
 
uint8_t isi_R2Y::C5
 Color Space Conversion Matrix Coefficient C5. More...
 
uint8_t isi_R2Y::C6
 Color Space Conversion Matrix Coefficient C6. More...
 
uint8_t isi_R2Y::C7
 Color Space Conversion Matrix Coefficient C7. More...
 
uint8_t isi_R2Y::C8
 Color Space Conversion Matrix Coefficient C8. More...
 
uint8_t isi_Y2R::Cboff
 Color Space Conversion Blue Chrominance Default Offset. More...
 
uint32_t isi_frame_buffer_descriptors::control
 Address of the Control. More...
 
uint8_t isi_config_t::crc_sync
 Embedded Synchronization Correction. More...
 
uint8_t isi_Y2R::Croff
 Color Space Conversion Red Chrominance Default Offset. More...
 
uint32_t isi_frame_buffer_descriptors::current
 Address of the Current FrameBuffer. More...
 
uint8_t isi_config_t::emb_sync
 Embedded Synchronization. More...
 
uint8_t isi_R2Y::Goff
 Color Space Conversion Green Component Offset. More...
 
uint8_t isi_config_t::hpol
 Horizontal Synchronization Polarity. More...
 
enum isi_input_image_format isi_config_t::image_fmt
 Input image format. More...
 
uint32_t isi_config_t::image_hsize
 Input image horizontal size. More...
 
uint32_t isi_config_t::image_vsize
 Input image vertical size. More...
 
uint32_t isi_frame_buffer_descriptors::next
 Address of the Next FrameBuffer. More...
 
uint8_t isi_config_t::pck_plo
 Pixel Clock Polarity. More...
 
uint8_t isi_R2Y::Roff
 Color Space Conversion Red Component Offset. More...
 
uint8_t isi_config_t::sfd
 Start of Frame Delay. More...
 
uint8_t isi_config_t::sld
 Start of Line Delay. More...
 
uint8_t isi_config_t::thmask
 Threshold Mask. More...
 
uint8_t isi_config_t::vpol
 Vertical Synchronization Polarity. More...
 
uint8_t isi_Y2R::Yoff
 Color Space Conversion Luminance Default Offset. More...
 

Enum for the possible image format for the ISI module.

Enumerator
ISI_INPUT_YUV 

ISI input YCrCb.

ISI_INPUT_RGB565 

ISI input RGB 8:8:8.

ISI_INPUT_RGB888 

ISI input RGB 5:6:5.

ISI_INPUT_GS_12BIT 

ISI input 12-bit grayscale.

ISI_INPUT_GS_8BIT 

ISI input 8-bit grayscale.

static void isi_capture ( Isi *  p_isi)
inlinestatic

Enable the codec datapath and capture a full resolution frame.

Parameters
p_isiPointer to a ISI instance.
static void isi_disable ( Isi *  p_isi)
inlinestatic

Disable ISI.

Parameters
p_isiPointer to a ISI instance.
static void isi_disable_interrupt ( Isi *  p_isi,
uint32_t  flag 
)
inlinestatic

Disable ISI interrupt.

Parameters
p_isiPointer to a ISI instance.
flagof interrupt to disable

References flag.

static void isi_dma_channel_disable ( Isi *  p_isi,
uint32_t  channel 
)
inlinestatic

Disable ISI Dma channel.

Parameters
p_isiPointer to a ISI instance.
channelto be disabled
static void isi_dma_channel_enable ( Isi *  p_isi,
uint32_t  channel 
)
inlinestatic

Enable ISI Dma channel.

Parameters
p_isiPointer to a ISI instance.
channelto be enabled
static void isi_enable ( Isi *  p_isi)
inlinestatic

Enable ISI.

Parameters
p_isiPointer to a ISI instance.
static void isi_enable_interrupt ( Isi *  p_isi,
uint32_t  flag 
)
inlinestatic

Enable ISI interrupt.

Parameters
p_isiPointer to a ISI instance.
flagof interrupt to enable

References flag.

static uint32_t isi_get_status ( Isi *  p_isi)
inlinestatic

Return ISI status register.

Parameters
p_isiPointer to a ISI instance.
Returns
Status of ISI register
static uint32_t isi_get_writeprotect_status ( Isi *  p_isi)
inlinestatic

Indicate write protect status.

Parameters
p_isiPointer to a ISI instance.
Returns
0 if no write protect violation occurred, or 16-bit write protect violation source.
void isi_gs_configue ( Isi *  p_isi,
uint8_t  mode 
)

Input image is assumed to be grayscale-coded.

Parameters
p_isiPointer to a ISI instance.
mode0: 2 pixels per word, 1: 1 pixel per word.

References _isi_get_CFG2_workaround().

static void isi_reset ( Isi *  p_isi)
inlinestatic

Reset ISI.

Parameters
p_isiPointer to a ISI instance.
void isi_rgb_configue ( Isi *  p_isi,
uint8_t  patten,
uint8_t  swap 
)

Configue RGB swap mode and RGB pattern when RGB_MODE is set to 1.

Parameters
p_isiPointer to a ISI instance.
pattenRGB pattern
swap0: D7-R7, 1: D0-R7

References _isi_get_CFG2_workaround().

void isi_set_dma_codec_path ( Isi *  p_isi,
uint8_t  full_mode,
uint8_t  discr,
uint32_t  base_buf_desc,
uint32_t  dma_ctrl,
uint32_t  frame_buf_start_addr 
)

Configure DMA for codec path.

Parameters
p_isiPointer to a ISI instance.
full_modeFull mode is allowed.
discrDisable codec request.
base_buf_descCodec descriptor address.
dma_ctrlDMA codec Control.
frame_buf_start_addrDMA codec base address.
void isi_set_dma_preview_path ( Isi *  p_isi,
uint8_t  frate,
uint32_t  base_buf_desc,
uint32_t  dma_ctrl,
uint32_t  frame_buf_start_addr 
)

Configure DMA for preview path.

Parameters
p_isiPointer to a ISI instance.
frateframe rate capture
base_buf_descPreview descriptor address.
dma_ctrlDMA preview control.
frame_buf_start_addrDMA preview base address.
void isi_set_matrix_rgb2yuv ( Isi *  p_isi,
isi_R2Y rgb2yuv 
)

ISI set matrix for RGB to YUV color space for codec path.

Parameters
p_isiPointer to a ISI instance.
rgb2yuvstructure of RGB to YUV parameters.

References isi_R2Y::Boff, isi_R2Y::C0, isi_R2Y::C1, isi_R2Y::C2, isi_R2Y::C3, isi_R2Y::C4, isi_R2Y::C5, isi_R2Y::C6, isi_R2Y::C7, isi_R2Y::C8, isi_R2Y::Goff, and isi_R2Y::Roff.

void isi_set_matrix_yuv2rgb ( Isi *  p_isi,
isi_Y2R yuv2rgb 
)

ISI set matrix for YUV to RGB color space for preview path.

Parameters
p_isiPointer to a ISI instance.
yuv2rgbstructure of YUV to RBG parameters.

References isi_Y2R::C0, isi_Y2R::C1, isi_Y2R::C2, isi_Y2R::C3, isi_Y2R::C4, isi_Y2R::Cboff, isi_Y2R::Croff, and isi_Y2R::Yoff.

static void isi_set_writeprotect ( Isi *  p_isi,
const bool  is_enable 
)
inlinestatic

Enable or disable write protection of ADC registers.

Parameters
p_isiPointer to a ISI instance.
is_enable1 to enable, 0 to disable.
void isi_size_configure ( Isi *  p_isi,
uint32_t  image_hsize,
uint32_t  image_vsize,
uint32_t  preview_hsize,
uint32_t  preview_vsize 
)

Set image and preview size, then calculate scaler factor automatically.

Parameters
p_isiPointer to a ISI instance.
image_hsizeHorizontal image input size (range 1~2048).
image_vsizeVertical image input size (range 1~2048).
preview_hsizeHorizontal Preview size (640 max only in RGB mode).
preview_vsizeVertical Preview size (480 max only in RGB mode).

References _isi_get_CFG2_workaround().

void isi_yuv_configue ( Isi *  p_isi,
uint8_t  swap 
)

Defines YCrCb swap format.

Parameters
p_isiPointer to a ISI instance.
swapYUV Swap format

References _isi_get_CFG2_workaround().

uint8_t isi_R2Y::Boff

Color Space Conversion Blue Component Offset.

Referenced by isi_set_matrix_rgb2yuv().

uint8_t isi_Y2R::C0

Color Space Conversion Matrix Coefficient C0.

Referenced by isi_set_matrix_yuv2rgb().

uint8_t isi_R2Y::C0

Color Space Conversion Matrix Coefficient C0.

Referenced by isi_set_matrix_rgb2yuv().

uint8_t isi_Y2R::C1

Color Space Conversion Matrix Coefficient C1.

Referenced by isi_set_matrix_yuv2rgb().

uint8_t isi_R2Y::C1

Color Space Conversion Matrix Coefficient C1.

Referenced by isi_set_matrix_rgb2yuv().

uint8_t isi_Y2R::C2

Color Space Conversion Matrix Coefficient C2.

Referenced by isi_set_matrix_yuv2rgb().

uint8_t isi_R2Y::C2

Color Space Conversion Matrix Coefficient C2.

Referenced by isi_set_matrix_rgb2yuv().

uint8_t isi_Y2R::C3

Color Space Conversion Matrix Coefficient C3.

Referenced by isi_set_matrix_yuv2rgb().

uint8_t isi_R2Y::C3

Color Space Conversion Matrix Coefficient C3.

Referenced by isi_set_matrix_rgb2yuv().

uint16_t isi_Y2R::C4

Color Space Conversion Matrix Coefficient C4.

Referenced by isi_set_matrix_yuv2rgb().

uint8_t isi_R2Y::C4

Color Space Conversion Matrix Coefficient C4.

Referenced by isi_set_matrix_rgb2yuv().

uint8_t isi_R2Y::C5

Color Space Conversion Matrix Coefficient C5.

Referenced by isi_set_matrix_rgb2yuv().

uint8_t isi_R2Y::C6

Color Space Conversion Matrix Coefficient C6.

Referenced by isi_set_matrix_rgb2yuv().

uint8_t isi_R2Y::C7

Color Space Conversion Matrix Coefficient C7.

Referenced by isi_set_matrix_rgb2yuv().

uint8_t isi_R2Y::C8

Color Space Conversion Matrix Coefficient C8.

Referenced by isi_set_matrix_rgb2yuv().

uint8_t isi_Y2R::Cboff

Color Space Conversion Blue Chrominance Default Offset.

Referenced by isi_set_matrix_yuv2rgb().

uint32_t isi_frame_buffer_descriptors::control

Address of the Control.

uint8_t isi_config_t::crc_sync

Embedded Synchronization Correction.

Referenced by isi_init().

uint8_t isi_Y2R::Croff

Color Space Conversion Red Chrominance Default Offset.

Referenced by isi_set_matrix_yuv2rgb().

uint32_t isi_frame_buffer_descriptors::current

Address of the Current FrameBuffer.

uint8_t isi_config_t::emb_sync

Embedded Synchronization.

Referenced by isi_init().

uint8_t isi_R2Y::Goff

Color Space Conversion Green Component Offset.

Referenced by isi_set_matrix_rgb2yuv().

uint8_t isi_config_t::hpol

Horizontal Synchronization Polarity.

Referenced by isi_init().

enum isi_input_image_format isi_config_t::image_fmt

Input image format.

Referenced by isi_init().

uint32_t isi_config_t::image_hsize

Input image horizontal size.

Referenced by isi_init().

uint32_t isi_config_t::image_vsize

Input image vertical size.

Referenced by isi_init().

uint32_t isi_frame_buffer_descriptors::next

Address of the Next FrameBuffer.

uint8_t isi_config_t::pck_plo

Pixel Clock Polarity.

Referenced by isi_init().

uint8_t isi_R2Y::Roff

Color Space Conversion Red Component Offset.

Referenced by isi_set_matrix_rgb2yuv().

uint8_t isi_config_t::sfd

Start of Frame Delay.

Referenced by isi_init().

uint8_t isi_config_t::sld

Start of Line Delay.

Referenced by isi_init().

uint8_t isi_config_t::thmask

Threshold Mask.

Referenced by isi_init().

uint8_t isi_config_t::vpol

Vertical Synchronization Polarity.

Referenced by isi_init().

uint8_t isi_Y2R::Yoff

Color Space Conversion Luminance Default Offset.

Referenced by isi_set_matrix_yuv2rgb().