summaryrefslogtreecommitdiffstats
path: root/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage_dep.h
blob: 566b244bd8c552eb860e3957c1a0eb30227378cb (plain)
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
/* Cypress West Bridge API header file (cyanstorage_dep.h)
## ===========================
## Copyright (C) 2010  Cypress Semiconductor
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street
## Fifth Floor, Boston, MA  02110-1301, USA.
## ===========================
*/

/* This header will contain Antioch specific declaration
 * of the APIs that are deprecated in Astoria SDK. This is
 * for maintaining backward compatibility
 */
#ifndef __INCLUDED_CYANSTORAGE_DEP_H__
#define __INCLUDED_CYANSTORAGE_DEP_H__

#ifndef __doxygen__

typedef void (*cy_as_storage_callback_dep)(
/* Handle to the device completing the storage operation */
	cy_as_device_handle handle,
	/* The media type completing the operation */
	cy_as_media_type type,
	/* The device completing the operation */
	uint32_t device,
	/* The unit completing the operation */
	uint32_t unit,
	/* The block number of the completed operation */
	uint32_t block_number,
	/* The type of operation */
	cy_as_oper_type op,
	/* The error status */
	cy_as_return_status_t status
	);

typedef void (*cy_as_storage_event_callback_dep)(
	/* Handle to the device sending the event notification */
	cy_as_device_handle handle,
	/* The media type */
	cy_as_media_type type,
	/* The event type */
	cy_as_storage_event evtype,
	/* Event related data */
	void *evdata
	);

typedef struct cy_as_storage_query_device_data_dep {
	/* The type of media to query */
	cy_as_media_type	type;
	/* The logical device number to query */
	uint32_t		device;
	/* The return value for the device descriptor */
	cy_as_device_desc	 desc_p;
} cy_as_storage_query_device_data_dep;

typedef struct cy_as_storage_query_unit_data_dep {
	/* The type of media to query */
	cy_as_media_type	type;
	/* The logical device number to query */
	uint32_t	device;
	/* The unit to query on the device */
	uint32_t	unit;
	/* The return value for the unit descriptor */
	cy_as_unit_desc	 desc_p;
} cy_as_storage_query_unit_data_dep;


/************ FUNCTIONS *********************/

EXTERN cy_as_return_status_t
cy_as_storage_register_callback_dep(
	/* Handle to the device of interest */
	cy_as_device_handle	handle,
	/* The callback function to call for async storage events */
	cy_as_storage_event_callback_dep callback
	);

EXTERN cy_as_return_status_t
cy_as_storage_claim_dep(cy_as_device_handle handle,
		   cy_as_media_type type
		   );

EXTERN cy_as_return_status_t
cy_as_storage_claim_dep_EX(
	/* Handle to the device of interest */
	cy_as_device_handle		handle,
	/* The type of media to claim */
	cy_as_media_type	*type,
	/* Callback to be called when the operation is complete */
	cy_as_function_callback	cb,
	/* Client data to be passed to the callback */
	uint32_t	client
	);

EXTERN cy_as_return_status_t
cy_as_storage_release_dep(cy_as_device_handle handle,
			 cy_as_media_type type
			 );

EXTERN cy_as_return_status_t
cy_as_storage_release_dep_EX(
	/* Handle to the device of interest */
	cy_as_device_handle		handle,
	/* Handle to the device of interest */
	cy_as_media_type	*type,
	/* Callback to be called when the operation is complete */
	cy_as_function_callback		cb,
	/* Client data to be passed to the callback */
	uint32_t			client
	);

EXTERN cy_as_return_status_t
cy_as_storage_query_device_dep(
			cy_as_device_handle handle,
			 cy_as_media_type media,
			 uint32_t device,
			 cy_as_device_desc *desc_p
			 );

EXTERN cy_as_return_status_t
cy_as_storage_query_device_dep_EX(
	/* Handle to the device of interest */
	cy_as_device_handle		handle,
	/* Parameters and return value for the query call */
	cy_as_storage_query_device_data_dep *data,
	/* Callback to be called when the operation is complete */
	cy_as_function_callback		cb,
	/* Client data to be passed to the callback */
	uint32_t client
	);

EXTERN cy_as_return_status_t
cy_as_storage_query_unit_dep(
	/* Handle to the device of interest */
	cy_as_device_handle	handle,
	/* The type of media to query */
	cy_as_media_type		type,
	/* The logical device number to query */
	uint32_t			device,
	/* The unit to query on the device */
	uint32_t			unit,
	/* The return value for the unit descriptor */
	cy_as_unit_desc *unit_p
	);

EXTERN cy_as_return_status_t
cy_as_storage_query_unit_dep_EX(
	/* Handle to the device of interest */
	cy_as_device_handle	handle,
	/* Parameters and return value for the query call */
	cy_as_storage_query_unit_data_dep *data_p,
	/* Callback to be called when the operation is complete */
	cy_as_function_callback	cb,
	/* Client data to be passed to the callback */
	uint32_t client
	);

EXTERN cy_as_return_status_t
cy_as_storage_device_control_dep(
	/* Handle to the West Bridge device */
	cy_as_device_handle	   handle,
	/* Enable/disable control for card detection */
	cy_bool				 card_detect_en,
	/* Enable/disable control for write protect handling */
	cy_bool				 write_prot_en,
	/* Callback to be called when the operation is complete */
	cy_as_function_callback   cb,
	/* Client data to be passed to the callback */
	uint32_t			   client
	);


EXTERN cy_as_return_status_t
cy_as_storage_read_dep(
	/* Handle to the device of interest */
	cy_as_device_handle	handle,
	/* The type of media to access */
	cy_as_media_type type,
	/* The device to access */
	uint32_t device,
	/* The unit to access */
	uint32_t unit,
	/* The first block to access */
	uint32_t block,
	/* The buffer where data will be placed */
	void *data_p,
	/* The number of blocks to be read */
	uint16_t			num_blocks
	);

EXTERN cy_as_return_status_t
cy_as_storage_read_async_dep(
	/* Handle to the device of interest */
	cy_as_device_handle		handle,
	/* The type of media to access */
	cy_as_media_type	type,
	/* The device to access */
	uint32_t	device,
	/* The unit to access */
	uint32_t	unit,
	/* The first block to access */
	uint32_t		block,
	/* The buffer where data will be placed */
	void *data_p,
	/* The number of blocks to be read */
	uint16_t num_blocks,
	/* The function to call when the read is complete
		or an error occurs */
	cy_as_storage_callback_dep		callback
	);
EXTERN cy_as_return_status_t
cy_as_storage_write_dep(
	/* Handle to the device of interest */
	cy_as_device_handle	handle,
	/* The type of media to access */
	cy_as_media_type type,
	/* The device to access */
	uint32_t	device,
	/* The unit to access */
	uint32_t	unit,
	/* The first block to access */
	uint32_t	block,
	/* The buffer containing the data to be written */
	void	*data_p,
	/* The number of blocks to be written */
	uint16_t num_blocks
	);

EXTERN cy_as_return_status_t
cy_as_storage_write_async_dep(
	/* Handle to the device of interest */
	cy_as_device_handle	handle,
	/* The type of media to access */
	cy_as_media_type	type,
	/* The device to access */
	uint32_t	device,
	/* The unit to access */
	uint32_t	unit,
	/* The first block to access */
	uint32_t	block,
	/* The buffer where the data to be written is stored */
	void *data_p,
	/* The number of blocks to be written */
	uint16_t num_blocks,
	/* The function to call when the write is complete
	or an error occurs */
	cy_as_storage_callback_dep			callback
	);

EXTERN cy_as_return_status_t
cy_as_storage_sd_register_read_dep(
		cy_as_device_handle		handle,
		cy_as_media_type		   type,
		uint8_t				 device,
		cy_as_sd_card_reg_type	   reg_type,
		uint8_t				 read_len,
		uint8_t				 *data_p
		);

EXTERN cy_as_return_status_t
cy_as_storage_sd_register_read_dep_EX(
	/* Handle to the West Bridge device. */
	cy_as_device_handle	handle,
	/* The type of media to query */
	cy_as_media_type type,
	/* The device to query */
	uint8_t	device,
	/* The type of register to read. */
	cy_as_sd_card_reg_type	reg_type,
	/* Output data buffer and length. */
	cy_as_storage_sd_reg_read_data	 *data_p,
	/* Callback function to call when done. */
	cy_as_function_callback	cb,
	/* Call context to send to the cb function. */
	uint32_t	client
	);

EXTERN cy_as_return_status_t
cy_as_storage_create_p_partition_dep(
		cy_as_device_handle	 handle,
		cy_as_media_type		media,
		uint32_t			 device,
		uint32_t			 size,
		cy_as_function_callback cb,
		uint32_t			 client);

EXTERN cy_as_return_status_t
cy_as_storage_remove_p_partition_dep(
		cy_as_device_handle		handle,
		cy_as_media_type		   media,
		uint32_t				device,
		cy_as_function_callback	cb,
		uint32_t				client);

#endif /*__doxygen*/

#endif /*__INCLUDED_CYANSTORAGE_DEP_H__*/
OpenPOWER on IntegriCloud