1 /* Cypress West Bridge API header file (cyasstorage.h)
2 ## ===========================
3 ## Copyright (C) 2010 Cypress Semiconductor
5 ## This program is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU General Public License
7 ## as published by the Free Software Foundation; either version 2
8 ## of the License, or (at your option) any later version.
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 51 Franklin Street
18 ## Fifth Floor, Boston, MA 02110-1301, USA.
19 ## ===========================
22 #ifndef _INCLUDED_CYASSTORAGE_H_
23 #define _INCLUDED_CYASSTORAGE_H_
25 #include "cyasmedia.h"
27 #include "cyas_cplus_start.h"
32 This section documents the storage APIs supported by the
36 The storage API is based on some specific concepts which
38 * <LINK Storage API Overview>
41 * <LINK Asynchronous Versus Synchronous Operation>
44 /*@@Storage API Overview
46 Storage devices are identified by media type. Each media
47 type is considered a single logical device.
50 Each media type has a consistent block size and consists
51 of a set of logical blocks numbered from 0 to N - 1 where
53 media type in blocks. The mass storage APIs defined below
55 capability to query for devices that are present, and
56 read/write data to/from
62 Blocks within a storage device are address by a hierarchal
64 address consists of the bus number, physical device,
65 logical unit, and finally
69 While currently only a single device of each media type
70 is supported, the address
71 space reserves space in the future for multiple devices
72 of each type. Therefore
73 the second element of the address is the specific device
74 being addressed within
75 a given device type. For this release of the software,
76 this value will always be
77 zero to address the first device.
79 The third element of the address is the logical unit.
80 A device being managed
81 by West Bridge can be partitioned into multiple logical
83 information is stored on each device itself. Currently,
84 one of the storage devices
85 managed by West Bridge can be partitioned into two
88 Finally a logical block address is given within the
89 logical unit to address an
95 While West Bridge supports concurrent block level
96 operations from both the USB port and
97 the processor port, this is not desirable in most
98 situations as the file system
99 contained on the storage media cannot be accessed
100 concurrently. To insure access
101 by only one of USB and the processor, the West Bridge
102 API provides for ownership of storage
103 devices based on media type.
106 The processor requests ownership of a given media type
107 by calling CyAsStorageClaim().
108 The firmware in West Bridge releases control of the
109 media and signals the processor through
110 the event callback registered with
111 CyAsStorageRegisterCallback(). The specific event is
112 the CyAsStorageProcessor. The processor can later
113 release the media via a call to
114 CyAsStorageRelease(). This call is immediate and
115 no callback is required.
117 If the processor has claimed storage and the USB port
118 is connected, West Bridge will need to
119 claim the storage to manage the mass storage device.
120 West Bridge requests the storage through
121 the event callback registered with
122 CyAsStorageRegisterCallback(). The specific event is
123 CyAsStorageAntioch and is named as such to reflect
124 the USB view of storage. This callback
125 is a request for the processor to release storage.
126 The storage is not actually released
127 until the processor calls CyAsStorageRelease().
129 Note that the CyAsStorageAntioch is only sent when the
130 USB storage device is enumerated and
131 NOT at every USB operation. The ownership of a given
132 storage media type is assumed to belong
133 to the processor until the USB connection is established.
134 At that point, the storage ownership
135 is transferred to West Bridge. After the USB connection
136 is broken, ownership can be transferred
137 back to the processor.
140 /*@@Asynchronous Versus Synchronous Operation
142 When read or write operations are performed to the
143 storage devices, these operations may be
144 synchronous or asynchronous. A synchronous operation
145 is an operation where the read or write
146 operation is requested and the function does not return
147 until the operation is complete. This
148 type of function is the easiest to use but does not
149 provide for optimal usage of the P port processor time.
152 An asynchronous operation is one where the function returns
153 as soon as the request is started.
154 The specific read and write request will complete at some
155 time in the future and the P port
156 processor will be notified via a callback function. While
157 asynchronous functions provide for
158 much better usage of the CPU, these function have more
159 stringent requirements for use. First,
160 any buffer use for data transfer must be valid from the
161 function call to request the operation
162 through when the callback function is called. This basically
163 implies that stack based buffers
164 are not acceptable for asynchronous calls. Second, error
165 handling must be deferred until the
166 callback function is called indicating any kind of error
167 that may have occurred.
172 West Bridge API and firmware support the creation of up to
173 two logical partitions on one
174 of the storage devices that are managed by West Bridge. The
175 partitions are managed through
176 the CyAsStorageCreatePPartition and CyAsStorageRemovePPartition
180 The CyAsStorageCreatePPartition API is used to divide the total
182 device into two logical units or partitions. Since the partition
183 information is stored
184 on the storage device in a custom format, partitions should
185 only be created on fixed
186 storage devices (i.e., no removable SD/MMC cards). Any data
188 before the creation of the partition, is liable to be lost when
189 a partition is created.
191 The CyAsStorageRemovePPartition API is used to remove the
192 stored partition information,
193 so that all of the device's capacity is treated as a single
196 When a storage device with two partitions (units) is being
197 enumerated as a mass storage
198 device through the West Bridge, it is possible to select the
199 partitions to be made
200 visible to the USB host. This is done through the
201 CyAsUsbSelectMSPartitions API.
204 /*********************************
205 * West Bridge Constants
206 **********************************/
209 This constants indicates a raw device access to the read/write
213 When performing reading and writing operations on the
214 storage devices attached
215 to West Bridge, there are cases where writes need to
216 happen to raw devices, versus
217 the units contained within a device. This is
218 specifically required to manage
219 the partitions within physical devices. This constant
221 CyAsStorageRead(), CyAsStorageReadAsync(),
222 CyAsStorageWrite() and
223 CyAsStorageWriteAsync(), to indicate that the raw
224 physical device is being
225 accessed and not any specific unit on the device.
229 * CyAsStorageReadAsync
231 * CyAsStorageWriteAsync
233 #define CY_AS_LUN_PHYSICAL_DEVICE (0xffffffff)
236 This constant represents the maximum DMA burst length
237 supported on a storage endpoint
240 West Bridge reserves separate endpoints for accessing
241 storage media through the
242 CyAsStorageRead() and CyAsStorageWrite() calls. The
243 maximum size of these
244 endpoints is always 512 bytes, regardless of status
248 #define CY_AS_STORAGE_EP_SIZE (512)
250 /********************************
252 *******************************/
255 This type indicates the type of event in an event
256 callback from West Bridge
259 At times West Bridge needs to inform the P port
260 processor of events that have
261 occurred. These events are asynchronous to the
262 thread of control on the P
263 port processor and as such are generally delivered
264 via a callback function that
265 is called as part of an interrupt handler. This
266 type indicates the resonse for
267 the call to the callback function.
270 * CyAsStorageEventCallback
271 * CyAsStorageRegisterCallback
273 typedef enum cy_as_storage_event {
274 /* This event occurs when the West Bridge device has
275 detected a USB connect and has enumerated the
276 storage controlled by west bridge to the USB port.
277 this event is the signal that the processor
278 needs to release the storage media. west bridge will
279 not have control of the storage media until the
280 processor calls cy_as_release_storage() to release
281 the specific media. */
282 cy_as_storage_antioch,
284 /* This event occurs when the processor has requested
285 ownership of a given media type and west bridge has
286 released the media. this event is an indicator
287 that the transfer of ownership is complete and the
288 processor now owns the given media type. */
289 cy_as_storage_processor,
291 /* This event occurs when a removable media type has
293 cy_as_storage_removed,
295 /* This event occurs when a removable media type has
297 cy_as_storage_inserted,
299 /* This event occurs when the West Bridge device
300 * percieves an interrrupt from an SDIO card */
303 } cy_as_storage_event;
306 This type gives the type of the operation in a storage
310 This type is used in the callback function for asynchronous
311 operation. This type indicates whether it is a
312 CyAsStorageRead() or CyAsStorageWrite() operation that
316 * <LINK Asynchronous Versus Synchronous Operation>
320 typedef enum cy_as_oper_type {
321 /* A data read operation */
323 /* A data write operation */
328 This data structure describes a specific type of media
331 This data structure is the return value from the
332 CyAsStorageQueryDevice function. This structure provides
333 information about the specific storage device being queried.
336 * CyAsStorageQueryDevice
338 typedef struct cy_as_device_desc {
340 cy_as_media_type type;
341 /* Is the device removable */
343 /* Is the device writeable */
345 /* Basic block size for device */
347 /* Number of LUNs on the device */
348 uint32_t number_units;
349 /* Is the device password locked */
351 /* Size in bytes of an Erase Unit. Block erase operation
352 is only supported for SD storage, and the erase_unit_size
353 is invalid for all other kinds of storage. */
354 uint32_t erase_unit_size;
358 This data structure describes a specific unit on a
359 specific type of media
362 This data structure is the return value from the
363 CyAsStorageQueryUnit function. This structure provides
364 information about the specific unit.
367 * CyAsStorageQueryUnit
369 typedef struct cy_as_unit_desc {
371 cy_as_media_type type;
372 /* Basic block size for device */
374 /* Physical start block for LUN */
375 uint32_t start_block;
376 /* Number of blocks in the LUN */
381 This function type defines a callback to be called after an
382 asynchronous operation
385 This function type defines a callback function that is called
386 at the completion of any asynchronous read or write operation.
389 * CyAsStorageReadAsync()
390 * CyAsStorageWriteAsync()
392 typedef void (*cy_as_storage_callback)(
393 /* Handle to the device completing the storage operation */
394 cy_as_device_handle handle,
395 /* The bus completing the operation */
396 cy_as_bus_number_t bus,
397 /* The device completing the operation */
399 /* The unit completing the operation */
401 /* The block number of the completed operation */
402 uint32_t block_number,
403 /* The type of operation */
405 /* The error status */
406 cy_as_return_status_t status
410 This function type defines a callback to be called in the
411 event of a storage related event
414 At times West Bridge needs to inform the P port processor
416 occurred. These events are asynchronous to the thread of
418 port processor and as such are generally delivered via a
419 callback function that
420 is called as part of an interrupt handler. This type
421 defines the type of function
422 that must be provided as a callback function.
426 * CyAsStorageRegisterCallback
428 typedef void (*cy_as_storage_event_callback)(
429 /* Handle to the device sending the event notification */
430 cy_as_device_handle handle,
431 /* The bus where the event happened */
432 cy_as_bus_number_t bus,
433 /* The device where the event happened */
436 cy_as_storage_event evtype,
437 /* Event related data */
442 This function type defines a callback to be called after
443 an asynchronous sdio operation
446 The Callback function is called at the completion of an
447 asynchronous sdio read or write operation.
450 * CyAsSdioExtendedRead()
451 * CyAsSdioExtendedWrite()
453 typedef void (*cy_as_sdio_callback)(
454 /* Handle to the device completing the storage operation */
455 cy_as_device_handle handle,
456 /* The bus completing the operation */
457 cy_as_bus_number_t bus,
458 /* The device completing the operation */
460 /* The function number of the completing the operation.
461 if the status of the operation is either CY_AS_ERROR_IO_ABORTED
462 or CY_AS_IO_SUSPENDED then the most significant word parameter will
463 contain the number of blocks still pending. */
465 /* The base address of the completed operation */
467 /* The type of operation */
469 /* The status of the operation */
470 cy_as_return_status_t status
474 Enumeration of SD/MMC card registers that can be read
478 Some of the registers on the SD/MMC card(s) attached to the
479 West Bridge can be read through the API layers. This type
480 enumerates the registers that can be read.
483 * CyAsStorageSDRegisterRead
485 typedef enum cy_as_sd_card_reg_type {
486 cy_as_sd_reg_OCR = 0,
489 } cy_as_sd_card_reg_type;
492 Struct encapsulating parameters and return values for a
493 CyAsStorageQueryDevice call.
496 This struct holds the input parameters and the return values
497 for an asynchronous CyAsStorageQueryDevice call.
500 * CyAsStorageQueryDevice
502 typedef struct cy_as_storage_query_device_data {
503 /* The bus with the device to query */
504 cy_as_bus_number_t bus;
505 /* The logical device number to query */
507 /* The return value for the device descriptor */
508 cy_as_device_desc desc_p;
509 } cy_as_storage_query_device_data;
513 Struct encapsulating parameters and return values
514 for a CyAsStorageQueryUnit call.
517 This struct holds the input parameters and the return
518 values for an asynchronous CyAsStorageQueryUnit call.
521 * CyAsStorageQueryUnit
523 typedef struct cy_as_storage_query_unit_data {
524 /* The bus with the device to query */
525 cy_as_bus_number_t bus;
526 /* The logical device number to query */
528 /* The unit to query on the device */
530 /* The return value for the unit descriptor */
531 cy_as_unit_desc desc_p;
532 } cy_as_storage_query_unit_data;
535 Struct encapsulating the input parameter and return
536 values for a CyAsStorageSDRegisterRead call.
539 This struct holds the input parameter and return
540 values for an asynchronous CyAsStorageSDRegisterRead
544 * CyAsStorageSDRegisterRead
546 typedef struct cy_as_storage_sd_reg_read_data {
547 /* Pointer to the result buffer. */
549 /* Length of data to be copied in bytes. */
551 } cy_as_storage_sd_reg_read_data;
554 Controls which pins are used for card detection
557 When a StorageDeviceControl call is made to enable or
558 disable card detection this enum is passed in to
559 control which pin is used for the detection.
562 * CyAsStorageDeviceControl
564 typedef enum cy_as_storage_card_detect {
565 cy_as_storage_detect_GPIO,
566 cy_as_storage_detect_SDAT_3
567 } cy_as_storage_card_detect;
570 #define cy_as_storage_detect_GPIO_0 cy_as_storage_detect_GPIO
572 /* Length of OCR value in bytes. */
573 #define CY_AS_SD_REG_OCR_LENGTH (4)
574 /* Length of CID value in bytes. */
575 #define CY_AS_SD_REG_CID_LENGTH (16)
576 /* Length of CSD value in bytes. */
577 #define CY_AS_SD_REG_CSD_LENGTH (16)
578 /* Max. length of register response in words. */
579 #define CY_AS_SD_REG_MAX_RESP_LENGTH (10)
584 This data structure is the data passed via the evdata
585 paramater on a usb event callback for the mass storage
586 device progress event.
589 This data structure reports the number of sectors that have
590 been written and read on the USB mass storage device since
591 the last event report. The corresponding event is only sent
592 when either the number of writes, or the number of reads has
593 crossed a pre-set threshold.
596 * CyAsUsbEventCallback
597 * CyAsUsbRegisterCallback
599 typedef struct cy_as_m_s_c_progress_data {
600 /* Number of sectors written since the last event. */
602 /* Number of sectors read since the last event. */
604 } cy_as_m_s_c_progress_data;
607 Flag to set Direct Write operation to read back from the
612 *CyAsSdioDirectWrite()
614 #define CY_SDIO_RAW (0x01)
618 Flag to set Extended Read and Write to perform IO
619 using a FIFO i.e. read or write from the specified
623 *CyAsSdioExtendedRead()
624 *CyAsSdioExtendedWrite()
626 #define CY_SDIO_OP_FIFO (0x00)
629 Flag to set Extended Read and Write to perform incremental
630 IO using the address provided as the base address.
634 *CyAsSdioExtendedRead()
635 *CyAsSdioExtendedWrite()
637 #define CY_SDIO_OP_INCR (0x02)
640 Flag to set Extended Read and Write to Block Mode operation
643 *CyAsSdioExtendedRead()
644 *CyAsSdioExtendedWrite()
646 #define CY_SDIO_BLOCKMODE (0x04)
649 Flag to set Extended Read and Write to Byte Mode operation
652 *CyAsSdioExtendedRead()
653 *CyAsSdioExtendedWrite()
655 #define CY_SDIO_BYTEMODE (0x00)
658 Flag to force re/initialization of a function.
661 If not set a call to CyAsSdioInitFunction()
662 will not initialize a function that has been previously
665 *CyAsSdioInitFunction()
667 #define CY_SDIO_FORCE_INIT (0x40)
670 Flag to re-enable the SDIO interrupts.
673 Used with a direct read or direct write
674 after the Interrupt triggerred by SDIO has been serviced
675 and cleared to reset the West Bridge Sdio Interrupt.
677 *CyAsSdioDirectRead()
678 *CyAsSdioDirectWrite()
681 #define CY_SDIO_REARM_INT (0x80)
685 Flag to check if 4 bit support is enabled on a
688 <link CyAsSDIOCard::card_capability>*/
689 #define CY_SDIO_4BLS (0x80)
692 Flag to check if card is a low speed card
694 <link CyAsSDIOCard::card_capability> */
695 #define CY_SDIO_LSC (0x40)
698 Flag to check if interrupt during multiblock data
701 <link CyAsSDIOCard::card_capability>*/
702 #define CY_SDIO_E4MI (0x20)
705 Flag to check if interrupt during multiblock data
706 transfer is supported
708 <link CyAsSDIOCard::card_capability> */
709 #define CY_SDIO_S4MI (0x10)
712 Flag to check if card supports function suspending.
714 <link CyAsSDIOCard::card_capability> */
715 #define CY_SDIO_SBS (0x08)
718 Flag to check if card supports SDIO Read-Wait
720 <link CyAsSDIOCard::card_capability> */
721 #define CY_SDIO_SRW (0x04)
724 Flag to check if card supports multi-block transfers
726 <link CyAsSDIOCard::card_capability> */
727 #define CY_SDIO_SMB (0x02)
730 Flag to check if card supports Direct IO commands
731 during execution of an Extended
734 <link CyAsSDIOCard::card_capability>*/
735 #define CY_SDIO_SDC (0x01)
738 Flag to check if function has a CSA area.
740 <link CyAsSDIOFunc::csa_bits> */
741 #define CY_SDIO_CSA_SUP (0x40)
744 Flag to check if CSA access is enabled.
746 <link CyAsSDIOFunc::csa_bits> */
747 #define CY_SDIO_CSA_EN (0x80)
750 Flag to check if CSA is Write protected.
752 <link CyAsSDIOFunc::csa_bits> */
753 #define CY_SDIO_CSA_WP (0x01)
756 Flag to check if CSA formatting is prohibited.
758 <link CyAsSDIOFunc::csa_bits>*/
759 #define CY_SDIO_CSA_NF (0x02)
762 Flag to check if the function allows wake-up from low
763 power mode using some vendor specific method.
765 <link CyAsSDIOFunc::wakeup_support>*/
766 #define CY_SDIO_FN_WUS (0x01)
770 This data structure stores SDIO function 0
771 parameters for a SDIO card
773 typedef struct cy_as_sdio_card {
774 /* Number of functions present on the card. */
775 uint8_t num_functions;
776 /* Memory present(Combo card) or not */
777 uint8_t memory_present;
778 /* 16 bit manufacturer ID */
779 uint16_t manufacturer__id;
780 /* Additional vendor specific info */
781 uint16_t manufacturer_info;
782 /* Max Block size for function 0 */
783 uint16_t maxblocksize;
784 /* Block size used for function 0 */
786 /* SDIO version supported by the card */
787 uint8_t sdio_version;
788 /* Card capability flags */
789 uint8_t card_capability;
793 This data structure stores SDIO function 1-7 parameters
796 typedef struct cy_as_sdio_func {
797 /* SDIO function code. 0 if non standard function */
798 uint8_t function_code;
799 /* Extended function type code for non-standard function */
800 uint8_t extended_func_code;
801 /* Max IO Blocksize supported by the function */
802 uint16_t maxblocksize;
803 /* IO Blocksize used by the function */
805 /* 32 bit product serial number for the function */
807 /* Code storage area variables */
809 /* Function wake-up support */
810 uint8_t wakeup_support;
813 /***********************************
814 * West Bridge Functions
815 ************************************/
818 This function starts the West Bridge storage module.
821 This function initializes the West Bridge storage software
822 stack and readies this module to service storage related
823 requests. If the stack is already running, the reference
824 count for the stack is incremented.
826 * Valid In Asynchronous Callback: YES (if cb supplied)
830 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
831 * not been configured
832 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
833 * loaded into West Bridge
834 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
835 * CY_AS_ERROR_SUCCESS - the module started successfully
836 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
837 * with the West Bridge device
838 * CY_AS_ERROR_OUT_OF_MEMORY
839 * CY_AS_ERROR_INVALID_RESPONSE
844 EXTERN cy_as_return_status_t
846 /* Handle to the device */
847 cy_as_device_handle handle,
848 /* Callback to be called when the operation is complete */
849 cy_as_function_callback cb,
850 /* Client data to be passed to the callback */
855 This function stops the West Bridge storage module.
858 This function decrements the reference count for the
859 storage stack and if this count is zero, the storage
860 stack is shut down. The shutdown frees all resources
861 associated with the storage stack.
863 * Valid In Asynchronous Callback: YES (if cb supplied)
867 While all resources associated with the storage stack
868 will be freed is a shutdown occurs,
869 resources associated with underlying layers of the
870 software will not be freed if they
871 are shared by the USB stack and the USB stack is
872 active. Specifically the DMA manager,
873 the interrupt manager, and the West Bridge
874 communications module are all shared by both the
875 USB stack and the storage stack.
878 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge
879 * device has not been configured
880 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not
881 * been loaded into West Bridge
882 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
884 * CY_AS_ERROR_SUCCESS - this module was shut
886 * CY_AS_ERROR_TIMEOUT - a timeout occurred
887 * communicating with the West Bridge device
888 * CY_AS_ERROR_NOT_RUNNING
889 * CY_AS_ERROR_ASYNC_PENDING
890 * CY_AS_ERROR_OUT_OF_MEMORY
895 EXTERN cy_as_return_status_t
897 /* Handle to the device to configure */
898 cy_as_device_handle handle,
899 /* Callback to be called when the operation is complete */
900 cy_as_function_callback cb,
901 /* Client data to be passed to the callback */
906 This function is used to register a callback function
910 At times West Bridge needs to inform the P port processor
911 of events that have occurred. These events are asynchronous
912 to the thread of control on the P
913 port processor and as such are generally delivered via a
914 callback function that
915 is called as part of an interrupt handler. This function
916 registers the callback
917 function that is called when an event occurs. Each call
919 replaces any old callback function with a new callback
921 the most recent call. This function can also be called
922 with a callback function
923 of NULL in order to remove any existing callback function
925 * Valid In Asynchronous Callback:YES
928 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
929 * has not been configured
930 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
931 * loaded into West Bridge
932 * CY_AS_ERROR_NOT_RUNNING - the storage stack has
934 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle
936 * CY_AS_ERROR_SUCCESS - the function was registered
938 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
941 * CyAsStorageEventCallback
944 EXTERN cy_as_return_status_t
945 cy_as_storage_register_callback(
946 /* Handle to the device of interest */
947 cy_as_device_handle handle,
948 /* The callback function to call for async storage events */
949 cy_as_storage_event_callback callback
953 This function claims a given media type.
956 This function communicates to West Bridge that the
957 processor wants control of the
958 given storage media type. Each media type can be
959 claimed or released by the
960 processor independently. As the processor is the
961 master for the storage,
962 West Bridge should release control of the requested
963 media as soon as possible and
964 signal the processor via the CyAsStorageProcessor event.
966 * Valid In Asynchronous Callback: NO
969 This function just notifies West Bridge that the storage
970 is desired. The storage
971 has not actually been released by West Bridge until the
972 registered callback function
973 is called with the CyAsStorageProcessor event
976 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
977 * has not been configured
978 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
979 * loaded into West Bridge
980 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
982 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
984 * CY_AS_ERROR_SUCCESS - this request was successfully
985 * transmitted to the West Bridge device
986 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
987 * with the West Bridge device
988 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
989 * CY_AS_ERROR_NO_SUCH_MEDIA
990 * CY_AS_ERROR_OUT_OF_MEMORY
991 * CY_AS_ERROR_INVALID_RESPONSE
992 * CY_AS_ERROR_NOT_ACQUIRED
998 EXTERN cy_as_return_status_t
1000 /* Handle to the device of interest */
1001 cy_as_device_handle handle,
1002 /* The bus to claim */
1003 cy_as_bus_number_t bus,
1004 /* The device to claim */
1006 /* Callback to be called when the operation is complete */
1007 cy_as_function_callback cb,
1008 /* Client data to be passed to the callback */
1013 This function releases a given media type.
1016 This function communicates to West Bridge that the
1017 processor has released control of
1018 the given storage media type. Each media type can
1019 be claimed or released by the
1020 processor independently. As the processor is the
1021 master for the storage, West Bridge
1022 can now assume ownership of the media type. No callback
1023 or event is generated.
1025 * Valid In Asynchronous Callback: YES (if cb supplied)
1029 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
1030 * has not been configured
1031 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1032 * loaded into West Bridge
1033 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
1035 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle
1037 * CY_AS_ERROR_SUCCESS - the media was successfully
1039 * CY_AS_ERROR_MEDIA_NOT_CLAIMED - the media was not
1040 * claimed by the P port
1041 * CY_AS_ERROR_TIMEOUT - a timeout occurred
1042 * communicating with the West Bridge device
1043 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
1044 * CY_AS_ERROR_NO_SUCH_MEDIA
1045 * CY_AS_ERROR_OUT_OF_MEMORY
1046 * CY_AS_ERROR_INVALID_RESPONSE
1051 EXTERN cy_as_return_status_t
1052 cy_as_storage_release(
1053 /* Handle to the device of interest */
1054 cy_as_device_handle handle,
1055 /* The bus to release */
1056 cy_as_bus_number_t bus,
1057 /* The device to release */
1059 /* Callback to be called when the operation is complete */
1060 cy_as_function_callback cb,
1061 /* Client data to be passed to the callback */
1066 This function information about the number of devices present
1070 This function retrieves information about how many devices on
1074 * Valid In Asynchronous Callback: NO
1077 While the current implementation of West Bridge only
1078 supports one of logical device of
1079 each media type, future versions WestBridge/Antioch may
1080 support multiple devices.
1083 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
1084 * has not been configured
1085 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1086 * loaded into West Bridge
1087 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
1089 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1091 * CY_AS_ERROR_SUCCESS - the media information was
1093 * CY_AS_ERROR_TIMEOUT - a timeout occurred
1094 * communicating with the West Bridge device
1095 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
1096 * CY_AS_ERROR_OUT_OF_MEMORY
1097 * CY_AS_ERROR_INVALID_RESPONSE
1100 * CyAsStorageQueryDevice
1101 * CyAsStorageQueryUnit
1103 EXTERN cy_as_return_status_t
1104 cy_as_storage_query_bus(
1105 /* Handle to the device of interest */
1106 cy_as_device_handle handle,
1107 /* The bus to query */
1108 cy_as_bus_number_t bus,
1109 /* The return value containing the number of
1110 devices present for this media type */
1112 /* Callback to be called when the operation is complete */
1113 cy_as_function_callback cb,
1114 /* Client data to be passed to the callback */
1119 This function information about the number of devices
1120 present for a given media type
1123 This function retrieves information about how many
1124 devices of a given media type are attached to West Bridge.
1126 * Valid In Asynchronous Callback: YES (if cb supplied)
1130 While the current implementation of West Bridge only
1131 supports one of logical device of each media type, future
1132 versions West Bridge may support multiple devices.
1135 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
1136 * has not been configured
1137 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1138 * loaded into West Bridge
1139 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
1141 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1143 * CY_AS_ERROR_SUCCESS - the media information was
1145 * CY_AS_ERROR_TIMEOUT - a timeout occurred
1146 * communicating with the West Bridge device
1147 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
1148 * CY_AS_ERROR_OUT_OF_MEMORY
1149 * CY_AS_ERROR_INVALID_RESPONSE
1152 * CyAsStorageQueryMedia
1154 * CyAsStorageQueryDevice
1155 * CyAsStorageQueryUnit
1157 EXTERN cy_as_return_status_t
1158 cy_as_storage_query_media(
1159 /* Handle to the device of interest */
1160 cy_as_device_handle handle,
1161 /* The type of media to query */
1162 cy_as_media_type type,
1163 /* The return value containing the number of
1164 devices present for this media type */
1166 /* Callback to be called when the operation is complete */
1167 cy_as_function_callback cb,
1168 /* Client data to be passed to the callback */
1173 This function returns information about a given device
1174 of a specific media type
1177 This function retrieves information about a device of a
1178 given type of media. The function is called with a given
1179 media type and device and a pointer to a media descriptor
1180 (CyAsDeviceDesc). This function fills in the data in the
1181 media descriptor to provide information about the
1182 attributes of the device of the given device.
1184 * Valid In Asynchronous Callback: YES (if cb supplied)
1188 Currently this API only supports a single logical device
1189 of each media type. Therefore the only acceptable value
1190 for the parameter device is zero (0).
1193 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
1194 * not been configured
1195 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1196 * loaded into West Bridge
1197 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
1199 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1201 * CY_AS_ERROR_SUCCESS - the media information was
1203 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
1204 * with the West Bridge device
1205 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
1206 * CY_AS_ERROR_OUT_OF_MEMORY
1207 * CY_AS_ERROR_NO_SUCH_MEDIA
1208 * CY_AS_ERROR_NO_SUCH_DEVICE
1209 * CY_AS_ERROR_INVALID_RESPONSE
1213 * CyAsStorageQueryMedia
1214 * CyAsStorageQueryUnit
1217 EXTERN cy_as_return_status_t
1218 cy_as_storage_query_device(
1219 /* Handle to the device of interest */
1220 cy_as_device_handle handle,
1221 /* Parameters and return value for the query call */
1222 cy_as_storage_query_device_data *data,
1223 /* Callback to be called when the operation is complete */
1224 cy_as_function_callback cb,
1225 /* Client data to be passed to the callback */
1230 This function returns information about a given unit on a
1234 This function retrieves information about a device of a
1235 given logical unit. The function is called with a given
1236 media type, device address, unit address, and a pointer
1237 to a unit descriptor (CyAsUnitDesc). This function fills
1238 in the data in the unit descriptor to provide information
1239 about the attributes of the device of the given logical
1242 * Valid In Asynchronous Callback: YES (if cb supplied)
1246 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
1247 * not been configured
1248 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1249 * loaded into West Bridge
1250 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
1252 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1254 * CY_AS_ERROR_SUCCESS - the media information was returned
1255 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
1256 * with the West Bridge device
1257 * CY_AS_ERROR_OUT_OF_MEMORY
1258 * CY_AS_ERROR_NO_SUCH_DEVICE
1259 * CY_AS_ERROR_NO_SUCH_UNIT
1260 * CY_AS_ERROR_INVALID_RESPONSE
1265 * CyAsStorageQueryMedia
1266 * CyAsStorageQueryDevice
1269 EXTERN cy_as_return_status_t
1270 cy_as_storage_query_unit(
1271 /* Handle to the device of interest */
1272 cy_as_device_handle handle,
1273 /* Parameters and return value for the query call */
1274 cy_as_storage_query_unit_data *data_p,
1275 /* Callback to be called when the operation is complete */
1276 cy_as_function_callback cb,
1277 /* Client data to be passed to the callback */
1282 This function enables/disables the handling of SD/MMC card
1283 detection and SD/MMC write protection in West Bridge Firmware.
1286 If the detection of SD/MMC card insertion or removal is being
1287 done by the Processor directly, the West Bridge firmware needs
1288 to be instructed to disable the card detect feature. Also, if
1289 the hardware design does not use the SD_WP GPIO of the West
1290 Bridge to handle SD card's write protect notch, the handling
1291 of write protection if firmware should be disabled. This API
1292 is used to enable/disable the card detect and write protect
1293 support in West Bridge firmware.
1295 * Valid In Asynchronous Callback: YES (if cb supplied)
1299 * CY_AS_ERROR_SUCCESS - the feature controls were
1301 * CY_AS_ERROR_NO_SUCH_BUS - the specified bus is invalid
1302 * CY_AS_ERROR_NOT_SUPPORTED - function not supported on
1303 * the device in the specified bus
1304 * CY_AS_ERROR_IN_SUSPEND - the West Brdige device is in
1306 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
1307 * not been configured
1308 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1309 * loaded into West Bridge
1310 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
1311 * with the West Bridge device
1312 * CY_AS_ERROR_INVALID_HANDLE
1313 * CY_AS_ERROR_OUT_OF_MEMORY
1314 * CY_AS_ERROR_INVALID_RESPONSE
1317 EXTERN cy_as_return_status_t
1318 cy_as_storage_device_control(
1319 /* Handle to the West Bridge device */
1320 cy_as_device_handle handle,
1321 /* The bus to control */
1322 cy_as_bus_number_t bus,
1323 /* The device to control */
1325 /* Enable/disable control for card detection */
1326 cy_bool card_detect_en,
1327 /* Enable/disable control for write protect handling */
1328 cy_bool write_prot_en,
1329 /* Control which pin is used for card detection */
1330 cy_as_storage_card_detect config_detect,
1331 /* Callback to be called when the operation is complete */
1332 cy_as_function_callback cb,
1333 /* Client data to be passed to the callback */
1338 This function reads one or more blocks of data from
1342 This function synchronously reads one or more blocks
1343 of data from the given media
1344 type/device and places the data into the data buffer
1345 given. This function does not
1346 return until the data is read and placed into the buffer.
1348 * Valid In Asynchronous Callback: NO
1351 If the Samsung CEATA drive is the target for a
1352 read/write operation, the maximum
1353 number of sectors that can be accessed through a
1354 single API call is limited to 2047.
1355 Longer accesses addressed to a Samsung CEATA drive
1356 can result in time-out errors.
1359 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
1360 * has not been configured
1361 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1362 * loaded into West Bridge
1363 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
1365 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle
1367 * CY_AS_ERROR_SUCCESS - the media information was
1369 * CY_AS_ERROR_TIMEOUT - a timeout occurred
1370 * communicating with the West Bridge device
1371 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
1372 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified
1374 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified
1375 * media/device pair does not exist
1376 * CY_AS_ERROR_NO_SUCH_UNIT - the unit specified
1378 * CY_AS_ERROR_ASYNC_PENDING - an async operation
1380 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was
1381 * error in reading from the media
1382 * CY_AS_ERROR_MEDIA_WRITE_PROTECTED - the media is
1384 * CY_AS_ERROR_INVALID_PARAMETER - Reads/Writes greater
1385 * than 4095 logic blocks are not allowed
1388 * CyAsStorageReadAsync
1390 * CyAsStorageWriteAsync
1391 * CyAsStorageCancelAsync
1392 * <LINK Asynchronous Versus Synchronous Operation>
1394 EXTERN cy_as_return_status_t
1396 /* Handle to the device of interest */
1397 cy_as_device_handle handle,
1398 /* The bus to access */
1399 cy_as_bus_number_t bus,
1400 /* The device to access */
1402 /* The unit to access */
1404 /* The first block to access */
1406 /* The buffer where data will be placed */
1408 /* The number of blocks to be read */
1413 This function asynchronously reads one or more blocks of data
1414 from the storage system.
1417 This function asynchronously reads one or more blocks of
1418 data from the given media
1419 type/device and places the data into the data buffer given.
1420 This function returns
1421 as soon as the request is transmitted to the West Bridge
1422 device but before the data is
1423 available. When the read is complete, the callback function
1424 is called to indicate the
1425 data has been placed into the data buffer. Note that the
1426 data buffer must remain
1427 valid from when the read is requested until the callback
1430 * Valid In Asynchronous Callback: YES
1433 If the Samsung CEATA drive is the target for a read/write
1434 operation, the maximum
1435 number of sectors that can be accessed through a single API
1436 call is limited to 2047.
1437 Longer accesses addressed to a Samsung CEATA drive can
1438 result in time-out errors.
1441 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
1442 * has not been configured
1443 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1444 * loaded into West Bridge
1445 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
1447 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle
1449 * CY_AS_ERROR_SUCCESS - the media information was
1451 * CY_AS_ERROR_TIMEOUT - a timeout occurred
1452 * communicating with the West Bridge device
1453 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
1454 * CY_AS_ERROR_ASYNC_PENDING - an async operation
1456 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error
1457 * in reading from the media
1458 * CY_AS_ERROR_MEDIA_WRITE_PROTECTED - the media is
1460 * CY_AS_ERROR_QUERY_DEVICE_NEEDED - Before an
1461 * asynchronous read can be issue a call to
1462 * CyAsStorageQueryDevice must be made
1463 * CY_AS_ERROR_INVALID_PARAMETER - Reads/Writes greater
1464 * than 4095 logic blocks are not allowed
1469 * CyAsStorageWriteAsync
1470 * CyAsStorageCancelAsync
1471 * CyAsStorageQueryDevice
1472 * <LINK Asynchronous Versus Synchronous Operation>
1474 EXTERN cy_as_return_status_t
1475 cy_as_storage_read_async(
1476 /* Handle to the device of interest */
1477 cy_as_device_handle handle,
1478 /* The bus to access */
1479 cy_as_bus_number_t bus,
1480 /* The device to access */
1482 /* The unit to access */
1484 /* The first block to access */
1486 /* The buffer where data will be placed */
1488 /* The number of blocks to be read */
1489 uint16_t num_blocks,
1490 /* The function to call when the read is complete
1491 or an error occurs */
1492 cy_as_storage_callback callback
1496 This function writes one or more blocks of data
1497 to the storage system.
1500 This function synchronously writes one or more blocks of
1501 data to the given media/device.
1502 This function does not return until the data is written
1505 * Valid In Asynchronous Callback: NO
1508 If the Samsung CEATA drive is the target for a read/write
1509 operation, the maximum
1510 number of sectors that can be accessed through a single
1511 API call is limited to 2047.
1512 Longer accesses addressed to a Samsung CEATA drive can
1513 result in time-out errors.
1516 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
1517 * has not been configured
1518 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1519 * loaded into West Bridge
1520 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
1522 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1524 * CY_AS_ERROR_SUCCESS - the media information was
1526 * CY_AS_ERROR_TIMEOUT - a timeout occurred
1527 * communicating with the West Bridge device
1528 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
1529 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does
1531 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified
1532 * media/device pair does not exist
1533 * CY_AS_ERROR_NO_SUCH_UNIT - the unit specified
1535 * CY_AS_ERROR_ASYNC_PENDING - an async operation
1537 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error
1538 * in reading from the media
1539 * CY_AS_ERROR_MEDIA_WRITE_PROTECTED - the media is
1541 * CY_AS_ERROR_INVALID_PARAMETER - Reads/Writes greater
1542 * than 4095 logic blocks are not allowed
1546 * CyAsStorageReadAsync
1547 * CyAsStorageWriteAsync
1548 * CyAsStorageCancelAsync
1549 * <LINK Asynchronous Versus Synchronous Operation>
1551 EXTERN cy_as_return_status_t
1552 cy_as_storage_write(
1553 /* Handle to the device of interest */
1554 cy_as_device_handle handle,
1555 /* The bus to access */
1556 cy_as_bus_number_t bus,
1557 /* The device to access */
1559 /* The unit to access */
1561 /* The first block to access */
1563 /* The buffer containing the data to be written */
1565 /* The number of blocks to be written */
1570 This function asynchronously writes one or more blocks
1571 of data to the storage system
1574 This function asynchronously writes one or more blocks of
1575 data to the given media type/device.
1576 This function returns as soon as the request is transmitted
1577 to the West Bridge device
1578 but before the data is actually written. When the write is
1579 complete, the callback
1580 function is called to indicate the data has been physically
1581 written into the media.
1583 * Valid In Asynchronous Callback: YES
1586 If the Samsung CEATA drive is the target for a read/write
1587 operation, the maximum
1588 number of sectors that can be accessed through a single API
1589 call is limited to 2047.
1590 Longer accesses addressed to a Samsung CEATA drive can
1591 result in time-out errors.
1594 The data buffer must remain valid from when the write is
1595 requested until the callback function is called.
1598 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
1599 * has not been configured
1600 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1601 * loaded into West Bridge
1602 * CY_AS_ERROR_NOT_RUNNING - the storage stack has
1604 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
1605 * CY_AS_ERROR_SUCCESS - the media information was returned
1606 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
1607 * with the West Bridge device
1608 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
1609 * CY_AS_ERROR_ASYNC_PENDING - an async operation is
1611 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
1612 * reading from the media
1613 * CY_AS_ERROR_MEDIA_WRITE_PROTECTED - the media is write
1615 * CY_AS_ERROR_QUERY_DEVICE_NEEDED - A query device call is
1616 * required before async writes are allowed
1617 * CY_AS_ERROR_INVALID_PARAMETER - Reads/Writes greater
1618 * than 4095 logic blocks are not allowed
1623 * CyAsStorageReadAsync
1624 * CyAsStorageCancelAsync
1625 * CyAsStorageQueryDevice
1626 * <LINK Asynchronous Versus Synchronous Operation>
1628 EXTERN cy_as_return_status_t
1629 cy_as_storage_write_async(
1630 /* Handle to the device of interest */
1631 cy_as_device_handle handle,
1632 /* The bus to access */
1633 cy_as_bus_number_t bus,
1634 /* The device to access */
1636 /* The unit to access */
1638 /* The first block to access */
1640 /* The buffer where the data to be written is stored */
1642 /* The number of blocks to be written */
1643 uint16_t num_blocks,
1644 /* The function to call when the write is complete
1645 or an error occurs */
1646 cy_as_storage_callback callback
1650 This function aborts any outstanding asynchronous operation
1653 This function aborts any asynchronous block read or block
1654 write operation. As only a single asynchronous block read
1655 or write operation is possible at one time, this aborts
1656 the single operation in progress.
1658 * Valid In Asynchronous Callback: YES
1661 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
1662 * has not been configured
1663 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1664 * loaded into West Bridge
1665 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
1667 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
1668 * CY_AS_ERROR_SUCCESS - the media information was returned
1669 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
1670 * CY_AS_ERROR_NO_OPERATION_PENDING - no asynchronous
1671 * operation is pending
1675 * CyAsStorageReadAsync
1677 * CyAsStorageWriteAsync
1678 * <LINK Asynchronous Versus Synchronous Operation>
1680 EXTERN cy_as_return_status_t
1681 cy_as_storage_cancel_async(
1682 /* Handle to the device with outstanding async request */
1683 cy_as_device_handle handle
1687 This function is used to read the content of SD registers
1690 This function is used to read the contents of CSD, CID and
1691 CSD registers of the SD Card.
1693 * Valid In Asynchronous Callback: YES (if cb supplied)
1697 * CY_AS_ERROR_SUCCESS - the read operation was successful
1698 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
1699 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1701 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1703 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
1705 * CY_AS_ERROR_IN_SUSPEND - The West Bridge device is in
1707 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device pair
1709 * CY_AS_ERROR_INVALID_PARAMETER - The register type is invalid
1710 * or the media is not supported on the bus
1711 * CY_AS_ERROR_OUT_OF_MEMORY - failed to get memory to process
1713 * CY_AS_ERROR_INVALID_RESPONSE - communication failure with
1714 * West Bridge firmware
1717 * CyAsStorageSDRegReadData
1719 EXTERN cy_as_return_status_t
1720 cy_as_storage_sd_register_read(
1721 /* Handle to the West Bridge device. */
1722 cy_as_device_handle handle,
1723 /* The bus to query */
1724 cy_as_bus_number_t bus,
1725 /* The device to query */
1727 /* The type of register to read. */
1728 cy_as_sd_card_reg_type reg_type,
1729 /* Output data buffer and length. */
1730 cy_as_storage_sd_reg_read_data *data_p,
1731 /* Callback function to call when done. */
1732 cy_as_function_callback cb,
1733 /* Call context to send to the cb function. */
1738 Creates a partition starting at the given block and using the
1739 remaining blocks on the card.
1742 Storage devices attached to West Bridge can be partitioned
1744 The visibility of these units through the mass storage
1746 individually controlled. This API is used to partition
1749 * Valid in Asynchronous Callback: Yes (if cb supplied)
1753 * CY_AS_ERROR_SUCCESS - the partition was successfully created
1754 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
1755 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1757 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1759 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
1761 * CY_AS_ERROR_IN_SUSPEND - The West Bridge device is in
1763 * CY_AS_ERROR_USB_RUNNING - Partition cannot be created while
1764 * USB stack is active
1765 * CY_AS_ERROR_OUT_OF_MEMORY - failed to get memory to
1767 * CY_AS_ERROR_INVALID_REQUEST - feature not supported by
1768 * active device or firmware
1769 * CY_AS_ERROR_INVALID_RESPONSE - communication failure with
1770 * West Bridge firmware
1771 * CY_AS_ERROR_ALREADY_PARTITIONED - the storage device already
1772 * has been partitioned
1773 * CY_AS_ERROR_INVALID_BLOCK - Size specified for the partition
1774 * exceeds the actual device capacity
1777 * <LINK Partitioning>
1778 * CyAsStorageRemovePPartition
1780 EXTERN cy_as_return_status_t
1781 cy_as_storage_create_p_partition(
1782 /* Handle to the device of interest */
1783 cy_as_device_handle handle,
1784 /* Bus on which the device to be partitioned is connected */
1785 cy_as_bus_number_t bus,
1786 /* Device number to be partitioned */
1788 /* Size of partition number 0 in blocks */
1790 /* Callback in case of async call */
1791 cy_as_function_callback cb,
1792 /* Client context to pass to the callback */
1797 Removes the partition table on a storage device connected
1801 Storage devices attached to West Bridge can be partitioned
1802 into two units.This partition information is stored on the
1803 device and is non-volatile. This API is used to remove the
1804 stored partition information and make the entire device
1805 visible as a single partition (unit).
1807 * Valid in Asynchronous Callback: Yes (if cb supplied)
1811 * CY_AS_ERROR_SUCCESS - the partition was successfully
1813 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1815 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
1816 * not been configured
1817 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1818 * loaded into West Bridge
1819 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
1821 * CY_AS_ERROR_IN_SUSPEND - The West Bridge device is in
1823 * CY_AS_ERROR_USB_RUNNING - Partition cannot be created
1824 * while USB stack is active
1825 * CY_AS_ERROR_OUT_OF_MEMORY - failed to get memory to
1827 * CY_AS_ERROR_INVALID_REQUEST - operation not supported
1828 * by active device/firmware
1829 * CY_AS_ERROR_NO_SUCH_UNIT - the addressed device is
1833 * <LINK Partitioning>
1834 * CyAsStorageCreatePPartition
1836 EXTERN cy_as_return_status_t
1837 cy_as_storage_remove_p_partition(
1838 /* Handle to the device of interest */
1839 cy_as_device_handle handle,
1840 /* Bus on which device of interest is connected */
1841 cy_as_bus_number_t bus,
1842 /* Device number of interest */
1844 /* Callback in case of async call */
1845 cy_as_function_callback cb,
1846 /* Client context to pass to the callback */
1851 Returns the amount of data read/written to the given
1852 device from the USB host.
1856 * Valid in Asynchronous Callback: Yes (if cb supplied)
1860 * CY_AS_ERROR_SUCCESS - API call completed successfully
1861 * CY_AS_ERROR_INVALID_HANDLE - Invalid West Bridge device
1863 * CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has
1864 * not been configured
1865 * CY_AS_ERROR_NO_FIRMWARE - No firmware image has been
1866 * loaded on West Bridge device
1867 * CY_AS_ERROR_NOT_RUNNING - Storage stack has not been
1869 * CY_AS_ERROR_NOT_SUPPORTED - This function is not
1870 * supported by active firmware version
1871 * CY_AS_ERROR_OUT_OF_MEMORY - Failed to get memory to
1872 * process the request
1873 * CY_AS_ERROR_TIMEOUT - West Bridge firmware did not
1874 * respond to request
1875 * CY_AS_ERROR_INVALID_RESPONSE - Unexpected reply from
1876 * West Bridge firmware
1879 * CyAsUsbSetMSReportThreshold
1881 EXTERN cy_as_return_status_t
1882 cy_as_storage_get_transfer_amount(
1883 /* Handle to the device of interest */
1884 cy_as_device_handle handle,
1885 /* Bus on which device of interest is connected */
1886 cy_as_bus_number_t bus,
1887 /* Device number of interest */
1889 /* Return value containing read/write sector counts. */
1890 cy_as_m_s_c_progress_data *data_p,
1891 /* Callback in case of async call */
1892 cy_as_function_callback cb,
1893 /* Client context to pass to the callback */
1898 Performs a Sector Erase on an attached SD Card
1901 This allows you to erase an attached SD card. The area to erase
1902 is specified in terms of a starting Erase Unit and a number of
1903 Erase Units. The size of each Erase Unit is defined in the
1904 DeviceDesc returned from a StorageQueryDevice call and it can
1905 differ between SD cards.
1907 A large erase can take a while to complete depending on the SD
1908 card. In such a case it is recommended that an async call is made.
1911 * CY_AS_ERROR_SUCCESS - API call completed successfully
1912 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1914 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1916 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
1918 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
1919 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1920 * the West Bridge device
1921 * CY_AS_ERROR_ASYNC_PENDING - an async operation is pending
1922 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
1923 * reading from the media
1924 * CY_AS_ERROR_MEDIA_WRITE_PROTECTED - the media is write protected
1925 * CY_AS_ERROR_QUERY_DEVICE_NEEDED - A query device call is
1926 * required before erase is allowed
1927 * CY_AS_ERROR_NO_SUCH_BUS
1928 * CY_AS_ERROR_NO_SUCH_DEVICE
1929 * CY_AS_ERROR_NOT_SUPPORTED - Erase is currently only supported
1930 * on SD and using SD only firmware
1931 * CY_AS_ERROR_OUT_OF_MEMORY
1934 * CyAsStorageSDRegisterRead
1936 EXTERN cy_as_return_status_t
1937 cy_as_storage_erase(
1938 /* Handle to the device of interest */
1939 cy_as_device_handle handle,
1940 /* Bus on which device of interest is connected */
1941 cy_as_bus_number_t bus,
1942 /* Device number of interest */
1944 /* Erase Unit to start the erase */
1945 uint32_t erase_unit,
1946 /* Number of Erase Units to erase */
1947 uint16_t num_erase_units,
1948 /* Callback in case of async call */
1949 cy_as_function_callback cb,
1950 /* Client context to pass to the callback */
1955 This function is used to read a Tuple from the SDIO CIS area.
1958 This function is used to read a Tuple from the SDIO CIS area.
1959 This function is to be used only for IO to an SDIO card as
1960 other media will not respond to the SDIO command set.
1962 * Valid in Asynchronous Callback: NO
1963 * Valid on Antioch device: NO
1966 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
1967 * not been configured
1968 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
1969 * loaded into West Bridge
1970 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
1972 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1974 * CY_AS_ERROR_SUCCESS - the media information was returned
1975 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device
1976 * is in suspend mode
1977 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
1978 * with the West Bridge device
1979 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
1981 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
1982 * pair does not exist
1983 * CY_AS_ERROR_ASYNC_PENDING - an async operation is pending
1984 * CY_AS_ERROR_INVALID_REQUEST - an invalid IO request
1986 * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
1987 * CY_AS_ERROR_INVALID_RESPONSE - an error message was
1988 * received from the firmware
1989 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
1990 * reading from the media
1991 * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made to
1992 * an invalid function
1993 * CY_AS_ERROR_INVALID_ENDPOINT - A DMA request was made to
1994 * an invalid endpoint
1995 * CY_AS_ERROR_ENDPOINT_DISABLED - A DMA request was made to
1996 * a disabled endpoint
1999 cy_as_return_status_t
2000 cy_as_sdio_get_c_i_s_info(
2001 /* Handle to the Westbridge device */
2002 cy_as_device_handle handle,
2004 cy_as_bus_number_t bus,
2007 /* IO function Number */
2008 uint8_t n_function_no,
2009 /* Id of tuple to be fetched */
2011 /* Buffer to hold tuple read from card.
2012 should be at least 256 bytes in size */
2018 This function is used to read properties of the SDIO card.
2021 This function is used to read properties of the SDIO card
2022 into a CyAsSDIOCard structure.
2023 This function is to be used only for IO to an SDIO card as
2024 other media will not respond to the SDIO command set.
2026 * Valid in Asynchronous Callback: NO
2027 * Valid on Antioch device: NO
2030 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
2031 * not been configured
2032 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
2033 * loaded into West Bridge
2034 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
2036 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2038 * CY_AS_ERROR_SUCCESS - the card information was returned
2039 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2041 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
2042 * with the West Bridge device
2043 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2044 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
2046 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
2047 * pair does not exist
2048 * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
2049 * CY_AS_ERROR_INVALID_RESPONSE - an error message was
2050 * received from the firmware
2053 cy_as_return_status_t
2054 cy_as_sdio_query_card(
2055 /* Handle to the Westbridge device */
2056 cy_as_device_handle handle,
2058 cy_as_bus_number_t bus,
2061 /* Buffer to store card properties */
2062 cy_as_sdio_card *data_p
2066 This function is used to reset a SDIO card.
2069 This function is used to reset a SDIO card by writing to
2070 the reset bit in the CCCR and reinitializing the card. This
2071 function is to be used only for IO to an SDIO card as
2072 other media will not respond to the SDIO command set.
2074 * Valid in Asynchronous Callback: NO
2075 * Valid on Antioch device: NO
2078 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
2079 * not been configured
2080 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
2082 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
2084 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2086 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2088 * CY_AS_ERROR_SUCCESS - the media information was returned
2089 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
2090 * with the West Bridge device
2091 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2092 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
2094 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
2095 * pair does not exist
2096 * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
2097 * CY_AS_ERROR_INVALID_RESPONSE - an error message was
2098 * received from the firmware
2100 cy_as_return_status_t
2101 cy_as_sdio_reset_card(
2102 /* Handle to the Westbridge device */
2103 cy_as_device_handle handle,
2105 cy_as_bus_number_t bus,
2111 This function performs a Synchronous 1 byte read from the sdio
2115 This function is used to perform a synchronous 1 byte read
2116 from an SDIO card function. This function is to be used only
2117 for IO to an SDIO card as other media will not respond to the
2120 * Valid in Asynchronous Callback: NO
2121 * Valid on Antioch device: NO
2124 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
2126 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
2128 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
2130 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed
2132 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2134 * CY_AS_ERROR_SUCCESS - the media information was returned
2135 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
2136 * the West Bridge device
2137 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2138 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not exist
2139 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device pair
2141 * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
2142 * CY_AS_ERROR_INVALID_RESPONSE - an error message was received
2144 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in reading
2146 * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made to an
2148 * CY_AS_ERROR_FUNCTION_SUSPENDED - The function to which read
2149 * was attempted is in suspend
2151 cy_as_return_status_t
2152 cy_as_sdio_direct_read(
2153 /* Handle to the Westbridge device */
2154 cy_as_device_handle handle,
2156 cy_as_bus_number_t bus,
2159 /* IO function Number */
2160 uint8_t n_function_no,
2161 /* Address for IO */
2163 /* Set to CY_SDIO_REARM_INT to reinitialize SDIO interrupt */
2165 /* Buffer to hold byte read from card */
2170 This function performs a Synchronous 1 byte write to the
2171 sdio device function.
2174 This function is used to perform a synchronous 1 byte write
2175 to an SDIO card function.
2176 This function is to be used only for IO to an SDIO card as
2177 other media will not respond to the SDIO command set.
2179 * Valid in Asynchronous Callback: NO
2180 * Valid on Antioch device: NO
2183 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
2184 * not been configured
2185 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
2186 * loaded into West Bridge
2187 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
2189 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2191 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2193 * CY_AS_ERROR_SUCCESS - the media information was returned
2194 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
2195 * with the West Bridge device
2196 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2197 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not exist
2198 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
2199 * pair does not exist
2200 * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
2201 * CY_AS_ERROR_INVALID_RESPONSE - an error message was received
2203 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
2204 * reading from the media
2205 * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made to
2206 * an invalid function
2207 * CY_AS_ERROR_FUNCTION_SUSPENDED - The function to which
2208 * write was attempted is in suspend
2210 cy_as_return_status_t
2211 cy_as_sdio_direct_write(
2212 /* Handle to the Westbridge device */
2213 cy_as_device_handle handle,
2215 cy_as_bus_number_t bus,
2218 /* IO function Number */
2219 uint8_t n_function_no,
2220 /* Address for IO */
2222 /* Set to CY_SDIO_REARM_INT to reinitialize SDIO interrupt,
2223 set to CY_SDIO_RAW for read after write */
2227 /* Buffer to hold byte read from card in Read after write mode */
2232 This function is used to set the blocksize of an SDIO function.
2235 This function is used to set the blocksize of an SDIO function.
2236 This function is to be used only for IO to an SDIO card as
2237 other media will not respond to the SDIO command set.
2239 * Valid in Asynchronous Callback: NO
2240 * Valid on Antioch device: NO
2243 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
2244 * not been configured
2245 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
2246 * loaded into West Bridge
2247 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
2249 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2251 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2253 * CY_AS_ERROR_SUCCESS - the media information was
2255 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
2256 * with the West Bridge device
2257 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2258 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
2260 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
2261 * pair does not exist
2262 * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory
2264 * CY_AS_ERROR_INVALID_RESPONSE - an error message was
2265 * received from the firmware
2266 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
2267 * reading from the media
2268 * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
2269 * to an invalid function
2270 * CY_AS_ERROR_INVALID_BLOCKSIZE - An incorrect blocksize
2271 * was passed to the function.
2272 * CY_AS_ERROR_FUNCTION_SUSPENDED - The function to which
2273 * write was attempted is in suspend
2275 cy_as_return_status_t
2276 cy_as_sdio_set_blocksize(
2277 /* Handle to the Westbridge device */
2278 cy_as_device_handle handle,
2280 cy_as_bus_number_t bus,
2283 /* IO function Number */
2284 uint8_t n_function_no,
2285 /* Block size to set. */
2290 This function is used to read Multibyte/Block data from a
2294 This function is used to read Multibyte/Block data from a
2295 IO function. This function is to be used only for IO to an
2296 SDIO card as other media will not respond to the SDIO
2299 * Valid in Asynchronous Callback: YES
2300 * Valid on Antioch device: NO
2303 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
2304 * not been configured
2305 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
2306 * loaded into West Bridge
2307 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
2309 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2311 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2313 * CY_AS_ERROR_SUCCESS - the media information was returned
2314 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
2315 * the West Bridge device
2316 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2317 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not exist
2318 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
2319 * pair does not exist
2320 * CY_AS_ERROR_ASYNC_PENDING - an async operation is pending
2321 * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
2322 * CY_AS_ERROR_INVALID_RESPONSE - an error message was received
2324 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
2325 * reading from the media
2326 * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made to
2327 * an invalid function
2328 * CY_AS_ERROR_INVALID_BLOCKSIZE - An incorrect blocksize or
2329 * block count was passed to the function.
2330 * CY_AS_ERROR_FUNCTION_SUSPENDED - The function to which
2331 * write was attempted is in suspend
2332 * CY_AS_ERROR_IO_ABORTED - The IO operation was aborted
2333 * CY_AS_ERROR_IO_SUSPENDED - The IO operation was suspended
2334 * CY_AS_ERROR_INVALID_REQUEST - An invalid request was
2335 * passed to the card.
2338 cy_as_return_status_t
2339 cy_as_sdio_extended_read(
2340 /* Handle to the Westbridge device */
2341 cy_as_device_handle handle,
2343 cy_as_bus_number_t bus,
2346 /* IO function Number */
2347 uint8_t n_function_no,
2348 /* Base Address for IO */
2350 /* Set to CY_SDIO_BLOCKMODE for block IO,
2351 CY_SDIO_BYTEMODE for multibyte IO,
2352 CY_SDIO_OP_FIFO to read multiple bytes from the
2353 same address, CY_SDIO_OP_INCR to read bytes from
2354 the incrementing addresses */
2356 /* Block/Byte count to read */
2358 /* Buffer to hold data read from card */
2360 /* Callback in case of Asyncronous call. 0 if Synchronous */
2361 cy_as_sdio_callback callback
2365 This function is used to write Multibyte/Block data
2369 This function is used to write Multibyte/Block data
2370 to a IO function. This function is to be used only
2371 for IO to an SDIO card as other media will not respond
2372 to the SDIO command set.
2374 * Valid in Asynchronous Callback: YES
2375 * Valid on Antioch device: NO
2378 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
2379 * not been configured
2380 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
2381 * loaded into West Bridge
2382 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
2384 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2386 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2388 * CY_AS_ERROR_SUCCESS - the media information was returned
2389 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
2390 * with the West Bridge device
2391 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2392 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
2394 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
2395 * pair does not exist
2396 * CY_AS_ERROR_ASYNC_PENDING - an async operation is pending
2397 * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
2398 * CY_AS_ERROR_INVALID_RESPONSE - an error message was
2399 * received from the firmware
2400 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
2401 * reading from the media
2402 * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
2403 * to an invalid function
2404 * CY_AS_ERROR_INVALID_BLOCKSIZE - An incorrect blocksize or
2405 * block count was passed to the function.
2406 * CY_AS_ERROR_FUNCTION_SUSPENDED - The function to which
2407 * write was attempted is in suspend
2408 * CY_AS_ERROR_IO_ABORTED - The IO operation was aborted
2409 * CY_AS_ERROR_IO_SUSPENDED - The IO operation was suspended
2410 * CY_AS_ERROR_INVALID_REQUEST - An invalid request was
2411 * passed to the card.
2413 cy_as_return_status_t
2414 cy_as_sdio_extended_write(
2415 /* Handle to the Westbridge device */
2416 cy_as_device_handle handle,
2418 cy_as_bus_number_t bus,
2421 /* IO function Number */
2422 uint8_t n_function_no,
2423 /* Base Address for IO */
2425 /* Set to CY_SDIO_BLOCKMODE for block IO,
2426 CY_SDIO_BYTEMODE for multibyte IO,
2427 CY_SDIO_OP_FIFO to write multiple bytes to the same address,
2428 CY_SDIO_OP_INCR to write multiple bytes to incrementing
2431 /* Block/Byte count to write
2432 in case of byte mode the count should not exceed the block size
2433 or 512, whichever is smaller.
2434 in case of block mode, maximum number of blocks is 511. */
2436 /* Buffer to hold data to be written to card. */
2438 /* Callback in case of Asyncronous call. 0 if Synchronous */
2439 cy_as_sdio_callback callback
2443 This function is used to initialize a SDIO card function.
2446 This function is used to initialize a SDIO card function
2447 (1 - 7). This function is to be used only for IO to an
2448 SDIO card as other media will not respond to the SDIO
2451 * Valid in Asynchronous Callback: NO
2452 * Valid on Antioch device: NO
2455 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
2456 * not been configured
2457 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
2459 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
2461 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed
2463 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2465 * CY_AS_ERROR_SUCCESS - the media information was returned
2466 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
2467 * with the West Bridge device
2468 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2469 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not exist
2470 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
2471 * pair does not exist
2472 * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
2473 * CY_AS_ERROR_INVALID_RESPONSE - an error message was
2474 * received from the firmware
2475 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
2476 * reading from the media
2477 * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
2478 * to an invalid function
2480 cy_as_return_status_t
2481 cy_as_sdio_init_function(
2482 /* Handle to the Westbridge device */
2483 cy_as_device_handle handle,
2485 cy_as_bus_number_t bus,
2488 /* IO function Number */
2489 uint8_t n_function_no,
2490 /* Set to CY_SDIO_FORCE_INIT to reinitialize function */
2495 This function is used to get properties of a SDIO card function.
2498 This function is used to get properties of a SDIO card functio
2499 (1 - 7) into a CyAsSDIOFunc structure. This function is to be
2500 used only for IO to an SDIO card as other media will not respond
2501 to the SDIO command set.
2503 * Valid in Asynchronous Callback: NO
2504 * Valid on Antioch device: NO
2507 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
2509 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
2511 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
2513 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed
2515 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2517 * CY_AS_ERROR_SUCCESS - the media information was returned
2518 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2519 * CY_AS_ERROR_NO_SUCH_BUS - the media specified does
2521 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device pair
2523 * CY_AS_ERROR_INVALID_FUNCTION - An IO request was made to
2524 * an invalid function
2526 cy_as_return_status_t
2527 cy_as_sdio_query_function(
2528 /* Handle to the Westbridge device */
2529 cy_as_device_handle handle,
2531 cy_as_bus_number_t bus,
2534 /* IO function Number */
2535 uint8_t n_function_no,
2536 /* Buffer to store function properties */
2537 cy_as_sdio_func *data_p
2541 This function is used to Abort the current IO function.
2544 This function is used to Abort the current IO function.
2545 This function is to be used only for IO to an SDIO card as
2546 other media will not respond to the SDIO command set.
2548 * Valid in Asynchronous Callback: NO
2549 * Valid on Antioch device: NO
2552 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
2553 * has not been configured
2554 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
2555 * loaded into West Bridge
2556 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
2558 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2560 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2562 * CY_AS_ERROR_SUCCESS - the media information was
2564 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
2565 * with the West Bridge device
2566 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2567 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
2569 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified
2570 * media/device pair does not exist
2571 * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory
2573 * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
2574 * to an invalid function
2576 cy_as_return_status_t
2577 cy_as_sdio_abort_function(
2578 /* Handle to the Westbridge device */
2579 cy_as_device_handle handle,
2581 cy_as_bus_number_t bus,
2584 /* IO function Number */
2585 uint8_t n_function_no
2589 This function is used to Disable IO to an SDIO function.
2592 This function is used to Disable IO to an SDIO function.
2593 This function is to be used only for IO to an SDIO card as
2594 other media will not respond to the SDIO command set.
2596 * Valid in Asynchronous Callback: NO
2597 * Valid on Antioch device: NO
2600 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
2601 * has not been configured
2602 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
2603 * loaded into West Bridge
2604 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
2606 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2608 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is
2610 * CY_AS_ERROR_SUCCESS - the media information was
2612 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
2613 * with the West Bridge device
2614 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2615 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
2617 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
2618 * pair does not exist
2619 * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
2620 * to an invalid function
2622 cy_as_return_status_t
2623 cy_as_sdio_de_init_function(
2624 /* Handle to the Westbridge device */
2625 cy_as_device_handle handle,
2627 cy_as_bus_number_t bus,
2630 /* IO function Number */
2631 uint8_t n_function_no
2635 This function is used to Suspend the current IO function.
2638 This function is used to Suspend the current IO function.
2639 This function is to be used only for IO to an SDIO card as
2640 other media will not respond to the SDIO command set.
2642 * Valid in Asynchronous Callback: NO
2643 * Valid on Antioch device: NO
2646 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
2647 * not been configured
2648 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
2649 * loaded into West Bridge
2650 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
2652 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2654 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2656 * CY_AS_ERROR_SUCCESS - the media information was returned
2657 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
2658 * with the West Bridge device
2659 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2660 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
2662 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified
2663 * media/device pair does not exist
2664 * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory
2666 * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
2667 * to an invalid function
2669 cy_as_return_status_t
2671 /* Handle to the Westbridge device */
2672 cy_as_device_handle handle,
2674 cy_as_bus_number_t bus,
2677 /* IO function Number */
2678 uint8_t n_function_no
2682 This function is used to resume a Suspended IO function.
2685 This function is used to resume a Suspended IO function.
2686 This function is to be used only for IO to an SDIO card as
2687 other media will not respond to the SDIO command set.
2689 * Valid in Asynchronous Callback: NO
2690 * Valid on Antioch device: NO
2693 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
2694 * has not been configured
2695 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
2696 * loaded into West Bridge
2697 * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
2699 * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2701 * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is
2703 * CY_AS_ERROR_SUCCESS - the media information was
2705 * CY_AS_ERROR_TIMEOUT - a timeout occurred
2706 * communicating with the West Bridge device
2707 * CY_AS_ERROR_NOT_RUNNING - the stack is not running
2708 * CY_AS_ERROR_NO_SUCH_BUS - the bus specified
2710 * CY_AS_ERROR_NO_SUCH_DEVICE - the specified
2711 * media/device pair does not exist
2712 * CY_AS_ERROR_ASYNC_PENDING - an async operation
2714 * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory
2716 * CY_AS_ERROR_INVALID_RESPONSE - an error message was
2717 * received from the firmware
2718 * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error
2719 * in reading from the media
2720 * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was
2721 * made to an invalid function
2722 * CY_AS_ERROR_IO_ABORTED - The IO operation was
2724 * CY_AS_ERROR_IO_SUSPENDED - The IO operation was
2726 * CY_AS_ERROR_INVALID_REQUEST - An invalid request was
2727 * passed to the card.
2730 cy_as_return_status_t
2732 /* Handle to the Westbridge device */
2733 cy_as_device_handle handle,
2735 cy_as_bus_number_t bus,
2738 /* IO function Number */
2739 uint8_t n_function_no,
2740 /* Operation to resume (Read or Write) */
2742 /* Micellaneous buffer same as for Extended read and Write */
2744 /* Number of pending blocks for IO. Should be less
2745 than or equal to the maximum defined for extended
2747 uint16_t pendingblockcount,
2748 /* Buffer to continue the Suspended IO operation */
2754 /* For supporting deprecated functions */
2755 #include "cyasstorage_dep.h"
2757 #include "cyas_cplus_end.h"
2759 #endif /* _INCLUDED_CYASSTORAGE_H_ */