blob: 245bca191bc09d691a048c469ab21e7aea8396d5 [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2010
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35
36/*******************************************************************************
37 * Filename:
38 * ---------
39 * ds_if.h
40 *
41 * Project:
42 * --------
43 * ALL
44 *
45 * Description:
46 * ------------
47 * This file is intends for direct sensor interface driver.
48 *
49 * Author:
50 * -------
51 * -------
52 *
53 *============================================================================
54 * HISTORY
55 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
56 *------------------------------------------------------------------------------
57 * removed!
58 * removed!
59 * removed!
60 *
61 * removed!
62 * removed!
63 * removed!
64 *
65 * removed!
66 * removed!
67 * removed!
68 *
69 * removed!
70 * removed!
71 * removed!
72 *
73 * removed!
74 * removed!
75 * removed!
76 *
77 * removed!
78 * removed!
79 * removed!
80 *
81 * removed!
82 * removed!
83 * removed!
84 *
85 *
86 *------------------------------------------------------------------------------
87 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
88 *============================================================================
89 ****************************************************************************/
90#ifndef __DS_IF_H__
91#define __DS_IF_H__
92
93//RHR #include "kal_release.h"
94//MSBB remove #include "kal_non_specific_general_types.h"
95
96
97//Action Id
98#define DS_IF_DATA_BUS_CONTL 0x01
99#define DS_IF_SEN2LCM_SET 0x02
100#define DS_IF_FRAME_DONE_CB_REGISTER 0x04
101#define DS_IF_SENSOR_PAUSE_CB_REGISTER 0x08
102#define DS_IF_SENSOR_RESUME_CB_REGISTER 0x10
103
104
105//Error code
106#define DS_IF_SUCCEED 0x0000
107#define DS_IF_ERR_INVALID_HANDLE 0x0001
108#define DS_IF_ERR_INVALID_ACTION 0x0002
109#define DS_IF_ERR_INVALID_PARA 0x0004
110#define DS_IF_ERR_NOT_ALLOWED_STATE 0x0008
111#define DS_IF_ERR_CALLER_CONTEXT_NOT_ALLOW 0x0010
112#define DS_IF_ERR_CAL_NOT_DIRECT_SENSOR 0x0020
113#define DS_IF_ERR_CAL_NOT_CONFIG_HW_TIMING 0x0040
114#define DS_IF_ERR_NOT_REGISTERED_CB 0x0080
115#define DS_IF_ERR_TOO_MANY_USERS 0x8000
116
117
118
119#define USER_HANDLE_FOR_NON_DIRECT_SENSOR 0x0
120#define DUMMY_USER_HANDLE_FOR_TOO_MANY_USERS 0xF1
121
122
123typedef void (*DS_CB_FUNC)(void * cb_para);
124
125typedef enum
126{
127 DS_IF_STATE_INIT= 0,
128 DS_IF_STATE_READY = 1,
129 DS_IF_STATE_BUS = 2,
130 DS_IF_STATE_BUSY = 3
131} DS_IF_STATE_E;
132
133
134typedef enum
135{
136 UNKNOWN_SENSOR = 0,
137 DIRECT_SENSOR = 1,
138 SERIAL_SENSOR = 2,
139 PARALLEL_SENSOR= 3
140} SENSOR_IF_TYPE;
141
142typedef enum
143{
144 CAL_DS_IF_USER = 0,
145 LCD_DS_IF_USER,
146 MAX_DS_IF_USERS
147} DS_IF_USER;
148
149
150typedef struct
151{
152 kal_uint16 para_1;
153 kal_uint16 para_2;
154 kal_uint16 para_3;
155 kal_uint16 para_4;
156 kal_uint16 para_5;
157 kal_uint16 para_6;
158 kal_bool para_7;
159 kal_bool para_8;
160 kal_bool para_9;
161 kal_uint32 para_10;
162} DS_SEN2LCM_T;
163
164
165typedef struct
166{
167//only valid for action DS_DATA_BUS_CONTL been asserted.
168kal_bool data_bus_control_take; // KAL_TRUE for taken, KAL_FALSE for release,
169// only valid for DS_SEN2LCM_SET been asserted.
170DS_SEN2LCM_T sen2lcm_setting;
171// only valid for DS_FRAME_DONE_CB_REGISTER been asserted.
172kal_bool repeat_callback; // KAL_TRUE for repeat, KAL_FALSE for first frame only
173DS_CB_FUNC frame_done_cb_func;
174// only valid for DS_SENSOR_PAUSE_CB_REGISTER been asserted.
175DS_CB_FUNC sensor_pause;
176// only valid for DS_SENSOR_RESUME_CB_REGISTER been asserted.
177DS_CB_FUNC sensor_resume;
178} DS_CONFG_T;
179
180
181/**
182 * Get user handle for other function call usage afterwards.
183 * @param sensor : sensor type
184 * @param user_id : predefine user id
185 * @return kal_uint32 : user handle
186 * @remarks This function return user handle, which is valid on for DIRECT_SENSOR.
187 * Other sensor type returned handle is not effective in following call.
188 */
189kal_uint32 ds_if_open(SENSOR_IF_TYPE sensor, DS_IF_USER user_id);
190
191
192/**
193 * release user handle and close usage privilege.
194 * @param handle : user handle
195 * @return kal_uint32 : error code
196 * @remarks This function must call after ds_if_open() and can not call in HW interface busy state.
197 *
198 */
199kal_uint32 ds_if_close(kal_uint32 handle);
200
201
202/**
203 * configure the HW parameters or others
204 * @param handle : user handle
205 * @param action : action id
206 * @param para : parameters corresponding to action id
207 * @return kal_uint32 : error code
208 * @remarks This function must call after ds_if_open() and can not call in HW interface busy state.
209 *
210 */
211kal_uint32 ds_if_config(kal_uint32 handle, kal_uint32 action, DS_CONFG_T* para);
212
213
214/**
215 * start HW for direct sensor mode display
216 * @param handle : user handle
217 * @return kal_uint32 : error code
218 * @remarks This function must call after ds_if_open() and can not call in HW interface busy state.
219 *
220 */
221kal_uint32 ds_if_start (kal_uint32 handle);
222
223
224/**
225 * stop HW which is in direct sensor mode display
226 * @param handle : user handle
227 * @return kal_uint32 : error code
228 * @remarks This function must call after ds_if_open() and after ds_if_start( ). That is, only stop HW when HW is in busy state
229 *
230 */
231kal_uint32 ds_if_stop (kal_uint32 handle);
232
233
234
235/**
236 * query current HW(direct sensor interface) state
237 * @param
238 * @return DS_IF_STATE_E : HW state
239 * @remarks After first call ds_if_open() the state change from INIT to READY. Afterwards, BUS, or BUSY states transition depends on data bus and hw status.
240 *
241 */
242DS_IF_STATE_E ds_if_query_state (void);
243
244//only for lcd driver
245kal_uint32 ds_if_pause_sensor_cb (kal_uint32 handle);
246
247//only for lcd driver
248kal_uint32 ds_if_resume_sensor_cb (kal_uint32 handle);
249
250//only call from lcd_Hisr
251kal_uint32 ds_if_hisr(kal_uint32 intr_status);
252
253//only for lcd driver
254void lcd_set_ds_a0_polarity(unsigned long a0);
255
256//only for lcd driver
257kal_uint32 ds_if_enable_per_frame_lcm_roi_coms (kal_uint32 handle, kal_bool on_Noff);
258
259#endif /*__DS_IF_H__*/
260