[453] | 1 | /*
|
---|
| 2 | * TOPPERS/ASP Kernel
|
---|
| 3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
| 4 | * Advanced Standard Profile Kernel
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
|
---|
| 7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
| 8 | * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory
|
---|
| 9 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
| 10 | * Copyright (C) 2015-2019 by TOPPERS PROJECT Educational Working Group.
|
---|
| 11 | *
|
---|
| 12 | * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
|
---|
| 13 | * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
|
---|
| 14 | * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
|
---|
| 15 | * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
---|
| 16 | * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
---|
| 17 | * スコード中に含まれていること.
|
---|
| 18 | * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
---|
| 19 | * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
---|
| 20 | * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
---|
| 21 | * の無保証規定を掲載すること.
|
---|
| 22 | * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
---|
| 23 | * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
|
---|
| 24 | * と.
|
---|
| 25 | * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
---|
| 26 | * 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
---|
| 27 | * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
|
---|
| 28 | * 報告すること.
|
---|
| 29 | * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
---|
| 30 | * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
---|
| 31 | * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
|
---|
| 32 | * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
|
---|
| 33 | * 免責すること.
|
---|
| 34 | *
|
---|
| 35 | * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
---|
| 36 | * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
|
---|
| 37 | * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
|
---|
| 38 | * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
|
---|
| 39 | * の責任を負わない.
|
---|
| 40 | *
|
---|
| 41 | * $Id$
|
---|
| 42 | */
|
---|
| 43 | /*
|
---|
| 44 | * SIPEED OV2640 CAMARE制御プログラムのヘッダファイル
|
---|
| 45 | */
|
---|
| 46 |
|
---|
| 47 | #ifndef _SIPEED_OV2640_H_
|
---|
| 48 | #define _SIPEED_OV2640_H_
|
---|
| 49 |
|
---|
| 50 | #ifdef __cplusplus
|
---|
| 51 | extern "C" {
|
---|
| 52 | #endif
|
---|
| 53 |
|
---|
| 54 | #include "kernel.h"
|
---|
| 55 | #include "dvp.h"
|
---|
| 56 |
|
---|
| 57 | #define OV9650_ID (0x96)
|
---|
| 58 | #define OV2640_ID (0x26)
|
---|
| 59 | #define OV7725_ID (0x77)
|
---|
| 60 | #define MT9V034_ID (0x13)
|
---|
| 61 | #define LEPTON_ID (0x54)
|
---|
| 62 | #define OV_CHIP_ID (0x0A)
|
---|
| 63 | #define ON_CHIP_ID (0x00)
|
---|
| 64 | #define GC0328_ID (0x9d)
|
---|
| 65 | #define GC0328_ADDR (0x42)
|
---|
| 66 |
|
---|
| 67 | #ifndef TOPPERS_MACRO_ONLY
|
---|
| 68 |
|
---|
| 69 | typedef enum {
|
---|
| 70 | FRAMESIZE_INVALID = 0,
|
---|
| 71 | // C/SIF Resolutions
|
---|
| 72 | FRAMESIZE_QQCIF, // 88x72
|
---|
| 73 | FRAMESIZE_QCIF, // 176x144
|
---|
| 74 | FRAMESIZE_CIF, // 352x288
|
---|
| 75 | FRAMESIZE_QQSIF, // 88x60
|
---|
| 76 | FRAMESIZE_QSIF, // 176x120
|
---|
| 77 | FRAMESIZE_SIF, // 352x240
|
---|
| 78 | // VGA Resolutions
|
---|
| 79 | FRAMESIZE_QQQQVGA, // 40x30
|
---|
| 80 | FRAMESIZE_QQQVGA, // 80x60
|
---|
| 81 | FRAMESIZE_QQVGA, // 160x120
|
---|
| 82 | FRAMESIZE_QVGA, // 320x240
|
---|
| 83 | FRAMESIZE_VGA, // 640x480
|
---|
| 84 | FRAMESIZE_HQQQVGA, // 60x40
|
---|
| 85 | FRAMESIZE_HQQVGA, // 120x80
|
---|
| 86 | FRAMESIZE_HQVGA, // 240x160
|
---|
| 87 | // FFT Resolutions
|
---|
| 88 | FRAMESIZE_64X32, // 64x32
|
---|
| 89 | FRAMESIZE_64X64, // 64x64
|
---|
| 90 | FRAMESIZE_128X64, // 128x64
|
---|
| 91 | FRAMESIZE_128X128, // 128x128
|
---|
| 92 | // Other
|
---|
| 93 | FRAMESIZE_LCD, // 128x160
|
---|
| 94 | FRAMESIZE_QQVGA2, // 128x160
|
---|
| 95 | FRAMESIZE_WVGA, // 720x480
|
---|
| 96 | FRAMESIZE_WVGA2, // 752x480
|
---|
| 97 | FRAMESIZE_SVGA, // 800x600
|
---|
| 98 | FRAMESIZE_SXGA, // 1280x1024
|
---|
| 99 | FRAMESIZE_UXGA, // 1600x1200
|
---|
| 100 | FRAMESIZE_CUSTOM,
|
---|
| 101 | } framesize_t;
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 | typedef enum {
|
---|
| 105 | PIXFORMAT_INVLAID = 0,
|
---|
| 106 | PIXFORMAT_BAYER, // RAW
|
---|
| 107 | PIXFORMAT_RGB565, // RGB565
|
---|
| 108 | PIXFORMAT_YUV422, // YUV422
|
---|
| 109 | PIXFORMAT_GRAYSCALE, // GRAYSCALE
|
---|
| 110 | PIXFORMAT_JPEG, // JPEG/COMPRESSED
|
---|
| 111 | } pixformat_t;
|
---|
| 112 |
|
---|
| 113 |
|
---|
| 114 |
|
---|
| 115 | typedef enum {
|
---|
| 116 | GAINCEILING_2X,
|
---|
| 117 | GAINCEILING_4X,
|
---|
| 118 | GAINCEILING_8X,
|
---|
| 119 | GAINCEILING_16X,
|
---|
| 120 | GAINCEILING_32X,
|
---|
| 121 | GAINCEILING_64X,
|
---|
| 122 | GAINCEILING_128X,
|
---|
| 123 | } gainceiling_t;
|
---|
| 124 |
|
---|
| 125 | typedef enum {
|
---|
| 126 | FRAMERATE_2FPS =0x9F,
|
---|
| 127 | FRAMERATE_8FPS =0x87,
|
---|
| 128 | FRAMERATE_15FPS=0x83,
|
---|
| 129 | FRAMERATE_30FPS=0x81,
|
---|
| 130 | FRAMERATE_60FPS=0x80,
|
---|
| 131 | } framerate_t;
|
---|
| 132 |
|
---|
| 133 | typedef enum {
|
---|
| 134 | ACTIVE_LOW,
|
---|
| 135 | ACTIVE_HIGH,
|
---|
| 136 | ACTIVE_BINOCULAR,
|
---|
| 137 | } polarity_t;
|
---|
| 138 |
|
---|
| 139 | typedef struct _OV2640_s {
|
---|
| 140 | DVP_Handle_t *hdvp;
|
---|
| 141 | framesize_t frameSize;
|
---|
| 142 | pixformat_t pixFormat;
|
---|
| 143 |
|
---|
| 144 | uint16_t _width;
|
---|
| 145 | uint16_t _height;
|
---|
| 146 | uint8_t _id;
|
---|
| 147 | uint32_t *_dataBuffer;
|
---|
| 148 | uint32_t *_aiBuffer;
|
---|
| 149 | uint16_t _resetPoliraty;
|
---|
| 150 | uint16_t _pwdnPoliraty;
|
---|
| 151 | uint32_t _slaveAddr;
|
---|
| 152 | } OV2640_t;
|
---|
| 153 |
|
---|
| 154 | extern void ov2640_getResolition(OV2640_t *hcmr, framesize_t frameSize);
|
---|
| 155 | extern ER ov2640_sensor_ov_detect(OV2640_t *hcmr);
|
---|
| 156 | extern ER ov2640_sensro_gc_detect(OV2640_t *hcmr);
|
---|
| 157 | extern ER ov2640_reset(OV2640_t *hcmr);
|
---|
| 158 | extern ER ov2640_set_pixformat(OV2640_t *hcmr);
|
---|
| 159 | extern ER ov2640_set_framesize(OV2640_t *hcmr);
|
---|
| 160 | extern ER ov2640_activate(OV2640_t *hcmr, bool_t run);
|
---|
| 161 | extern ER ov2640_snapshot(OV2640_t *hcmr);
|
---|
| 162 | extern ER ov2640_cambus_scan_gc0328(OV2640_t *hcmr);
|
---|
| 163 | extern int ov2640_id(OV2640_t *hcmr);
|
---|
| 164 |
|
---|
| 165 | extern ER ov2640_setInvert(OV2640_t *hcmr, bool_t invert);
|
---|
| 166 | extern ER ov2640_set_contrast(OV2640_t *hcmr, int level);
|
---|
| 167 | extern ER ov2640_set_brightness(OV2640_t *hcmr, int level);
|
---|
| 168 | extern ER ov2640_set_saturation(OV2640_t *hcmr, int level);
|
---|
| 169 | extern ER ov2640_set_gainceiling(OV2640_t *hcmr, gainceiling_t gainceiling);
|
---|
| 170 | extern ER ov2640_set_quality(OV2640_t *hcmr, int qs);
|
---|
| 171 | extern ER ov2640_set_colorbar(OV2640_t *hcmr, bool_t enable);
|
---|
| 172 | extern ER ov2640_set_auto_exposure(OV2640_t *hcmr, bool_t enable, int exposure_us);
|
---|
| 173 | extern ER ov2640_get_exposure_us(OV2640_t *hcmr, int *exposure_us);
|
---|
| 174 | extern ER ov2640_set_auto_whitebal(OV2640_t *hcmr, bool_t enable, float r_gain_db, float g_gain_db, float b_gain_db);
|
---|
| 175 | extern ER ov2640_set_vflip(OV2640_t *hcmr, bool_t enable);
|
---|
| 176 | #ifdef USE_GAIN
|
---|
| 177 | extern ER ov2640_set_auto_gain(OV2640_t *hcmr, bool_t enable, float gain_db, float gain_db_ceiling);
|
---|
| 178 | extern ER ov2640_get_gain_db(OV2640_t *hcmr, float *gain_db);
|
---|
| 179 | #endif /* USE_GAIN */
|
---|
| 180 |
|
---|
| 181 | #endif /* TOPPERS_MACRO_ONLY */
|
---|
| 182 |
|
---|
| 183 | #ifdef __cplusplus
|
---|
| 184 | }
|
---|
| 185 | #endif
|
---|
| 186 |
|
---|
| 187 | #endif /* _SIPEED_OV2640_H_ */
|
---|
| 188 |
|
---|