omap3530/beagle_drivers/wb/api/include/cyanstorage.h
changeset 27 117faf51deac
equal deleted inserted replaced
26:b7e488c49d0d 27:117faf51deac
       
     1 /*  Cypress West Bridge API header file (cyanstorage.h)
       
     2  ## Header for backward compatibility with previous releases of Antioch SDK.
       
     3  ## ===========================
       
     4  ##
       
     5  ##  Copyright Cypress Semiconductor Corporation, 2006-2009,
       
     6  ##  All Rights Reserved
       
     7  ##  UNPUBLISHED, LICENSED SOFTWARE.
       
     8  ##
       
     9  ##  CONFIDENTIAL AND PROPRIETARY INFORMATION
       
    10  ##  WHICH IS THE PROPERTY OF CYPRESS.
       
    11  ##
       
    12  ##  Use of this file is governed
       
    13  ##  by the license agreement included in the file
       
    14  ##
       
    15  ##     <install>/license/license.txt
       
    16  ##
       
    17  ##  where <install> is the Cypress software
       
    18  ##  installation root directory path.
       
    19  ##
       
    20  ## ===========================
       
    21 */
       
    22 
       
    23 #ifndef _INCLUDED_CYANSTORAGE_H_
       
    24 #define _INCLUDED_CYANSTORAGE_H_
       
    25 #ifndef __doxygen__
       
    26 
       
    27 #include "cyanmedia.h"
       
    28 #include "cyanmisc.h"
       
    29 #include "cyasstorage.h"
       
    30 #include "cyas_cplus_start.h"
       
    31 
       
    32 #define CY_AN_LUN_PHYSICAL_DEVICE				(CY_AS_LUN_PHYSICAL_DEVICE)
       
    33 #define CY_AN_STORAGE_EP_SIZE                                   (CY_AS_STORAGE_EP_SIZE)
       
    34 
       
    35 #define	CyAnStorageAntioch	CyAsStorageAntioch
       
    36 #define	CyAnStorageProcessor	CyAsStorageProcessor
       
    37 #define	CyAnStorageRemoved	CyAsStorageRemoved
       
    38 #define	CyAnStorageInserted	CyAsStorageInserted
       
    39 #define	CyAnSdioInterrupt	CyAsSdioInterrupt
       
    40 typedef CyAsStorageEvent    CyAnStorageEvent;
       
    41 
       
    42 #define	CyAnOpRead	 CyAsOpRead
       
    43 #define	CyAnOpWrite	 CyAsOpWrite
       
    44 typedef CyAsOperType CyAnOperType;
       
    45 
       
    46 typedef CyAsDeviceDesc CyAnDeviceDesc;
       
    47 
       
    48 typedef CyAsUnitDesc CyAnUnitDesc;
       
    49 
       
    50 typedef CyAsStorageCallback_dep CyAnStorageCallback;
       
    51 
       
    52 typedef CyAsStorageEventCallback_dep CyAnStorageEventCallback;
       
    53 
       
    54 #define	CyAnSDReg_OCR CyAsSDReg_OCR
       
    55 #define	CyAnSDReg_CID CyAsSDReg_CID
       
    56 #define	CyAnSDReg_CSD CyAsSDReg_CSD
       
    57 typedef CyAsSDCardRegType CyAnSDCardRegType;
       
    58 
       
    59 typedef CyAsStorageQueryDeviceData_dep CyAnStorageQueryDeviceData ;
       
    60 
       
    61 typedef CyAsStorageQueryUnitData_dep CyAnStorageQueryUnitData ;
       
    62 
       
    63 typedef CyAsStorageSDRegReadData CyAnStorageSDRegReadData;
       
    64 
       
    65 #define CY_AN_SD_REG_OCR_LENGTH         (CY_AS_SD_REG_OCR_LENGTH)
       
    66 #define CY_AN_SD_REG_CID_LENGTH         (CY_AS_SD_REG_CID_LENGTH)
       
    67 #define CY_AN_SD_REG_CSD_LENGTH         (CY_AS_SD_REG_CSD_LENGTH)
       
    68 #define CY_AN_SD_REG_MAX_RESP_LENGTH    (CY_AS_SD_REG_MAX_RESP_LENGTH)
       
    69 
       
    70 /**** API Functions ******/
       
    71 
       
    72 /* Sync version of Storage Start */
       
    73 EXTERN CyAnReturnStatus_t
       
    74 CyAnStorageStart(
       
    75 	CyAnDeviceHandle		handle
       
    76 	) ;
       
    77 #define CyAnStorageStart(handle) CyAsStorageStart((CyAsDeviceHandle)(handle), 0, 0)
       
    78 
       
    79 /* Async version of Storage Start */
       
    80 EXTERN CyAnReturnStatus_t
       
    81 CyAnStorageStartEX(
       
    82 	CyAnDeviceHandle	handle,
       
    83 	CyAnFunctionCallback	cb,
       
    84 	uint32_t		client
       
    85 	) ;
       
    86 #define CyAnStorageStartEX(h, cb, client)		\
       
    87     CyAsStorageStart((CyAsDeviceHandle)(h), (CyAsFunctionCallback)(cb), (client))
       
    88 
       
    89 /* Sync version of Storage Stop */
       
    90 EXTERN CyAnReturnStatus_t
       
    91 CyAnStorageStop(
       
    92 	CyAnDeviceHandle		handle
       
    93 	) ;
       
    94 #define CyAnStorageStop(handle) CyAsStorageStop((CyAsDeviceHandle)(handle), 0, 0)
       
    95 
       
    96 /* Async version of Storage Stop */
       
    97 EXTERN CyAnReturnStatus_t
       
    98 CyAnStorageStopEX(
       
    99 	CyAnDeviceHandle	handle,
       
   100 	CyAnFunctionCallback	cb,
       
   101 	uint32_t		client
       
   102 	) ;
       
   103 #define CyAnStorageStopEX(h, cb, client)		\
       
   104     CyAsStorageStop((CyAsDeviceHandle)(h), (CyAsFunctionCallback)(cb), (client))
       
   105 
       
   106 /* Register Call back api */
       
   107 EXTERN CyAnReturnStatus_t
       
   108 CyAnStorageRegisterCallback(
       
   109 	CyAnDeviceHandle	        handle,
       
   110 	CyAnStorageEventCallback	callback
       
   111 	) ;
       
   112 #define CyAnStorageRegisterCallback(h, cb)		\
       
   113     CyAsStorageRegisterCallback_dep((CyAsDeviceHandle)(h), (CyAsStorageEventCallback_dep)(cb))
       
   114 
       
   115 /* Sync version of Storage Claim */
       
   116 EXTERN CyAnReturnStatus_t
       
   117 CyAnStorageClaim(
       
   118 	CyAnDeviceHandle		handle,
       
   119 	CyAnMediaType			type
       
   120 	) ;
       
   121 #define CyAnStorageClaim(h, type)			\
       
   122     CyAsStorageClaim_dep((CyAsDeviceHandle)(h), (CyAsMediaType)(type))
       
   123 
       
   124 /* Async version of Storage Claim */
       
   125 EXTERN CyAnReturnStatus_t
       
   126 CyAnStorageClaimEX(
       
   127 	CyAnDeviceHandle		handle,
       
   128 	CyAnMediaType*			type,
       
   129 	CyAnFunctionCallback		cb,
       
   130 	uint32_t			client
       
   131 	) ;
       
   132 #define CyAnStorageClaimEX(h, type_p, cb, client)		\
       
   133     CyAsStorageClaim_dep_EX((CyAsDeviceHandle)(h), (CyAsMediaType *)(type_p), (CyAsFunctionCallback)(cb), (client))
       
   134 
       
   135 /* Sync Version of Storage Release */
       
   136 EXTERN CyAnReturnStatus_t
       
   137 CyAnStorageRelease(
       
   138 	CyAnDeviceHandle		handle,
       
   139 	CyAnMediaType			type
       
   140 	) ;
       
   141 #define CyAnStorageRelease(h, type)			\
       
   142     CyAsStorageRelease_dep((CyAsDeviceHandle)(h), (CyAsMediaType)(type))
       
   143 
       
   144 /* Async Version of Storage Release */
       
   145 EXTERN CyAnReturnStatus_t
       
   146 CyAnStorageReleaseEX(
       
   147 	CyAnDeviceHandle		handle,
       
   148 	CyAnMediaType*			type,
       
   149 	CyAnFunctionCallback		cb,
       
   150 	uint32_t			client
       
   151 	) ;
       
   152 #define CyAnStorageReleaseEX(h, type_p, cb, client)	\
       
   153     CyAsStorageRelease_dep_EX((CyAsDeviceHandle)(h), (CyAsMediaType *)(type_p), (CyAsFunctionCallback)(cb), (client))
       
   154 
       
   155 /* Sync version of Query Media */
       
   156 EXTERN CyAnReturnStatus_t
       
   157 CyAnStorageQueryMedia(
       
   158 	CyAnDeviceHandle		handle,
       
   159 	CyAnMediaType			type,
       
   160 	uint32_t *			count
       
   161 	) ;
       
   162 #define CyAnStorageQueryMedia(handle, type, count) \
       
   163     CyAsStorageQueryMedia((CyAsDeviceHandle)(handle), (CyAsMediaType)(type), (count), 0, 0)
       
   164 
       
   165 /* Async version of Query Media */
       
   166 EXTERN CyAnReturnStatus_t
       
   167 CyAnStorageQueryMediaEX(
       
   168 	CyAnDeviceHandle		handle,
       
   169 	CyAnMediaType			type,
       
   170 	uint32_t *			count,
       
   171 	CyAnFunctionCallback		cb,
       
   172 	uint32_t			client
       
   173 	) ;
       
   174 #define CyAnStorageQueryMediaEX(h, type, count, cb, client)	\
       
   175     CyAsStorageQueryMedia((CyAsDeviceHandle)(h), (CyAsMediaType)(type), (count), (CyAsFunctionCallback)(cb), (client))
       
   176 
       
   177 /* Sync version of Query device */
       
   178 EXTERN CyAnReturnStatus_t
       
   179 CyAnStorageQueryDevice(
       
   180 	CyAnDeviceHandle		handle,
       
   181 	CyAnMediaType			type,
       
   182 	uint32_t			device,
       
   183 	CyAnDeviceDesc *		desc_p
       
   184 	) ;
       
   185 #define CyAnStorageQueryDevice(h, type, device, desc_p)		\
       
   186     CyAsStorageQueryDevice_dep((CyAsDeviceHandle)(h), (CyAsMediaType)(type), (device), (CyAsDeviceDesc *)(desc_p))
       
   187 
       
   188 /* Async version of Query device */
       
   189 EXTERN CyAnReturnStatus_t
       
   190 CyAnStorageQueryDeviceEX(
       
   191 	CyAnDeviceHandle		handle,
       
   192 	CyAnStorageQueryDeviceData*	data,
       
   193 	CyAnFunctionCallback		cb,
       
   194 	uint32_t			client
       
   195 	) ;
       
   196 #define CyAnStorageQueryDeviceEX(h, data, cb, client)							\
       
   197     CyAsStorageQueryDevice_dep_EX((CyAsDeviceHandle)(h), (CyAsStorageQueryDeviceData_dep *)(data),	\
       
   198 	    (CyAsFunctionCallback)(cb), (client))
       
   199 
       
   200 /* Sync version of Query Unit */
       
   201 EXTERN CyAnReturnStatus_t
       
   202 CyAnStorageQueryUnit(
       
   203 	CyAnDeviceHandle		handle,
       
   204 	CyAnMediaType			type,
       
   205 	uint32_t			device,
       
   206 	uint32_t			unit,
       
   207 	CyAnUnitDesc *			desc_p
       
   208 	) ;
       
   209 #define CyAnStorageQueryUnit(h, type, device, unit, desc_p)	\
       
   210     CyAsStorageQueryUnit_dep((CyAsDeviceHandle)(h), (CyAsMediaType)(type), (device), (unit), (CyAsUnitDesc *)(desc_p))
       
   211 
       
   212 /* Async version of Query Unit */
       
   213 EXTERN CyAnReturnStatus_t
       
   214 CyAnStorageQueryUnitEX(
       
   215 	CyAnDeviceHandle		handle,
       
   216 	CyAnStorageQueryUnitData*	data_p,
       
   217 	CyAnFunctionCallback		cb,
       
   218 	uint32_t			client
       
   219 	) ;
       
   220 #define CyAnStorageQueryUnitEX(h, data_p, cb, client)							\
       
   221     CyAsStorageQueryUnit_dep_EX((CyAsDeviceHandle)(h), (CyAsStorageQueryUnitData_dep *)(data_p),	\
       
   222 	    (CyAsFunctionCallback)(cb), (client))
       
   223 
       
   224 /* Sync version of device control */
       
   225 EXTERN CyAnReturnStatus_t
       
   226 CyAnStorageDeviceControl(
       
   227         CyAnDeviceHandle                handle,
       
   228         CyBool                          card_detect_en,
       
   229         CyBool                          write_prot_en
       
   230         ) ;
       
   231 #define CyAnStorageDeviceControl(handle, card_detect_en, write_prot_en) \
       
   232     CyAsStorageDeviceControl_dep((CyAsDeviceHandle)(handle), (card_detect_en), (write_prot_en), 0, 0)
       
   233 
       
   234 /* Async version of device control */
       
   235 EXTERN CyAnReturnStatus_t
       
   236 CyAnStorageDeviceControlEX(
       
   237         CyAnDeviceHandle                handle,
       
   238         CyBool                          card_detect_en,
       
   239         CyBool                          write_prot_en,
       
   240 	CyAnFunctionCallback		cb,
       
   241 	uint32_t			client
       
   242         ) ;
       
   243 #define CyAnStorageDeviceControlEX(h, det_en, prot_en, cb, client)	\
       
   244     CyAsStorageDeviceControl_dep((CyAsDeviceHandle)(h), (det_en), (prot_en), (CyAsFunctionCallback)(cb), (client))
       
   245 
       
   246 /* Sync Read */
       
   247 EXTERN CyAnReturnStatus_t
       
   248 CyAnStorageRead(
       
   249 	CyAnDeviceHandle		handle,
       
   250 	CyAnMediaType			type,
       
   251 	uint32_t			device,
       
   252 	uint32_t			unit,
       
   253 	uint32_t			block,
       
   254 	void *				data_p,
       
   255 	uint16_t			num_blocks
       
   256 	) ;
       
   257 #define CyAnStorageRead(h, type, device, unit, block, data_p, nblks)	\
       
   258     CyAsStorageRead_dep((CyAsDeviceHandle)(h), (CyAsMediaType)(type), (device), (unit), (block), (data_p), (nblks))
       
   259 
       
   260 /* Async Read */
       
   261 EXTERN CyAnReturnStatus_t
       
   262 CyAnStorageReadAsync(
       
   263 	CyAnDeviceHandle		handle,
       
   264 	CyAnMediaType			type,
       
   265 	uint32_t			device,
       
   266 	uint32_t			unit,
       
   267 	uint32_t			block,
       
   268 	void *				data_p,
       
   269 	uint16_t			num_blocks,
       
   270 	CyAnStorageCallback		callback
       
   271 	) ;
       
   272 #define CyAnStorageReadAsync(h, type, device, unit, block, data_p, nblks, cb)				\
       
   273     CyAsStorageReadAsync_dep((CyAsDeviceHandle)(h), (CyAsMediaType)(type), (device), (unit), (block),	\
       
   274 	    (data_p), (nblks), (CyAsStorageCallback_dep)(cb))
       
   275 
       
   276 /* Sync Write */
       
   277 EXTERN CyAnReturnStatus_t
       
   278 CyAnStorageWrite(
       
   279 	CyAnDeviceHandle		handle,
       
   280 	CyAnMediaType			type,
       
   281 	uint32_t			device,
       
   282 	uint32_t			unit,
       
   283 	uint32_t			block,
       
   284 	void *				data_p,
       
   285 	uint16_t			num_blocks
       
   286 	) ;
       
   287 #define CyAnStorageWrite(h, type, device, unit, block, data_p, nblks)	\
       
   288     CyAsStorageWrite_dep((CyAsDeviceHandle)(h), (CyAsMediaType)(type), (device), (unit), (block), (data_p), (nblks))
       
   289 
       
   290 /* Async Write */
       
   291 EXTERN CyAnReturnStatus_t
       
   292 CyAnStorageWriteAsync(
       
   293 	CyAnDeviceHandle		handle,
       
   294 	CyAnMediaType			type,
       
   295 	uint32_t			device,
       
   296 	uint32_t			unit,
       
   297 	uint32_t			block,
       
   298 	void *				data_p,
       
   299 	uint16_t			num_blocks,
       
   300 	CyAnStorageCallback		callback
       
   301 	) ;
       
   302 #define CyAnStorageWriteAsync(h, type, device, unit, block, data_p, nblks, cb)				\
       
   303     CyAsStorageWriteAsync_dep((CyAsDeviceHandle)(h), (CyAsMediaType)(type), (device), (unit), (block),	\
       
   304 	    (data_p), (nblks), (CyAsStorageCallback_dep)(cb))
       
   305 
       
   306 /* Cancel Async */
       
   307 EXTERN CyAnReturnStatus_t
       
   308 CyAnStorageCancelAsync(
       
   309 	CyAnDeviceHandle		handle
       
   310 	) ;
       
   311 #define CyAnStorageCancelAsync(h) CyAsStorageCancelAsync((CyAsDeviceHandle)(h))
       
   312 
       
   313 /* Sync SD Register Read*/
       
   314 EXTERN CyAnReturnStatus_t
       
   315 CyAnStorageSDRegisterRead(
       
   316         CyAnDeviceHandle          handle,
       
   317 	CyAnMediaType		  type,
       
   318 	uint8_t		          device,
       
   319 	CyAnSDCardRegType         regType,
       
   320 	uint8_t                   readLen,
       
   321 	uint8_t                  *data_p
       
   322         ) ;
       
   323 #define CyAnStorageSDRegisterRead(h, type, device, regType, len, data_p)			\
       
   324     CyAsStorageSDRegisterRead_dep((CyAsDeviceHandle)(h), (CyAsMediaType)(type), (device), 	\
       
   325 	    (CyAsSDCardRegType)(regType), (len), (data_p))
       
   326 
       
   327 /*Async SD Register Read*/
       
   328 EXTERN CyAnReturnStatus_t
       
   329 CyAnStorageSDRegisterReadEX(
       
   330         CyAnDeviceHandle          handle,
       
   331 	CyAnMediaType		  type,
       
   332 	uint8_t		          device,
       
   333 	CyAnSDCardRegType         regType,
       
   334 	CyAnStorageSDRegReadData *data_p,
       
   335 	CyAnFunctionCallback      cb,
       
   336 	uint32_t                  client
       
   337         ) ;
       
   338 #define CyAnStorageSDRegisterReadEX(h, type, device, regType, data_p, cb, client)		\
       
   339     CyAsStorageSDRegisterRead_dep_EX((CyAsDeviceHandle)(h), (CyAsMediaType)(type), (device),	\
       
   340 	    (CyAsSDCardRegType)(regType), (CyAsStorageSDRegReadData *)(data_p),			\
       
   341 	    (CyAsFunctionCallback)(cb), (client))
       
   342 
       
   343 /* Create partition on storage device */
       
   344 EXTERN CyAnReturnStatus_t
       
   345 CyAnStorageCreatePPartition(
       
   346         CyAnDeviceHandle     handle,
       
   347         CyAnMediaType        media,
       
   348         uint32_t             device,
       
   349         uint32_t             size,
       
   350         CyAnFunctionCallback cb,
       
   351         uint32_t             client) ;
       
   352 #define CyAnStorageCreatePPartition(h, media, dev, size, cb, client)                            \
       
   353     CyAsStorageCreatePPartition_dep((CyAsDeviceHandle)(h), (CyAsMediaType)(media), (dev),       \
       
   354             (size), (CyAsFunctionCallback)(cb), (client))
       
   355 
       
   356 /* Remove partition on storage device */
       
   357 EXTERN CyAnReturnStatus_t
       
   358 CyAnStorageRemovePPartition(
       
   359         CyAnDeviceHandle        handle,
       
   360         CyAnMediaType           media,
       
   361         uint32_t                device,
       
   362         CyAnFunctionCallback    cb,
       
   363         uint32_t                client) ;
       
   364 #define CyAnStorageRemovePPartition(h, media, dev, cb, client)                                  \
       
   365     CyAsStorageRemovePPartition_dep((CyAsDeviceHandle)(h), (CyAsMediaType)(media), (dev),       \
       
   366             (CyAsFunctionCallback)(cb), (client))
       
   367 
       
   368 #include "cyas_cplus_end.h"
       
   369 #endif /*__doxygen__ */
       
   370 
       
   371 #endif