linux/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h
<<
>>
Prefs
   1/* Cypress West Bridge API header file (cyasstorage.h)
   2## ===========================
   3## Copyright (C) 2010  Cypress Semiconductor
   4##
   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.
   9##
  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.
  14##
  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## ===========================
  20*/
  21
  22#ifndef _INCLUDED_CYASSTORAGE_H_
  23#define _INCLUDED_CYASSTORAGE_H_
  24
  25#include "cyasmedia.h"
  26#include "cyasmisc.h"
  27#include "cyas_cplus_start.h"
  28
  29
  30/*@@Storage APIs
  31  Summary
  32  This section documents the storage APIs supported by the
  33  West Bridge API.
  34
  35  Description
  36  The storage API is based on some specific concepts which
  37  are referenced here.
  38  * <LINK Storage API Overview>
  39  * Addressing
  40  * Ownership
  41  * <LINK Asynchronous Versus Synchronous Operation>
  42*/
  43
  44/*@@Storage API Overview
  45  Summary
  46  Storage devices are identified by media type. Each media
  47  type is considered a  single logical device.
  48
  49  Description
  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
  52  N is the size of the
  53  media type in blocks. The mass storage APIs defined below
  54  provide the
  55  capability to query for devices that are present, and
  56  read/write data to/from
  57  these devices.
  58*/
  59
  60/*@@Addressing
  61  Summary
  62  Blocks within a storage device are address by a hierarchal
  63  block address.  This
  64  address consists of the bus number, physical device,
  65   logical unit, and finally
  66  block address.
  67
  68  Description
  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.
  78
  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
  82  units.  This partition
  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
  86  logical units.
  87
  88  Finally a logical block address is given within the
  89  logical unit to address an
  90  individual block.
  91*/
  92
  93/*@@Ownership
  94  Summary
  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.
 104
 105  Description
 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.
 116
 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().
 128
 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.
 138*/
 139
 140/*@@Asynchronous Versus Synchronous Operation
 141  Summary
 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.
 150
 151  Description
 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.
 168*/
 169
 170/*@@Partitioning
 171  Summary
 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
 177  APIs.
 178
 179  Description
 180  The CyAsStorageCreatePPartition API is used to divide the total
 181  storage on a storage
 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
 187  stored on the device
 188  before the creation of the partition, is liable to be lost when
 189  a partition is created.
 190
 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
 194  partition again.
 195
 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.
 202*/
 203
 204/*********************************
 205 * West Bridge Constants
 206 **********************************/
 207
 208/* Summary
 209   This constants indicates a raw device access to the read/write
 210   functions
 211
 212   Description
 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
 220   is used in calls to
 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.
 226
 227   See Also
 228   * CyAsStorageRead
 229   * CyAsStorageReadAsync
 230   * CyAsStorageWrite
 231   * CyAsStorageWriteAsync
 232*/
 233#define CY_AS_LUN_PHYSICAL_DEVICE (0xffffffff)
 234
 235/* Summary
 236   This constant represents the maximum DMA burst length
 237   supported on a storage endpoint
 238
 239   Description
 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
 245   and speed of the USB
 246   connection.
 247*/
 248#define CY_AS_STORAGE_EP_SIZE (512)
 249
 250/********************************
 251 * West Bridge Types
 252 *******************************/
 253
 254/* Summary
 255   This type indicates the type of event in an event
 256   callback from West Bridge
 257
 258   Description
 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.
 268
 269   See Also
 270   * CyAsStorageEventCallback
 271   * CyAsStorageRegisterCallback
 272*/
 273typedef 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,
 283
 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,
 290
 291        /*  This event occurs when a removable media type has
 292        been removed. */
 293        cy_as_storage_removed,
 294
 295        /*  This event occurs when a removable media type has
 296                been inserted. */
 297        cy_as_storage_inserted,
 298
 299        /* This event occurs when the West Bridge device
 300         * percieves an interrrupt from an SDIO card */
 301        cy_as_sdio_interrupt
 302
 303} cy_as_storage_event;
 304
 305/* Summary
 306   This type gives the type of the operation in a storage
 307   operation callback
 308
 309   Description
 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
 313   has completed.
 314
 315   See Also
 316   * <LINK Asynchronous Versus Synchronous Operation>
 317   * CyAsStorageRead
 318   * CyAsStorageWrite
 319*/
 320typedef enum cy_as_oper_type {
 321        /* A data read operation */
 322        cy_as_op_read,
 323        /* A data write operation */
 324        cy_as_op_write
 325} cy_as_oper_type;
 326
 327/* Summary
 328   This data structure describes a specific type of media
 329
 330   Description
 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.
 334
 335   See Also
 336   * CyAsStorageQueryDevice
 337*/
 338typedef struct cy_as_device_desc {
 339        /* Type of device */
 340        cy_as_media_type   type;
 341        /* Is the device removable */
 342        cy_bool         removable;
 343        /* Is the device writeable */
 344        cy_bool         writeable;
 345        /* Basic block size for device */
 346        uint16_t                block_size;
 347        /* Number of LUNs on the device */
 348        uint32_t                number_units;
 349        /* Is the device password locked */
 350        cy_bool         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;
 355} cy_as_device_desc;
 356
 357/* Summary
 358   This data structure describes a specific unit on a
 359   specific type of media
 360
 361   Description
 362   This data structure is the return value from the
 363   CyAsStorageQueryUnit function. This structure provides
 364   information about the specific unit.
 365
 366   See Also
 367   * CyAsStorageQueryUnit
 368*/
 369typedef struct cy_as_unit_desc {
 370        /* Type of device */
 371        cy_as_media_type type;
 372        /* Basic block size for device */
 373        uint16_t block_size;
 374        /* Physical start block for LUN */
 375        uint32_t start_block;
 376        /* Number of blocks in the LUN */
 377        uint32_t unit_size;
 378} cy_as_unit_desc;
 379
 380/* Summary
 381   This function type defines a callback to be called after an
 382   asynchronous operation
 383
 384   Description
 385   This function type defines a callback function that is called
 386   at the completion of any asynchronous read or write operation.
 387
 388   See Also
 389   * CyAsStorageReadAsync()
 390   * CyAsStorageWriteAsync()
 391*/
 392typedef 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 */
 398        uint32_t device,
 399        /* The unit completing the operation */
 400        uint32_t unit,
 401        /* The block number of the completed operation */
 402        uint32_t block_number,
 403        /* The type of operation */
 404        cy_as_oper_type op,
 405        /* The error status */
 406        cy_as_return_status_t status
 407        );
 408
 409/* Summary
 410   This function type defines a callback to be called in the
 411   event of a storage related event
 412
 413   Description
 414   At times West Bridge needs to inform the P port processor
 415   of events that have
 416   occurred.  These events are asynchronous to the thread of
 417   control on the P
 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.
 423
 424   See Also
 425   * CyAsStorageEvent
 426   * CyAsStorageRegisterCallback
 427*/
 428typedef 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 */
 434        uint32_t device,
 435        /* The event type */
 436        cy_as_storage_event evtype,
 437        /* Event related data */
 438        void *evdata
 439        );
 440
 441/* Summary
 442   This function type defines a callback to be called after
 443   an asynchronous sdio operation
 444
 445   Description
 446   The Callback function is called at the completion of an
 447   asynchronous sdio read or write operation.
 448
 449   See Also
 450   * CyAsSdioExtendedRead()
 451   * CyAsSdioExtendedWrite()
 452*/
 453typedef 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 */
 459        uint32_t device,
 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. */
 464        uint32_t function,
 465        /* The base address of the completed operation */
 466        uint32_t address,
 467        /* The type of operation */
 468        cy_as_oper_type op,
 469        /* The status of the operation */
 470        cy_as_return_status_t status
 471        );
 472
 473/* Summary
 474   Enumeration of SD/MMC card registers that can be read
 475   through the API.
 476
 477   Description
 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.
 481
 482   See Also
 483   * CyAsStorageSDRegisterRead
 484 */
 485typedef enum cy_as_sd_card_reg_type {
 486        cy_as_sd_reg_OCR = 0,
 487        cy_as_sd_reg_CID,
 488        cy_as_sd_reg_CSD
 489} cy_as_sd_card_reg_type;
 490
 491/* Summary
 492   Struct encapsulating parameters and return values for a
 493   CyAsStorageQueryDevice call.
 494
 495   Description
 496   This struct holds the input parameters and the return values
 497   for an asynchronous CyAsStorageQueryDevice call.
 498
 499   See Also
 500   * CyAsStorageQueryDevice
 501 */
 502typedef 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 */
 506        uint32_t                device;
 507        /* The return value for the device descriptor */
 508        cy_as_device_desc        desc_p;
 509} cy_as_storage_query_device_data;
 510
 511
 512/* Summary
 513   Struct encapsulating parameters and return values
 514   for a CyAsStorageQueryUnit call.
 515
 516   Description
 517   This struct holds the input parameters and the return
 518   values for an asynchronous CyAsStorageQueryUnit call.
 519
 520   See Also
 521   * CyAsStorageQueryUnit
 522 */
 523typedef 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 */
 527        uint32_t                        device;
 528        /* The unit to query on the device */
 529        uint32_t                        unit;
 530        /* The return value for the unit descriptor */
 531        cy_as_unit_desc  desc_p;
 532} cy_as_storage_query_unit_data;
 533
 534/* Summary
 535   Struct encapsulating the input parameter and return
 536   values for a CyAsStorageSDRegisterRead call.
 537
 538   Description
 539   This struct holds the input parameter and return
 540   values for an asynchronous CyAsStorageSDRegisterRead
 541   call.
 542
 543   See Also
 544   * CyAsStorageSDRegisterRead
 545 */
 546typedef struct cy_as_storage_sd_reg_read_data {
 547        /* Pointer to the result buffer. */
 548        uint8_t *buf_p;
 549        /* Length of data to be copied in bytes. */
 550        uint8_t  length;
 551} cy_as_storage_sd_reg_read_data;
 552
 553/* Summary
 554   Controls which pins are used for card detection
 555
 556   Description
 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.
 560
 561   See Also
 562   * CyAsStorageDeviceControl
 563*/
 564typedef 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;
 568
 569#ifndef __doxygen__
 570#define cy_as_storage_detect_GPIO_0 cy_as_storage_detect_GPIO
 571
 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)
 580
 581#endif
 582
 583/* Summary
 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.
 587
 588   Description
 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.
 594
 595   See Also
 596   * CyAsUsbEventCallback
 597   * CyAsUsbRegisterCallback
 598*/
 599typedef struct cy_as_m_s_c_progress_data {
 600        /* Number of sectors written since the last event. */
 601        uint32_t wr_count;
 602        /* Number of sectors read since the last event. */
 603        uint32_t rd_count;
 604} cy_as_m_s_c_progress_data;
 605
 606/* Summary
 607Flag to set Direct Write operation to read back from the
 608address written to.
 609
 610
 611 See Also
 612 *CyAsSdioDirectWrite()
 613*/
 614#define CY_SDIO_RAW     (0x01)
 615
 616
 617/* Summary
 618Flag to set Extended Read and Write to perform IO
 619using a FIFO i.e. read or write from the specified
 620address only.
 621
 622 See Also
 623 *CyAsSdioExtendedRead()
 624 *CyAsSdioExtendedWrite()
 625*/
 626#define CY_SDIO_OP_FIFO (0x00)
 627
 628/* Summary
 629Flag to set Extended Read and Write to perform incremental
 630IO using the address provided as the base address.
 631
 632
 633 See Also
 634 *CyAsSdioExtendedRead()
 635 *CyAsSdioExtendedWrite()
 636*/
 637#define CY_SDIO_OP_INCR          (0x02)
 638
 639/* Summary
 640Flag to set Extended Read and Write to Block Mode operation
 641
 642 See Also
 643 *CyAsSdioExtendedRead()
 644 *CyAsSdioExtendedWrite()
 645*/
 646#define CY_SDIO_BLOCKMODE          (0x04)
 647
 648/* Summary
 649Flag to set Extended Read and Write to Byte Mode operation
 650
 651 See Also
 652 *CyAsSdioExtendedRead()
 653 *CyAsSdioExtendedWrite()
 654*/
 655#define CY_SDIO_BYTEMODE                (0x00)
 656
 657/* Summary
 658Flag to force re/initialization of a function.
 659
 660Description
 661If not set a call to CyAsSdioInitFunction()
 662will not initialize a function that has been previously
 663initialized.
 664 See Also
 665 *CyAsSdioInitFunction()
 666 */
 667#define CY_SDIO_FORCE_INIT        (0x40)
 668
 669/* Summary
 670Flag to re-enable the SDIO interrupts.
 671
 672Description
 673Used with a direct read or direct write
 674after the Interrupt triggerred by SDIO has been serviced
 675and cleared to reset the West Bridge Sdio Interrupt.
 676 See Also
 677 *CyAsSdioDirectRead()
 678 *CyAsSdioDirectWrite()
 679*/
 680
 681#define CY_SDIO_REARM_INT          (0x80)
 682
 683
 684/* Summary
 685   Flag to check if 4 bit support is enabled on a
 686   low speed card
 687   See Also
 688   <link CyAsSDIOCard::card_capability>*/
 689#define CY_SDIO_4BLS    (0x80)
 690
 691/* Summary
 692   Flag to check if card is a low speed card
 693   See Also
 694   <link CyAsSDIOCard::card_capability>   */
 695#define CY_SDIO_LSC      (0x40)
 696
 697/* Summary
 698   Flag to check if interrupt during multiblock data
 699   transfer is enabled
 700   See Also
 701   <link CyAsSDIOCard::card_capability>*/
 702#define CY_SDIO_E4MI    (0x20)
 703
 704/* Summary
 705   Flag to check if interrupt during multiblock data
 706   transfer is supported
 707   See Also
 708   <link CyAsSDIOCard::card_capability> */
 709#define CY_SDIO_S4MI    (0x10)
 710
 711/* Summary
 712   Flag to check if card supports function suspending.
 713   See Also
 714   <link CyAsSDIOCard::card_capability>  */
 715#define CY_SDIO_SBS      (0x08)
 716
 717/* Summary
 718   Flag to check if card supports SDIO Read-Wait
 719   See Also
 720   <link CyAsSDIOCard::card_capability>  */
 721#define CY_SDIO_SRW      (0x04)
 722
 723/* Summary
 724   Flag to check if card supports multi-block transfers
 725   See Also
 726   <link CyAsSDIOCard::card_capability> */
 727#define CY_SDIO_SMB      (0x02)
 728
 729/* Summary
 730   Flag to check if card supports Direct IO commands
 731   during execution of an Extended
 732   IO function
 733   See Also
 734   <link CyAsSDIOCard::card_capability>*/
 735#define CY_SDIO_SDC      (0x01)
 736
 737/* Summary
 738   Flag to check if function has a CSA area.
 739   See Also
 740   <link CyAsSDIOFunc::csa_bits> */
 741#define CY_SDIO_CSA_SUP          (0x40)
 742
 743/* Summary
 744   Flag to check if CSA access is enabled.
 745   See Also
 746   <link CyAsSDIOFunc::csa_bits> */
 747#define CY_SDIO_CSA_EN            (0x80)
 748
 749/* Summary
 750   Flag to check if CSA is Write protected.
 751   See Also
 752   <link CyAsSDIOFunc::csa_bits> */
 753#define CY_SDIO_CSA_WP            (0x01)
 754
 755/* Summary
 756   Flag to check if CSA formatting is prohibited.
 757   See Also
 758   <link CyAsSDIOFunc::csa_bits>*/
 759#define CY_SDIO_CSA_NF            (0x02)
 760
 761/* Summary
 762   Flag to check if the function allows wake-up from low
 763   power mode using some vendor specific method.
 764   See Also
 765   <link CyAsSDIOFunc::wakeup_support>*/
 766#define CY_SDIO_FN_WUS            (0x01)
 767
 768
 769/* Summary
 770   This data structure stores SDIO function 0
 771   parameters for a SDIO card
 772*/
 773typedef 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 */
 785        uint16_t        blocksize;
 786        /* SDIO version supported by the card */
 787        uint8_t  sdio_version;
 788        /* Card capability flags */
 789        uint8_t  card_capability;
 790} cy_as_sdio_card;
 791
 792/* Summary
 793   This data structure stores SDIO function 1-7 parameters
 794   for a SDIO card
 795*/
 796typedef 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 */
 804        uint16_t        blocksize;
 805        /* 32 bit product serial number for the function */
 806        uint32_t        card_psn;
 807        /* Code storage area variables */
 808        uint8_t  csa_bits;
 809        /* Function wake-up support */
 810        uint8_t  wakeup_support;
 811} cy_as_sdio_func;
 812
 813/***********************************
 814 * West Bridge Functions
 815 ************************************/
 816
 817/* Summary
 818   This function starts the West Bridge storage module.
 819
 820   Description
 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.
 825
 826   * Valid In Asynchronous Callback: YES (if cb supplied)
 827   * Nestable: YES
 828
 829   Returns
 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 sucessfully
 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
 840
 841   See Also
 842   * CyAsStorageStop
 843*/
 844EXTERN cy_as_return_status_t
 845cy_as_storage_start(
 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 */
 851        uint32_t                client
 852        );
 853
 854/* Summary
 855   This function stops the West Bridge storage module.
 856
 857   Description
 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.
 862
 863   * Valid In Asynchronous Callback: YES (if cb supplied)
 864   * Nestable: YES
 865
 866   Notes
 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.
 876
 877   Returns
 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
 883   *    passed in
 884   * CY_AS_ERROR_SUCCESS - this module was shut
 885   *    down sucessfully
 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
 891
 892   See Also
 893   * CyAsStorageStart
 894*/
 895EXTERN cy_as_return_status_t
 896cy_as_storage_stop(
 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 */
 902        uint32_t                client
 903        );
 904
 905/* Summary
 906   This function is used to register a callback function
 907   for the storage API.
 908
 909   Description
 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
 918   to this function
 919   replaces any old callback function with a new callback
 920   function supplied on
 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
 924
 925   * Valid In Asynchronous Callback:YES
 926
 927   Returns
 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
 933   *    not been started
 934   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle
 935   *    was passed in
 936   * CY_AS_ERROR_SUCCESS - the function was registered
 937   *    sucessfully
 938   * CY_AS_ERROR_NOT_RUNNING - the stack is not running
 939
 940   See Also
 941   * CyAsStorageEventCallback
 942   * CyAsStorageEvent
 943*/
 944EXTERN cy_as_return_status_t
 945cy_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
 950        );
 951
 952/* Summary
 953   This function claims a given media type.
 954
 955   Description
 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.
 965
 966   * Valid In Asynchronous Callback: NO
 967
 968   Notes
 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
 974
 975   Returns
 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
 981   *    been started
 982   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
 983   *    passed in
 984   * CY_AS_ERROR_SUCCESS - this request was sucessfully
 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
 993
 994   See Also:
 995   * CyAsStorageClaim
 996   * CyAsStorageRelease
 997*/
 998EXTERN cy_as_return_status_t
 999cy_as_storage_claim(
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 */
1005        uint32_t                 device,
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 */
1009        uint32_t                client
1010        );
1011
1012/* Summary
1013   This function releases a given media type.
1014
1015   Description
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.
1024
1025   * Valid In Asynchronous Callback: YES (if cb supplied)
1026   * Nestable: YES
1027
1028   Returns
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
1034   *    been started
1035   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle
1036   *    was passed in
1037   * CY_AS_ERROR_SUCCESS - the media was sucessfully
1038   *    released
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
1047
1048   See Also
1049   * CyAsStorageClaim
1050*/
1051EXTERN cy_as_return_status_t
1052cy_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 */
1058        uint32_t                 device,
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 */
1062        uint32_t                client
1063        );
1064
1065/* Summary
1066   This function information about the number of devices present
1067   on a given bus
1068
1069   Description
1070   This function retrieves information about how many devices on
1071   on the given
1072   West Bridge bus.
1073
1074   * Valid In Asynchronous Callback: NO
1075
1076   Notes
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.
1081
1082   Returns
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
1088   *    been started
1089   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1090   *    passed in
1091   * CY_AS_ERROR_SUCCESS - the media information was
1092   *    returned
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
1098
1099   See Also
1100   * CyAsStorageQueryDevice
1101   * CyAsStorageQueryUnit
1102*/
1103EXTERN cy_as_return_status_t
1104cy_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 */
1111        uint32_t *count,
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 */
1115        uint32_t client
1116        );
1117
1118/* Summary
1119   This function information about the number of devices
1120   present for a given media type
1121
1122   Description
1123   This function retrieves information about how many
1124   devices of a given media type are attached to West Bridge.
1125
1126   * Valid In Asynchronous Callback: YES (if cb supplied)
1127   * Nestable: YES
1128
1129   Notes
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.
1133
1134   Returns
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
1140   *    been started
1141   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1142   *    passed in
1143   * CY_AS_ERROR_SUCCESS - the media information was
1144   *    returned
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
1150
1151   See Also
1152   * CyAsStorageQueryMedia
1153   * CyAsMediaType
1154   * CyAsStorageQueryDevice
1155   * CyAsStorageQueryUnit
1156*/
1157EXTERN cy_as_return_status_t
1158cy_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 */
1165        uint32_t *count,
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 */
1169        uint32_t                client
1170        );
1171
1172/* Summary
1173   This function returns information about a given device
1174   of a specific media type
1175
1176   Description
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.
1183
1184   * Valid In Asynchronous Callback: YES (if cb supplied)
1185   * Nestable: YES
1186
1187   Notes
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).
1191
1192   Returns
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
1198   *    been started
1199   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1200   *    passed in
1201   * CY_AS_ERROR_SUCCESS - the media information was
1202   *    returned
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
1210
1211   See Also
1212   * CyAsMediaType
1213   * CyAsStorageQueryMedia
1214   * CyAsStorageQueryUnit
1215   * CyAsDeviceDesc
1216*/
1217EXTERN cy_as_return_status_t
1218cy_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 */
1226        uint32_t                        client
1227        );
1228
1229/* Summary
1230   This function returns information about a given unit on a
1231   specific device
1232
1233   Description
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
1240   unit.
1241
1242   * Valid In Asynchronous Callback: YES (if cb supplied)
1243   * Nestable: YES
1244
1245   Returns
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
1251   *    been started
1252   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1253   *    passed in
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
1261
1262
1263   See Also
1264   * CyAsMediaType
1265   * CyAsStorageQueryMedia
1266   * CyAsStorageQueryDevice
1267   * CyAsUnitDesc
1268*/
1269EXTERN cy_as_return_status_t
1270cy_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 */
1278        uint32_t                        client
1279        );
1280
1281/* Summary
1282   This function enables/disables the handling of SD/MMC card
1283   detection and SD/MMC write protection in West Bridge Firmware.
1284
1285   Description
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.
1294
1295   * Valid In Asynchronous Callback: YES (if cb supplied)
1296   * Nestable: YES
1297
1298   Returns
1299   * CY_AS_ERROR_SUCCESS - the feature controls were
1300   *    set successfully
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
1305   *    suspended mode
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
1315
1316*/
1317EXTERN cy_as_return_status_t
1318cy_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 */
1324        uint32_t                 device,
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 */
1334        uint32_t                client
1335                );
1336
1337/* Summary
1338   This function reads one or more blocks of data from
1339   the storage system.
1340
1341   Description
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.
1347
1348   * Valid In Asynchronous Callback: NO
1349
1350   Notes
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.
1357
1358   Returns
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
1364   *    been started
1365   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle
1366   *    was passed in
1367   * CY_AS_ERROR_SUCCESS - the media information was
1368   *    returned
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
1373   *    does not exist
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
1377   *    does not exist
1378   * CY_AS_ERROR_ASYNC_PENDING - an async operation
1379   *    is pending
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
1383   *    write protected
1384   * CY_AS_ERROR_INVALID_PARAMETER - Reads/Writes greater
1385   *    than 4095 logic blocks are not allowed
1386
1387   See Also
1388   * CyAsStorageReadAsync
1389   * CyAsStorageWrite
1390   * CyAsStorageWriteAsync
1391   * CyAsStorageCancelAsync
1392   * <LINK Asynchronous Versus Synchronous Operation>
1393*/
1394EXTERN cy_as_return_status_t
1395cy_as_storage_read(
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 */
1401        uint32_t                device,
1402        /* The unit to access */
1403        uint32_t                unit,
1404        /* The first block to access */
1405        uint32_t                block,
1406        /* The buffer where data will be placed */
1407        void *data_p,
1408        /* The number of blocks to be read */
1409        uint16_t                num_blocks
1410        );
1411
1412/* Summary
1413   This function asynchronously reads one or more blocks of data
1414   from the storage system.
1415
1416   Description
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
1428   function is called.
1429
1430   * Valid In Asynchronous Callback: YES
1431
1432   Notes
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.
1439
1440   Returns
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
1446   *    been started
1447   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle
1448   *    was passed in
1449   * CY_AS_ERROR_SUCCESS - the media information was
1450   *    returned
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
1455   *    is pending
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
1459   *    write protected
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
1465
1466   See Also
1467   * CyAsStorageRead
1468   * CyAsStorageWrite
1469   * CyAsStorageWriteAsync
1470   * CyAsStorageCancelAsync
1471   * CyAsStorageQueryDevice
1472   * <LINK Asynchronous Versus Synchronous Operation>
1473*/
1474EXTERN cy_as_return_status_t
1475cy_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 */
1481        uint32_t device,
1482        /* The unit to access */
1483        uint32_t unit,
1484        /* The first block to access */
1485        uint32_t block,
1486        /* The buffer where data will be placed */
1487        void *data_p,
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
1493        );
1494
1495/* Summary
1496   This function writes one or more blocks of data
1497   to the storage system.
1498
1499   Description
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
1503   into the media.
1504
1505   * Valid In Asynchronous Callback: NO
1506
1507   Notes
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.
1514
1515   Returns
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
1521   *    been started
1522   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1523   *    passed in
1524   * CY_AS_ERROR_SUCCESS - the media information was
1525   *    returned
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
1530   *    not exist
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
1534   *    does not exist
1535   * CY_AS_ERROR_ASYNC_PENDING - an async operation
1536   *    is pending
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
1540   *    write protected
1541   * CY_AS_ERROR_INVALID_PARAMETER - Reads/Writes greater
1542   *    than 4095 logic blocks are not allowed
1543
1544   See Also
1545   * CyAsStorageRead
1546   * CyAsStorageReadAsync
1547   * CyAsStorageWriteAsync
1548   * CyAsStorageCancelAsync
1549   * <LINK Asynchronous Versus Synchronous Operation>
1550*/
1551EXTERN cy_as_return_status_t
1552cy_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 */
1558        uint32_t device,
1559        /* The unit to access */
1560        uint32_t unit,
1561        /* The first block to access */
1562        uint32_t block,
1563        /* The buffer containing the data to be written */
1564        void *data_p,
1565        /* The number of blocks to be written */
1566        uint16_t num_blocks
1567        );
1568
1569/* Summary
1570   This function asynchronously writes one or more blocks
1571   of data to the storage system
1572
1573   Description
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.
1582
1583   * Valid In Asynchronous Callback: YES
1584
1585   Notes
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.
1592
1593   Notes
1594   The data buffer must remain valid from when the write is
1595   requested until the callback function is called.
1596
1597   Returns
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
1603   *    not been started
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
1610   *    pending
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
1614   *    protected
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
1619
1620   See Also
1621   * CyAsStorageRead
1622   * CyAsStorageWrite
1623   * CyAsStorageReadAsync
1624   * CyAsStorageCancelAsync
1625   * CyAsStorageQueryDevice
1626   * <LINK Asynchronous Versus Synchronous Operation>
1627*/
1628EXTERN cy_as_return_status_t
1629cy_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 */
1635        uint32_t        device,
1636        /* The unit to access */
1637        uint32_t        unit,
1638        /* The first block to access */
1639        uint32_t        block,
1640        /* The buffer where the data to be written is stored */
1641        void *data_p,
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
1647        );
1648
1649/* Summary
1650   This function aborts any outstanding asynchronous operation
1651
1652   Description
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.
1657
1658   * Valid In Asynchronous Callback: YES
1659
1660   Returns
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
1666   *    been started
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
1672
1673   See Also
1674   * CyAsStorageRead
1675   * CyAsStorageReadAsync
1676   * CyAsStorageWrite
1677   * CyAsStorageWriteAsync
1678   * <LINK Asynchronous Versus Synchronous Operation>
1679*/
1680EXTERN cy_as_return_status_t
1681cy_as_storage_cancel_async(
1682        /* Handle to the device with outstanding async request */
1683        cy_as_device_handle             handle
1684        );
1685
1686/* Summary
1687   This function is used to read the content of SD registers
1688
1689   Description
1690   This function is used to read the contents of CSD, CID and
1691   CSD registers of the SD Card.
1692
1693   * Valid In Asynchronous Callback: YES (if cb supplied)
1694   * Nestable: YES
1695
1696   Returns
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
1700   *    been configured
1701   * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1702   *    into West Bridge
1703   * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
1704   *    started
1705   * CY_AS_ERROR_IN_SUSPEND - The West Bridge device is in
1706   *    suspend mode
1707   * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device pair
1708   *    does not exist
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
1712   *    request
1713   * CY_AS_ERROR_INVALID_RESPONSE - communication failure with
1714   *    West Bridge firmware
1715
1716   See Also
1717   * CyAsStorageSDRegReadData
1718 */
1719EXTERN cy_as_return_status_t
1720cy_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 */
1726        uint8_t device,
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. */
1734        uint32_t client
1735        );
1736
1737/* Summary
1738   Creates a partition starting at the given block and using the
1739   remaining blocks on the card.
1740
1741   Description
1742   Storage devices attached to West Bridge can be partitioned
1743   into two units.
1744   The visibility of these units through the mass storage
1745   interface can be
1746   individually controlled.  This API is used to partition
1747   a device into two.
1748
1749   * Valid in Asynchronous Callback: Yes (if cb supplied)
1750   * Nestable: Yes
1751
1752   Returns
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
1756   *    been configured
1757   * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1758   *    into West Bridge
1759   * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
1760   *    started
1761   * CY_AS_ERROR_IN_SUSPEND - The West Bridge device is in
1762   *    suspend mode
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
1766   *    process request
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
1775
1776   See Also
1777   * <LINK Partitioning>
1778   * CyAsStorageRemovePPartition
1779 */
1780EXTERN cy_as_return_status_t
1781cy_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 */
1787        uint32_t device,
1788        /* Size of partition number 0 in blocks */
1789        uint32_t size,
1790        /* Callback in case of async call */
1791        cy_as_function_callback cb,
1792        /* Client context to pass to the callback */
1793        uint32_t client
1794        );
1795
1796/* Summary
1797   Removes the partition table on a storage device connected
1798   to the West Bridge.
1799
1800   Description
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).
1806
1807   * Valid in Asynchronous Callback: Yes (if cb supplied)
1808   * Nestable: Yes
1809
1810   Returns
1811   * CY_AS_ERROR_SUCCESS - the partition was successfully
1812   *    deleted
1813   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1814   *    passed in
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
1820   *    been started
1821   * CY_AS_ERROR_IN_SUSPEND - The West Bridge device is in
1822   *    suspend mode
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
1826   *    process request
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
1830   *    not partitioned
1831
1832   See Also
1833   * <LINK Partitioning>
1834   * CyAsStorageCreatePPartition
1835 */
1836EXTERN cy_as_return_status_t
1837cy_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 */
1843        uint32_t device,
1844        /* Callback in case of async call */
1845        cy_as_function_callback cb,
1846        /* Client context to pass to the callback */
1847        uint32_t client
1848        );
1849
1850/* Summary
1851   Returns the amount of data read/written to the given
1852   device from the USB host.
1853
1854   Description
1855
1856   * Valid in Asynchronous Callback: Yes (if cb supplied)
1857   * Nestable: Yes
1858
1859   Returns
1860   * CY_AS_ERROR_SUCCESS - API call completed successfully
1861   * CY_AS_ERROR_INVALID_HANDLE - Invalid West Bridge device
1862   *    handle
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
1868   *    started
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
1877
1878   See Also
1879   * CyAsUsbSetMSReportThreshold
1880*/
1881EXTERN cy_as_return_status_t
1882cy_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 */
1888        uint32_t device,
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 */
1894        uint32_t client
1895        );
1896
1897/* Summary
1898   Performs a Sector Erase on an attached SD Card
1899
1900   Description
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.
1906
1907   A large erase can take a while to complete depending on the SD
1908   card. In such a case it is reccomended that an async call is made.
1909
1910   Returns
1911   * CY_AS_ERROR_SUCCESS - API call completed successfully
1912   * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1913   *    been configured
1914   * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1915   *    into West Bridge
1916   * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
1917   *    started
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 currenly only supported
1930   *    on SD and using SD only firmware
1931   * CY_AS_ERROR_OUT_OF_MEMORY
1932
1933   See Also
1934   * CyAsStorageSDRegisterRead
1935*/
1936EXTERN cy_as_return_status_t
1937cy_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 */
1943        uint32_t device,
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 */
1951        uint32_t client
1952        );
1953
1954/* Summary
1955   This function is used to read a Tuple from the SDIO CIS area.
1956
1957   Description
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.
1961
1962   * Valid in Asynchronous Callback: NO
1963   * Valid on Antioch device: NO
1964
1965   Returns
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
1971   *    been started
1972   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
1973   *    passed in
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
1980   *    exist
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
1985   *    type was made
1986   * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
1987   * CY_AS_ERROR_INVALID_RESPONSE - an error message was
1988   *    recieved 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
1997
1998*/
1999cy_as_return_status_t
2000cy_as_sdio_get_c_i_s_info(
2001        /* Handle to the Westbridge device */
2002        cy_as_device_handle     handle,
2003        /* Bus to use */
2004        cy_as_bus_number_t              bus,
2005        /* Device number */
2006        uint32_t                device,
2007         /* IO function Number */
2008        uint8_t                 n_function_no,
2009        /* Id of tuple to be fetched */
2010        uint16_t                tuple_id,
2011        /* Buffer to hold tuple read from card.
2012         should be at least 256 bytes in size */
2013        uint8_t *data_p
2014        );
2015
2016
2017/* Summary
2018   This function is used to read properties of the SDIO card.
2019
2020   Description
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.
2025
2026   * Valid in Asynchronous Callback: NO
2027   * Valid on Antioch device: NO
2028
2029   Returns
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
2035   *    started
2036   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2037   *    passed in
2038   * CY_AS_ERROR_SUCCESS - the card information was returned
2039   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2040   * suspend mode
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
2045   *    exist
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   *    recieved from the firmware
2051
2052*/
2053cy_as_return_status_t
2054cy_as_sdio_query_card(
2055        /* Handle to the Westbridge device */
2056        cy_as_device_handle     handle,
2057        /* Bus to use */
2058        cy_as_bus_number_t       bus,
2059        /* Device number */
2060        uint32_t                device,
2061        /* Buffer to store card properties */
2062        cy_as_sdio_card         *data_p
2063                );
2064
2065/* Summary
2066   This function is used to reset a SDIO card.
2067
2068   Description
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.
2073
2074   * Valid in Asynchronous Callback: NO
2075   * Valid on Antioch device: NO
2076
2077   Returns
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
2081   *    into West Bridge
2082   * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
2083   *    been started
2084   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2085   *    passed in
2086   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2087   *    suspend mode
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
2093   *    exist
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   *    recieved from the firmware
2099   */
2100cy_as_return_status_t
2101cy_as_sdio_reset_card(
2102        /* Handle to the Westbridge device */
2103        cy_as_device_handle     handle,
2104        /* Bus to use */
2105        cy_as_bus_number_t      bus,
2106        /* Device number */
2107        uint32_t device
2108        );
2109
2110/* Summary
2111   This function performs a Synchronous 1 byte read from the sdio
2112   device function.
2113
2114   Description
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
2118   SDIO command set.
2119
2120   * Valid in Asynchronous Callback: NO
2121   * Valid on Antioch device: NO
2122
2123   Returns
2124   * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
2125   *    been configured
2126   * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
2127   *    into West Bridge
2128   * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
2129   *    been started
2130   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed
2131   *    in
2132   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2133   *    suspend mode
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
2140   *    does not exist
2141   * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
2142   * CY_AS_ERROR_INVALID_RESPONSE - an error message was recieved
2143   *    from the firmware
2144   * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in reading
2145   *    from the media
2146   * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made to an
2147   *    invalid function
2148   * CY_AS_ERROR_FUNCTION_SUSPENDED - The function to which read
2149   *    was attempted is in suspend
2150*/
2151cy_as_return_status_t
2152cy_as_sdio_direct_read(
2153        /* Handle to the Westbridge device */
2154        cy_as_device_handle     handle,
2155        /* Bus to use */
2156        cy_as_bus_number_t               bus,
2157        /* Device number */
2158        uint32_t                device,
2159        /* IO function Number */
2160        uint8_t                 n_function_no,
2161        /* Address for IO */
2162        uint32_t                address,
2163        /* Set to CY_SDIO_REARM_INT to reinitialize SDIO interrupt */
2164        uint8_t                 misc_buf,
2165        /* Buffer to hold byte read from card */
2166        uint8_t *data_p
2167                );
2168
2169/* Summary
2170   This function performs a Synchronous 1 byte write to the
2171   sdio device function.
2172
2173   Description
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.
2178
2179   * Valid in Asynchronous Callback: NO
2180   * Valid on Antioch device: NO
2181
2182   Returns
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
2188   * started
2189   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2190   * passed in
2191   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2192   * suspend mode
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 recieved
2202   * from the firmware
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
2209*/
2210cy_as_return_status_t
2211cy_as_sdio_direct_write(
2212        /* Handle to the Westbridge device */
2213        cy_as_device_handle     handle,
2214        /* Bus to use */
2215        cy_as_bus_number_t      bus,
2216        /* Device number */
2217        uint32_t                device,
2218        /* IO function Number */
2219        uint8_t                 n_function_no,
2220        /* Address for IO */
2221        uint32_t                address,
2222        /* Set to CY_SDIO_REARM_INT to reinitialize SDIO interrupt,
2223        set to CY_SDIO_RAW for read after write */
2224        uint8_t                 misc_buf,
2225        /* Byte to write */
2226        uint16_t                argument,
2227        /* Buffer to hold byte read from card in Read after write mode */
2228        uint8_t *data_p
2229        );
2230
2231/* Summary
2232   This function is used to set the blocksize of an SDIO function.
2233
2234   Description
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.
2238
2239   * Valid in Asynchronous Callback: NO
2240   * Valid on Antioch device: NO
2241
2242   Returns
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
2248   *    been started
2249   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2250   *    passed in
2251   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2252   *    suspend mode
2253   * CY_AS_ERROR_SUCCESS - the media information was
2254   *    returned
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
2259   *    exist
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
2263   *    available
2264   * CY_AS_ERROR_INVALID_RESPONSE - an error message was
2265   *    recieved 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
2274*/
2275cy_as_return_status_t
2276cy_as_sdio_set_blocksize(
2277        /* Handle to the Westbridge device */
2278        cy_as_device_handle     handle,
2279        /* Bus to use */
2280        cy_as_bus_number_t      bus,
2281        /* Device number */
2282        uint32_t device,
2283        /* IO function Number */
2284        uint8_t n_function_no,
2285        /* Block size to set. */
2286        uint16_t blocksize
2287        );
2288
2289/* Summary
2290   This function is used to read Multibyte/Block data from a
2291   IO function.
2292
2293   Description
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
2297   command set.
2298
2299   * Valid in Asynchronous Callback: YES
2300   * Valid on Antioch device: NO
2301
2302   Returns
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
2308   *    been started
2309   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2310   *    passed in
2311   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2312   *    suspend mode
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 recieved
2323   *    from the firmware
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.
2336
2337*/
2338cy_as_return_status_t
2339cy_as_sdio_extended_read(
2340        /* Handle to the Westbridge device */
2341        cy_as_device_handle     handle,
2342        /* Bus to use */
2343        cy_as_bus_number_t bus,
2344        /* Device number */
2345        uint32_t device,
2346        /* IO function Number */
2347        uint8_t n_function_no,
2348        /* Base Address for IO */
2349        uint32_t address,
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 */
2355        uint8_t                 misc_buf,
2356        /* Block/Byte count to read */
2357        uint16_t                argument,
2358        /* Buffer to hold data read from card */
2359        uint8_t *data_p,
2360        /* Callback in case of Asyncronous call. 0 if Synchronous */
2361        cy_as_sdio_callback             callback
2362        );
2363
2364/* Summary
2365   This function is used to write Multibyte/Block data
2366   to a IO function.
2367
2368   Description
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.
2373
2374   * Valid in Asynchronous Callback: YES
2375   * Valid on Antioch device: NO
2376
2377   Returns
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
2383   *    been started
2384   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2385   *    passed in
2386   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2387   *    suspend mode
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
2393   *    exist
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   *    recieved 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.
2412*/
2413cy_as_return_status_t
2414cy_as_sdio_extended_write(
2415        /* Handle to the Westbridge device */
2416        cy_as_device_handle     handle,
2417        /* Bus to use */
2418        cy_as_bus_number_t bus,
2419        /* Device number */
2420        uint32_t device,
2421        /* IO function Number */
2422        uint8_t n_function_no,
2423        /* Base Address for IO */
2424        uint32_t address,
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
2429        addresses */
2430        uint8_t  misc_buf,
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. */
2435        uint16_t                argument,
2436        /* Buffer to hold data to be written to card. */
2437        uint8_t *data_p,
2438        /* Callback in case of Asyncronous call. 0 if Synchronous */
2439        cy_as_sdio_callback             callback
2440        );
2441
2442/* Summary
2443   This function is used to initialize a SDIO card function.
2444
2445   Description
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
2449   command set.
2450
2451   * Valid in Asynchronous Callback: NO
2452   * Valid on Antioch device: NO
2453
2454   Returns
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
2458   *    into West Bridge
2459   * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
2460   *    started
2461   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed
2462   *    in
2463   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2464   *    suspend mode
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   *    recieved 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
2479*/
2480cy_as_return_status_t
2481cy_as_sdio_init_function(
2482        /* Handle to the Westbridge device */
2483        cy_as_device_handle     handle,
2484        /* Bus to use */
2485        cy_as_bus_number_t      bus,
2486        /* Device number */
2487        uint32_t device,
2488        /* IO function Number */
2489        uint8_t n_function_no,
2490        /* Set to CY_SDIO_FORCE_INIT to reinitialize function */
2491        uint8_t misc_buf
2492        );
2493
2494/* Summary
2495   This function is used to get properties of a SDIO card function.
2496
2497   Description
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.
2502
2503   * Valid in Asynchronous Callback: NO
2504   * Valid on Antioch device: NO
2505
2506   Returns
2507   * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
2508   *    been configured
2509   * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
2510   *    into West Bridge
2511   * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
2512   *    started
2513   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed
2514   *    in
2515   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2516   *    suspend mode
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
2520   *    not exist
2521   * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device pair
2522   *    does not exist
2523   * CY_AS_ERROR_INVALID_FUNCTION - An IO request was made to
2524   *    an invalid function
2525*/
2526cy_as_return_status_t
2527cy_as_sdio_query_function(
2528        /* Handle to the Westbridge device */
2529        cy_as_device_handle     handle,
2530        /* Bus to use */
2531        cy_as_bus_number_t      bus,
2532        /* Device number */
2533        uint32_t device,
2534        /* IO function Number */
2535        uint8_t n_function_no,
2536        /* Buffer to store function properties */
2537        cy_as_sdio_func *data_p
2538        );
2539
2540/* Summary
2541   This function is used to Abort the current IO function.
2542
2543   Description
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.
2547
2548   * Valid in Asynchronous Callback: NO
2549   * Valid on Antioch device: NO
2550
2551   Returns
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
2557   *    been started
2558   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2559   *    passed in
2560   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2561   *    suspend mode
2562   * CY_AS_ERROR_SUCCESS - the media information was
2563   *    returned
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
2568   *    exist
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
2572   *    available
2573   * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
2574   *    to an invalid function
2575*/
2576cy_as_return_status_t
2577cy_as_sdio_abort_function(
2578        /* Handle to the Westbridge device */
2579        cy_as_device_handle     handle,
2580        /* Bus to use */
2581        cy_as_bus_number_t  bus,
2582        /* Device number */
2583        uint32_t device,
2584        /* IO function Number */
2585        uint8_t n_function_no
2586                );
2587
2588/* Summary
2589   This function is used to Disable IO to an SDIO function.
2590
2591   Description
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.
2595
2596   * Valid in Asynchronous Callback: NO
2597   * Valid on Antioch device: NO
2598
2599   Returns
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
2605   *    been started
2606   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2607   *    passed in
2608   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is
2609   *    in suspend mode
2610   * CY_AS_ERROR_SUCCESS - the media information was
2611   *    returned
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
2616   *    exist
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
2621*/
2622cy_as_return_status_t
2623cy_as_sdio_de_init_function(
2624        /* Handle to the Westbridge device */
2625        cy_as_device_handle     handle,
2626        /* Bus to use */
2627        cy_as_bus_number_t      bus,
2628        /* Device number */
2629        uint32_t device,
2630        /* IO function Number */
2631        uint8_t n_function_no
2632        );
2633
2634/* Summary
2635   This function is used to Suspend the current IO function.
2636
2637   Description
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.
2641
2642   * Valid in Asynchronous Callback: NO
2643   * Valid on Antioch device: NO
2644
2645   Returns
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
2651   *    been started
2652   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2653   *    passed in
2654   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
2655   *    suspend mode
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
2661   *    exist
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
2665   *    available
2666   * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
2667   *    to an invalid function
2668*/
2669cy_as_return_status_t
2670cy_as_sdio_suspend(
2671        /* Handle to the Westbridge device */
2672        cy_as_device_handle     handle,
2673        /* Bus to use */
2674        cy_as_bus_number_t  bus,
2675        /* Device number */
2676        uint32_t device,
2677        /* IO function Number */
2678        uint8_t n_function_no
2679        );
2680
2681/* Summary
2682   This function is used to resume a Suspended IO function.
2683
2684   Description
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.
2688
2689   * Valid in Asynchronous Callback: NO
2690   * Valid on Antioch device: NO
2691
2692   Returns
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
2698   *    been started
2699   * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
2700   *    passed in
2701   * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is
2702   *    in suspend mode
2703   * CY_AS_ERROR_SUCCESS - the media information was
2704   *    returned
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
2709   *    does not exist
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
2713   *    is pending
2714   * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory
2715   *    available
2716   * CY_AS_ERROR_INVALID_RESPONSE - an error message was
2717   *    recieved 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
2723   *    aborted
2724   * CY_AS_ERROR_IO_SUSPENDED - The IO operation was
2725   *    suspended
2726   * CY_AS_ERROR_INVALID_REQUEST - An invalid request was
2727   *    passed to the card.
2728
2729*/
2730cy_as_return_status_t
2731cy_as_sdio_resume(
2732        /* Handle to the Westbridge device */
2733        cy_as_device_handle     handle,
2734        /* Bus to use */
2735        cy_as_bus_number_t      bus,
2736        /* Device number */
2737        uint32_t device,
2738        /* IO function Number */
2739        uint8_t n_function_no,
2740        /* Operation to resume (Read or Write) */
2741        cy_as_oper_type op,
2742        /* Micellaneous buffer same as for Extended read and Write */
2743        uint8_t misc_buf,
2744        /* Number of pending blocks for IO. Should be less
2745        than or equal to the maximum defined for extended
2746        read and write */
2747        uint16_t pendingblockcount,
2748         /* Buffer to continue the Suspended IO operation */
2749        uint8_t          *data_p
2750        );
2751
2752
2753
2754/* For supporting deprecated functions */
2755#include "cyasstorage_dep.h"
2756
2757#include "cyas_cplus_end.h"
2758
2759#endif                          /* _INCLUDED_CYASSTORAGE_H_ */
2760