source: azure_iot_hub_riscv/trunk/asp_baseplatform/pdic/k210/dvp.h@ 453

Last change on this file since 453 was 453, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 9.0 KB
Line 
1/*
2 * TOPPERS/ASP Kernel
3 * Toyohashi Open Platform for Embedded Real-Time Systems/
4 * Advanced Standard Profile Kernel
5 *
6 * Copyright (C) 2008-2011 by Embedded and Real-Time Systems Laboratory
7 * Graduate School of Information Science, Nagoya Univ., JAPAN
8 * Copyright (C) 2015-2019 by TOPPERS PROJECT Educational Working Group.
9 *
10 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
11 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
12 * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
13 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
14 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
15 * スコード中に含まれていること.
16 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
17 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
18 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
19 * の無保証規定を掲載すること.
20 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
21 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
22 * と.
23 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
24 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
25 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
26 * 報告すること.
27 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
28 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
29 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
30 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
31 * 免責すること.
32 *
33 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
34 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
35 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
36 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
37 * の責任を負わない.
38 *
39 * @(#) $Id$
40 */
41/*
42 *
43 * K210 DVPデバイスドライバの外部宣言
44 *
45 */
46
47#ifndef _DVP_H_
48#define _DVP_H_
49
50#include <kernel.h>
51#include <target_syssvc.h>
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57#define TADR_DVP_BASE (DVP_BASE_ADDR)
58#define TOFF_DVP_CFG 0x0000 /* (RW) DVP Config Register */
59 #define DVP_CFG_START_INT_ENABLE 0x00000001
60 #define DVP_CFG_FINISH_INT_ENABLE 0x00000002
61 #define DVP_CFG_AI_OUTPUT_ENABLE 0x00000004
62 #define DVP_CFG_DISPLAY_OUTPUT_ENABLE 0x00000008
63 #define DVP_CFG_AUTO_ENABLE 0x00000010
64 #define DVP_CFG_BURST_SIZE_4BEATS 0x00000100
65 #define DVP_CFG_FORMAT_MASK 0x00000600
66 #define DVP_CFG_RGB_FORMAT 0x00000000
67 #define DVP_CFG_YUV_FORMAT 0x00000200
68 #define DVP_CFG_Y_FORMAT 0x00000600
69 #define DVP_CFG_HREF_BURST_NUM_MASK 0x000FF000
70 #define DVP_CFG_LINE_NUM_MASK 0x3FF00000
71#define TOFF_DVP_R_ADDR 0x0004 /* (RW) RED ADDRESS */
72#define TOFF_DVP_G_ADDR 0x0008 /* (RW) GREEN ADDRESS */
73#define TOFF_DVP_B_ADDR 0x000C /* (RW) BLUE ADDRESS */
74#define TOFF_DVP_CMOS_CFG 0x0010 /* (RW) DVP CMOS Config Register */
75 #define DVP_CMOS_CLK_DIV_MASK 0x000000FF
76 #define DVP_CMOS_CLK_DIV(x) ((x) << 0)
77 #define DVP_CMOS_CLK_ENABLE 0x00000100
78 #define DVP_CMOS_RESET 0x00010000
79 #define DVP_CMOS_POWER_DOWN 0x01000000
80#define TOFF_DVP_SCCB_CFG 0x0014 /* (RW) DVP SCCB Config Register */
81 #define DVP_SCCB_BYTE_NUM_MASK 0x00000003
82 #define DVP_SCCB_BYTE_NUM_2 0x00000001
83 #define DVP_SCCB_BYTE_NUM_3 0x00000002
84 #define DVP_SCCB_BYTE_NUM_4 0x00000003
85 #define DVP_SCCB_SCL_LCNT_MASK 0x0000FF00
86 #define DVP_SCCB_SCL_HCNT_MASK 0x00FF0000
87 #define DVP_SCCB_RDATA_BYTE_MASK 0xFF000000
88#define TOFF_DVP_SCCB_CTL 0x0018 /* (RW) DVP SCCB Control Register */
89 #define DVP_SCCB_WRITE_DATA_ENABLE 0x00000001
90 #define DVP_SCCB_DEVICE_ADDRESS 0x000000FF
91 #define DVP_SCCB_REG_ADDRESS 0x0000FF00
92 #define DVP_SCCB_WDATA_BYTE0 0x00FF0000
93 #define DVP_SCCB_WDATA_BYTE1 0xFF000000
94#define TOFF_DVP_AXI 0x001C /* (RW) DVP AXI Register */
95 #define DVP_AXI_GM_MLEN_MASK 0x000000FF
96 #define DVP_AXI_GM_MLEN_1BYTE 0x00000000
97 #define DVP_AXI_GM_MLEN_4BYTE 0x00000003
98#define TOFF_DVP_STS 0x0020 /* (RW) DVP STS Register */
99 #define DVP_STS_FRAME_START 0x00000001
100 #define DVP_STS_FRAME_START_WE 0x00000002
101 #define DVP_STS_FRAME_FINISH 0x00000100
102 #define DVP_STS_FRAME_FINISH_WE 0x00000200
103 #define DVP_STS_DVP_EN 0x00010000
104 #define DVP_STS_DVP_EN_WE 0x00020000
105 #define DVP_STS_SCCB_EN 0x01000000
106 #define DVP_STS_SCCB_EN_WE 0x02000000
107#define TOFF_DVP_RGB_ADDR 0x0028 /* (RW) DVP RGB ADDRESS */
108
109
110/*
111 * BURSTモード設定
112 */
113#define DVP_BURST_ENABLE DVP_CFG_BURST_SIZE_4BEATS
114#define DVP_BURST_DISABLE 0
115
116/*
117 * AUTOモード設定
118 */
119#define DVP_AUTOMODE_ENABLE DVP_CFG_AUTO_ENABLE
120#define DVP_AUTOMODE_DISABLE 0
121
122/*
123 * DVPイメージフォーマット設定
124 */
125#define DVP_FORMAT_RGB DVP_CFG_RGB_FORMAT
126#define DVP_FORMAT_YUY DVP_CFG_YUV_FORMAT
127#define DVP_FORMAT_Y DVP_CFG_Y_FORMAT
128
129/*
130 * DVP状態定義
131 */
132#define DVP_STATE_INIT 0
133#define DVP_STATE_READY 1
134#define DVP_STATE_ACTIVATE 2
135#define DVP_STATE_STARTED 3
136#define DVP_STATE_FINISH 4
137
138
139#define INHNO_DVP IRQ_VECTOR_DVP /* 割込みハンドラ番号 */
140#define INTNO_DVP IRQ_VECTOR_DVP /* 割込み番号 */
141#define INTPRI_DVP -3 /* 割込み優先度 */
142#define INTATR_DVP 0 /* 割込み属性 */
143
144#ifndef TOPPERS_MACRO_ONLY
145
146/*
147 * DVP 設定初期設定構造体
148 */
149typedef struct
150{
151 uint32_t Freq; /* DVP 周波数設定 */
152 uint32_t RedAddr; /* DVP Readアドレス設定 */
153 uint32_t GreenAddr; /* DVP Greenアドレス設定 */
154 uint32_t BlueAddr; /* DVP Blueアドレス設定 */
155 uint32_t RGBAddr; /* DVP RGBアドレス設定 */
156
157 uint32_t Format; /* DVP イメージフォーマット */
158 uint32_t BurstMode; /* DVP ブーストモード設定 */
159 uint32_t AutoMode; /* DVP オートモード設定 */
160 uint32_t GMMlen; /* DVP GM MLEN設定 */
161 uint16_t Width; /* DVP 幅設定 */
162 uint16_t Height; /* DVP 高さ設定 */
163 uint8_t num_sccb_reg; /* DVP SCCBレジスタ長 */
164 int8_t CMosPClkPin; /* DVP PCLKピン設定 */
165 int8_t CMosXClkPin; /* DVP XCLKピン設定 */
166 int8_t CMosHRefPin; /* DVP HREFピン設定 */
167 int8_t CMosPwDnPin; /* DVP パワーダウン設定 */
168 int8_t CMosVSyncPin; /* DVP VSYNCピン設定 */
169 int8_t CMosRstPin; /* DVP リセットピン設定 */
170 int8_t SccbSClkPin; /* DVP SCCB SCLKピン設定 */
171 int8_t SccbSdaPin; /* DVP SCCB SDAピン設定 */
172 uint8_t dummy;
173 uint16_t IntNo; /* DVP 割込み番号 */
174 int semlock; /* SPI ロックセマフォ値 */
175}DVP_Init_t;
176
177/*
178 * SPIハンドラ
179 */
180typedef struct _DVP_Handle_t
181{
182 unsigned long base; /* DVP registers base address */
183 DVP_Init_t Init; /* DVP communication parameters */
184 ID semid; /* DVP semaphore id */
185 volatile uint16_t state; /* DVP state */
186 volatile uint16_t ErrorCode; /* DVP Error code */
187}DVP_Handle_t;
188
189
190extern ER dvp_init(DVP_Handle_t *hdvp);
191extern ER dvp_deinit(DVP_Handle_t *hdvp);
192extern ER dvp_activate(DVP_Handle_t *hdvp, bool_t run);
193extern ER dvp_set_image_format(DVP_Handle_t *hdvp);
194extern ER dvp_set_image_size(DVP_Handle_t *hdvp);
195extern uint32_t dvp_sccb_set_clk_rate(DVP_Handle_t *hdvp, uint32_t clk_rate);
196extern ER dvp_dcmi_reset(DVP_Handle_t *hdvp, bool_t reset);
197extern ER dvp_dcmi_powerdown(DVP_Handle_t *hdvp, bool_t down);
198extern void dvp_sccb_send_data(DVP_Handle_t *hdvp, uint8_t dev_addr, uint16_t reg_addr, uint8_t reg_data);
199extern uint8_t dvp_sccb_receive_data(DVP_Handle_t *hdvp, uint8_t dev_addr, uint16_t reg_addr);
200extern void dvp_handler(void);
201
202#endif /* TOPPERS_MACRO_ONLY */
203
204#ifdef __cplusplus
205}
206#endif
207
208#endif /* _DVP_H_ */
209
Note: See TracBrowser for help on using the repository browser.