RTEMS: bsps/arm/atsam/contrib/libraries/libboard/include/image_sensor_inf.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
image_sensor_inf.h
1/* ---------------------------------------------------------------------------- */
2/* Atmel Microcontroller Software Support */
3/* SAM Software Package License */
4/* ---------------------------------------------------------------------------- */
5/* Copyright (c) 2015, Atmel Corporation */
6/* */
7/* All rights reserved. */
8/* */
9/* Redistribution and use in source and binary forms, with or without */
10/* modification, are permitted provided that the following condition is met: */
11/* */
12/* - Redistributions of source code must retain the above copyright notice, */
13/* this list of conditions and the disclaimer below. */
14/* */
15/* Atmel's name may not be used to endorse or promote products derived from */
16/* this software without specific prior written permission. */
17/* */
18/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
19/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
20/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
21/* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */
22/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
23/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
24/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
25/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
26/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
27/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28/* ---------------------------------------------------------------------------- */
29
30/*----------------------------------------------------------------------------
31 * Headers
32 *----------------------------------------------------------------------------*/
33#include "board.h"
34
35
36/*---------------------------------------------------------------------------
37 * Definition
38 *---------------------------------------------------------------------------*/
39#define SENDOR_SUPPORTED_OUTPUTS 7
40
42#define SENSOR_REG_TERM 0xFF
44#define SENSOR_VAL_TERM 0xFF
45
46/*----------------------------------------------------------------------------
47 * Types
48 *----------------------------------------------------------------------------*/
49
51typedef enum _sensorType {
52 SENSOR_COMS = 0,
53 SENSOR_CCD
54} sensorType_t;
55
57typedef enum _sensorStatus {
58 SENSOR_OK = 0,
59 SENSOR_TWI_ERROR,
60 SENSOR_ID_ERROR,
61 SENSOR_RESOLUTION_NOT_SUPPORTED
62} sendorStatus_t;
63
65typedef enum _sensorTwiMode {
66 SENSOR_TWI_REG_BYTE_DATA_BYTE = 0,
67 SENSOR_TWI_REG_2BYTE_DATA_BYTE,
68 SENSOR_TWI_REG_BYTE_DATA_2BYTE
69} sensorTwiMode_t;
70
72typedef enum _sensorResolution {
73 QVGA = 0,
74 VGA,
75 SVGA,
76 XGA,
77 WXGA,
78 UVGA
79} sensorOutputResolution_t;
80
82typedef enum _sensorOutputFormat {
83 RAW_BAYER_12_BIT = 0,
84 RAW_BAYER_10_BIT,
85 YUV_422_8_BIT,
86 YUV_422_10_BIT,
87 MONO_12_BIT
88} sensorOutputFormat_t;
89
91 typedef struct _sensor_reg {
92 uint16_t reg; /* Register to be written */
93 uint16_t val; /* value to be written */
94} sensorReg_t;
95
96 typedef struct _sensor_output {
97 uint8_t type;
98 sensorOutputResolution_t output_resolution;
99 sensorOutputFormat_t output_format;
100 uint8_t supported;
101 uint32_t output_width;
102 uint32_t output_height;
103 const sensorReg_t *output_setting;
104} sensorOutput_t;
105
107 typedef struct _sensor_profile {
108 sensorType_t cmos_ccd;
109 sensorTwiMode_t twi_inf_mode;
110 uint32_t twi_slave_addr;
111 uint16_t pid_high_reg;
112 uint16_t pid_low_reg;
113 uint16_t pid_high;
114 uint16_t pid_low;
115 uint16_t version_mask;
116 const sensorOutput_t
117 *outputConf[SENDOR_SUPPORTED_OUTPUTS];
118} sensorProfile_t;
119
120/*----------------------------------------------------------------------------
121 * Exported functions
122 *----------------------------------------------------------------------------*/
123extern sendorStatus_t sensor_twi_write_regs(Twid *pTwid,
124 const sensorReg_t *pReglist);
125
126extern sendorStatus_t sensor_twi_read_regs(Twid *pTwid,
127 const sensorReg_t *pReglist);
128
129extern sendorStatus_t sensor_setup(Twid *pTwid,
130 const sensorProfile_t *sensor_profile,
131 sensorOutputResolution_t resolution);
132
133extern sendorStatus_t sensor_get_output(sensorOutputFormat_t *format,
134 uint32_t *width,
135 uint32_t *height,
136 sensorOutputResolution_t resolution);
board.h
_Twid
TWI driver structure. Holds the internal state of the driver.
Definition: twid.h:72
_sensor_output
Definition: image_sensor_inf.h:96
_sensor_output::output_height
uint32_t output_height
Definition: image_sensor_inf.h:102
_sensor_output::output_resolution
sensorOutputResolution_t output_resolution
Definition: image_sensor_inf.h:98
_sensor_output::output_width
uint32_t output_width
Definition: image_sensor_inf.h:101
_sensor_output::output_setting
const sensorReg_t * output_setting
Definition: image_sensor_inf.h:103
_sensor_output::supported
uint8_t supported
Definition: image_sensor_inf.h:100
_sensor_output::output_format
sensorOutputFormat_t output_format
Definition: image_sensor_inf.h:99
_sensor_profile
Definition: image_sensor_inf.h:107
_sensor_profile::pid_low_reg
uint16_t pid_low_reg
Definition: image_sensor_inf.h:112
_sensor_profile::twi_inf_mode
sensorTwiMode_t twi_inf_mode
Definition: image_sensor_inf.h:109
_sensor_profile::version_mask
uint16_t version_mask
Definition: image_sensor_inf.h:115
_sensor_profile::outputConf
const sensorOutput_t * outputConf[SENDOR_SUPPORTED_OUTPUTS]
Definition: image_sensor_inf.h:117
_sensor_profile::pid_high_reg
uint16_t pid_high_reg
Definition: image_sensor_inf.h:111
_sensor_profile::pid_high
uint16_t pid_high
Definition: image_sensor_inf.h:113
_sensor_profile::twi_slave_addr
uint32_t twi_slave_addr
Definition: image_sensor_inf.h:110
_sensor_profile::pid_low
uint16_t pid_low
Definition: image_sensor_inf.h:114
_sensor_reg
Definition: image_sensor_inf.h:91
format
Definition: mknod-pack_dev.c:254