RTEMS  5.1
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
43 
44 #define SENSOR_VAL_TERM 0xFF
45 
46 /*----------------------------------------------------------------------------
47  * Types
48  *----------------------------------------------------------------------------*/
49 
51 typedef enum _sensorType {
52  SENSOR_COMS = 0,
53  SENSOR_CCD
54 } sensorType_t;
55 
57 typedef enum _sensorStatus {
58  SENSOR_OK = 0,
59  SENSOR_TWI_ERROR,
60  SENSOR_ID_ERROR,
61  SENSOR_RESOLUTION_NOT_SUPPORTED
62 } sendorStatus_t;
63 
65 typedef 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 
72 typedef enum _sensorResolution {
73  QVGA = 0,
74  VGA,
75  SVGA,
76  XGA,
77  WXGA,
78  UVGA
79 } sensorOutputResolution_t;
80 
82 typedef 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;
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];
119 
120 /*----------------------------------------------------------------------------
121  * Exported functions
122  *----------------------------------------------------------------------------*/
123 extern sendorStatus_t sensor_twi_write_regs(Twid *pTwid,
124  const sensorReg_t *pReglist);
125 
126 extern sendorStatus_t sensor_twi_read_regs(Twid *pTwid,
127  const sensorReg_t *pReglist);
128 
129 extern sendorStatus_t sensor_setup(Twid *pTwid,
130  const sensorProfile_t *sensor_profile,
131  sensorOutputResolution_t resolution);
132 
133 extern sendorStatus_t sensor_get_output(sensorOutputFormat_t *format,
134  uint32_t *width,
135  uint32_t *height,
136  sensorOutputResolution_t resolution);
uint16_t pid_high_reg
Definition: image_sensor_inf.h:111
Definition: mknod-pack_dev.c:254
Definition: image_sensor_inf.h:107
uint8_t supported
Definition: image_sensor_inf.h:100
uint16_t version_mask
Definition: image_sensor_inf.h:115
uint32_t twi_slave_addr
Definition: image_sensor_inf.h:110
Definition: image_sensor_inf.h:91
uint32_t output_height
Definition: image_sensor_inf.h:102
Definition: image_sensor_inf.h:96
sensorOutputResolution_t output_resolution
Definition: image_sensor_inf.h:98
uint16_t pid_low_reg
Definition: image_sensor_inf.h:112
sensorTwiMode_t twi_inf_mode
Definition: image_sensor_inf.h:109
uint16_t pid_low
Definition: image_sensor_inf.h:114
const sensorReg_t * output_setting
Definition: image_sensor_inf.h:103
uint32_t output_width
Definition: image_sensor_inf.h:101
const sensorOutput_t * outputConf[SENDOR_SUPPORTED_OUTPUTS]
Definition: image_sensor_inf.h:117
TWI driver structure. Holds the internal state of the driver.
Definition: twid.h:72
sensorOutputFormat_t output_format
Definition: image_sensor_inf.h:99
uint16_t pid_high
Definition: image_sensor_inf.h:113