dcl_common.h
4.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2001
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* dcl_common.h
*
* Project:
* --------
* Maui
*
* Description:
* ------------
* Header file of DCL (Driver Common Layer).
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#ifndef __DCL_COMMON_H__
#define __DCL_COMMON_H__
//this file only for DCL common layer user
typedef enum{
DCL_USER_GENERAL,
DCL_USER_MRE,
DCL_USER_DRV_GENERAL = 0x100
}DCL_USER_ID;
//this enum used to replace the module_type enum at the MRE APP level.
//module_type is 16 bit at present, but if it changed in the future or the compiler changed(treat the enum as 32bits always),
//there will be error. So use another enum to simulate it.
typedef enum{
MODULE_START = 0,
MODULE_END = 0x1FF//make sure this enum will be at least 16bit.
}DCL_MODULE_TYPE;
//this enum used to hold the data transfer from ilm
typedef struct{
void *local_para_ptr; /* local_para pointer */
void *peer_buff_ptr; /* peer_buff pointer */
}DCL_CB_ILM_DATA;
/*******************************************************************************
* DCL_CALLBACK
*******************************************************************************/
typedef void (*DCL_CALLBACK)(void* param, DCL_EVENT event,DCL_HANDLE handle);
/*******************************************************************************
* API:
*******************************************************************************/
DCL_HANDLE DCL_Open(DCL_DEV dev, DCL_FLAGS flags);
DCL_STATUS DCL_Control (
DCL_HANDLE device_handle,
DCL_CTRL_CMD cmd,
void* arg);
DCL_STATUS DCL_Close(DCL_HANDLE device_handle);
DCL_STATUS DCL_RegisterCallback(
DCL_HANDLE device_handle,
DCL_EVENT event,
DCL_CALLBACK callback,
void* user_data,
DCL_USER_ID user_id);
DCL_STATUS DCL_Query(
DCL_HANDLE device_handle,
void* handle_status);
DCL_STATUS DCL_Read(
DCL_HANDLE device_handle,
DCL_BUFF* buf,
DCL_BUFF_LEN read_len,
DCL_BUFF_LEN * returned_len,
DCL_OPTIONS options);
DCL_STATUS DCL_Write(
DCL_HANDLE device_handle,
DCL_BUFF* buf,
DCL_BUFF_LEN write_len,
DCL_BUFF_LEN* written_len,
DCL_OPTIONS options);
DCL_MODULE_TYPE DCL_GetDestinationID(DCL_USER_ID user_id);
/*******************************************************************************
* DCL structure for device drivers
*******************************************************************************/
typedef struct {
DCL_HANDLE (*DCL_DrvOpen)(DCL_DEV device_number, DCL_FLAGS flags);
DCL_STATUS (*DCL_DrvRead)(
DCL_HANDLE device_handle,
DCL_BUFF* buffer,
DCL_BUFF_LEN read_len,
DCL_BUFF_LEN * returned_len,
DCL_OPTIONS option);
DCL_STATUS (*DCL_DrvWrite)(
DCL_HANDLE device_handle,
DCL_BUFF* buf,
DCL_BUFF_LEN write_len,
DCL_BUFF_LEN* written_len,
DCL_OPTIONS option) ;
DCL_STATUS (*DCL_DrvControl) (
DCL_HANDLE device_handle,
DCL_CTRL_CMD cmd,
void* arg);
DCL_STATUS (*DCL_DrvRegisterCallback)(
DCL_HANDLE device_handle,
DCL_EVENT event,
DCL_CALLBACK callback,
void* user_data,
DCL_USER_ID user_id);
DCL_STATUS (*DCL_DrvQuery)(
DCL_HANDLE device_handle,
void* handle_status);
DCL_STATUS (*DCL_DrvClose)(DCL_HANDLE device_handle);
}DEV_Operations;
typedef struct{
DCL_STATUS (*DCL_DrvQueryHandleWithMSG)(
msg_type msg_id,
ilm_struct* ilm,
DCL_HANDLE* dev_handle);
}DEV_Utility;
typedef struct {
DCL_EVENT event_id;
msg_type msg_id;
}DCL_EVENT_MSG_PAIR;
typedef struct {
DCL_INT32 count;
DCL_EVENT_MSG_PAIR* event_msg_pairs;
}DCL_EVENT_MSG_MAP;
typedef struct{
DCL_INT32 user_handle;
DCL_UINT16 start_number;
DCL_UINT16 end_number;
DEV_Operations* dev_operations;
DEV_Utility* dev_utility;
DCL_EVENT_MSG_MAP* event_msg_map;
}DCL_DEVICE_T;
#endif /* __DCL_COMMON_H__ */