summaryrefslogtreecommitdiffstats
path: root/drivers/staging/westbridge/astoria/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/westbridge/astoria/include/linux')
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyanerr.h418
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmedia.h59
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmisc.h614
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyanregs.h180
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyansdkversion.h30
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyanstorage.h419
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyantioch.h35
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyantypes.h31
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyanusb.h619
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyas_cplus_end.h11
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyas_cplus_start.h11
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyascast.h35
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h1057
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h375
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyaserr.h1094
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyashal.h108
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyashalcb.h44
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h800
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h104
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslep2pep.h36
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslowlevel.h366
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmedia.h54
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h1549
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc_dep.h53
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmtp.h646
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasprotocol.h3838
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasregs.h201
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h2759
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage_dep.h309
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyastoria.h36
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyastsdkversion.h30
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyastypes.h71
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h1862
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb_dep.h224
34 files changed, 18078 insertions, 0 deletions
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanerr.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanerr.h
new file mode 100644
index 0000000..c7d4ebb
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanerr.h
@@ -0,0 +1,418 @@
+/* Cypress West Bridge API header file (cyanerr.h)
+ ## Symbols for backward compatibility with previous releases of Antioch SDK.
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYANERR_H_
+#define _INCLUDED_CYANERR_H_
+
+#include "cyaserr.h"
+
+#ifndef __doxygen__
+
+/*
+ * Function completed successfully.
+ */
+#define CY_AN_ERROR_SUCCESS (CY_AS_ERROR_SUCCESS)
+
+/*
+ * A function trying to acquire a resource was unable to do so.
+ */
+#define CY_AN_ERROR_NOT_ACQUIRED (CY_AS_ERROR_NOT_ACQUIRED)
+
+/*
+ * A function trying to acquire a resource was unable to do so.
+ */
+#define CY_AN_ERROR_NOT_RELEASED (CY_AS_ERROR_NOT_RELEASED)
+
+/*
+ * The West Bridge firmware is not loaded.
+ */
+#define CY_AN_ERROR_NO_FIRMWARE (CY_AS_ERROR_NO_FIRMWARE)
+
+/*
+ * A timeout occurred waiting on a response from the West Bridge device
+ */
+#define CY_AN_ERROR_TIMEOUT (CY_AS_ERROR_TIMEOUT)
+
+/*
+ * A request to download firmware was made while not in the CONFIG mode
+ */
+#define CY_AN_ERROR_NOT_IN_CONFIG_MODE (CY_AS_ERROR_NOT_IN_CONFIG_MODE)
+
+/*
+ * This error is returned if the firmware size specified is too invalid.
+ */
+#define CY_AN_ERROR_INVALID_SIZE (CY_AS_ERROR_INVALID_SIZE)
+
+/*
+ * This error is returned if a request is made to acquire a resource that has
+ * already been acquired.
+ */
+#define CY_AN_ERROR_RESOURCE_ALREADY_OWNED (CY_AS_ERROR_RESOURCE_ALREADY_OWNED)
+
+/*
+ * This error is returned if a request is made to release a resource that has
+ * not previously been acquired.
+ */
+#define CY_AN_ERROR_RESOURCE_NOT_OWNED (CY_AS_ERROR_RESOURCE_NOT_OWNED)
+
+/*
+ * This error is returned when a request is made for a media that does not
+ * exist
+ */
+#define CY_AN_ERROR_NO_SUCH_MEDIA (CY_AS_ERROR_NO_SUCH_MEDIA)
+
+/*
+ * This error is returned when a request is made for a device that does
+ * not exist
+ */
+#define CY_AN_ERROR_NO_SUCH_DEVICE (CY_AS_ERROR_NO_SUCH_DEVICE)
+
+/*
+ * This error is returned when a request is made for a unit that does
+ * not exist
+ */
+#define CY_AN_ERROR_NO_SUCH_UNIT (CY_AS_ERROR_NO_SUCH_UNIT)
+
+/*
+ * This error is returned when a request is made for a block that does
+ * not exist
+ */
+#define CY_AN_ERROR_INVALID_BLOCK (CY_AS_ERROR_INVALID_BLOCK)
+
+/*
+ * This error is returned when an invalid trace level is set.
+ */
+#define CY_AN_ERROR_INVALID_TRACE_LEVEL (CY_AS_ERROR_INVALID_TRACE_LEVEL)
+
+/*
+ * This error is returned when West Bridge is already in the standby state
+ * and an attempt is made to put West Bridge into this state again.
+ */
+#define CY_AN_ERROR_ALREADY_STANDBY (CY_AS_ERROR_ALREADY_STANDBY)
+
+/*
+ * This error is returned when the API needs to set a pin on the
+ * West Bridge device, but this is not supported by the underlying HAL
+ * layer.
+ */
+#define CY_AN_ERROR_SETTING_WAKEUP_PIN (CY_AS_ERROR_SETTING_WAKEUP_PIN)
+
+/*
+ * This error is returned when a module is being started that has
+ * already been started.
+ */
+#define CY_AN_ERROR_ALREADY_RUNNING (CY_AS_ERROR_ALREADY_RUNNING)
+
+/*
+ * This error is returned when a module is being stopped that has
+ * already been stopped.
+ */
+#define CY_AN_ERROR_NOT_RUNNING (CY_AS_ERROR_NOT_RUNNING)
+
+/*
+ * This error is returned when the caller tries to claim a media that has
+ * already been claimed.
+ */
+#define CY_AN_ERROR_MEDIA_ALREADY_CLAIMED (CY_AS_ERROR_MEDIA_ALREADY_CLAIMED)
+
+/*
+ * This error is returned when the caller tries to release a media that
+ * has already been released.
+ */
+#define CY_AN_ERROR_MEDIA_NOT_CLAIMED (CY_AS_ERROR_MEDIA_NOT_CLAIMED)
+
+/*
+ * This error is returned when canceling trying to cancel an asynchronous
+ * operation when an async operation is not pending.
+ */
+#define CY_AN_ERROR_NO_OPERATION_PENDING (CY_AS_ERROR_NO_OPERATION_PENDING)
+
+/*
+ * This error is returned when an invalid endpoint number is provided
+ * to an API call.
+ */
+#define CY_AN_ERROR_INVALID_ENDPOINT (CY_AS_ERROR_INVALID_ENDPOINT)
+
+/*
+ * This error is returned when an invalid descriptor type
+ * is specified in an API call.
+ */
+#define CY_AN_ERROR_INVALID_DESCRIPTOR (CY_AS_ERROR_INVALID_DESCRIPTOR)
+
+/*
+ * This error is returned when an invalid descriptor index
+ * is specified in an API call.
+ */
+#define CY_AN_ERROR_BAD_INDEX (CY_AS_ERROR_BAD_INDEX)
+
+/*
+ * This error is returned if trying to set a USB descriptor
+ * when in the P port enumeration mode.
+ */
+#define CY_AN_ERROR_BAD_ENUMERATION_MODE (CY_AS_ERROR_BAD_ENUMERATION_MODE)
+
+/*
+ * This error is returned when the endpoint configuration specified
+ * is not valid.
+ */
+#define CY_AN_ERROR_INVALID_CONFIGURATION (CY_AS_ERROR_INVALID_CONFIGURATION)
+
+/*
+ * This error is returned when the API cannot verify it is connected
+ * to an West Bridge device.
+ */
+#define CY_AN_ERROR_NO_ANTIOCH (CY_AS_ERROR_NO_ANTIOCH)
+
+/*
+ * This error is returned when an API function is called and
+ * CyAnMiscConfigureDevice has not been called to configure West
+ * Bridge for the current environment.
+ */
+#define CY_AN_ERROR_NOT_CONFIGURED (CY_AS_ERROR_NOT_CONFIGURED)
+
+/*
+ * This error is returned when West Bridge cannot allocate memory required for
+ * internal API operations.
+ */
+#define CY_AN_ERROR_OUT_OF_MEMORY (CY_AS_ERROR_OUT_OF_MEMORY)
+
+/*
+ * This error is returned when a module is being started that has
+ * already been started.
+ */
+#define CY_AN_ERROR_NESTED_SLEEP (CY_AS_ERROR_NESTED_SLEEP)
+
+/*
+ * This error is returned when an operation is attempted on an endpoint that has
+ * been disabled.
+ */
+#define CY_AN_ERROR_ENDPOINT_DISABLED (CY_AS_ERROR_ENDPOINT_DISABLED)
+
+/*
+ * This error is returned when a call is made to an API function when the device
+ * is in standby.
+ */
+#define CY_AN_ERROR_IN_STANDBY (CY_AS_ERROR_IN_STANDBY)
+
+/*
+ * This error is returned when an API call is made with an invalid handle value.
+ */
+#define CY_AN_ERROR_INVALID_HANDLE (CY_AS_ERROR_INVALID_HANDLE)
+
+/*
+ * This error is returned when an invalid response is returned from the West
+ * Bridge device.
+ */
+#define CY_AN_ERROR_INVALID_RESPONSE (CY_AS_ERROR_INVALID_RESPONSE)
+
+/*
+ * This error is returned from the callback function for any asynchronous
+ * read or write request that is canceled.
+ */
+#define CY_AN_ERROR_CANCELED (CY_AS_ERROR_CANCELED)
+
+/*
+ * This error is returned when the call to create sleep channel fails
+ * in the HAL layer.
+ */
+#define CY_AN_ERROR_CREATE_SLEEP_CHANNEL_FAILED \
+ (CY_AS_ERROR_CREATE_SLEEP_CHANNEL_FAILED)
+
+/*
+ * This error is returned when the call to CyAnMiscLeaveStandby
+ * is made and the device is not in standby.
+ */
+#define CY_AN_ERROR_NOT_IN_STANDBY (CY_AS_ERROR_NOT_IN_STANDBY)
+
+/*
+ * This error is returned when the call to destroy sleep channel fails
+ * in the HAL layer.
+ */
+#define CY_AN_ERROR_DESTROY_SLEEP_CHANNEL_FAILED \
+ (CY_AS_ERROR_DESTROY_SLEEP_CHANNEL_FAILED)
+
+/*
+ * This error is returned when an invalid resource is specified to a call
+ * to CyAnMiscAcquireResource() or CyAnMiscReleaseResource()
+ */
+#define CY_AN_ERROR_INVALID_RESOURCE (CY_AS_ERROR_INVALID_RESOURCE)
+
+/*
+ * This error occurs when an operation is requested on an endpoint that has
+ * a currently pending async operation.
+ */
+#define CY_AN_ERROR_ASYNC_PENDING (CY_AS_ERROR_ASYNC_PENDING)
+
+/*
+ * This error is returned when a call to CyAnStorageCancelAsync() or
+ * CyAnUsbCancelAsync() is made when no asynchronous request is pending.
+ */
+#define CY_AN_ERROR_ASYNC_NOT_PENDING (CY_AS_ERROR_ASYNC_NOT_PENDING)
+
+/*
+ * This error is returned when a request is made to put the West Bridge device
+ * into standby mode while the USB stack is still active.
+ */
+#define CY_AN_ERROR_USB_RUNNING (CY_AS_ERROR_USB_RUNNING)
+
+/*
+ * A request for in the wrong direction was issued on an endpoint.
+ */
+#define CY_AN_ERROR_USB_BAD_DIRECTION (CY_AS_ERROR_USB_BAD_DIRECTION)
+
+/*
+ * An invalid request was received
+ */
+#define CY_AN_ERROR_INVALID_REQUEST (CY_AS_ERROR_INVALID_REQUEST)
+
+/*
+ * An ACK request was requested while no setup packet was pending.
+ */
+#define CY_AN_ERROR_NO_SETUP_PACKET_PENDING \
+ (CY_AS_ERROR_NO_SETUP_PACKET_PENDING)
+
+/*
+ * A call was made to a API function that cannot be called from a callback.
+ */
+#define CY_AN_ERROR_INVALID_IN_CALLBACK (CY_AS_ERROR_INVALID_IN_CALLBACK)
+
+/*
+ * A call was made to CyAnUsbSetEndPointConfig() before
+ * CyAnUsbSetPhysicalConfiguration() was called.
+ */
+#define CY_AN_ERROR_ENDPOINT_CONFIG_NOT_SET \
+ (CY_AS_ERROR_ENDPOINT_CONFIG_NOT_SET)
+
+/*
+ * The physical endpoint referenced is not valid in the current
+ * physical configuration
+ */
+#define CY_AN_ERROR_INVALID_PHYSICAL_ENDPOINT \
+ (CY_AS_ERROR_INVALID_PHYSICAL_ENDPOINT)
+
+/*
+ * The data supplied to the CyAnMiscDownloadFirmware() call is not aligned on a
+ * WORD (16 bit) boundary.
+ */
+#define CY_AN_ERROR_ALIGNMENT_ERROR (CY_AS_ERROR_ALIGNMENT_ERROR)
+
+/*
+ * A call was made to destroy the West Bridge device, but the USB stack or the
+ * storage stack was will running.
+ */
+#define CY_AN_ERROR_STILL_RUNNING (CY_AS_ERROR_STILL_RUNNING)
+
+/*
+ * A call was made to the API for a function that is not yet supported.
+ */
+#define CY_AN_ERROR_NOT_YET_SUPPORTED (CY_AS_ERROR_NOT_YET_SUPPORTED)
+
+/*
+ * A NULL callback was provided where a non-NULL callback was required
+ */
+#define CY_AN_ERROR_NULL_CALLBACK (CY_AS_ERROR_NULL_CALLBACK)
+
+/*
+ * This error is returned when a request is made to put the West Bridge device
+ * into standby mode while the storage stack is still active.
+ */
+#define CY_AN_ERROR_STORAGE_RUNNING (CY_AS_ERROR_STORAGE_RUNNING)
+
+/*
+ * This error is returned when an operation is attempted that cannot be
+ * completed while the USB stack is connected to a USB host.
+ */
+#define CY_AN_ERROR_USB_CONNECTED (CY_AS_ERROR_USB_CONNECTED)
+
+/*
+ * This error is returned when a USB disconnect is attempted and the
+ * West Bridge device is not connected.
+ */
+#define CY_AN_ERROR_USB_NOT_CONNECTED (CY_AS_ERROR_USB_NOT_CONNECTED)
+
+/*
+ * This error is returned when an P2S storage operation attempted and
+ * data could not be read or written to the storage media.
+ */
+#define CY_AN_ERROR_MEDIA_ACCESS_FAILURE (CY_AS_ERROR_MEDIA_ACCESS_FAILURE)
+
+/*
+ * This error is returned when an P2S storage operation attempted and
+ * the media is write protected.
+ */
+#define CY_AN_ERROR_MEDIA_WRITE_PROTECTED (CY_AS_ERROR_MEDIA_WRITE_PROTECTED)
+
+/*
+ * This error is returned when an attempt is made to cancel a request
+ * that has already been sent to the West Bridge.
+ */
+#define CY_AN_ERROR_OPERATION_IN_TRANSIT (CY_AS_ERROR_OPERATION_IN_TRANSIT)
+
+/*
+ * This error is returned when an invalid parameter is passed to one of
+ * the APIs.
+ */
+#define CY_AN_ERROR_INVALID_PARAMETER (CY_AS_ERROR_INVALID_PARAMETER)
+
+/*
+ * This error is returned if an API is not supported by the current
+ * West Bridge device or the active firmware version.
+ */
+#define CY_AN_ERROR_NOT_SUPPORTED (CY_AS_ERROR_NOT_SUPPORTED)
+
+/*
+ * This error is returned when a call is made to one of the Storage or
+ * USB APIs while the device is in suspend mode.
+ */
+#define CY_AN_ERROR_IN_SUSPEND (CY_AS_ERROR_IN_SUSPEND)
+
+/*
+ * This error is returned when the call to CyAnMiscLeaveSuspend
+ * is made and the device is not in suspend mode.
+ */
+#define CY_AN_ERROR_NOT_IN_SUSPEND (CY_AS_ERROR_NOT_IN_SUSPEND)
+
+/*
+ * This error is returned when a command that is disabled by USB is called.
+ */
+#define CY_AN_ERROR_FEATURE_NOT_ENABLED (CY_AS_ERROR_FEATURE_NOT_ENABLED)
+
+/*
+ * This error is returned when an Async storage read or write is called before a
+ * query device call is issued.
+ */
+#define CY_AN_ERROR_QUERY_DEVICE_NEEDED (CY_AS_ERROR_QUERY_DEVICE_NEEDED)
+
+/*
+ * This error is returned when a call is made to USB or STORAGE Start or
+ * Stop before a prior Start or Stop has finished.
+ */
+#define CY_AN_ERROR_STARTSTOP_PENDING (CY_AS_ERROR_STARTSTOP_PENDING)
+
+/*
+ * This error is returned when a request is made for a bus that does not exist
+ */
+#define CY_AN_ERROR_NO_SUCH_BUS (CY_AS_ERROR_NO_SUCH_BUS)
+
+#endif /* __doxygen__ */
+
+#endif /* _INCLUDED_CYANERR_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmedia.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmedia.h
new file mode 100644
index 0000000..be07488
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmedia.h
@@ -0,0 +1,59 @@
+/* Cypress West Bridge API header file (cyanmedia.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor
+## Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYANMEDIA_H_
+#define _INCLUDED_CYANMEDIA_H_
+
+#include "cyas_cplus_start.h"
+
+/* Summary
+ Specifies a specific type of media supported by West Bridge
+
+ Description
+ The West Bridge device supports five specific types
+ of media as storage/IO devices attached to it's S-Port. This
+ type is used to indicate the type of media being referenced in
+ any API call.
+*/
+#include "cyasmedia.h"
+
+/* Flash NAND memory (may be SLC or MLC) */
+#define cy_an_media_nand cy_as_media_nand
+
+/* An SD flash memory device */
+#define cy_an_media_sd_flash cy_as_media_sd_flash
+
+/* An MMC flash memory device */
+#define cy_an_media_mmc_flash cy_as_media_mmc_flash
+
+/* A CE-ATA disk drive */
+#define cy_an_media_ce_ata cy_as_media_ce_ata
+
+ /* SDIO device. */
+#define cy_an_media_sdio cy_as_media_sdio
+#define cy_an_media_max_media_value \
+ cy_as_media_max_media_value
+
+typedef cy_as_media_type cy_an_media_type;
+
+#include "cyas_cplus_end.h"
+
+#endif /* _INCLUDED_CYANMEDIA_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmisc.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmisc.h
new file mode 100644
index 0000000..0838648
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmisc.h
@@ -0,0 +1,614 @@
+/* Cypress West Bridge API header file (cyanmisc.h)
+ ## Version for backward compatibility with previous Antioch SDK releases.
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYANMISC_H_
+#define _INCLUDED_CYANMISC_H_
+
+#include "cyantypes.h"
+#include <cyasmisc.h>
+#include "cyanmedia.h"
+#include "cyas_cplus_start.h"
+
+#define CY_AN_LEAVE_STANDBY_DELAY_CLOCK \
+ (CY_AS_LEAVE_STANDBY_DELAY_CLOCK)
+#define CY_AN_RESET_DELAY_CLOCK \
+ (CY_AS_RESET_DELAY_CLOCK)
+
+#define CY_AN_LEAVE_STANDBY_DELAY_CRYSTAL \
+ (CY_AS_LEAVE_STANDBY_DELAY_CRYSTAL)
+
+#define CY_AN_RESET_DELAY_CRYSTAL \
+ (CY_AS_RESET_DELAY_CRYSTAL)
+
+/* Defines to convert the old CyAn names to the new
+ * CyAs names
+ */
+typedef cy_as_device_handle cy_an_device_handle;
+
+#define cy_an_device_dack_ack cy_as_device_dack_ack
+#define cy_an_device_dack_eob cy_as_device_dack_eob
+typedef cy_as_device_dack_mode cy_an_device_dack_mode;
+
+typedef cy_as_device_config cy_an_device_config;
+
+#define cy_an_resource_u_s_b cy_as_bus_u_sB
+#define cy_an_resource_sdio_MMC cy_as_bus_1
+#define cy_an_resource_nand cy_as_bus_0
+typedef cy_as_resource_type cy_an_resource_type;
+
+#define cy_an_reset_soft cy_as_reset_soft
+#define cy_an_reset_hard cy_as_reset_hard
+typedef cy_as_reset_type cy_an_reset_type;
+typedef cy_as_funct_c_b_type cy_an_funct_c_b_type;
+typedef cy_as_function_callback cy_an_function_callback;
+
+#define cy_an_event_misc_initialized \
+ cy_as_event_misc_initialized
+#define cy_an_event_misc_awake \
+ cy_as_event_misc_awake
+#define cy_an_event_misc_heart_beat \
+ cy_as_event_misc_heart_beat
+#define cy_an_event_misc_wakeup \
+ cy_as_event_misc_wakeup
+#define cy_an_event_misc_device_mismatch \
+ cy_as_event_misc_device_mismatch
+typedef cy_as_misc_event_type \
+ cy_an_misc_event_type;
+typedef cy_as_misc_event_callback \
+ cy_an_misc_event_callback;
+
+#define cy_an_misc_gpio_0 cy_as_misc_gpio_0
+#define cy_an_misc_gpio_1 cy_as_misc_gpio_1
+#define cy_an_misc_gpio__nand_CE \
+ cy_as_misc_gpio__nand_CE
+#define cy_an_misc_gpio__nand_CE2 \
+ cy_as_misc_gpio__nand_CE2
+#define cy_an_misc_gpio__nand_WP \
+ cy_as_misc_gpio__nand_WP
+#define cy_an_misc_gpio__nand_CLE \
+ cy_as_misc_gpio__nand_CLE
+#define cy_an_misc_gpio__nand_ALE \
+ cy_as_misc_gpio__nand_ALE
+#define cy_an_misc_gpio_U_valid \
+ cy_as_misc_gpio_U_valid
+#define cy_an_misc_gpio_SD_POW \
+ cy_as_misc_gpio_SD_POW
+typedef cy_as_misc_gpio cy_an_misc_gpio;
+
+#define CY_AN_SD_DEFAULT_FREQ CY_AS_SD_DEFAULT_FREQ
+#define CY_AN_SD_RATED_FREQ CY_AS_SD_RATED_FREQ
+typedef cy_as_low_speed_sd_freq cy_an_low_speed_sd_freq;
+
+#define CY_AN_HS_SD_FREQ_48 CY_AS_HS_SD_FREQ_48
+#define CY_AN_HS_SD_FREQ_24 CY_AS_HS_SD_FREQ_24
+typedef cy_as_high_speed_sd_freq \
+ cy_an_high_speed_sd_freq;
+
+#define cy_an_misc_active_high cy_as_misc_active_high
+#define cy_an_misc_active_low cy_as_misc_active_low
+typedef cy_as_misc_signal_polarity cy_an_misc_signal_polarity;
+
+typedef cy_as_get_firmware_version_data \
+ cy_an_get_firmware_version_data;
+
+enum {
+ CYAN_FW_TRACE_LOG_NONE = 0,
+ CYAN_FW_TRACE_LOG_STATE,
+ CYAN_FW_TRACE_LOG_CALLS,
+ CYAN_FW_TRACE_LOG_STACK_TRACE,
+ CYAN_FW_TRACE_MAX_LEVEL
+};
+
+
+/***********************************/
+/***********************************/
+/* FUNCTIONS */
+/***********************************/
+/***********************************/
+
+
+EXTERN cy_an_return_status_t
+cy_an_misc_create_device(
+ cy_an_device_handle *handle_p,
+ cy_an_hal_device_tag tag
+ );
+#define cy_an_misc_create_device(h, tag) \
+ cy_as_misc_create_device((cy_as_device_handle *)(h), \
+ (cy_as_hal_device_tag)(tag))
+
+EXTERN cy_an_return_status_t
+cy_an_misc_destroy_device(
+ cy_an_device_handle handle
+ );
+#define cy_an_misc_destroy_device(h) \
+ cy_as_misc_destroy_device((cy_as_device_handle)(h))
+
+EXTERN cy_an_return_status_t
+cy_an_misc_configure_device(
+ cy_an_device_handle handle,
+ cy_an_device_config *config_p
+ );
+#define cy_an_misc_configure_device(h, cfg) \
+ cy_as_misc_configure_device((cy_as_device_handle)(h), \
+ (cy_as_device_config *)(cfg))
+
+EXTERN cy_an_return_status_t
+cy_an_misc_in_standby(
+ cy_an_device_handle handle,
+ cy_bool *standby
+ );
+#define cy_an_misc_in_standby(h, standby) \
+ cy_as_misc_in_standby((cy_as_device_handle)(h), (standby))
+
+/* Sync version of Download Firmware */
+EXTERN cy_an_return_status_t
+cy_an_misc_download_firmware(
+ cy_an_device_handle handle,
+ const void *fw_p,
+ uint16_t size
+ );
+
+#define cy_an_misc_download_firmware(handle, fw_p, size) \
+ cy_as_misc_download_firmware((cy_as_device_handle)\
+ (handle), (fw_p), (size), 0, 0)
+
+/* Async version of Download Firmware */
+EXTERN cy_an_return_status_t
+cy_an_misc_download_firmware_e_x(
+ cy_an_device_handle handle,
+ const void *fw_p,
+ uint16_t size,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+
+#define cy_an_misc_download_firmware_e_x(h, fw_p, size, cb, client) \
+ cy_as_misc_download_firmware((cy_as_device_handle)(h), \
+ (fw_p), (size), (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Get Firmware Version */
+EXTERN cy_an_return_status_t
+cy_as_misc_get_firmware_version_dep(
+ cy_as_device_handle handle,
+ uint16_t *major,
+ uint16_t *minor,
+ uint16_t *build,
+ uint8_t *media_type,
+ cy_bool *is_debug_mode);
+
+#define cy_an_misc_get_firmware_version\
+ (h, major, minor, bld, type, mode) \
+ cy_as_misc_get_firmware_version_dep((cy_as_device_handle)(h), \
+ (major), (minor), (bld), (type), (mode))
+
+/* Async version of Get Firmware Version*/
+EXTERN cy_an_return_status_t
+cy_an_misc_get_firmware_version_e_x(
+ cy_an_device_handle handle,
+ cy_an_get_firmware_version_data *data,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_get_firmware_version_e_x\
+ (h, data, cb, client) \
+ cy_as_misc_get_firmware_version((cy_as_device_handle)(h), \
+ (data), (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Read MCU Register*/
+EXTERN cy_an_return_status_t
+cy_an_misc_read_m_c_u_register(
+ cy_an_device_handle handle,
+ uint16_t address,
+ uint8_t *value
+ );
+
+#define cy_an_misc_read_m_c_u_register(handle, address, value) \
+ cy_as_misc_read_m_c_u_register((cy_as_device_handle)(handle), \
+ (address), (value), 0, 0)
+
+/* Async version of Read MCU Register*/
+EXTERN cy_an_return_status_t
+cy_an_misc_read_m_c_u_register_e_x(
+ cy_an_device_handle handle,
+ uint16_t address,
+ uint8_t *value,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+
+#define cy_an_misc_read_m_c_u_register_e_x\
+ (h, addr, val, cb, client) \
+ cy_as_misc_read_m_c_u_register((cy_as_device_handle)(h), \
+ (addr), (val), (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Write MCU Register*/
+EXTERN cy_an_return_status_t
+cy_an_misc_write_m_c_u_register(
+ cy_an_device_handle handle,
+ uint16_t address,
+ uint8_t mask,
+ uint8_t value
+ );
+#define cy_an_misc_write_m_c_u_register\
+ (handle, address, mask, value) \
+ cy_as_misc_write_m_c_u_register((cy_as_device_handle)(handle), \
+ (address), (mask), (value), 0, 0)
+
+/* Async version of Write MCU Register*/
+EXTERN cy_an_return_status_t
+cy_an_misc_write_m_c_u_register_e_x(
+ cy_an_device_handle handle,
+ uint16_t address,
+ uint8_t mask,
+ uint8_t value,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_write_m_c_u_register_e_x\
+ (h, addr, mask, val, cb, client) \
+ cy_as_misc_write_m_c_u_register((cy_as_device_handle)(h), \
+ (addr), (mask), (val), (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Write MCU Register*/
+EXTERN cy_an_return_status_t
+cy_an_misc_reset(
+ cy_an_device_handle handle,
+ cy_an_reset_type type,
+ cy_bool flush
+ );
+#define cy_an_misc_reset(handle, type, flush) \
+ cy_as_misc_reset((cy_as_device_handle)(handle), \
+ (type), (flush), 0, 0)
+
+/* Async version of Write MCU Register*/
+EXTERN cy_an_return_status_t
+cy_an_misc_reset_e_x(
+ cy_an_device_handle handle,
+ cy_an_reset_type type,
+ cy_bool flush,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_reset_e_x(h, type, flush, cb, client) \
+ cy_as_misc_reset((cy_as_device_handle)(h), \
+ (cy_as_reset_type)(type), (flush), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Synchronous version of CyAnMiscAcquireResource. */
+EXTERN cy_an_return_status_t
+cy_an_misc_acquire_resource(
+ cy_an_device_handle handle,
+ cy_an_resource_type type,
+ cy_bool force
+ );
+#define cy_an_misc_acquire_resource(h, type, force) \
+ cy_as_misc_acquire_resource_dep((cy_as_device_handle)(h), \
+ (cy_as_resource_type)(type), (force))
+
+/* Asynchronous version of CyAnMiscAcquireResource. */
+EXTERN cy_an_return_status_t
+cy_an_misc_acquire_resource_e_x(
+ cy_an_device_handle handle,
+ cy_an_resource_type *type,
+ cy_bool force,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_acquire_resource_e_x\
+ (h, type_p, force, cb, client) \
+ cy_as_misc_acquire_resource((cy_as_device_handle)(h), \
+ (cy_as_resource_type *)(type_p), \
+ (force), (cy_as_function_callback)(cb), (client))
+
+/* The one and only version of Release resource */
+EXTERN cy_an_return_status_t
+cy_an_misc_release_resource(
+ cy_an_device_handle handle,
+ cy_an_resource_type type
+ );
+#define cy_an_misc_release_resource(h, type)\
+ cy_as_misc_release_resource((cy_as_device_handle)(h), \
+ (cy_as_resource_type)(type))
+
+/* Synchronous version of CyAnMiscSetTraceLevel. */
+EXTERN cy_an_return_status_t
+cy_an_misc_set_trace_level(
+ cy_an_device_handle handle,
+ uint8_t level,
+ cy_an_media_type media,
+ uint32_t device,
+ uint32_t unit
+ );
+
+#define cy_an_misc_set_trace_level\
+ (handle, level, media, device, unit) \
+ cy_as_misc_set_trace_level_dep((cy_as_device_handle)(handle), \
+ (level), (cy_as_media_type)(media), (device), (unit), 0, 0)
+
+/* Asynchronous version of CyAnMiscSetTraceLevel. */
+EXTERN cy_an_return_status_t
+cy_an_misc_set_trace_level_e_x(
+ cy_an_device_handle handle,
+ uint8_t level,
+ cy_an_media_type media,
+ uint32_t device,
+ uint32_t unit,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_set_trace_level_e_x\
+ (h, level, media, device, unit, cb, client) \
+ cy_as_misc_set_trace_level_dep((cy_as_device_handle)(h), \
+ (level), (cy_as_media_type)(media), (device), (unit), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Synchronous version of CyAnMiscEnterStandby. */
+EXTERN cy_an_return_status_t
+cy_an_misc_enter_standby(
+ cy_an_device_handle handle,
+ cy_bool pin
+ );
+#define cy_an_misc_enter_standby(handle, pin) \
+ cy_as_misc_enter_standby(\
+ (cy_as_device_handle)(handle), (pin), 0, 0)
+
+/* Synchronous version of CyAnMiscEnterStandby. */
+EXTERN cy_an_return_status_t
+cy_an_misc_enter_standby_e_x(
+ cy_an_device_handle handle,
+ cy_bool pin,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_enter_standby_e_x(h, pin, cb, client) \
+ cy_as_misc_enter_standby((cy_as_device_handle)(h), \
+ (pin), (cy_as_function_callback)(cb), (client))
+
+/* Only one version of CyAnMiscLeaveStandby. */
+EXTERN cy_an_return_status_t
+cy_an_misc_leave_standby(
+ cy_an_device_handle handle,
+ cy_an_resource_type type
+ );
+#define cy_an_misc_leave_standby(h, type) \
+ cy_as_misc_leave_standby((cy_as_device_handle)(h), \
+ (cy_as_resource_type)(type))
+
+/* The one version of Misc Register Callback */
+EXTERN cy_an_return_status_t
+cy_an_misc_register_callback(
+ cy_an_device_handle handle,
+ cy_an_misc_event_callback callback
+ );
+#define cy_an_misc_register_callback(h, cb) \
+ cy_as_misc_register_callback((cy_as_device_handle)(h), \
+ (cy_as_misc_event_callback)(cb))
+
+/* The only version of SetLogLevel */
+EXTERN void
+cy_an_misc_set_log_level(
+ uint8_t level
+ );
+#define cy_an_misc_set_log_level(level) \
+ cy_as_misc_set_log_level(level)
+
+/* Sync version of Misc Storage Changed */
+EXTERN cy_an_return_status_t
+cy_an_misc_storage_changed(
+ cy_an_device_handle handle
+ );
+#define cy_an_misc_storage_changed(handle) \
+ cy_as_misc_storage_changed((cy_as_device_handle)(handle), 0, 0)
+
+/* Async version of Misc Storage Changed */
+EXTERN cy_an_return_status_t
+cy_an_misc_storage_changed_e_x(
+ cy_an_device_handle handle,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_storage_changed_e_x(h, cb, client) \
+ cy_as_misc_storage_changed((cy_as_device_handle)(h), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Heartbeat control */
+EXTERN cy_an_return_status_t
+cy_an_misc_heart_beat_control(
+ cy_an_device_handle handle,
+ cy_bool enable
+ );
+#define cy_an_misc_heart_beat_control(handle, enable) \
+ cy_as_misc_heart_beat_control((cy_as_device_handle)\
+ (handle), (enable), 0, 0)
+
+/* Async version of Heartbeat control */
+EXTERN cy_an_return_status_t
+cy_an_misc_heart_beat_control_e_x(
+ cy_an_device_handle handle,
+ cy_bool enable,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_heart_beat_control_e_x(h, enable, cb, client) \
+ cy_as_misc_heart_beat_control((cy_as_device_handle)(h), \
+ (enable), (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Get Gpio */
+EXTERN cy_an_return_status_t
+cy_an_misc_get_gpio_value(
+ cy_an_device_handle handle,
+ cy_an_misc_gpio pin,
+ uint8_t *value
+ );
+#define cy_an_misc_get_gpio_value(handle, pin, value) \
+ cy_as_misc_get_gpio_value((cy_as_device_handle)(handle), \
+ (cy_as_misc_gpio)(pin), (value), 0, 0)
+
+/* Async version of Get Gpio */
+EXTERN cy_an_return_status_t
+cy_an_misc_get_gpio_value_e_x(
+ cy_an_device_handle handle,
+ cy_an_misc_gpio pin,
+ uint8_t *value,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_get_gpio_value_e_x(h, pin, value, cb, client) \
+ cy_as_misc_get_gpio_value((cy_as_device_handle)(h), \
+ (cy_as_misc_gpio)(pin), (value), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Set Gpio */
+EXTERN cy_an_return_status_t
+cy_an_misc_set_gpio_value(
+ cy_an_device_handle handle,
+ cy_an_misc_gpio pin,
+ uint8_t value
+ );
+#define cy_an_misc_set_gpio_value(handle, pin, value) \
+ cy_as_misc_set_gpio_value((cy_as_device_handle)(handle), \
+ (cy_as_misc_gpio)(pin), (value), 0, 0)
+
+/* Async version of Set Gpio */
+EXTERN cy_an_return_status_t
+cy_an_misc_set_gpio_value_e_x(
+ cy_an_device_handle handle,
+ cy_an_misc_gpio pin,
+ uint8_t value,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_set_gpio_value_e_x\
+ (h, pin, value, cb, client) \
+ cy_as_misc_set_gpio_value((cy_as_device_handle)(h), \
+ (cy_as_misc_gpio)(pin), (value), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Enter suspend */
+EXTERN cy_an_return_status_t
+cy_an_misc_enter_suspend(
+ cy_an_device_handle handle,
+ cy_bool usb_wakeup_en,
+ cy_bool gpio_wakeup_en
+ );
+#define cy_an_misc_enter_suspend(handle, usb_wakeup_en, \
+ gpio_wakeup_en) \
+ cy_as_misc_enter_suspend((cy_as_device_handle)(handle), \
+ (usb_wakeup_en), (gpio_wakeup_en), 0, 0)
+
+/* Async version of Enter suspend */
+EXTERN cy_an_return_status_t
+cy_an_misc_enter_suspend_e_x(
+ cy_an_device_handle handle,
+ cy_bool usb_wakeup_en,
+ cy_bool gpio_wakeup_en,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_enter_suspend_e_x(h, usb_en, gpio_en, cb, client)\
+ cy_as_misc_enter_suspend((cy_as_device_handle)(h), (usb_en), \
+ (gpio_en), (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Enter suspend */
+EXTERN cy_an_return_status_t
+cy_an_misc_leave_suspend(
+ cy_an_device_handle handle
+ );
+#define cy_an_misc_leave_suspend(handle) \
+ cy_as_misc_leave_suspend((cy_as_device_handle)(handle), 0, 0)
+
+/* Async version of Enter suspend */
+EXTERN cy_an_return_status_t
+cy_an_misc_leave_suspend_e_x(
+ cy_an_device_handle handle,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+
+#define cy_an_misc_leave_suspend_e_x(h, cb, client) \
+ cy_as_misc_leave_suspend((cy_as_device_handle)(h), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of SetLowSpeedSDFreq */
+EXTERN cy_an_return_status_t
+cy_an_misc_set_low_speed_sd_freq(
+ cy_an_device_handle handle,
+ cy_an_low_speed_sd_freq setting
+ );
+#define cy_an_misc_set_low_speed_sd_freq(h, setting) \
+ cy_as_misc_set_low_speed_sd_freq((cy_as_device_handle)(h), \
+ (cy_as_low_speed_sd_freq)(setting), 0, 0)
+
+/* Async version of SetLowSpeedSDFreq */
+EXTERN cy_an_return_status_t
+cy_an_misc_set_low_speed_sd_freq_e_x(
+ cy_an_device_handle handle,
+ cy_an_low_speed_sd_freq setting,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_set_low_speed_sd_freq_e_x\
+(h, setting, cb, client) \
+ cy_as_misc_set_low_speed_sd_freq((cy_as_device_handle)(h), \
+ (cy_as_low_speed_sd_freq)(setting), \
+ (cy_as_function_callback)(cb), (client))
+
+/* SetHighSpeedSDFreq */
+EXTERN cy_an_return_status_t
+cy_an_misc_set_high_speed_sd_freq(
+ cy_an_device_handle handle,
+ cy_an_high_speed_sd_freq setting,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_misc_set_high_speed_sd_freq(h, setting, cb, client) \
+ cy_as_misc_set_high_speed_sd_freq((cy_as_device_handle)(h), \
+ (cy_as_high_speed_sd_freq)(setting), \
+ (cy_as_function_callback)(cb), (client))
+
+/* ReserveLNABootArea */
+EXTERN cy_an_return_status_t
+cy_an_misc_reserve_l_n_a_boot_area(
+ cy_an_device_handle handle,
+ uint8_t numzones,
+ cy_an_function_callback cb,
+ uint32_t client);
+#define cy_an_misc_reserve_l_n_a_boot_area(h, num, cb, client) \
+ cy_as_misc_reserve_l_n_a_boot_area((cy_as_device_handle)(h), \
+ num, (cy_as_function_callback)(cb), (client))
+
+/* SetSDPowerPolarity */
+EXTERN cy_an_return_status_t
+cy_an_misc_set_sd_power_polarity(
+ cy_an_device_handle handle,
+ cy_an_misc_signal_polarity polarity,
+ cy_an_function_callback cb,
+ uint32_t client);
+#define cy_an_misc_set_sd_power_polarity(h, pol, cb, client) \
+ cy_as_misc_set_sd_power_polarity((cy_as_device_handle)(h), \
+ (cy_as_misc_signal_polarity)(pol), \
+ (cy_as_function_callback)(cb), (client))
+
+#include "cyas_cplus_end.h"
+
+#endif
+
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanregs.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanregs.h
new file mode 100644
index 0000000..d670291
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanregs.h
@@ -0,0 +1,180 @@
+/* Cypress West Bridge API header file (cyanregs.h)
+ ## Register and field definitions for the Antioch device.
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYANREG_H_
+#define _INCLUDED_CYANREG_H_
+
+#if !defined(__doxygen__)
+
+#define CY_AN_MEM_CM_WB_CFG_ID (0x80)
+#define CY_AN_MEM_CM_WB_CFG_ID_VER_MASK (0x000F)
+#define CY_AN_MEM_CM_WB_CFG_ID_HDID_MASK (0xFFF0)
+#define CY_AN_MEM_CM_WB_CFG_ID_HDID_ANTIOCH_VALUE (0xA100)
+#define CY_AN_MEM_CM_WB_CFG_ID_HDID_ASTORIA_FPGA_VALUE (0x6800)
+#define CY_AN_MEM_CM_WB_CFG_ID_HDID_ASTORIA_VALUE (0xA200)
+
+
+#define CY_AN_MEM_RST_CTRL_REG (0x81)
+#define CY_AN_MEM_RST_CTRL_REG_HARD (0x0003)
+#define CY_AN_MEM_RST_CTRL_REG_SOFT (0x0001)
+#define CY_AN_MEM_RST_RSTCMPT (0x0004)
+
+#define CY_AN_MEM_P0_ENDIAN (0x82)
+#define CY_AN_LITTLE_ENDIAN (0x0000)
+#define CY_AN_BIG_ENDIAN (0x0101)
+
+#define CY_AN_MEM_P0_VM_SET (0x83)
+#define CY_AN_MEM_P0_VM_SET_VMTYPE_MASK (0x0007)
+#define CY_AN_MEM_P0_VM_SET_VMTYPE_RAM (0x0005)
+#define CY_AN_MEM_P0_VM_SET_VMTYPE_VMWIDTH (0x0008)
+#define CY_AN_MEM_P0_VM_SET_VMTYPE_FLOWCTRL (0x0010)
+#define CY_AN_MEM_P0_VM_SET_IFMODE (0x0020)
+#define CY_AN_MEM_P0_VM_SET_CFGMODE (0x0040)
+#define CY_AN_MEM_P0_VM_SET_DACKEOB (0x0080)
+#define CY_AN_MEM_P0_VM_SET_OVERRIDE (0x0100)
+#define CY_AN_MEM_P0_VM_SET_INTOVERD (0x0200)
+#define CY_AN_MEM_P0_VM_SET_DRQOVERD (0x0400)
+#define CY_AN_MEM_P0_VM_SET_DRQPOL (0x0800)
+#define CY_AN_MEM_P0_VM_SET_DACKPOL (0x1000)
+
+
+#define CY_AN_MEM_P0_NV_SET (0x84)
+#define CY_AN_MEM_P0_NV_SET_WPSWEN (0x0001)
+#define CY_AN_MEM_P0_NV_SET_WPPOLAR (0x0002)
+
+#define CY_AN_MEM_PMU_UPDATE (0x85)
+#define CY_AN_MEM_PMU_UPDATE_UVALID (0x0001)
+#define CY_AN_MEM_PMU_UPDATE_USBUPDATE (0x0002)
+#define CY_AN_MEM_PMU_UPDATE_SDIOUPDATE (0x0004)
+
+#define CY_AN_MEM_P0_INTR_REG (0x90)
+#define CY_AN_MEM_P0_INTR_REG_MCUINT (0x0020)
+#define CY_AN_MEM_P0_INTR_REG_DRQINT (0x0800)
+#define CY_AN_MEM_P0_INTR_REG_MBINT (0x1000)
+#define CY_AN_MEM_P0_INTR_REG_PMINT (0x2000)
+#define CY_AN_MEM_P0_INTR_REG_PLLLOCKINT (0x4000)
+
+#define CY_AN_MEM_P0_INT_MASK_REG (0x91)
+#define CY_AN_MEM_P0_INT_MASK_REG_MMCUINT (0x0020)
+#define CY_AN_MEM_P0_INT_MASK_REG_MDRQINT (0x0800)
+#define CY_AN_MEM_P0_INT_MASK_REG_MMBINT (0x1000)
+#define CY_AN_MEM_P0_INT_MASK_REG_MPMINT (0x2000)
+#define CY_AN_MEM_P0_INT_MASK_REG_MPLLLOCKINT (0x4000)
+
+#define CY_AN_MEM_MCU_MB_STAT (0x92)
+#define CY_AN_MEM_P0_MCU_MBNOTRD (0x0001)
+
+#define CY_AN_MEM_P0_MCU_STAT (0x94)
+#define CY_AN_MEM_P0_MCU_STAT_CARDINS (0x0001)
+#define CY_AN_MEM_P0_MCU_STAT_CARDREM (0x0002)
+
+#define CY_AN_MEM_PWR_MAGT_STAT (0x95)
+#define CY_AN_MEM_PWR_MAGT_STAT_WAKEUP (0x0001)
+
+#define CY_AN_MEM_P0_RSE_ALLOCATE (0x98)
+#define CY_AN_MEM_P0_RSE_ALLOCATE_SDIOAVI (0x0001)
+#define CY_AN_MEM_P0_RSE_ALLOCATE_SDIOALLO (0x0002)
+#define CY_AN_MEM_P0_RSE_ALLOCATE_NANDAVI (0x0004)
+#define CY_AN_MEM_P0_RSE_ALLOCATE_NANDALLO (0x0008)
+#define CY_AN_MEM_P0_RSE_ALLOCATE_USBAVI (0x0010)
+#define CY_AN_MEM_P0_RSE_ALLOCATE_USBALLO (0x0020)
+
+#define CY_AN_MEM_P0_RSE_MASK (0x9A)
+#define CY_AN_MEM_P0_RSE_MASK_MSDIOBUS_RW (0x0003)
+#define CY_AN_MEM_P0_RSE_MASK_MNANDBUS_RW (0x00C0)
+#define CY_AN_MEM_P0_RSE_MASK_MUSBBUS_RW (0x0030)
+
+#define CY_AN_MEM_P0_DRQ (0xA0)
+#define CY_AN_MEM_P0_DRQ_EP2DRQ (0x0004)
+#define CY_AN_MEM_P0_DRQ_EP3DRQ (0x0008)
+#define CY_AN_MEM_P0_DRQ_EP4DRQ (0x0010)
+#define CY_AN_MEM_P0_DRQ_EP5DRQ (0x0020)
+#define CY_AN_MEM_P0_DRQ_EP6DRQ (0x0040)
+#define CY_AN_MEM_P0_DRQ_EP7DRQ (0x0080)
+#define CY_AN_MEM_P0_DRQ_EP8DRQ (0x0100)
+#define CY_AN_MEM_P0_DRQ_EP9DRQ (0x0200)
+#define CY_AN_MEM_P0_DRQ_EP10DRQ (0x0400)
+#define CY_AN_MEM_P0_DRQ_EP11DRQ (0x0800)
+#define CY_AN_MEM_P0_DRQ_EP12DRQ (0x1000)
+#define CY_AN_MEM_P0_DRQ_EP13DRQ (0x2000)
+#define CY_AN_MEM_P0_DRQ_EP14DRQ (0x4000)
+#define CY_AN_MEM_P0_DRQ_EP15DRQ (0x8000)
+
+#define CY_AN_MEM_P0_DRQ_MASK (0xA1)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP2DRQ (0x0004)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP3DRQ (0x0008)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP4DRQ (0x0010)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP5DRQ (0x0020)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP6DRQ (0x0040)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP7DRQ (0x0080)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP8DRQ (0x0100)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP9DRQ (0x0200)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP10DRQ (0x0400)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP11DRQ (0x0800)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP12DRQ (0x1000)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP13DRQ (0x2000)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP14DRQ (0x4000)
+#define CY_AN_MEM_P0_DRQ_MASK_MEP15DRQ (0x8000)
+
+#define CY_AN_MEM_P0_EP2_DMA_REG (0xA2)
+#define CY_AN_MEM_P0_E_pn_DMA_REG_COUNT_MASK (0x7FF)
+#define CY_AN_MEM_P0_E_pn_DMA_REG_DMAVAL (1 << 12)
+#define CY_AN_MEM_P0_EP3_DMA_REG (0xA3)
+#define CY_AN_MEM_P0_EP4_DMA_REG (0xA4)
+#define CY_AN_MEM_P0_EP5_DMA_REG (0xA5)
+#define CY_AN_MEM_P0_EP6_DMA_REG (0xA6)
+#define CY_AN_MEM_P0_EP7_DMA_REG (0xA7)
+#define CY_AN_MEM_P0_EP8_DMA_REG (0xA8)
+#define CY_AN_MEM_P0_EP9_DMA_REG (0xA9)
+#define CY_AN_MEM_P0_EP10_DMA_REG (0xAA)
+#define CY_AN_MEM_P0_EP11_DMA_REG (0xAB)
+#define CY_AN_MEM_P0_EP12_DMA_REG (0xAC)
+#define CY_AN_MEM_P0_EP13_DMA_REG (0xAD)
+#define CY_AN_MEM_P0_EP14_DMA_REG (0xAE)
+#define CY_AN_MEM_P0_EP15_DMA_REG (0xAF)
+
+#define CY_AN_MEM_IROS_IO_CFG (0xC1)
+#define CY_AN_MEM_IROS_IO_CFG_GPIODRVST_MASK (0x0003)
+#define CY_AN_MEM_IROS_IO_CFG_GPIOSLEW_MASK (0x0004)
+#define CY_AN_MEM_IROS_IO_CFG_PPIODRVST_MASK (0x0018)
+#define CY_AN_MEM_IROS_IO_CFG_PPIOSLEW_MASK (0x0020)
+#define CY_AN_MEM_IROS_IO_CFG_SSIODRVST_MASK (0x0300)
+#define CY_AN_MEM_IROS_IO_CFG_SSIOSLEW_MASK (0x0400)
+#define CY_AN_MEM_IROS_IO_CFG_SNIODRVST_MASK (0x1800)
+#define CY_AN_MEM_IROS_IO_CFG_SNIOSLEW_MASK (0x2000)
+
+#define CY_AN_MEM_PLL_LOCK_LOSS_STAT (0xC4)
+#define CY_AN_MEM_PLL_LOCK_LOSS_STAT_PLLSTAT (0x0800)
+
+#define CY_AN_MEM_P0_MAILBOX0 (0xF0)
+#define CY_AN_MEM_P0_MAILBOX1 (0xF1)
+#define CY_AN_MEM_P0_MAILBOX2 (0xF2)
+#define CY_AN_MEM_P0_MAILBOX3 (0xF3)
+
+#define CY_AN_MEM_MCU_MAILBOX0 (0xF8)
+#define CY_AN_MEM_MCU_MAILBOX1 (0xF9)
+#define CY_AN_MEM_MCU_MAILBOX2 (0xFA)
+#define CY_AN_MEM_MCU_MAILBOX3 (0xFB)
+
+#endif /* !defined(__doxygen__) */
+
+#endif /* _INCLUDED_CYANREG_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyansdkversion.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyansdkversion.h
new file mode 100644
index 0000000..ac26b95
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyansdkversion.h
@@ -0,0 +1,30 @@
+/* Cypress Antioch Sdk Version file (cyansdkversion.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYANSDK_VERSION_H_
+#define _INCLUDED_CYANSDK_VERSION_H_
+
+/* Antioch SDK version 1.3.2 */
+#define CYAN_MAJOR_VERSION (1)
+#define CYAN_MINOR_VERSION (3)
+#define CYAN_BUILD_NUMBER (473)
+
+#endif /*_INCLUDED_CYANSDK_VERSION_H_*/
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanstorage.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanstorage.h
new file mode 100644
index 0000000..deb9af8
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanstorage.h
@@ -0,0 +1,419 @@
+/* Cypress West Bridge API header file (cyanstorage.h)
+ ## Header for backward compatibility with previous releases of Antioch SDK.
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYANSTORAGE_H_
+#define _INCLUDED_CYANSTORAGE_H_
+#ifndef __doxygen__
+
+#include "cyanmedia.h"
+#include "cyanmisc.h"
+#include "cyasstorage.h"
+#include "cyas_cplus_start.h"
+
+#define CY_AN_LUN_PHYSICAL_DEVICE (CY_AS_LUN_PHYSICAL_DEVICE)
+#define CY_AN_STORAGE_EP_SIZE (CY_AS_STORAGE_EP_SIZE)
+
+#define cy_an_storage_antioch cy_as_storage_antioch
+#define cy_an_storage_processor cy_as_storage_processor
+#define cy_an_storage_removed cy_as_storage_removed
+#define cy_an_storage_inserted cy_as_storage_inserted
+#define cy_an_sdio_interrupt cy_as_sdio_interrupt
+typedef cy_as_storage_event cy_an_storage_event;
+
+#define cy_an_op_read cy_as_op_read
+#define cy_an_op_write cy_as_op_write
+typedef cy_as_oper_type cy_an_oper_type;
+
+typedef cy_as_device_desc cy_an_device_desc;
+
+typedef cy_as_unit_desc cy_an_unit_desc;
+
+typedef cy_as_storage_callback_dep \
+ cy_an_storage_callback;
+
+typedef cy_as_storage_event_callback_dep \
+ cy_an_storage_event_callback;
+
+#define cy_an_sd_reg_OCR cy_as_sd_reg_OCR
+#define cy_an_sd_reg_CID cy_as_sd_reg_CID
+#define cy_an_sd_reg_CSD cy_as_sd_reg_CSD
+typedef cy_as_sd_card_reg_type \
+ cy_an_sd_card_reg_type;
+
+typedef cy_as_storage_query_device_data_dep \
+ cy_an_storage_query_device_data;
+
+typedef cy_as_storage_query_unit_data_dep \
+ cy_an_storage_query_unit_data;
+
+typedef cy_as_storage_sd_reg_read_data \
+ cy_an_storage_sd_reg_read_data;
+
+#define CY_AN_SD_REG_OCR_LENGTH (CY_AS_SD_REG_OCR_LENGTH)
+#define CY_AN_SD_REG_CID_LENGTH (CY_AS_SD_REG_CID_LENGTH)
+#define CY_AN_SD_REG_CSD_LENGTH (CY_AS_SD_REG_CSD_LENGTH)
+#define CY_AN_SD_REG_MAX_RESP_LENGTH \
+ (CY_AS_SD_REG_MAX_RESP_LENGTH)
+
+/**** API Functions ******/
+
+/* Sync version of Storage Start */
+EXTERN cy_an_return_status_t
+cy_an_storage_start(
+ cy_an_device_handle handle
+ );
+#define cy_an_storage_start(handle) \
+ cy_as_storage_start((cy_as_device_handle)(handle), 0, 0)
+
+/* Async version of Storage Start */
+EXTERN cy_an_return_status_t
+cy_an_storage_start_e_x(
+ cy_an_device_handle handle,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_storage_start_e_x(h, cb, client) \
+ cy_as_storage_start((cy_as_device_handle)(h), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Storage Stop */
+EXTERN cy_an_return_status_t
+cy_an_storage_stop(
+ cy_an_device_handle handle
+ );
+#define cy_an_storage_stop(handle) \
+ cy_as_storage_stop((cy_as_device_handle)(handle), 0, 0)
+
+/* Async version of Storage Stop */
+EXTERN cy_an_return_status_t
+cy_an_storage_stop_e_x(
+ cy_an_device_handle handle,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_storage_stop_e_x(h, cb, client) \
+ cy_as_storage_stop((cy_as_device_handle)(h), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Register Call back api */
+EXTERN cy_an_return_status_t
+cy_an_storage_register_callback(
+ cy_an_device_handle handle,
+ cy_an_storage_event_callback callback
+ );
+#define cy_an_storage_register_callback(h, cb) \
+ cy_as_storage_register_callback_dep((cy_as_device_handle)(h), \
+ (cy_as_storage_event_callback_dep)(cb))
+
+/* Sync version of Storage Claim */
+EXTERN cy_an_return_status_t
+cy_an_storage_claim(
+ cy_an_device_handle handle,
+ cy_an_media_type type
+ );
+#define cy_an_storage_claim(h, type) \
+ cy_as_storage_claim_dep((cy_as_device_handle)(h), \
+ (cy_as_media_type)(type))
+
+/* Async version of Storage Claim */
+EXTERN cy_an_return_status_t
+cy_an_storage_claim_e_x(
+ cy_an_device_handle handle,
+ cy_an_media_type *type,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_storage_claim_e_x(h, type_p, cb, client) \
+ cy_as_storage_claim_dep_EX((cy_as_device_handle)(h), \
+ (cy_as_media_type *)(type_p), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync Version of Storage Release */
+EXTERN cy_an_return_status_t
+cy_an_storage_release(
+ cy_an_device_handle handle,
+ cy_an_media_type type
+ );
+#define cy_an_storage_release(h, type) \
+ cy_as_storage_release_dep((cy_as_device_handle)(h), \
+ (cy_as_media_type)(type))
+
+/* Async Version of Storage Release */
+EXTERN cy_an_return_status_t
+cy_an_storage_release_e_x(
+ cy_an_device_handle handle,
+ cy_an_media_type *type,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_storage_release_e_x(h, type_p, cb, client) \
+ cy_as_storage_release_dep_EX((cy_as_device_handle)(h), \
+ (cy_as_media_type *)(type_p), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Query Media */
+EXTERN cy_an_return_status_t
+cy_an_storage_query_media(
+ cy_an_device_handle handle,
+ cy_an_media_type type,
+ uint32_t *count
+ );
+#define cy_an_storage_query_media(handle, type, count) \
+ cy_as_storage_query_media((cy_as_device_handle)(handle), \
+ (cy_as_media_type)(type), (count), 0, 0)
+
+/* Async version of Query Media */
+EXTERN cy_an_return_status_t
+cy_an_storage_query_media_e_x(
+ cy_an_device_handle handle,
+ cy_an_media_type type,
+ uint32_t *count,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_storage_query_media_e_x(h, type, count, cb, client) \
+ cy_as_storage_query_media((cy_as_device_handle)(h), \
+ (cy_as_media_type)(type), (count), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Query device */
+EXTERN cy_an_return_status_t
+cy_an_storage_query_device(
+ cy_an_device_handle handle,
+ cy_an_media_type type,
+ uint32_t device,
+ cy_an_device_desc *desc_p
+ );
+#define cy_an_storage_query_device(h, type, device, desc_p) \
+ cy_as_storage_query_device_dep((cy_as_device_handle)(h), \
+ (cy_as_media_type)(type), (device), (cy_as_device_desc *)(desc_p))
+
+/* Async version of Query device */
+EXTERN cy_an_return_status_t
+cy_an_storage_query_device_e_x(
+ cy_an_device_handle handle,
+ cy_an_storage_query_device_data *data,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_storage_query_device_e_x(h, data, cb, client) \
+ cy_as_storage_query_device_dep_EX((cy_as_device_handle)(h), \
+ (cy_as_storage_query_device_data_dep *)(data), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Query Unit */
+EXTERN cy_an_return_status_t
+cy_an_storage_query_unit(
+ cy_an_device_handle handle,
+ cy_an_media_type type,
+ uint32_t device,
+ uint32_t unit,
+ cy_an_unit_desc *desc_p
+ );
+#define cy_an_storage_query_unit(h, type, device, unit, desc_p) \
+ cy_as_storage_query_unit_dep((cy_as_device_handle)(h), \
+ (cy_as_media_type)(type), (device), \
+ (unit), (cy_as_unit_desc *)(desc_p))
+
+/* Async version of Query Unit */
+EXTERN cy_an_return_status_t
+cy_an_storage_query_unit_e_x(
+ cy_an_device_handle handle,
+ cy_an_storage_query_unit_data *data_p,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_storage_query_unit_e_x(h, data_p, cb, client) \
+ cy_as_storage_query_unit_dep_EX((cy_as_device_handle)(h), \
+ (cy_as_storage_query_unit_data_dep *)(data_p), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of device control */
+EXTERN cy_an_return_status_t
+cy_an_storage_device_control(
+ cy_an_device_handle handle,
+ cy_bool card_detect_en,
+ cy_bool write_prot_en
+ );
+#define cy_an_storage_device_control(handle, \
+ card_detect_en, write_prot_en) \
+ cy_as_storage_device_control_dep((cy_as_device_handle)(handle), \
+ (card_detect_en), (write_prot_en), 0, 0)
+
+/* Async version of device control */
+EXTERN cy_an_return_status_t
+cy_an_storage_device_control_e_x(
+ cy_an_device_handle handle,
+ cy_bool card_detect_en,
+ cy_bool write_prot_en,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_storage_device_control_e_x(h, det_en, prot_en, cb, client) \
+ cy_as_storage_device_control_dep((cy_as_device_handle)(h), (det_en), \
+ (prot_en), (cy_as_function_callback)(cb), (client))
+
+/* Sync Read */
+EXTERN cy_an_return_status_t
+cy_an_storage_read(
+ cy_an_device_handle handle,
+ cy_an_media_type type,
+ uint32_t device,
+ uint32_t unit,
+ uint32_t block,
+ void *data_p,
+ uint16_t num_blocks
+ );
+#define cy_an_storage_read(h, type, device, unit, block, data_p, nblks) \
+ cy_as_storage_read_dep((cy_as_device_handle)(h), \
+ (cy_as_media_type)(type), (device), (unit), \
+ (block), (data_p), (nblks))
+
+/* Async Read */
+EXTERN cy_an_return_status_t
+cy_an_storage_read_async(
+ cy_an_device_handle handle,
+ cy_an_media_type type,
+ uint32_t device,
+ uint32_t unit,
+ uint32_t block,
+ void *data_p,
+ uint16_t num_blocks,
+ cy_an_storage_callback callback
+ );
+#define cy_an_storage_read_async(h, type, device, unit, \
+ block, data_p, nblks, cb) \
+ cy_as_storage_read_async_dep((cy_as_device_handle)(h), \
+ (cy_as_media_type)(type), (device), (unit), (block), \
+ (data_p), (nblks), (cy_as_storage_callback_dep)(cb))
+
+/* Sync Write */
+EXTERN cy_an_return_status_t
+cy_an_storage_write(
+ cy_an_device_handle handle,
+ cy_an_media_type type,
+ uint32_t device,
+ uint32_t unit,
+ uint32_t block,
+ void *data_p,
+ uint16_t num_blocks
+ );
+#define cy_an_storage_write(h, type, device, unit, \
+ block, data_p, nblks) \
+ cy_as_storage_write_dep((cy_as_device_handle)(h), \
+ (cy_as_media_type)(type), (device), (unit), \
+ (block), (data_p), (nblks))
+
+/* Async Write */
+EXTERN cy_an_return_status_t
+cy_an_storage_write_async(
+ cy_an_device_handle handle,
+ cy_an_media_type type,
+ uint32_t device,
+ uint32_t unit,
+ uint32_t block,
+ void *data_p,
+ uint16_t num_blocks,
+ cy_an_storage_callback callback
+ );
+#define cy_an_storage_write_async(h, type, device, unit, \
+ block, data_p, nblks, cb) \
+ cy_as_storage_write_async_dep((cy_as_device_handle)(h), \
+ (cy_as_media_type)(type), (device), (unit), (block), \
+ (data_p), (nblks), (cy_as_storage_callback_dep)(cb))
+
+/* Cancel Async */
+EXTERN cy_an_return_status_t
+cy_an_storage_cancel_async(
+ cy_an_device_handle handle
+ );
+#define cy_an_storage_cancel_async(h) \
+ cy_as_storage_cancel_async((cy_as_device_handle)(h))
+
+/* Sync SD Register Read*/
+EXTERN cy_an_return_status_t
+cy_an_storage_sd_register_read(
+ cy_an_device_handle handle,
+ cy_an_media_type type,
+ uint8_t device,
+ cy_an_sd_card_reg_type reg_type,
+ uint8_t read_len,
+ uint8_t *data_p
+ );
+#define cy_an_storage_sd_register_read(h, type, device, \
+ reg_type, len, data_p) \
+ cy_as_storage_sd_register_read_dep((cy_as_device_handle)(h), \
+ (cy_as_media_type)(type), (device), \
+ (cy_as_sd_card_reg_type)(reg_type), (len), (data_p))
+
+/*Async SD Register Read*/
+EXTERN cy_an_return_status_t
+cy_an_storage_sd_register_read_e_x(
+ cy_an_device_handle handle,
+ cy_an_media_type type,
+ uint8_t device,
+ cy_an_sd_card_reg_type reg_type,
+ cy_an_storage_sd_reg_read_data *data_p,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_storage_sd_register_read_e_x(h, type, device, \
+ reg_type, data_p, cb, client) \
+ cy_as_storage_sd_register_read_dep_EX((cy_as_device_handle)(h), \
+ (cy_as_media_type)(type), (device), \
+ (cy_as_sd_card_reg_type)(reg_type), \
+ (cy_as_storage_sd_reg_read_data *)(data_p), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Create partition on storage device */
+EXTERN cy_an_return_status_t
+cy_an_storage_create_p_partition(
+ cy_an_device_handle handle,
+ cy_an_media_type media,
+ uint32_t device,
+ uint32_t size,
+ cy_an_function_callback cb,
+ uint32_t client);
+#define cy_an_storage_create_p_partition(h, media, dev, \
+ size, cb, client) \
+ cy_as_storage_create_p_partition_dep((cy_as_device_handle)(h), \
+ (cy_as_media_type)(media), (dev), \
+ (size), (cy_as_function_callback)(cb), (client))
+
+/* Remove partition on storage device */
+EXTERN cy_an_return_status_t
+cy_an_storage_remove_p_partition(
+ cy_an_device_handle handle,
+ cy_an_media_type media,
+ uint32_t device,
+ cy_an_function_callback cb,
+ uint32_t client);
+#define cy_an_storage_remove_p_partition\
+(h, media, dev, cb, client) \
+ cy_as_storage_remove_p_partition_dep((cy_as_device_handle)(h), \
+ (cy_as_media_type)(media), (dev), \
+ (cy_as_function_callback)(cb), (client))
+
+#include "cyas_cplus_end.h"
+#endif /*__doxygen__ */
+
+#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyantioch.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyantioch.h
new file mode 100644
index 0000000..d65b35a
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyantioch.h
@@ -0,0 +1,35 @@
+/* Cypress West Bridge API header file (cyastioch.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYANTIOCH_H_
+#define _INCLUDED_CYANTIOCH_H_
+
+#if !defined(__doxygen__)
+
+#include "cyanerr.h"
+#include "cyanmisc.h"
+#include "cyanstorage.h"
+#include "cyanusb.h"
+#include "cyanch9.h"
+
+#endif
+
+#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyantypes.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyantypes.h
new file mode 100644
index 0000000..48cd50f
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyantypes.h
@@ -0,0 +1,31 @@
+/* Cypress West Bridge API header file (cyantypes.h)
+## Type definitions for backward compatibility with previous
+## Antioch SDK releases.
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYANTYPES_H_
+#define _INCLUDED_CYANTYPES_H_
+
+#include "cyastypes.h"
+typedef cy_as_end_point_number_t cy_an_end_point_number_t;
+typedef cy_as_return_status_t cy_an_return_status_t;
+typedef cy_as_bus_number_t cy_an_bus_number_t;
+#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanusb.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanusb.h
new file mode 100644
index 0000000..1e4e7db
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanusb.h
@@ -0,0 +1,619 @@
+/* Cypress West Bridge API header file (cyanusb.h)
+ ## Header for backward compatibility with previous Antioch SDK releases.
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYANUSB_H_
+#define _INCLUDED_CYANUSB_H_
+
+#if !defined(__doxygen__)
+
+#include "cyanmisc.h"
+#include "cyasusb.h"
+#include "cyas_cplus_start.h"
+
+#define CY_AN_MAX_USB_DESCRIPTOR_SIZE (CY_AS_MAX_USB_DESCRIPTOR_SIZE)
+
+typedef cy_as_usb_inquiry_data_dep cy_an_usb_inquiry_data;
+typedef cy_as_usb_unknown_command_data_dep \
+ cy_an_usb_unknown_command_data;
+typedef cy_as_usb_start_stop_data_dep cy_an_usb_start_stop_data;
+typedef cy_as_m_s_c_progress_data cy_an_m_s_c_progress_data;
+
+#define cy_an_usb_nand_enum cy_as_usb_nand_enum
+#define cy_an_usb_sd_enum cy_as_usb_sd_enum
+#define cy_an_usb_mmc_enum cy_as_usb_mmc_enum
+#define cy_an_usb_ce_ata_enum cy_as_usb_ce_ata_enum
+typedef cy_as_usb_mass_storage_enum cy_an_usb_mass_storage_enum;
+
+#define cy_an_usb_desc_device cy_as_usb_desc_device
+#define cy_an_usb_desc_device_qual cy_as_usb_desc_device_qual
+#define cy_an_usb_desc_f_s_configuration \
+ cy_as_usb_desc_f_s_configuration
+#define cy_an_usb_desc_h_s_configuration \
+ cy_as_usb_desc_h_s_configuration
+#define cy_an_usb_desc_string cy_as_usb_desc_string
+typedef cy_as_usb_desc_type cy_an_usb_desc_type;
+
+#define cy_an_usb_in cy_as_usb_in
+#define cy_an_usb_out cy_as_usb_out
+#define cy_an_usb_in_out cy_as_usb_in_out
+typedef cy_as_usb_end_point_dir cy_an_usb_end_point_dir;
+
+
+#define cy_an_usb_control cy_as_usb_control
+#define cy_an_usb_iso cy_as_usb_iso
+#define cy_an_usb_bulk cy_as_usb_bulk
+#define cy_an_usb_int cy_as_usb_int
+typedef cy_as_usb_end_point_type cy_an_usb_end_point_type;
+
+
+typedef cy_as_usb_enum_control_dep cy_an_usb_enum_control;
+typedef cy_as_usb_end_point_config cy_an_usb_end_point_config;
+
+#define cy_an_usb_m_s_unit0 cy_as_usb_m_s_unit0
+#define cy_an_usb_m_s_unit1 cy_as_usb_m_s_unit1
+#define cy_an_usb_m_s_both cy_as_usb_m_s_both
+typedef cy_as_usb_m_s_type_t cy_an_usb_m_s_type_t;
+
+#define cy_an_event_usb_suspend cy_as_event_usb_suspend
+#define cy_an_event_usb_resume cy_as_event_usb_resume
+#define cy_an_event_usb_reset cy_as_event_usb_reset
+#define cy_an_event_usb_set_config cy_as_event_usb_set_config
+#define cy_an_event_usb_speed_change cy_as_event_usb_speed_change
+#define cy_an_event_usb_setup_packet cy_as_event_usb_setup_packet
+#define cy_an_event_usb_status_packet cy_as_event_usb_status_packet
+#define cy_an_event_usb_inquiry_before cy_as_event_usb_inquiry_before
+#define cy_an_event_usb_inquiry_after cy_as_event_usb_inquiry_after
+#define cy_an_event_usb_start_stop cy_as_event_usb_start_stop
+#define cy_an_event_usb_unknown_storage cy_as_event_usb_unknown_storage
+#define cy_an_event_usb_m_s_c_progress cy_as_event_usb_m_s_c_progress
+typedef cy_as_usb_event cy_an_usb_event;
+
+typedef cy_as_usb_event_callback_dep cy_an_usb_event_callback;
+
+typedef cy_as_usb_io_callback cy_an_usb_io_callback;
+typedef cy_as_usb_function_callback cy_an_usb_function_callback;
+
+/******* USB Functions ********************/
+
+/* Sync Usb Start */
+extern cy_an_return_status_t
+cy_an_usb_start(
+ cy_an_device_handle handle
+ );
+#define cy_an_usb_start(handle) \
+ cy_as_usb_start((cy_as_device_handle)(handle), 0, 0)
+
+/*Async Usb Start */
+extern cy_an_return_status_t
+cy_an_usb_start_e_x(
+ cy_an_device_handle handle,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_start_e_x(h, cb, client) \
+ cy_as_usb_start((cy_as_device_handle)(h), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync Usb Stop */
+extern cy_an_return_status_t
+cy_an_usb_stop(
+ cy_an_device_handle handle
+ );
+#define cy_an_usb_stop(handle) \
+ cy_as_usb_stop((cy_as_device_handle)(handle), 0, 0)
+
+/*Async Usb Stop */
+extern cy_an_return_status_t
+cy_an_usb_stop_e_x(
+ cy_an_device_handle handle,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_stop_e_x(h, cb, client) \
+ cy_as_usb_stop((cy_as_device_handle)(h), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Register USB event callback */
+EXTERN cy_an_return_status_t
+cy_an_usb_register_callback(
+ cy_an_device_handle handle,
+ cy_an_usb_event_callback callback
+ );
+#define cy_an_usb_register_callback(h, cb) \
+ cy_as_usb_register_callback_dep((cy_as_device_handle)(h), \
+ (cy_as_usb_event_callback_dep)(cb))
+
+/*Sync Usb connect */
+EXTERN cy_an_return_status_t
+cy_an_usb_connect(
+ cy_an_device_handle handle
+ );
+#define cy_an_usb_connect(handle) \
+ cy_as_usb_connect((cy_as_device_handle)(handle), 0, 0)
+
+/*Async Usb connect */
+extern cy_an_return_status_t
+cy_an_usb_connect_e_x(
+ cy_an_device_handle handle,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_connect_e_x(h, cb, client) \
+ cy_as_usb_connect((cy_as_device_handle)(h), \
+ (cy_as_function_callback)(cb), (client))
+
+/*Sync Usb disconnect */
+EXTERN cy_an_return_status_t
+cy_an_usb_disconnect(
+ cy_an_device_handle handle
+ );
+#define cy_an_usb_disconnect(handle) \
+ cy_as_usb_disconnect((cy_as_device_handle)(handle), 0, 0)
+
+/*Async Usb disconnect */
+extern cy_an_return_status_t
+cy_an_usb_disconnect_e_x(
+ cy_an_device_handle handle,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_disconnect_e_x(h, cb, client) \
+ cy_as_usb_disconnect((cy_as_device_handle)(h), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of set enum config */
+EXTERN cy_an_return_status_t
+cy_an_usb_set_enum_config(
+ cy_an_device_handle handle,
+ cy_an_usb_enum_control *config_p
+ );
+#define cy_an_usb_set_enum_config(handle, config_p) \
+ cy_as_usb_set_enum_config_dep((cy_as_device_handle)(handle), \
+ (cy_as_usb_enum_control_dep *)(config_p), 0, 0)
+
+/* Async version of set enum config */
+extern cy_an_return_status_t
+cy_an_usb_set_enum_config_e_x(
+ cy_an_device_handle handle,
+ cy_an_usb_enum_control *config_p,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_set_enum_config_e_x(h, config_p, cb, client) \
+ cy_as_usb_set_enum_config_dep((cy_as_device_handle)(h), \
+ (cy_as_usb_enum_control_dep *)(config_p), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of get enum config */
+EXTERN cy_an_return_status_t
+cy_an_usb_get_enum_config(
+ cy_an_device_handle handle,
+ cy_an_usb_enum_control *config_p
+ );
+#define cy_an_usb_get_enum_config(handle, config_p) \
+ cy_as_usb_get_enum_config_dep((cy_as_device_handle)(handle), \
+ (cy_as_usb_enum_control_dep *)(config_p), 0, 0)
+
+/* Async version of get enum config */
+extern cy_an_return_status_t
+cy_an_usb_get_enum_config_e_x(
+ cy_an_device_handle handle,
+ cy_an_usb_enum_control *config_p,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_get_enum_config_e_x(h, config_p, cb, client) \
+ cy_as_usb_get_enum_config_dep((cy_as_device_handle)(h), \
+ (cy_as_usb_enum_control_dep *)(config_p), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync Version of Set descriptor */
+EXTERN cy_an_return_status_t
+cy_an_usb_set_descriptor(
+ cy_an_device_handle handle,
+ cy_an_usb_desc_type type,
+ uint8_t index,
+ void *desc_p,
+ uint16_t length
+ );
+#define cy_an_usb_set_descriptor(handle, type, index, desc_p, length) \
+ cy_as_usb_set_descriptor((cy_as_device_handle)(handle), \
+ (cy_as_usb_desc_type)(type), (index), (desc_p), (length), 0, 0)
+
+/* Async Version of Set descriptor */
+extern cy_an_return_status_t
+cy_an_usb_set_descriptor_e_x(
+ cy_an_device_handle handle,
+ cy_an_usb_desc_type type,
+ uint8_t index,
+ void *desc_p,
+ uint16_t length,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_set_descriptor_e_x\
+ (h, type, index, desc_p, length, cb, client) \
+ cy_as_usb_set_descriptor((cy_as_device_handle)(h), \
+ (cy_as_usb_desc_type)(type), (index), (desc_p), (length), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Only version of clear descriptors */
+EXTERN cy_an_return_status_t
+cy_an_usb_clear_descriptors(
+ cy_an_device_handle handle,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_clear_descriptors(h, cb, client) \
+ cy_as_usb_clear_descriptors((cy_as_device_handle)(h), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of get descriptor*/
+EXTERN cy_an_return_status_t
+cy_an_usb_get_descriptor(
+ cy_an_device_handle handle,
+ cy_an_usb_desc_type type,
+ uint8_t index,
+ void *desc_p,
+ uint32_t *length_p
+ );
+#define cy_an_usb_get_descriptor(h, type, index, desc_p, length_p) \
+ cy_as_usb_get_descriptor_dep((cy_as_device_handle)(h), \
+ (cy_as_usb_desc_type)(type), (index), (desc_p), (length_p))
+
+typedef cy_as_get_descriptor_data cy_an_get_descriptor_data;
+
+/* Async version of get descriptor */
+extern cy_an_return_status_t
+cy_an_usb_get_descriptor_e_x(
+ cy_an_device_handle handle,
+ cy_an_usb_desc_type type,
+ uint8_t index,
+ cy_an_get_descriptor_data *data,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_get_descriptor_e_x\
+ (h, type, index, data, cb, client) \
+ cy_as_usb_get_descriptor((cy_as_device_handle)(h), \
+ (cy_as_usb_desc_type)(type), (index), \
+ (cy_as_get_descriptor_data *)(data), \
+ (cy_as_function_callback)(cb), (client))
+
+EXTERN cy_an_return_status_t
+cy_an_usb_set_physical_configuration(
+ cy_an_device_handle handle,
+ uint8_t config
+ );
+#define cy_an_usb_set_physical_configuration(h, config) \
+ cy_as_usb_set_physical_configuration\
+ ((cy_as_device_handle)(h), (config))
+
+EXTERN cy_an_return_status_t
+cy_an_usb_set_end_point_config(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_an_usb_end_point_config *config_p
+ );
+#define cy_an_usb_set_end_point_config(h, ep, config_p) \
+ cy_as_usb_set_end_point_config((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), \
+ (cy_as_usb_end_point_config *)(config_p))
+
+EXTERN cy_an_return_status_t
+cy_an_usb_get_end_point_config(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_an_usb_end_point_config *config_p
+ );
+#define cy_an_usb_get_end_point_config(h, ep, config_p) \
+ cy_as_usb_get_end_point_config((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), \
+ (cy_as_usb_end_point_config *)(config_p))
+
+/* Sync version of commit */
+EXTERN cy_an_return_status_t
+cy_an_usb_commit_config(
+ cy_an_device_handle handle
+ );
+#define cy_an_usb_commit_config(handle) \
+ cy_as_usb_commit_config((cy_as_device_handle)(handle), 0, 0)
+
+/* Async version of commit */
+extern cy_an_return_status_t
+cy_an_usb_commit_config_e_x(
+ cy_an_device_handle handle,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_commit_config_e_x(h, cb, client) \
+ cy_as_usb_commit_config((cy_as_device_handle)(h), \
+ (cy_as_function_callback)(cb), (client))
+
+EXTERN cy_an_return_status_t
+cy_an_usb_read_data(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_bool pktread,
+ uint32_t dsize,
+ uint32_t *dataread,
+ void *data
+ );
+#define cy_an_usb_read_data(h, ep, pkt, dsize, dataread, data_p) \
+ cy_as_usb_read_data((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), (pkt), (dsize), \
+ (dataread), (data_p))
+
+EXTERN cy_an_return_status_t
+cy_an_usb_read_data_async(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_bool pktread,
+ uint32_t dsize,
+ void *data,
+ cy_an_usb_io_callback callback
+ );
+#define cy_an_usb_read_data_async(h, ep, pkt, dsize, data_p, cb) \
+ cy_as_usb_read_data_async((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), (pkt), (dsize), (data_p), \
+ (cy_as_usb_io_callback)(cb))
+
+EXTERN cy_an_return_status_t
+cy_an_usb_write_data(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ uint32_t dsize,
+ void *data
+ );
+#define cy_an_usb_write_data(h, ep, dsize, data_p) \
+ cy_as_usb_write_data((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), (dsize), (data_p))
+
+EXTERN cy_an_return_status_t
+cy_an_usb_write_data_async(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ uint32_t dsize,
+ void *data,
+ cy_bool spacket,
+ cy_an_usb_io_callback callback
+ );
+#define cy_an_usb_write_data_async(h, ep, dsize, data_p, spacket, cb) \
+ cy_as_usb_write_data_async((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), (dsize), (data_p), (spacket), \
+ (cy_as_usb_io_callback)(cb))
+
+EXTERN cy_an_return_status_t
+cy_an_usb_cancel_async(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep
+ );
+#define cy_an_usb_cancel_async(h, ep) \
+ cy_as_usb_cancel_async((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep))
+
+/* Sync version of set stall */
+EXTERN cy_an_return_status_t
+cy_an_usb_set_stall(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_an_usb_function_callback cb,
+ uint32_t client
+);
+#define cy_an_usb_set_stall(h, ep, cb, client) \
+ cy_as_usb_set_stall_dep((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), \
+ (cy_as_usb_function_callback)(cb), (client))
+
+/* Async version of set stall */
+extern cy_an_return_status_t
+cy_an_usb_set_stall_e_x(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_an_function_callback cb,
+ uint32_t client
+);
+#define cy_an_usb_set_stall_e_x(h, ep, cb, client) \
+ cy_as_usb_set_stall((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), \
+ (cy_as_function_callback)(cb), (client))
+
+/*Sync version of clear stall */
+EXTERN cy_an_return_status_t
+cy_an_usb_clear_stall(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_an_usb_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_clear_stall(h, ep, cb, client) \
+ cy_as_usb_clear_stall_dep((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), \
+ (cy_as_usb_function_callback)(cb), (client))
+
+/*Sync version of clear stall */
+extern cy_an_return_status_t
+cy_an_usb_clear_stall_e_x(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_clear_stall_e_x(h, ep, cb, client) \
+ cy_as_usb_clear_stall((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync get stall */
+EXTERN cy_an_return_status_t
+cy_an_usb_get_stall(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_bool *stall_p
+ );
+#define cy_an_usb_get_stall(handle, ep, stall_p) \
+ cy_as_usb_get_stall((cy_as_device_handle)(handle), \
+ (cy_as_end_point_number_t)(ep), (stall_p), 0, 0)
+
+/* Async get stall */
+extern cy_an_return_status_t
+cy_an_usb_get_stall_e_x(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_bool *stall_p,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_get_stall_e_x(h, ep, stall_p, cb, client) \
+ cy_as_usb_get_stall((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), (stall_p), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of Set Nak */
+EXTERN cy_an_return_status_t
+cy_an_usb_set_nak(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_an_usb_function_callback cb,
+ uint32_t client
+);
+
+#define cy_an_usb_set_nak(h, ep, cb, client) \
+ cy_as_usb_set_nak_dep((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), \
+ (cy_as_usb_function_callback)(cb), (client))
+
+/* Async version of Set Nak */
+extern cy_an_return_status_t
+cy_an_usb_set_nak_e_x(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_an_function_callback cb,
+ uint32_t client
+);
+#define cy_an_usb_set_nak_e_x(h, ep, cb, client) \
+ cy_as_usb_set_nak((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync version of clear nak */
+EXTERN cy_an_return_status_t
+cy_an_usb_clear_nak(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_an_usb_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_clear_nak(h, ep, cb, client) \
+ cy_as_usb_clear_nak_dep((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), \
+ (cy_as_usb_function_callback)(cb), (client))
+
+/* Sync version of clear nak */
+extern cy_an_return_status_t
+cy_an_usb_clear_nak_e_x(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_clear_nak_e_x(h, ep, cb, client) \
+ cy_as_usb_clear_nak((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync Get NAK */
+EXTERN cy_an_return_status_t
+cy_an_usb_get_nak(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_bool *nak_p
+);
+#define cy_an_usb_get_nak(handle, ep, nak_p) \
+ cy_as_usb_get_nak((cy_as_device_handle)(handle), \
+ (cy_as_end_point_number_t)(ep), (nak_p), 0, 0)
+
+/* Async Get NAK */
+EXTERN cy_an_return_status_t
+cy_an_usb_get_nak_e_x(
+ cy_an_device_handle handle,
+ cy_an_end_point_number_t ep,
+ cy_bool *nak_p,
+ cy_an_function_callback cb,
+ uint32_t client
+);
+#define cy_an_usb_get_nak_e_x(h, ep, nak_p, cb, client) \
+ cy_as_usb_get_nak((cy_as_device_handle)(h), \
+ (cy_as_end_point_number_t)(ep), (nak_p), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Sync remote wakup */
+EXTERN cy_an_return_status_t
+cy_an_usb_signal_remote_wakeup(
+ cy_an_device_handle handle
+ );
+#define cy_an_usb_signal_remote_wakeup(handle) \
+ cy_as_usb_signal_remote_wakeup((cy_as_device_handle)(handle), 0, 0)
+
+/* Async remote wakup */
+EXTERN cy_an_return_status_t
+cy_an_usb_signal_remote_wakeup_e_x(
+ cy_an_device_handle handle,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_signal_remote_wakeup_e_x(h, cb, client) \
+ cy_as_usb_signal_remote_wakeup((cy_as_device_handle)(h), \
+ (cy_as_function_callback)(cb), (client))
+
+/* Only version of SetMSReportThreshold */
+EXTERN cy_an_return_status_t
+cy_an_usb_set_m_s_report_threshold(
+ cy_an_device_handle handle,
+ uint32_t wr_sectors,
+ uint32_t rd_sectors,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_set_m_s_report_threshold\
+ (h, wr_cnt, rd_cnt, cb, client) \
+ cy_as_usb_set_m_s_report_threshold((cy_as_device_handle)(h), \
+ wr_cnt, rd_cnt, (cy_as_function_callback)(cb), (client))
+
+/* Select storage partitions to be enumerated. */
+EXTERN cy_an_return_status_t
+cy_an_usb_select_m_s_partitions(
+ cy_an_device_handle handle,
+ cy_an_media_type media,
+ uint32_t device,
+ cy_an_usb_m_s_type_t type,
+ cy_an_function_callback cb,
+ uint32_t client
+ );
+#define cy_an_usb_select_m_s_partitions(h, media, dev, type, cb, client) \
+ cy_as_usb_select_m_s_partitions_dep((cy_as_device_handle)(h), \
+ (cy_as_media_type)(media), (dev), \
+ (cy_as_usb_m_s_type_t)(type), (cy_as_function_callback)(cb), (client))
+
+#include "cyas_cplus_end.h"
+#endif /*__doxygen__*/
+#endif /*_INCLUDED_CYANUSB_H_*/
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyas_cplus_end.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyas_cplus_end.h
new file mode 100644
index 0000000..ece44ca
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyas_cplus_end.h
@@ -0,0 +1,11 @@
+/*
+ * This file is included at the end of other include files.
+ * It basically turns off the C++ specific code words that
+ * insure this code is seen as C code even within
+ * a C++ compiler.
+ *
+ */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyas_cplus_start.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyas_cplus_start.h
new file mode 100644
index 0000000..b879cef
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyas_cplus_start.h
@@ -0,0 +1,11 @@
+/*
+ * This file is included after all other headers files, but before any other
+ * definitions in the file. It basically insures that the definitions within
+ * the file are seen as C defintions even when compiled by a C++ compiler.
+ */
+
+#ifdef __cplusplus
+
+extern "C" {
+
+#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyascast.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyascast.h
new file mode 100644
index 0000000..5f8c852
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyascast.h
@@ -0,0 +1,35 @@
+/* Cypress West Bridge API header file (cyascast.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASCAST_H_
+#define _INCLUDED_CYASCAST_H_
+
+#ifndef __doxygen__
+
+#ifdef _DEBUG
+#define cy_cast_int2U_int16(v) \
+ (cy_as_hal_assert(v < 65536), (uint16_t)(v))
+#else /* _DEBUG */
+#define cy_cast_int2U_int16(v) ((uint16_t)(v))
+#endif /* _DEBUG */
+
+#endif /* __doxygen__ */
+#endif /* _INCLUDED_CYASCAST_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h
new file mode 100644
index 0000000..0c0726b6
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h
@@ -0,0 +1,1057 @@
+/* Cypress West Bridge API header file (cyasdevice.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor
+##Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef __INCLUDED_CYASDEVICE_H__
+#define __INCLUDED_CYASDEVICE_H__
+
+#include "cyashal.h"
+#include "cyasprotocol.h"
+#include "cyasusb.h"
+#include "cyasstorage.h"
+#include "cyasmtp.h"
+#include "cyas_cplus_start.h"
+
+/***********************************
+ * West Bridge Constants
+ ***********************************/
+
+/* The endpoints used by West Bridge for the P port to S port path */
+#define CY_AS_P2S_WRITE_ENDPOINT (0x04)
+#define CY_AS_P2S_READ_ENDPOINT (0x08)
+
+/* The endpoint to use for firmware download */
+#define CY_AS_FIRMWARE_ENDPOINT (0x02)
+
+/* The maximum size of the firmware image West Bridge can accept */
+#define CY_AS_MAXIMUM_FIRMWARE_SIZE (24 * 1024)
+
+/* The maximum size of a write for EP0 and EP1 */
+#define CY_AS_EP0_MAX_WRITE_SIZE (128)
+#define CY_AS_EP1_MAX_WRITE_SIZE (64)
+
+/* The bitfields for the device state value */
+
+/* The device is in StandBy mode */
+#define CY_AS_DEVICE_STATE_PIN_STANDBY (0x00000001)
+/* The device has been configured */
+#define CY_AS_DEVICE_STATE_CONFIGURED (0x00000002)
+/* The firmware has been loaded into the device */
+#define CY_AS_DEVICE_STATE_FIRMWARE_LOADED (0x00000004)
+/* The interrupt module has been initialized */
+#define CY_AS_DEVICE_STATE_LOWLEVEL_MODULE (0x00000008)
+/* The DMA module has been initialized */
+#define CY_AS_DEVICE_STATE_DMA_MODULE (0x00000010)
+/* The interrupt module has been initialized */
+#define CY_AS_DEVICE_STATE_INTR_MODULE (0x00000020)
+/* The storage module has been initialized */
+#define CY_AS_DEVICE_STATE_STORAGE_MODULE (0x00000040)
+/* The USB module has been initialized */
+#define CY_AS_DEVICE_STATE_USB_MODULE (0x00000080)
+/* If set, the API wants SCSI messages */
+#define CY_AS_DEVICE_STATE_STORAGE_SCSIMSG (0x00000100)
+/* If set, an ASYNC storage operation is pending */
+#define CY_AS_DEVICE_STATE_STORAGE_ASYNC_PENDING (0x00000200)
+/* If set, the USB port is connected */
+#define CY_AS_DEVICE_STATE_USB_CONNECTED (0x00000400)
+/* If set and USB is connected, it is high speed */
+#define CY_AS_DEVICE_STATE_USB_HIGHSPEED (0x00000800)
+/* If set, we are in a callback */
+#define CY_AS_DEVICE_STATE_IN_CALLBACK (0x00001000)
+/* If set, we are processing a setup packet */
+#define CY_AS_DEVICE_STATE_IN_SETUP_PACKET (0x00004000)
+/* The device was placed in standby via register */
+#define CY_AS_DEVICE_STATE_REGISTER_STANDBY (0x00008000)
+/* If set, the device is using a crystal */
+#define CY_AS_DEVICE_STATE_CRYSTAL (0x00010000)
+/* If set, wakeup has been called */
+#define CY_AS_DEVICE_STATE_WAKING (0x00020000)
+/* If set, EP0 has been stalled. */
+#define CY_AS_DEVICE_STATE_EP0_STALLED (0x00040000)
+/* If set, device is in suspend mode. */
+#define CY_AS_DEVICE_STATE_SUSPEND (0x00080000)
+/* If set, device is a reset is pending. */
+#define CY_AS_DEVICE_STATE_RESETP (0x00100000)
+/* If set, device is a standby is pending. */
+#define CY_AS_DEVICE_STATE_STANDP (0x00200000)
+/* If set, device has a storage start or stop pending. */
+#define CY_AS_DEVICE_STATE_SSSP (0x00400000)
+/* If set, device has a usb start or stop pending. */
+#define CY_AS_DEVICE_STATE_USSP (0x00800000)
+/* If set, device has a mtp start or stop pending. */
+#define CY_AS_DEVICE_STATE_MSSP (0x01000000)
+/* If set, P2S DMA transfer can be started. */
+#define CY_AS_DEVICE_STATE_P2SDMA_START (0x02000000)
+
+/* The bitfields for the endpoint state value */
+/* DMA requests are accepted into the queue */
+#define CY_AS_DMA_ENDPOINT_STATE_ENABLED (0x0001)
+/* The endpoint has a sleeping client, waiting on a queue drain */
+#define CY_AS_DMA_ENDPOINT_STATE_SLEEPING (0x0002)
+/* The DMA backend to hardware is running */
+#define CY_AS_DMA_ENDPOINT_STATE_DMA_RUNNING (0x0004)
+/* There is an outstanding DMA entry deployed to the HAL */
+#define CY_AS_DMA_ENDPOINT_STATE_IN_TRANSIT (0x0008)
+/* 0 = OUT (West Bridge -> P Port), 1 = IN (P Port -> West Bridge) */
+#define CY_AS_DMA_ENDPOINT_STATE_DIRECTION (0x0010)
+
+/* The state values for the request list */
+/* Mask for getting the state information */
+#define CY_AS_REQUEST_LIST_STATE_MASK (0x0f)
+/* The request is queued, nothing further */
+#define CY_AS_REQUEST_LIST_STATE_QUEUED (0x00)
+/* The request is sent, waiting for response */
+#define CY_AS_REQUEST_LIST_STATE_WAITING (0x01)
+/* The response has been received, processing reponse */
+#define CY_AS_REQUEST_LIST_STATE_RECEIVED (0x02)
+/* The request/response is being canceled */
+#define CY_AS_REQUEST_LIST_STATE_CANCELING (0x03)
+/* The request is synchronous */
+#define CY_AS_REQUEST_LIST_STATE_SYNC (0x80)
+
+/* The flag values for a LL RequestResponse */
+/* This request requires an ACK to be sent after it is completed */
+#define CY_AS_REQUEST_RESPONSE_DELAY_ACK (0x01)
+/* This request originated from a version V1.1 function call */
+#define CY_AS_REQUEST_RESPONSE_EX (0x02)
+/* This request originated from a version V1.2 function call */
+#define CY_AS_REQUEST_RESPONSE_MS (0x04)
+
+
+#define CY_AS_DEVICE_HANDLE_SIGNATURE (0x01211219)
+
+/*
+ * This macro returns the endpoint pointer given the
+ * device pointer and an endpoint number
+ */
+#define CY_AS_NUM_EP(dev_p, num) ((dev_p)->endp[(num)])
+
+/****************************************
+ * West Bridge Data Structures
+ ****************************************/
+
+typedef struct cy_as_device cy_as_device;
+
+/* Summary
+ This type defines a callback function that will be called
+ on completion of a DMA operation.
+
+ Description
+ This function definition is for a function that is called when
+ the DMA operation is complete. This function is called with the
+ endpoint number, operation type, buffer pointer and size.
+
+ See Also
+ * CyAsDmaOper
+ * CyAsDmaQueueWrite
+ */
+typedef void (*cy_as_dma_callback)(
+ /* The device that completed DMA */
+ cy_as_device *dev_p,
+ /* The endpoint that completed DMA */
+ cy_as_end_point_number_t ep,
+ /* The pointer to the buffer that completed DMA */
+ void *mem_p,
+ /* The amount of data transferred */
+ uint32_t size,
+ /* The error code for this DMA xfer */
+ cy_as_return_status_t error
+ );
+
+/* Summary
+ This structure defines a DMA request that is queued
+
+ Description
+ This structure contains the information about a DMA
+ request that is queued and is to be sent when possible.
+*/
+typedef struct cy_as_dma_queue_entry {
+ /* Pointer to memory buffer for this request */
+ void *buf_p;
+ /* Size of the memory buffer for DMA operation */
+ uint32_t size;
+ /* Offset into memory buffer for next DMA operation */
+ uint32_t offset;
+ /* If TRUE and IN request */
+ cy_bool packet;
+ /* If TRUE, this is a read request */
+ cy_bool readreq;
+ /* Callback function for when DMA is complete */
+ cy_as_dma_callback cb;
+ /* Pointer to next entry in queue */
+ struct cy_as_dma_queue_entry *next_p;
+} cy_as_dma_queue_entry;
+
+/* Summary
+ This structure defines the endpoint data for a given
+
+ Description
+ This structure defines all of the information required
+ to manage DMA for a given endpoint.
+*/
+typedef struct cy_as_dma_end_point {
+ /* The endpoint number */
+ cy_as_end_point_number_t ep;
+ /* The state of this endpoint */
+ uint8_t state;
+ /* The maximum amount of data accepted in a packet by the hw */
+ uint16_t maxhwdata;
+ /* The maximum amount of data accepted by the HAL layer */
+ uint32_t maxhaldata;
+ /* The queue for DMA operations */
+ cy_as_dma_queue_entry *queue_p;
+ /* The last entry in the DMA queue */
+ cy_as_dma_queue_entry *last_p;
+ /* This sleep channel is used to wait while the DMA queue
+ * drains for a given endpoint */
+ cy_as_hal_sleep_channel channel;
+} cy_as_dma_end_point;
+
+#define cy_as_end_point_number_is_usb(n) \
+ ((n) != 2 && (n) != 4 && (n) != 6 && (n) != 8)
+#define cy_as_end_point_number_is_storage(n) \
+ ((n) == 2 || (n) == 4 || (n) == 6 || (n) == 8)
+
+#define cy_as_dma_end_point_is_enabled(ep) \
+ ((ep)->state & CY_AS_DMA_ENDPOINT_STATE_ENABLED)
+#define cy_as_dma_end_point_enable(ep) \
+ ((ep)->state |= CY_AS_DMA_ENDPOINT_STATE_ENABLED)
+#define cy_as_dma_end_point_disable(ep) \
+ ((ep)->state &= ~CY_AS_DMA_ENDPOINT_STATE_ENABLED)
+
+#define cy_as_dma_end_point_is_sleeping(ep) \
+ ((ep)->state & CY_AS_DMA_ENDPOINT_STATE_SLEEPING)
+#define cy_as_dma_end_point_set_sleep_state(ep) \
+ ((ep)->state |= CY_AS_DMA_ENDPOINT_STATE_SLEEPING)
+#define cy_as_dma_end_point_set_wake_state(ep) \
+ ((ep)->state &= ~CY_AS_DMA_ENDPOINT_STATE_SLEEPING)
+
+#define cy_as_dma_end_point_is_running(ep) \
+ ((ep)->state & CY_AS_DMA_ENDPOINT_STATE_DMA_RUNNING)
+#define cy_as_dma_end_point_set_running(ep) \
+ ((ep)->state |= CY_AS_DMA_ENDPOINT_STATE_DMA_RUNNING)
+#define cy_as_dma_end_point_set_stopped(ep) \
+ ((ep)->state &= ~CY_AS_DMA_ENDPOINT_STATE_DMA_RUNNING)
+
+#define cy_as_dma_end_point_in_transit(ep) \
+ ((ep)->state & CY_AS_DMA_ENDPOINT_STATE_IN_TRANSIT)
+#define cy_as_dma_end_point_set_in_transit(ep) \
+ ((ep)->state |= CY_AS_DMA_ENDPOINT_STATE_IN_TRANSIT)
+#define cy_as_dma_end_point_clear_in_transit(ep) \
+ ((ep)->state &= ~CY_AS_DMA_ENDPOINT_STATE_IN_TRANSIT)
+
+#define cy_as_dma_end_point_is_direction_in(ep) \
+ (((ep)->state & CY_AS_DMA_ENDPOINT_STATE_DIRECTION) == \
+ CY_AS_DMA_ENDPOINT_STATE_DIRECTION)
+#define cy_as_dma_end_point_is_direction_out(ep) \
+ (((ep)->state & CY_AS_DMA_ENDPOINT_STATE_DIRECTION) == 0)
+#define cy_as_dma_end_point_set_direction_in(ep) \
+ ((ep)->state |= CY_AS_DMA_ENDPOINT_STATE_DIRECTION)
+#define cy_as_dma_end_point_set_direction_out(ep) \
+ ((ep)->state &= ~CY_AS_DMA_ENDPOINT_STATE_DIRECTION)
+
+#define cy_as_dma_end_point_is_usb(p) \
+ cy_as_end_point_number_is_usb((p)->ep)
+#define cy_as_dma_end_point_is_storage(p) \
+ cy_as_end_point_number_is_storage((p)->ep)
+
+typedef struct cy_as_ll_request_response {
+ /* The mbox[0] contents - see low level comm section of API doc */
+ uint16_t box0;
+ /* The amount of data stored in this request/response in bytes */
+ uint16_t stored;
+ /* Length of this request in words */
+ uint16_t length;
+ /* Additional status information about the request */
+ uint16_t flags;
+ /* Note: This is over indexed and contains the request/response data */
+ uint16_t data[1];
+} cy_as_ll_request_response;
+
+/*
+ * The callback function for responses
+ */
+typedef void (*cy_as_response_callback)(
+ /* The device that had the response */
+ cy_as_device *dev_p,
+ /* The context receiving a response */
+ uint8_t context,
+ /* The request data */
+ cy_as_ll_request_response *rqt,
+ /* The response data */
+ cy_as_ll_request_response *resp,
+ /* The status of the request */
+ cy_as_return_status_t status
+ );
+
+typedef struct cy_as_ll_request_list_node {
+ /* The request to send */
+ cy_as_ll_request_response *rqt;
+ /* The associated response for the request */
+ cy_as_ll_request_response *resp;
+ /* Length of the response */
+ uint16_t length;
+ /* The callback to call when done */
+ cy_as_response_callback callback;
+ /* The state of the request */
+ uint8_t state;
+ /* The next request in the list */
+ struct cy_as_ll_request_list_node *next;
+} cy_as_ll_request_list_node;
+
+#define cy_as_request_get_node_state(node_p) \
+ ((node_p)->state & CY_AS_REQUEST_LIST_STATE_MASK)
+#define cy_as_request_set_node_state(node_p, st) \
+ ((node_p)->state = \
+ ((node_p)->state & ~CY_AS_REQUEST_LIST_STATE_MASK) | (st))
+
+#define cy_as_request_node_is_sync(node_p) \
+ ((node_p)->state & CY_AS_REQUEST_LIST_STATE_SYNC)
+#define cy_as_request_node_set_sync(node_p) \
+ ((node_p)->state |= CY_AS_REQUEST_LIST_STATE_SYNC)
+#define cy_as_request_node_clear_sync(node_p) \
+ ((node_p)->state &= ~CY_AS_REQUEST_LIST_STATE_SYNC)
+
+#ifndef __doxygen__
+typedef enum cy_as_c_b_node_type {
+ CYAS_INVALID,
+ CYAS_USB_FUNC_CB,
+ CYAS_USB_IO_CB,
+ CYAS_STORAGE_IO_CB,
+ CYAS_FUNC_CB
+} cy_as_c_b_node_type;
+
+typedef struct cy_as_func_c_b_node {
+ cy_as_c_b_node_type node_type;
+ cy_as_function_callback cb_p;
+ uint32_t client_data;
+ cy_as_funct_c_b_type data_type;
+ void *data;
+ struct cy_as_func_c_b_node *next_p;
+} cy_as_func_c_b_node;
+
+extern cy_as_func_c_b_node*
+cy_as_create_func_c_b_node_data(cy_as_function_callback
+ cb, uint32_t client, cy_as_funct_c_b_type type, void *data);
+
+extern cy_as_func_c_b_node*
+cy_as_create_func_c_b_node(cy_as_function_callback cb,
+ uint32_t client);
+
+extern void
+cy_as_destroy_func_c_b_node(cy_as_func_c_b_node *node);
+
+typedef struct cy_as_mtp_func_c_b_node {
+ cy_as_c_b_node_type type;
+ cy_as_mtp_function_callback cb_p;
+ uint32_t client_data;
+ struct cy_as_mtp_func_c_b_node *next_p;
+} cy_as_mtp_func_c_b_node;
+
+extern cy_as_mtp_func_c_b_node*
+cy_as_create_mtp_func_c_b_node(cy_as_mtp_function_callback cb,
+ uint32_t client);
+
+extern void
+cy_as_destroy_mtp_func_c_b_node(cy_as_mtp_func_c_b_node *node);
+
+typedef struct cy_as_usb_func_c_b_node {
+ cy_as_c_b_node_type type;
+ cy_as_usb_function_callback cb_p;
+ uint32_t client_data;
+ struct cy_as_usb_func_c_b_node *next_p;
+} cy_as_usb_func_c_b_node;
+
+extern cy_as_usb_func_c_b_node*
+cy_as_create_usb_func_c_b_node(cy_as_usb_function_callback cb,
+ uint32_t client);
+
+extern void
+cy_as_destroy_usb_func_c_b_node(cy_as_usb_func_c_b_node *node);
+
+typedef struct cy_as_usb_io_c_b_node {
+ cy_as_c_b_node_type type;
+ cy_as_usb_io_callback cb_p;
+ struct cy_as_usb_io_c_b_node *next_p;
+} cy_as_usb_io_c_b_node;
+
+extern cy_as_usb_io_c_b_node*
+cy_as_create_usb_io_c_b_node(cy_as_usb_io_callback cb);
+
+extern void
+cy_as_destroy_usb_io_c_b_node(cy_as_usb_io_c_b_node *node);
+
+typedef struct cy_as_storage_io_c_b_node {
+ cy_as_c_b_node_type type;
+ cy_as_storage_callback cb_p;
+ /* The media for the currently outstanding async storage request */
+ cy_as_media_type media;
+ /* The device index for the currently outstanding async storage
+ * request */
+ uint32_t device_index;
+ /* The unit index for the currently outstanding async storage
+ * request */
+ uint32_t unit;
+ /* The block address for the currently outstanding async storage
+ * request */
+ uint32_t block_addr;
+ /* The operation for the currently outstanding async storage
+ * request */
+ cy_as_oper_type oper;
+ cy_as_ll_request_response *req_p;
+ cy_as_ll_request_response *reply_p;
+ struct cy_as_storage_io_c_b_node *next_p;
+} cy_as_storage_io_c_b_node;
+
+extern cy_as_storage_io_c_b_node*
+cy_as_create_storage_io_c_b_node(cy_as_storage_callback cb,
+ cy_as_media_type media, uint32_t device_index,
+ uint32_t unit, uint32_t block_addr, cy_as_oper_type oper,
+ cy_as_ll_request_response *req_p,
+ cy_as_ll_request_response *reply_p);
+
+extern void
+cy_as_destroy_storage_io_c_b_node(cy_as_storage_io_c_b_node *node);
+
+typedef struct cy_as_c_b_queue {
+ void *head_p;
+ void *tail_p;
+ uint32_t count;
+ cy_as_c_b_node_type type;
+} cy_as_c_b_queue;
+
+extern cy_as_c_b_queue *
+cy_as_create_c_b_queue(cy_as_c_b_node_type type);
+
+extern void
+cy_as_destroy_c_b_queue(cy_as_c_b_queue *queue);
+
+/* Allocates a new CyAsCBNode */
+extern void
+cy_as_insert_c_b_node(cy_as_c_b_queue *queue_p, void *cbnode);
+
+/* Removes the first CyAsCBNode from the queue and frees it */
+extern void
+cy_as_remove_c_b_node(cy_as_c_b_queue *queue_p);
+
+/* Remove the last CyAsCBNode from the queue and frees it */
+extern void
+cy_as_remove_c_b_tail_node(cy_as_c_b_queue *queue_p);
+
+/* Removes and frees all pending callbacks */
+extern void
+cy_as_clear_c_b_queue(cy_as_c_b_queue *queue_p);
+
+extern cy_as_return_status_t
+cy_as_misc_send_request(cy_as_device *dev_p,
+ cy_as_function_callback cb,
+ uint32_t client,
+ cy_as_funct_c_b_type type,
+ void *data,
+ cy_as_c_b_queue *queue,
+ uint16_t req_type,
+ cy_as_ll_request_response *req_p,
+ cy_as_ll_request_response *reply_p,
+ cy_as_response_callback rcb);
+
+extern void
+cy_as_misc_cancel_ex_requests(cy_as_device *dev_p);
+
+/* Summary
+ Free all memory allocated by and zero all
+ structures initialized by CyAsUsbStart.
+ */
+extern void
+cy_as_usb_cleanup(
+ cy_as_device *dev_p);
+
+/* Summary
+ Free all memory allocated and zero all structures initialized
+ by CyAsStorageStart.
+ */
+extern void
+cy_as_storage_cleanup(
+ cy_as_device *dev_p);
+#endif
+
+/* Summary
+ This structure defines the data structure to support a
+ given command context
+
+ Description
+ All commands send to the West Bridge device via the mailbox
+ registers are sent via a context.Each context is independent
+ and there can be a parallel stream of requests and responses on
+ each context. This structure is used to manage a single context.
+*/
+typedef struct cy_as_context {
+ /* The context number for this context */
+ uint8_t number;
+ /* This sleep channel is used to sleep while waiting on a
+ * response from the west bridge device for a request. */
+ cy_as_hal_sleep_channel channel;
+ /* The buffer for received requests */
+ cy_as_ll_request_response *req_p;
+ /* The length of the request being received */
+ uint16_t request_length;
+ /* The callback for the next request received */
+ cy_as_response_callback request_callback;
+ /* A list of low level requests to go to the firmware */
+ cy_as_ll_request_list_node *request_queue_p;
+ /* The list node in the request queue */
+ cy_as_ll_request_list_node *last_node_p;
+ /* Index upto which data is stored. */
+ uint16_t queue_index;
+ /* Index to the next request in the queue. */
+ uint16_t rqt_index;
+ /* Queue of data stored */
+ uint16_t data_queue[128];
+
+} cy_as_context;
+
+#define cy_as_context_is_waiting(ctxt) \
+ ((ctxt)->state & CY_AS_CTXT_STATE_WAITING_RESPONSE)
+#define cy_as_context_set_waiting(ctxt) \
+ ((ctxt)->state |= CY_AS_CTXT_STATE_WAITING_RESPONSE)
+#define cy_as_context_clear_waiting(ctxt) \
+ ((ctxt)->state &= ~CY_AS_CTXT_STATE_WAITING_RESPONSE)
+
+
+
+/* Summary
+ This data structure stores SDIO function
+ parameters for a SDIO card
+
+ Description
+*/
+typedef struct cy_as_sdio_device {
+ /* Keeps track of IO functions initialized*/
+ uint8_t function_init_map;
+ uint8_t function_suspended_map;
+ /* Function 0 (Card Common) properties*/
+ cy_as_sdio_card card;
+ /* Function 1-7 (Mapped to array element 0-6) properties.*/
+ cy_as_sdio_func function[7];
+
+} cy_as_sdio_device;
+
+/* Summary
+Macros to access the SDIO card properties
+*/
+
+#define cy_as_sdio_get_function_code(handle, bus, i) \
+ (((cy_as_device *)handle)->sdiocard[bus].function[i-1].function_code)
+
+#define cy_as_sdio_get_function_ext_code(handle, bus, i) \
+ (((cy_as_device *)handle)->sdiocard[bus].\
+ function[i-1].extended_func_code)
+
+#define cy_as_sdio_get_function_p_s_n(handle, bus, i) \
+ (((cy_as_device *)handle)->sdiocard[bus].function[i-1].card_psn)
+
+#define cy_as_sdio_get_function_blocksize(handle, bus, i) \
+ (((cy_as_device *)handle)->sdiocard[bus].function[i-1].blocksize)
+
+#define cy_as_sdio_get_function_max_blocksize(handle, bus, i) \
+ (((cy_as_device *)handle)->sdiocard[bus].function[i-1].maxblocksize)
+
+#define cy_as_sdio_get_function_csa_support(handle, bus, i) \
+ (((cy_as_device *)handle)->sdiocard[bus].function[i-1].csa_bits)
+
+#define cy_as_sdio_get_function_wakeup_support(handle, bus, i) \
+ (((cy_as_device *)handle)->sdiocard[bus].function[i-1]. wakeup_support)
+
+#define cy_as_sdio_set_function_block_size(handle, bus, i, blocksize) \
+ (((cy_as_device *)handle)->sdiocard[bus].function[i-1].blocksize = \
+ blocksize)
+
+#define cy_as_sdio_get_card_num_functions(handle, bus) \
+ (((cy_as_device *)handle)->sdiocard[bus].card.num_functions)
+
+#define cy_as_sdio_get_card_mem_present(handle, bus) \
+ (((cy_as_device *)handle)->sdiocard[bus].card.memory_present)
+
+#define cy_as_sdio_get_card_manf_id(handle, bus) \
+ (((cy_as_device *)handle)->sdiocard[bus].card.manufacturer__id)
+
+#define cy_as_sdio_get_card_manf_info(handle, bus) \
+ (((cy_as_device *)handle)->sdiocard[bus].card.manufacturer_info)
+
+#define cy_as_sdio_get_card_blocksize(handle, bus) \
+ (((cy_as_device *)handle)->sdiocard[bus].card.blocksize)
+
+#define cy_as_sdio_get_card_max_blocksize(handle, bus) \
+ (((cy_as_device *)handle)->sdiocard[bus].card.maxblocksize)
+
+#define cy_as_sdio_get_card_sdio_version(handle, bus) \
+ (((cy_as_device *)handle)->sdiocard[bus].card.sdio_version)
+
+#define cy_as_sdio_get_card_capability(handle, bus) \
+ (((cy_as_device *)handle)->sdiocard[bus].card.card_capability)
+
+#define cy_as_sdio_get_function_init_map(handle, bus) \
+ (((cy_as_device *)handle)->sdiocard[bus].function_init_map)
+
+#define cy_as_sdio_check_function_initialized(handle, bus, i) \
+ (((cy_as_sdio_get_function_init_map(handle, bus)) & (0x01<<i)) ? 1 : 0)
+
+#define cy_as_sdio_set_card_block_size(handle, bus, blocksize) \
+ (((cy_as_device *)handle)->sdiocard[bus].card.blocksize = blocksize)
+
+#define cy_as_sdio_check_support_bus_suspend(handle, bus) \
+ ((cy_as_sdio_get_card_capability(handle, bus) & CY_SDIO_SBS) ? 1 : 0)
+
+#define cy_as_sdio_check_function_suspended(handle, bus, i) \
+ ((((cy_as_device *)handle)->sdiocard[bus].function_suspended_map & \
+ (0x01<<i)) ? 1 : 0)
+
+#define cy_as_sdio_set_function_suspended(handle, bus, i) \
+ ((((cy_as_device *)handle)->sdiocard[bus].function_suspended_map) \
+ |= (0x01<<i))
+
+#define cy_as_sdio_clear_function_suspended(handle, bus, i) \
+ ((((cy_as_device *)handle)->sdiocard[bus].function_suspended_map) \
+ &= (~(0x01<<i)))
+
+/* Summary
+ This data structure represents a single device.
+
+ Description
+*/
+struct cy_as_device {
+ /* General stuff */
+ /* A signature to insure we have a valid handle */
+ uint32_t sig;
+ /* The ID of the silicon */
+ uint16_t silicon_id;
+ /* Pointer to the next device */
+ struct cy_as_device *next_p;
+ /* This is the client specific tag for this device */
+ cy_as_hal_device_tag tag;
+ /* This contains various state information about the device */
+ uint32_t state;
+ /* Flag indicating whether INT# pin is used for DRQ */
+ cy_bool use_int_drq;
+
+ /* DMA related */
+ /* The endpoint pointers associated with this device */
+ cy_as_dma_end_point *endp[16];
+ /* List of queue entries that can be used for xfers */
+ cy_as_dma_queue_entry *dma_freelist_p;
+
+ /* Low level comm related */
+ /* The contexts available in this device */
+ cy_as_context *context[CY_RQT_CONTEXT_COUNT];
+ /* The low level error returned from sending an async request */
+ cy_as_return_status_t ll_error;
+ /* A request is currently being sent to West Bridge. */
+ cy_bool ll_sending_rqt;
+ /* The current mailbox request should be aborted. */
+ cy_bool ll_abort_curr_rqt;
+ /* Indicates that the LL layer has queued mailbox data. */
+ cy_bool ll_queued_data;
+
+ /* MISC API related */
+ /* Misc callback */
+ cy_as_misc_event_callback misc_event_cb;
+
+ /* Storage Related */
+ /* The reference count for the Storage API */
+ uint32_t storage_count;
+ /* Callback for storage events */
+ cy_as_storage_event_callback_dep storage_event_cb;
+ /* V1.2+ callback for storage events */
+ cy_as_storage_event_callback storage_event_cb_ms;
+ /* The error for a sleeping storage operation */
+ cy_as_return_status_t storage_error;
+ /* Flag indicating that the storage stack is waiting for an operation */
+ cy_bool storage_wait;
+ /* Request used for storage read/writes. */
+ cy_as_ll_request_response *storage_rw_req_p;
+ /* Response used for storage read/writes. */
+ cy_as_ll_request_response *storage_rw_resp_p;
+ /* The storage callback */
+ cy_as_storage_callback_dep storage_cb;
+ /* The V1.2+ storage callback */
+ cy_as_storage_callback storage_cb_ms;
+ /* The bus index for the currently outstanding async storage request */
+ cy_as_bus_number_t storage_bus_index;
+ /* The device index for the currently outstanding async storage
+ * request */
+ uint32_t storage_device_index;
+ /* The unit index for the currently outstanding async storage request */
+ uint32_t storage_unit;
+ /* The block address for the currently outstanding async storage
+ * request */
+ uint32_t storage_block_addr;
+ /* The operation for the currently outstanding async storage request */
+ cy_as_oper_type storage_oper;
+ /* The endpoint used to read Storage data */
+ cy_as_end_point_number_t storage_read_endpoint;
+ /* The endpoint used to write endpoint data */
+ cy_as_end_point_number_t storage_write_endpoint;
+ cy_as_device_desc storage_device_info
+ [CY_AS_MAX_BUSES][CY_AS_MAX_STORAGE_DEVICES];
+ /* The information on each device on each bus */
+
+ /* USB Related */
+ /* This conatins the endpoint async state */
+ uint16_t epasync;
+ /* The reference count for the USB API */
+ uint32_t usb_count;
+ /* The physical endpoint configuration */
+ uint8_t usb_phy_config;
+ /* The callbacks for async func calls */
+ cy_as_c_b_queue *usb_func_cbs;
+ /* Endpoint configuration information */
+ cy_as_usb_end_point_config usb_config[16];
+ /* The USB callback */
+ cy_as_usb_event_callback_dep usb_event_cb;
+ /* The V1.2+ USB callback */
+ cy_as_usb_event_callback usb_event_cb_ms;
+ /* The error for a sleeping usb operation */
+ cy_as_return_status_t usb_error;
+ /* The USB callback for a pending storage operation */
+ cy_as_usb_io_callback usb_cb[16];
+ /* The buffer pending from a USB operation */
+ void *usb_pending_buffer;
+ /* The size of the buffer pending from a USB operation */
+ uint32_t usb_pending_size;
+ /* If true, send a short packet */
+ cy_bool usb_spacket[16];
+ /* The amount of data actually xferred */
+ uint32_t usb_actual_cnt;
+ /* EP1OUT and EP1IN config register contents */
+ uint8_t usb_ep1cfg[2];
+ /* LEP config register contents */
+ uint16_t usb_lepcfg[10];
+ /* PEP config register contents */
+ uint16_t usb_pepcfg[4];
+ /* Buffer for EP0 and EP1 data sent via mailboxes */
+ uint8_t *usb_ep_data;
+ /* Used to track how many ack requests are pending */
+ uint32_t usb_delay_ack_count;
+ /* Maximum transfer size for USB endpoints. */
+ uint32_t usb_max_tx_size;
+
+ /* Request for sending EP0 data to West Bridge */
+ cy_as_ll_request_response *usb_ep0_dma_req;
+ /* Response for EP0 data sent to West Bridge */
+ cy_as_ll_request_response *usb_ep0_dma_resp;
+ /* Request for sending EP1 data to West Bridge */
+ cy_as_ll_request_response *usb_ep1_dma_req;
+ /* Response for EP1 data sent to West Bridge */
+ cy_as_ll_request_response *usb_ep1_dma_resp;
+
+ cy_as_ll_request_response *usb_ep0_dma_req_save;
+ cy_as_ll_request_response *usb_ep0_dma_resp_save;
+
+ /* MTP Related */
+ /* The reference count for the MTP API */
+ uint32_t mtp_count;
+ /* The MTP event callback supplied by the client */
+ cy_as_mtp_event_callback mtp_event_cb;
+ /* The current block table to be transfered */
+ cy_as_mtp_block_table *tp_blk_tbl;
+
+ cy_as_c_b_queue *func_cbs_mtp;
+ cy_as_c_b_queue *func_cbs_usb;
+ cy_as_c_b_queue *func_cbs_stor;
+ cy_as_c_b_queue *func_cbs_misc;
+ cy_as_c_b_queue *func_cbs_res;
+
+ /* The last USB event that was received */
+ cy_as_usb_event usb_last_event;
+ /* Types of storage media supported by the firmware */
+ uint8_t media_supported[CY_AS_MAX_BUSES];
+
+ /* SDIO card parameters*/
+ cy_as_sdio_device sdiocard[CY_AS_MAX_BUSES];
+ /* if true, MTP enabled Firmware. */
+ cy_bool is_mtp_firmware;
+ /* if true, mailbox message has come already */
+ cy_bool is_mtp_data_pending;
+ /* True between the time an Init was called and
+ * the complete event is generated */
+ cy_bool mtp_turbo_active;
+ /* mbox reported EP 2 data len */
+ uint16_t mtp_data_len;
+ /* The error for mtp EP4 write operation */
+ cy_as_return_status_t mtp_error;
+ /* mtp send/get operation callback */
+ cy_as_function_callback mtp_cb;
+ /* mtp send/get operation client id */
+ uint32_t mtp_client;
+ /* mtp operation type. To be used in callback */
+ cy_as_funct_c_b_type mtp_op;
+
+ /* Firmware is running in P2S only mode. */
+ cy_bool is_storage_only_mode;
+ /* Interrupt mask value during device standby. */
+ uint32_t stby_int_mask;
+};
+
+#define cy_as_device_is_configured(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_CONFIGURED)
+#define cy_as_device_set_configured(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_CONFIGURED)
+#define cy_as_device_set_unconfigured(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_CONFIGURED)
+
+#define cy_as_device_is_dma_running(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_DMA_MODULE)
+#define cy_as_device_set_dma_running(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_DMA_MODULE)
+#define cy_as_device_set_dma_stopped(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_DMA_MODULE)
+
+#define cy_as_device_is_low_level_running(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_LOWLEVEL_MODULE)
+#define cy_as_device_set_low_level_running(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_LOWLEVEL_MODULE)
+#define cy_as_device_set_low_level_stopped(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_LOWLEVEL_MODULE)
+
+#define cy_as_device_is_intr_running(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_INTR_MODULE)
+#define cy_as_device_set_intr_running(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_INTR_MODULE)
+#define cy_as_device_set_intr_stopped(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_INTR_MODULE)
+
+#define cy_as_device_is_firmware_loaded(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_FIRMWARE_LOADED)
+#define cy_as_device_set_firmware_loaded(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_FIRMWARE_LOADED)
+#define cy_as_device_set_firmware_not_loaded(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_FIRMWARE_LOADED)
+
+#define cy_as_device_is_storage_running(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_STORAGE_MODULE)
+#define cy_as_device_set_storage_running(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_STORAGE_MODULE)
+#define cy_as_device_set_storage_stopped(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_STORAGE_MODULE)
+
+#define cy_as_device_is_usb_running(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_USB_MODULE)
+#define cy_as_device_set_usb_running(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_USB_MODULE)
+#define cy_as_device_set_usb_stopped(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_USB_MODULE)
+
+#define cy_as_device_wants_scsi_messages(dp) \
+ (((dp)->state & CY_AS_DEVICE_STATE_STORAGE_SCSIMSG) \
+ ? cy_true : cy_false)
+#define cy_as_device_set_scsi_messages(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_STORAGE_SCSIMSG)
+#define cy_as_device_clear_scsi_messages(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_STORAGE_SCSIMSG)
+
+#define cy_as_device_is_storage_async_pending(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_STORAGE_ASYNC_PENDING)
+#define cy_as_device_set_storage_async_pending(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_STORAGE_ASYNC_PENDING)
+#define cy_as_device_clear_storage_async_pending(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_STORAGE_ASYNC_PENDING)
+
+#define cy_as_device_is_usb_connected(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_USB_CONNECTED)
+#define cy_as_device_set_usb_connected(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_USB_CONNECTED)
+#define cy_as_device_clear_usb_connected(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_USB_CONNECTED)
+
+#define cy_as_device_is_usb_high_speed(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_USB_HIGHSPEED)
+#define cy_as_device_set_usb_high_speed(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_USB_HIGHSPEED)
+#define cy_as_device_clear_usb_high_speed(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_USB_HIGHSPEED)
+
+#define cy_as_device_is_in_callback(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_IN_CALLBACK)
+#define cy_as_device_set_in_callback(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_IN_CALLBACK)
+#define cy_as_device_clear_in_callback(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_IN_CALLBACK)
+
+#define cy_as_device_is_setup_i_o_performed(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_SETUP_IO_PERFORMED)
+#define cy_as_device_set_setup_i_o_performed(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_SETUP_IO_PERFORMED)
+#define cy_as_device_clear_setup_i_o_performed(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_SETUP_IO_PERFORMED)
+
+#define cy_as_device_is_ack_delayed(dp) \
+ ((dp)->usb_delay_ack_count > 0)
+#define cy_as_device_set_ack_delayed(dp) \
+ ((dp)->usb_delay_ack_count++)
+#define cy_as_device_rem_ack_delayed(dp) \
+ ((dp)->usb_delay_ack_count--)
+#define cy_as_device_clear_ack_delayed(dp) \
+ ((dp)->usb_delay_ack_count = 0)
+
+#define cy_as_device_is_setup_packet(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_IN_SETUP_PACKET)
+#define cy_as_device_set_setup_packet(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_IN_SETUP_PACKET)
+#define cy_as_device_clear_setup_packet(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_IN_SETUP_PACKET)
+
+#define cy_as_device_is_ep0_stalled(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_EP0_STALLED)
+#define cy_as_device_set_ep0_stalled(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_EP0_STALLED)
+#define cy_as_device_clear_ep0_stalled(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_EP0_STALLED)
+
+#define cy_as_device_is_register_standby(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_REGISTER_STANDBY)
+#define cy_as_device_set_register_standby(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_REGISTER_STANDBY)
+#define cy_as_device_clear_register_standby(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_REGISTER_STANDBY)
+
+#define cy_as_device_is_pin_standby(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_PIN_STANDBY)
+#define cy_as_device_set_pin_standby(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_PIN_STANDBY)
+#define cy_as_device_clear_pin_standby(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_PIN_STANDBY)
+
+#define cy_as_device_is_crystal(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_CRYSTAL)
+#define cy_as_device_is_external_clock(dp) \
+ (!((dp)->state & CY_AS_DEVICE_STATE_CRYSTAL))
+#define cy_as_device_set_crystal(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_CRYSTAL)
+#define cy_as_device_set_external_clock(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_CRYSTAL)
+
+#define cy_as_device_is_waking(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_WAKING)
+#define cy_as_device_set_waking(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_WAKING)
+#define cy_as_device_clear_waking(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_WAKING)
+
+#define cy_as_device_is_in_suspend_mode(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_SUSPEND)
+#define cy_as_device_set_suspend_mode(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_SUSPEND)
+#define cy_as_device_clear_suspend_mode(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_SUSPEND)
+
+#define cy_as_device_is_reset_pending(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_RESETP)
+#define cy_as_device_set_reset_pending(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_RESETP)
+#define cy_as_device_clear_reset_pending(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_RESETP)
+
+#define cy_as_device_is_standby_pending(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_STANDP)
+#define cy_as_device_set_standby_pending(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_STANDP)
+#define cy_as_device_clear_standby_pending(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_STANDP)
+
+#define cy_as_device_is_s_s_s_pending(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_SSSP)
+#define cy_as_device_set_s_s_s_pending(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_SSSP)
+#define cy_as_device_clear_s_s_s_pending(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_SSSP)
+
+#define cy_as_device_is_u_s_s_pending(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_USSP)
+#define cy_as_device_set_u_s_s_pending(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_USSP)
+#define cy_as_device_clear_u_s_s_pending(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_USSP)
+
+#define cy_as_device_is_m_s_s_pending(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_MSSP)
+#define cy_as_device_set_m_s_s_pending(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_MSSP)
+#define cy_as_device_clear_m_s_s_pending(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_MSSP)
+
+#define cy_as_device_is_p2s_dma_start_recvd(dp) \
+ ((dp)->state & CY_AS_DEVICE_STATE_P2SDMA_START)
+#define cy_as_device_set_p2s_dma_start_recvd(dp) \
+ ((dp)->state |= CY_AS_DEVICE_STATE_P2SDMA_START)
+#define cy_as_device_clear_p2s_dma_start_recvd(dp) \
+ ((dp)->state &= ~CY_AS_DEVICE_STATE_P2SDMA_START)
+
+#define cy_as_device_is_usb_async_pending(dp, ep) \
+ ((dp)->epasync & (1 << ep))
+#define cy_as_device_set_usb_async_pending(dp, ep) \
+ ((dp)->epasync |= (1 << ep))
+#define cy_as_device_clear_usb_async_pending(dp, ep) \
+ ((dp)->epasync &= ~(1 << ep))
+
+#define cy_as_device_is_nand_storage_supported(dp) \
+ ((dp)->media_supported[0] & 1)
+
+/* Macros to check the type of West Bridge device. */
+#define cy_as_device_is_astoria_dev(dp) \
+ (((dp)->silicon_id == CY_AS_MEM_CM_WB_CFG_ID_HDID_ASTORIA_VALUE) || \
+ ((dp)->silicon_id == CY_AS_MEM_CM_WB_CFG_ID_HDID_ASTORIA_FPGA_VALUE))
+#define cy_as_device_is_antioch_dev(dp) \
+ ((dp)->silicon_id == CY_AS_MEM_CM_WB_CFG_ID_HDID_ANTIOCH_VALUE)
+
+#ifdef CY_AS_LOG_SUPPORT
+extern void cy_as_log_debug_message(int value, const char *msg);
+#else
+#define cy_as_log_debug_message(value, msg)
+#endif
+
+/* Summary
+ This function finds the device object given the HAL tag
+
+ Description
+ The user associats a device TAG with each West Bridge device
+ created. This tag is passed from the API functions to and HAL
+ functions that need to ID a specific West Bridge device. This
+ tag is also passed in from the user back into the API via
+ interrupt functions. This function allows the API to find the
+ device structure associated with a given tag.
+
+ Notes
+ This function does a simple linear search for the device based
+ on the TAG. This function is called each time an West Bridge
+ interrupt handler is called. Therefore this works fine for a
+ small number of West Bridge devices (e.g. less than five).
+ Anything more than this and this methodology will need to be
+ updated.
+
+ Returns
+ Pointer to a CyAsDevice associated with the tag
+*/
+extern cy_as_device *
+cy_as_device_find_from_tag(
+ cy_as_hal_device_tag tag
+ );
+
+#include "cyas_cplus_end.h"
+
+#endif /* __INCLUDED_CYASDEVICE_H__ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h
new file mode 100644
index 0000000..6efb8b8
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h
@@ -0,0 +1,375 @@
+/* Cypress West Bridge API header file (cyasdma.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASDMA_H_
+#define _INCLUDED_CYASDMA_H_
+
+#include "cyashal.h"
+#include "cyasdevice.h"
+
+#include "cyas_cplus_start.h"
+
+
+/*@@DMA Overview
+ This module manages the DMA operations to/from the West Bridge
+ device. The DMA module maintains a DMA queue for each endpoint
+ so multiple DMA requests may be queued and they will complete
+ at some future time.
+
+ The DMA module must be started before it can be used. It is
+ started by calling CyAsDmaStart(). This function intializes
+ all of the endpoint data structures.
+
+ In order to perform DMA on a particular endpoint, the endpoint
+ must be enabled by calling CyAsDmaEnableEndPoint(). In addition
+ to enabling or disabling the endpoint, this function also sets
+ the direction for a given endpoint. Direction is given in USB
+ terms. For P port to West Bridge traffic, the endpoint is a
+ CyAsDirectionIn endpoint. For West Bridge to P port traffic,
+ the endpoint is a CyAsDirectionOut endpoint.
+
+ Once DMA is started and an endpoint is enabled, DMA requests
+ are issued by calling CyAsDmaQueueRequest(). This function
+ queue either a DMA read or DMA write request. The callback
+ associated with the request is called once the request has been
+ fulfilled.
+
+ See Also
+ * CyAsDmaStart
+ * CyAsDmaEnableEndPoint
+ * CyAsDmaDirection
+ * CyAsDmaQueueRequest
+ */
+
+/************************
+ * West Bridge Constants
+ ************************/
+#define CY_AS_DMA_MAX_SIZE_HW_SIZE (0xffffffff)
+
+/************************
+ * West Bridge Data Structures
+ ************************/
+
+/* Summary
+ This type specifies the direction of an endpoint to the
+ CyAsDmaEnableEndPoint function.
+
+ Description
+ When an endpoint is enabled, the direction of the endpoint
+ can also be set. This type is used to specify the endpoint
+ type. Note that the direction is specified in USB terms.
+ Therefore, if the DMA is from the P port to West Bridge,
+ the direction is IN.
+
+ See Also
+ * CyAsDmaEnableEndPoint
+*/
+typedef enum cy_as_dma_direction {
+ /* Set the endpoint to type IN (P -> West Bridge) */
+ cy_as_direction_in = 0,
+ /* Set the endpoint to type OUT (West Bridge -> P) */
+ cy_as_direction_out = 1,
+ /* Only valid for EP 0 */
+ cy_as_direction_in_out = 2,
+ /* Do no change the endpoint type */
+ cy_as_direction_dont_change = 3
+} cy_as_dma_direction;
+
+/*********************************
+ * West Bridge Functions
+ *********************************/
+
+/* Summary
+ Initialize the DMA module and ready the module for receiving data
+
+ Description
+ This function initializes the DMA module by initializing all of
+ the endpoint data structures associated with the device given.
+ This function also register a DMA complete callback with the HAL
+ DMA code. This callback is called whenever the HAL DMA subsystem
+ completes a requested DMA operation.
+
+ Returns
+ CY_AS_ERROR_SUCCESS - the module initialized sucessfully
+ CY_AS_ERROR_OUT_OF_MEMORY - memory allocation failed during
+ initialization
+ CY_AS_ERROR_ALREADY_RUNNING - the DMA module was already running
+
+ See Also
+ * CyAsDmaStop
+*/
+extern cy_as_return_status_t
+cy_as_dma_start(
+ /* The device to start */
+ cy_as_device *dev_p
+ );
+
+/* Summary
+ Shutdown the DMA module
+
+ Description
+ This function shuts down the DMA module for this device by
+ canceling any DMA requests associated with each endpoint and
+ then freeing the resources associated with each DMA endpoint.
+
+ Returns
+ CY_AS_ERROR_SUCCESS - the module shutdown sucessfully
+ CY_AS_ERROR_NOT_RUNNING - the DMA module was not running
+
+ See Also
+ * CyAsDmaStart
+ * CyAsDmaCancel
+*/
+extern cy_as_return_status_t
+cy_as_dma_stop(
+ /* The device to stop */
+ cy_as_device *dev_p
+ );
+
+/* Summary
+ This function cancels all outstanding DMA requests on a given endpoint
+
+ Description
+ This function cancels any DMA requests outstanding on a given endpoint
+ by disabling the transfer of DMA requests from the queue to the HAL
+ layer and then removing any pending DMA requests from the queue. The
+ callback associated with any DMA requests that are being removed is
+ called with an error code of CY_AS_ERROR_CANCELED.
+
+ Notes
+ If a request has already been sent to the HAL layer it will be
+ completed and not canceled. Only requests that have not been sent to
+ the HAL layer will be cancelled.
+
+ Returns
+ CY_AS_ERROR_SUCCESS - the traffic on the endpoint is canceled
+ sucessfully
+
+ See Also
+*/
+extern cy_as_return_status_t
+cy_as_dma_cancel(
+ /* The device of interest */
+ cy_as_device *dev_p,
+ /* The endpoint to cancel */
+ cy_as_end_point_number_t ep,
+ cy_as_return_status_t err
+ );
+
+/* Summary
+ This function enables a single endpoint for DMA operations
+
+ Description
+ In order to enable the queuing of DMA requests on a given
+ endpoint, the endpoint must be enabled for DMA. This function
+ enables a given endpoint. In addition, this function sets the
+ direction of the DMA operation.
+
+ Returns
+ * CY_AS_ERROR_INVALID_ENDPOINT - invalid endpoint number
+ * CY_AS_ERROR_SUCCESS - endpoint was enabled or disabled
+ * successfully
+
+ See Also
+ * CyAsDmaQueueRequest
+*/
+extern cy_as_return_status_t
+cy_as_dma_enable_end_point(
+ /* The device of interest */
+ cy_as_device *dev_p,
+ /* The endpoint to enable or disable */
+ cy_as_end_point_number_t ep,
+ /* CyTrue to enable, CyFalse to disable */
+ cy_bool enable,
+ /* The direction of the endpoint */
+ cy_as_dma_direction dir
+);
+
+/* Summary
+ This function queue a DMA request for a given endpoint
+
+ Description
+ When an West Bridge API module wishes to do a DMA operation,
+ this function is called on the associated endpoint to queue
+ a DMA request. When the DMA request has been fulfilled, the
+ callback associated with the DMA operation is called.
+
+ Notes
+ The buffer associated with the DMA request, must remain valid
+ until after the callback function is calld.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the DMA operation was queued successfully
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint number was invalid
+ * CY_AS_ERROR_ENDPOINT_DISABLED - the endpoint was disabled
+ * CY_AS_ERROR_OUT_OF_MEMORY - out of memory processing the request
+
+ See Also
+ * CyAsDmaEnableEndPoint
+ * CyAsDmaCancel
+*/
+extern cy_as_return_status_t
+cy_as_dma_queue_request(
+ /* The device of interest */
+ cy_as_device *dev_p,
+ /* The endpoint to receive a new request */
+ cy_as_end_point_number_t ep,
+ /* The memory buffer for the DMA request -
+ * must be valid until after the callback has been called */
+ void *mem_p,
+ /* The size of the DMA request in bytes */
+ uint32_t size,
+ /* If true and a DMA read request, return the next packet
+ * regardless of size */
+ cy_bool packet,
+ /* If true, this is a read request,
+ * otherwise it is a write request */
+ cy_bool readreq,
+ /* The callback to call when the DMA request is complete,
+ * either successfully or via an error */
+ cy_as_dma_callback cb
+ );
+
+/* Summary
+ This function waits until all DMA requests on a given endpoint
+ have been processed and then return
+
+ Description
+ There are times when a module in the West Bridge API needs to
+ wait until the DMA operations have been queued. This function
+ sleeps until all DMA requests have been fulfilled and only then
+ returns to the caller.
+
+ Notes
+ I don't think we will need a list of sleeping clients to support
+ multiple parallel client modules sleeping on a single endpoint,
+ but if we do instead of having a single sleep channel in the
+ endpoint, each client will have to supply a sleep channel and we
+ will have to maintain a list of sleep channels to wake.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the queue has drained sucessfully
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given is not valid
+ * CY_AS_ERROR_NESTED_SLEEP - CyAsDmaQueueRequest() was requested
+ * on an endpoint where CyAsDmaQueueRequest was already called
+*/
+extern cy_as_return_status_t
+cy_as_dma_drain_queue(
+ /* The device of interest */
+ cy_as_device *dev_p,
+ /* The endpoint to drain */
+ cy_as_end_point_number_t ep,
+ /* If CyTrue, call kickstart to start the DMA process,
+ if cy_false, west bridge will start the DMA process */
+ cy_bool kickstart
+ );
+
+/* Summary
+ Sets the maximum amount of data West Bridge can accept in a single
+ DMA Operation for the given endpoint
+
+ Description
+ Depending on the configuration of the West Bridge device endpoint,
+ the amount of data that can be accepted varies. This function
+ sets the maximum amount of data West Bridge can accept in a single
+ DMA operation. The value is stored with the endpoint and passed
+ to the HAL layer in the CyAsHalDmaSetupWrite() and
+ CyAsHalDmaSetupRead() functoins.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the value was set sucessfully
+ * CY_AS_ERROR_INVALID_SIZE - the size value was not valid
+*/
+extern cy_as_return_status_t
+cy_as_dma_set_max_dma_size(
+ /* The device of interest */
+ cy_as_device *dev_p,
+ /* The endpoint to change */
+ cy_as_end_point_number_t ep,
+ /* The max size of this endpoint in bytes */
+ uint32_t size
+ );
+
+/* Summary
+ This function starts the DMA process on a given channel.
+
+ Description
+ When transferring data from the P port processor to West
+ Bridge, the DMA operation must be initiated P Port software
+ for the first transfer. Subsequent transferrs will be
+ handled at the interrupt level.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+*/
+extern cy_as_return_status_t
+cy_as_dma_kick_start(
+ /* The device of interest */
+ cy_as_device *dev_p,
+ /* The endpoint to change */
+ cy_as_end_point_number_t ep
+ );
+
+/* Summary
+ This function receives endpoint data from a request.
+
+ Description
+ For endpoint 0 and 1 the endpoint data is transferred from
+ the West Bridge device to the DMA via a lowlevel
+ requests (via the mailbox registers).
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+*/
+extern cy_as_return_status_t
+cy_as_dma_received_data(
+ /* The device of interest */
+ cy_as_device *dev_p,
+ /* The endpoint that received data */
+ cy_as_end_point_number_t ep,
+ /* The data size */
+ uint32_t dsize,
+ /* The data buffer */
+ void *data
+ );
+
+/* Summary
+ This function is called when the DMA operation on
+ an endpoint has been completed.
+
+ Returns
+ * void
+ */
+extern void
+cy_as_dma_completed_callback(
+ /* Tag to HAL completing the DMA operation. */
+ cy_as_hal_device_tag tag,
+ /* Endpoint on which DMA has been completed. */
+ cy_as_end_point_number_t ep,
+ /* Length of data received. */
+ uint32_t length,
+ /* Status of DMA operation. */
+ cy_as_return_status_t status
+ );
+
+#include "cyas_cplus_end.h"
+
+#endif /* _INCLUDED_CYASDMA_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaserr.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaserr.h
new file mode 100644
index 0000000..f78d602
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaserr.h
@@ -0,0 +1,1094 @@
+/* Cypress West Bridge API header file (cyaserr.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASERR_H_
+#define _INCLUDED_CYASERR_H_
+
+/*@@West Bridge Errors
+ Summary
+ This section lists the error codes for West Bridge.
+
+*/
+
+/* Summary
+ The function completed sucessfully
+*/
+#define CY_AS_ERROR_SUCCESS (0)
+
+/* Summary
+ A function trying to acquire a resource was unable to do so.
+
+ Description
+ This code indicates that a resource that the API was trying to claim
+ could not be claimed.
+
+ See Also
+ * CyAsMiscAcquireResource
+ * CyAsStorageClaim
+*/
+#define CY_AS_ERROR_NOT_ACQUIRED (1)
+
+/* Summary
+ A function trying to acquire a resource was unable to do so.
+
+ Description
+ The West Bridge API provides the capability to assign the storage media to
+ either the West Bridge device or the USB port. This error indicates the
+ P port was trying to release a storage media and was not able to do
+ so. This generally means it was not owned by the P port processor.
+
+ See Also
+ * CyAsStorageRelease
+*/
+#define CY_AS_ERROR_NOT_RELEASED (2)
+
+/* Summary
+ The West Bridge firmware is not loaded.
+
+ Description
+ Most of the API functions that are part of the West Bridge API rely on
+ firmware running on the West Bridge device. This error code is
+ returned when one of these functions is called and the firmware has
+ not yet been loaded.
+
+ See Also
+ * CyAsMiscGetFirmwareVersion
+ * CyAsMiscReset
+ * CyAsMiscAcquireResource
+ * CyAsMiscReleaseResource
+ * CyAsMiscSetTraceLevel
+ * CyAsStorageStart
+ * CyAsStorageStop
+ * CyAsStorageRegisterCallback
+ * CyAsStorageClaim
+ * CyAsStorageRelease
+ * CyAsStorageQueryMedia
+ * CyAsStorageQueryDevice
+ * CyAsStorageQueryUnit
+ * CyAsStorageRead
+ * CyAsStorageWrite
+ * CyAsStorageReadAsync
+ * CyAsStorageWriteAsync
+*/
+#define CY_AS_ERROR_NO_FIRMWARE (3)
+
+/* Summary
+ A timeout occurred waiting on a response from the West Bridge device
+
+ Description
+ When requests are made of the West Bridge device, a response is expected
+ within a given timeframe. If a response is not recevied within the
+ given timeframe, a timeout error occurs.
+*/
+#define CY_AS_ERROR_TIMEOUT (4)
+
+/* Summary
+ A request to download firmware was made while not in the CONFIG mode
+
+ Description
+ Firmware is downloaded via the CyAsMiscDownloadFirmware() function. This
+ function can only be called while in the CONFIG mode. This error indicates
+ that the CyAsMiscDownloadFirmware() call was made while not in the CONFIG
+ mode.
+
+ See Also
+ * CyAsMiscDownloadFirmware
+*/
+#define CY_AS_ERROR_NOT_IN_CONFIG_MODE (5)
+
+/* Summary
+ This error is returned if the firmware size specified is too invalid.
+
+ Description
+ If the size of the firmware to be downloaded into West Bridge is
+ invalid, this error is issued. Invalid firmware sizes are those
+ greater than 24K or a size of zero.
+
+ See Also
+ * CyAsMiscDownloadFirmare
+*/
+#define CY_AS_ERROR_INVALID_SIZE (6)
+
+/* Summary
+ This error is returned if a request is made to acquire a resource that has
+ already been acquired.
+
+ Description
+ This error is returned if a request is made to acquire a resource that has
+ already been acquired.
+
+ See Also
+ * CyAsMiscAcquireResource
+ * CyAsMiscReleaseResource
+*/
+#define CY_AS_ERROR_RESOURCE_ALREADY_OWNED (7)
+
+/* Summary
+ This error is returned if a request is made to release a resource that has
+ not previously been acquired.
+
+ Description
+ This error is returned if a request is made to release a resource that has
+ not previously been acquired.
+
+ See Also
+ * CyAsMiscAcquireResource
+ * CyAsMiscReleaseResource
+*/
+#define CY_AS_ERROR_RESOURCE_NOT_OWNED (8)
+
+/* Summary
+ This error is returned when a request is made for a media that
+ does not exist
+
+ Description
+ This error is returned when a request is made that references
+ a storage media that does not exist. This error is returned
+ when the storage media is not present in the current system,
+ or if the media value given is not valid.
+
+ See Also
+ * CyAsMiscSetTraceLevel
+ * CyAsStorageClaim
+ * CyAsStorageRelease
+ * CyAsStorageRead
+ * CyAsStorageWrite
+ * CyAsStorageReadAsync
+ * CyAsStorageWriteAsync
+*/
+#define CY_AS_ERROR_NO_SUCH_MEDIA (9)
+
+/* Summary
+ This error is returned when a request is made for a device
+ that does not exist
+
+ Description
+ This error is returned when a request is made that references a
+ storage device that does not exist. This error is returned when
+ the device index is not present in the current system, or if the
+ device index exceeds 15.
+
+ See Also
+ * CyAsMiscSetTraceLevel
+ * CyAsStorageQueryDevice
+ * CyAsStorageRead
+ * CyAsStorageWrite
+ * CyAsStorageReadAsync
+ * CyAsStorageWriteAsync
+*/
+#define CY_AS_ERROR_NO_SUCH_DEVICE (10)
+
+/* Summary
+ This error is returned when a request is made for a unit that
+ does not exist
+
+ Description
+ This error is returned when a request is made that references
+ a storage unit that does not exist. This error is returned
+ when the unit index is not present in the current system, or
+ if the unit index exceeds 255.
+
+ See Also
+ * CyAsMiscSetTraceLevel
+ * CyAsStorageQueryDevice
+ * CyAsStorageQueryUnit
+ * CyAsStorageRead
+ * CyAsStorageWrite
+ * CyAsStorageReadAsync
+ * CyAsStorageWriteAsync
+*/
+#define CY_AS_ERROR_NO_SUCH_UNIT (11)
+
+/* Summary
+ This error is returned when a request is made for a block that
+ does not exist
+
+ Description
+ This error is returned when a request is made that references
+ a storage block that does not exist. This error is returned
+ when the block address reference an address beyond the end of
+ the unit selected.
+
+ See Also
+ * CyAsStorageRead
+ * CyAsStorageWrite
+ * CyAsStorageReadAsync
+ * CyAsStorageWriteAsync
+*/
+#define CY_AS_ERROR_INVALID_BLOCK (12)
+
+/* Summary
+ This error is returned when an invalid trace level is set.
+
+ Description
+ This error is returned when the trace level request is greater
+ than three.
+
+ See Also
+ * CyAsMiscSetTraceLevel
+*/
+#define CY_AS_ERROR_INVALID_TRACE_LEVEL (13)
+
+/* Summary
+ This error is returned when West Bridge is already in the standby state
+ and an attempt is made to put West Bridge into this state again.
+
+ Description
+ This error is returned when West Bridge is already in the standby state
+ and an attempt is made to put West Bridge into this state again.
+
+ See Also
+ * CyAsMiscEnterStandby
+*/
+#define CY_AS_ERROR_ALREADY_STANDBY (14)
+
+/* Summary
+ This error is returned when the API needs to set a pin on the
+ West Bridge device, but this is not supported by the underlying HAL
+ layer.
+
+ Description
+ This error is returned when the API needs to set a pin on the
+ West Bridge device, but this is not supported by the underlying HAL
+ layer.
+
+ See Also
+ * CyAsMiscEnterStandby
+ * CyAsMiscLeaveStandby
+*/
+#define CY_AS_ERROR_SETTING_WAKEUP_PIN (15)
+
+/* Summary
+ This error is returned when a module is being started that has
+ already been started.
+
+ Description
+ This error is returned when a module is being started and that module
+ has already been started. This error does not occur with the
+ CyAsStorageStart() or CyAsUsbStart() functions as the storage and
+ USB modules are reference counted.
+
+ Note
+ At the current time, this error is returned by module internal to
+ the API but not returned by any of the API functions.
+*/
+#define CY_AS_ERROR_ALREADY_RUNNING (16)
+
+/* Summary
+ This error is returned when a module is being stopped that has
+ already been stopped.
+
+ Description
+ This error is returned when a module is being stopped and that module
+ has already been stopped. This error does not occur with the
+ CyAsStorageStop() or CyAsUsbStop() functions as the storage and USB
+ modules are reference counted.
+
+ Note
+ At the current time, this error is returned by module internal to
+ the API but not returned by any of the API functions.
+*/
+
+#define CY_AS_ERROR_NOT_RUNNING (17)
+
+/* Summary
+ This error is returned when the caller tries to claim a media that
+ has already been claimed.
+
+ Description
+ This error is returned when the caller tries to claim a media that
+ has already been claimed.
+
+ See Also
+ * CyAsStorageClaim
+*/
+#define CY_AS_ERROR_MEDIA_ALREADY_CLAIMED (18)
+
+/* Summary
+ This error is returned when the caller tries to release a media that has
+ already been released.
+
+ Description
+ This error is returned when the caller tries to release a media that has
+ already been released.
+
+ See Also
+ * CyAsStorageRelease
+*/
+#define CY_AS_ERROR_MEDIA_NOT_CLAIMED (19)
+
+/* Summary
+ This error is returned when canceling trying to cancel an asynchronous
+ operation when an async operation is not pending.
+
+ Description
+ This error is returned when a call is made to a function to cancel an
+ asynchronous operation and there is no asynchronous operation pending.
+
+ See Also
+ * CyAsStorageCancelAsync
+ * CyAsUsbCancelAsync
+*/
+#define CY_AS_ERROR_NO_OPERATION_PENDING (20)
+
+/* Summary
+ This error is returned when an invalid endpoint number is provided to
+ an API call.
+
+ Description
+ This error is returned when an invalid endpoint number is specified in
+ an API call. The endpoint number may be invalid because it is greater
+ than 15, or because it was a reference to an endpoint that is invalid
+ for West Bridge (2, 4, 6, or 8).
+
+ See Also
+ * CyAsUsbSetEndPointConfig
+ * CyAsUsbGetEndPointConfig
+ * CyAsUsbReadData
+ * CyAsUsbWriteData
+ * CyAsUsbReadDataAsync
+ * CyAsUsbWriteDataAsync
+ * CyAsUsbSetStall
+ * CyAsUsbGetStall
+*/
+#define CY_AS_ERROR_INVALID_ENDPOINT (21)
+
+/* Summary
+ This error is returned when an invalid descriptor type
+ is specified in an API call.
+
+ Description
+ This error is returned when an invalid descriptor type
+ is specified in an API call.
+
+ See Also
+ * CyAsUsbSetDescriptor
+ * CyAsUsbGetDescriptor
+*/
+#define CY_AS_ERROR_INVALID_DESCRIPTOR (22)
+
+/* Summary
+ This error is returned when an invalid descriptor index
+ is specified in an API call.
+
+ Description
+ This error is returned when an invalid descriptor index
+ is specified in an API call.
+
+ See Also
+ * CyAsUsbSetDescriptor
+ * CyAsUsbGetDescriptor
+*/
+#define CY_AS_ERROR_BAD_INDEX (23)
+
+/* Summary
+ This error is returned if trying to set a USB descriptor
+ when in the P port enumeration mode.
+
+ Description
+ This error is returned if trying to set a USB descriptor
+ when in the P port enumeration mode.
+
+ See Also
+ * CyAsUsbSetDescriptor
+ * CyAsUsbGetDescriptor
+*/
+#define CY_AS_ERROR_BAD_ENUMERATION_MODE (24)
+
+/* Summary
+ This error is returned when the endpoint configuration specified
+ is not valid.
+
+ Description
+ This error is returned when the endpoint configuration specified
+ is not valid.
+
+ See Also
+ * CyAsUsbSetDescriptor
+ * CyAsUsbGetDescriptor
+ * CyAsUsbCommitConfig
+*/
+#define CY_AS_ERROR_INVALID_CONFIGURATION (25)
+
+/* Summary
+ This error is returned when the API cannot verify it is connected
+ to an West Bridge device.
+
+ Description
+ When the API is initialized, the API tries to read the ID register from
+ the West Bridge device. The value from this ID register should match the
+ value expected before communications with West Bridge are established. This
+ error means that the contents of the ID register cannot be verified.
+
+ See Also
+ * CyAsMiscConfigureDevice
+*/
+#define CY_AS_ERROR_NO_ANTIOCH (26)
+
+/* Summary
+ This error is returned when an API function is called and
+ CyAsMiscConfigureDevice has not been called to configure West Bridge
+ for the current environment.
+
+ Description
+ This error is returned when an API function is called and
+ CyAsMiscConfigureDevice has not been called to configure West Bridge for
+ the current environment.
+
+ See Also
+ * Almost all API function
+*/
+#define CY_AS_ERROR_NOT_CONFIGURED (27)
+
+/* Summary
+ This error is returned when West Bridge cannot allocate memory required for
+ internal API operations.
+
+ Description
+ This error is returned when West Bridge cannot allocate memory required for
+ internal API operations.
+
+ See Also
+ * Almost all API functoins
+*/
+#define CY_AS_ERROR_OUT_OF_MEMORY (28)
+
+/* Summary
+ This error is returned when a module is being started that has
+ already been started.
+
+ Description
+ This error is returned when a module is being started and that module
+ has already been started. This error does not occur with the
+ CyAsStorageStart() or CyAsUsbStart() functions as the storage and
+ USB modules are reference counted.
+
+ Note
+ At the current time, this error is returned by module internal to the API but
+ not returned by any of the API functions.
+*/
+#define CY_AS_ERROR_NESTED_SLEEP (29)
+
+/* Summary
+ This error is returned when an operation is attempted on an endpoint that has
+ been disabled.
+
+ Description
+ This error is returned when an operation is attempted on an endpoint that has
+ been disabled.
+
+ See Also
+ * CyAsUsbReadData
+ * CyAsUsbWriteData
+ * CyAsUsbReadDataAsync
+ * CyAsUsbWriteDataAsync
+*/
+#define CY_AS_ERROR_ENDPOINT_DISABLED (30)
+
+/* Summary
+ This error is returned when a call is made to an API function when
+ the device is in standby.
+
+ Description
+ When the West Bridge device is in standby, the only two API functions that
+ can be called are CyAsMiscInStandby() and CyAsMiscLeaveStandby().
+ Calling any other API function will result in this error.
+
+ See Also
+*/
+#define CY_AS_ERROR_IN_STANDBY (31)
+
+/* Summary
+ This error is returned when an API call is made with an invalid handle value.
+
+ Description
+ This error is returned when an API call is made with an invalid handle value.
+
+ See Also
+*/
+#define CY_AS_ERROR_INVALID_HANDLE (32)
+
+/* Summary
+ This error is returned when an invalid response is returned from
+ the West Bridge device.
+
+ Description
+ Many of the API calls result in requests made to the West Bridge
+ device. This error occurs when the response from West Bridge is
+ invalid and generally indicates that the West Bridge device
+ should be reset.
+
+ See Also
+*/
+#define CY_AS_ERROR_INVALID_RESPONSE (33)
+
+/* Summary
+ This error is returned from the callback function for any asynchronous
+ read or write request that is canceled.
+
+ Description
+ When asynchronous requests are canceled, this error is passed to the
+ callback function associated with the request to indicate that the
+ request has been canceled
+
+ See Also
+ * CyAsStorageReadAsync
+ * CyAsStorageWriteAsync
+ * CyAsUsbReadDataAsync
+ * CyAsUsbWriteDataAsync
+ * CyAsStorageCancelAsync
+ * CyAsUsbCancelAsync
+*/
+#define CY_AS_ERROR_CANCELED (34)
+
+/* Summary
+ This error is returned when the call to create sleep channel fails
+ in the HAL layer.
+
+ Description
+ This error is returned when the call to create sleep channel fails
+ in the HAL layer.
+
+ See Also
+ * CyAsMiscConfigureDevice
+*/
+#define CY_AS_ERROR_CREATE_SLEEP_CHANNEL_FAILED (35)
+
+/* Summary
+ This error is returned when the call to CyAsMiscLeaveStandby
+ is made and the device is not in standby.
+
+ Description
+ This error is returned when the call to CyAsMiscLeaveStandby
+ is made and the device is not in standby.
+
+ See Also
+*/
+#define CY_AS_ERROR_NOT_IN_STANDBY (36)
+
+/* Summary
+ This error is returned when the call to destroy sleep channel fails
+ in the HAL layer.
+
+ Description
+ This error is returned when the call to destroy sleep channel fails
+ in the HAL layer.
+
+ See Also
+ * CyAsMiscDestroyDevice
+*/
+#define CY_AS_ERROR_DESTROY_SLEEP_CHANNEL_FAILED (37)
+
+/* Summary
+ This error is returned when an invalid resource is specified to a call
+ to CyAsMiscAcquireResource() or CyAsMiscReleaseResource()
+
+ Description
+ This error is returned when an invalid resource is specified to a call
+ to CyAsMiscAcquireResource() or CyAsMiscReleaseResource()
+
+ See Also
+ * CyAsMiscAcquireResource
+ * CyAsMiscReleaseResource
+*/
+#define CY_AS_ERROR_INVALID_RESOURCE (38)
+
+/* Summary
+ This error occurs when an operation is requested on an endpoint that has
+ a currently pending async operation.
+
+ Description
+ There can only be a single asynchronous pending operation on a given
+ endpoint and while the operation is pending on other operation can occur
+ on the endpoint. In addition, the device cannot enter standby while
+ any asynchronous operations are pending.
+
+ See Also
+ * CyAsStorageReadAsync
+ * CyAsStorageWriteAsync
+ * CyAsUsbReadDataAsync
+ * CyAsUsbWriteDataAsync
+ * CyAsStorageRead
+ * CyAsStorageWrite
+ * CyAsUsbReadData
+ * CyAsUsbWriteData
+ * CyAsMiscEnterStandby
+*/
+#define CY_AS_ERROR_ASYNC_PENDING (39)
+
+/* Summary
+ This error is returned when a call to CyAsStorageCancelAsync() or
+ CyAsUsbCancelAsync() is made when no asynchronous request is pending.
+
+ Description
+ This error is returned when a call to CyAsStorageCancelAsync() or
+ CyAsUsbCancelAsync() is made when no asynchronous request is pending.
+
+ See Also
+ * CyAsStorageCancelAsync
+ * CyAsUsbCancelAsync
+*/
+#define CY_AS_ERROR_ASYNC_NOT_PENDING (40)
+
+/* Summary
+ This error is returned when a request is made to put the West Bridge device
+ into standby mode while the USB stack is still active.
+
+ Description
+ This error is returned when a request is made to put the West Bridge device
+ into standby mode while the USB stack is still active. You must call the
+ function CyAsUsbStop() in order to shut down the USB stack in order to go
+ into the standby mode.
+
+ See Also
+ * CyAsMiscEnterStandby
+*/
+#define CY_AS_ERROR_USB_RUNNING (41)
+
+/* Summary
+ A request for in the wrong direction was issued on an endpoint.
+
+ Description
+ This error is returned when a write is attempted on an OUT endpoint or
+ a read is attempted on an IN endpoint.
+
+ See Also
+ * CyAsUsbReadData
+ * CyAsUsbWriteData
+ * CyAsUsbReadDataAsync
+ * CyAsUsbWriteDataAsync
+*/
+#define CY_AS_ERROR_USB_BAD_DIRECTION (42)
+
+/* Summary
+ An invalid request was received
+
+ Description
+ This error is isused if an invalid request is issued.
+*/
+#define CY_AS_ERROR_INVALID_REQUEST (43)
+
+/* Summary
+ An ACK request was requested while no setup packet was pending.
+
+ Description
+ This error is issued if CyAsUsbAckSetupPacket() is called when no
+ setup packet is pending.
+*/
+#define CY_AS_ERROR_NO_SETUP_PACKET_PENDING (44)
+
+/* Summary
+ A call was made to a API function that cannot be called from a callback.
+
+ Description
+ Only asynchronous functions can be called from within West Bridge callbacks.
+ This error results when an invalid function is called from a callback.
+*/
+#define CY_AS_ERROR_INVALID_IN_CALLBACK (45)
+
+/* Summary
+ A call was made to CyAsUsbSetEndPointConfig() before
+ CyAsUsbSetPhysicalConfiguration() was called.
+
+ Description
+ When logical endpoints are configured, you must define the physical
+ endpoint for the logical endpoint being configured. Therefore
+ CyAsUsbSetPhysicalConfiguration() must be called to define the
+ physical endpoints before calling CyAsUsbSetEndPointConfig().
+*/
+#define CY_AS_ERROR_ENDPOINT_CONFIG_NOT_SET (46)
+
+/* Summary
+ The physical endpoint referenced is not valid in the current physical
+ configuration
+
+ Description
+ When logical endpoints are configured, you must define the physical
+ endpoint for the logical endpoint being configured. Given the
+ current physical configuration, the physical endpoint referenced
+ is not valid.
+*/
+#define CY_AS_ERROR_INVALID_PHYSICAL_ENDPOINT (47)
+
+/* Summary
+ The data supplied to the CyAsMiscDownloadFirmware() call is not
+ aligned on a WORD (16 bit) boundary.
+
+ Description
+ Many systems have problems with the transfer of data a word at a
+ time when the data is not word aligned. For this reason, we
+ require that the firmware image be aligned on a word boundary and
+ be an even number of bytes. This error is returned if these
+ conditions are not met.
+*/
+#define CY_AS_ERROR_ALIGNMENT_ERROR (48)
+
+/* Summary
+ A call was made to destroy the West Bridge device, but the USB
+ stack or the storage stack was will running.
+
+ Description
+ Before calling CyAsMiscDestroyDevice to destroy an West Bridge
+ device created via a call to CyAsMiscCreateDevice, the USB and
+ STORAGE stacks much be stopped via calls to CyAsUsbStop and
+ CyAsStorageStop. This error indicates that one of these two
+ stacks have not been stopped.
+*/
+#define CY_AS_ERROR_STILL_RUNNING (49)
+
+/* Summary
+ A call was made to the API for a function that is not yet supported.
+
+ Description
+ There are calls that are not yet supported that may be called through
+ the API. This is done to maintain compatibility in the future with
+ the API. This error is returned if you are asking for a capability
+ that does not yet exist.
+*/
+#define CY_AS_ERROR_NOT_YET_SUPPORTED (50)
+
+/* Summary
+ A NULL callback was provided where a non-NULL callback was required
+
+ Description
+ When async IO function are called, a callback is required to indicate
+ that the IO has completed. This callback must be non-NULL.
+*/
+#define CY_AS_ERROR_NULL_CALLBACK (51)
+
+/* Summary
+ This error is returned when a request is made to put the West Bridge device
+ into standby mode while the storage stack is still active.
+
+ Description
+ This error is returned when a request is made to put the West Bridge device
+ into standby mode while the storage stack is still active. You must call the
+ function CyAsStorageStop() in order to shut down the storage stack in order
+ to go into the standby mode.
+
+ See Also
+ * CyAsMiscEnterStandby
+*/
+#define CY_AS_ERROR_STORAGE_RUNNING (52)
+
+/* Summary
+ This error is returned when an operation is attempted that cannot be
+ completed while the USB stack is connected to a USB host.
+
+ Description
+ This error is returned when an operation is attempted that cannot be
+ completed while the USB stack is connected to a USB host. In order
+ to sucessfully complete the desired operation, CyAsUsbDisconnect()
+ must be called to disconnect from the host.
+*/
+#define CY_AS_ERROR_USB_CONNECTED (53)
+
+/* Summary
+ This error is returned when a USB disconnect is attempted and the
+ West Bridge device is not connected.
+
+ Description
+ This error is returned when a USB disconnect is attempted and the
+ West Bridge device is not connected.
+*/
+#define CY_AS_ERROR_USB_NOT_CONNECTED (54)
+
+/* Summary
+ This error is returned when an P2S storage operation attempted
+ and data could not be read or written to the storage media.
+
+ Description
+ This error is returned when an P2S storage operation attempted
+ and data could not be read or written to the storage media. If
+ this error is recevied then a retry can be done.
+*/
+#define CY_AS_ERROR_MEDIA_ACCESS_FAILURE (55)
+
+/* Summary
+ This error is returned when an P2S storage operation attempted
+ and the media is write protected.
+
+ Description
+ This error is returned when an P2S storage operation attempted
+ and the media is write protected.
+*/
+#define CY_AS_ERROR_MEDIA_WRITE_PROTECTED (56)
+
+/* Summary
+ This error is returned when an attempt is made to cancel a request
+ that has already been sent to the West Bridge.
+
+ Description
+ It is not possible to cancel an asynchronous storage read/write
+ operation after the actual data transfer with the West Bridge
+ has started. This error is returned if CyAsStorageCancelAsync
+ is called to cancel such a request.
+ */
+#define CY_AS_ERROR_OPERATION_IN_TRANSIT (57)
+
+/* Summary
+ This error is returned when an invalid parameter is passed to
+ one of the APIs.
+
+ Description
+ Some of the West Bridge APIs are applicable to only specific
+ media types, devices etc. This error code is returned when a
+ API is called with an invalid parameter type.
+ */
+#define CY_AS_ERROR_INVALID_PARAMETER (58)
+
+/* Summary
+ This error is returned if an API is not supported in the current setup.
+
+ Description
+ Some of the West Bridge APIs work only with specific device types
+ or firmware images. This error is returned when such APIs are called
+ when the current device or firmware does not support the invoked API
+ function.
+ */
+#define CY_AS_ERROR_NOT_SUPPORTED (59)
+
+/* Summary
+ This error is returned when a call is made to one of the Storage or
+ USB APIs while the device is in suspend mode.
+
+ Description
+ This error is returned when a call is made to one of the storage or
+ USB APIs while the device is in suspend mode.
+ */
+#define CY_AS_ERROR_IN_SUSPEND (60)
+
+/* Summary
+ This error is returned when the call to CyAsMiscLeaveSuspend
+ is made and the device is not in suspend mode.
+
+ Description
+ This error is returned when the call to CyAsMiscLeaveSuspend
+ is made and the device is not in suspend mode.
+ */
+#define CY_AS_ERROR_NOT_IN_SUSPEND (61)
+
+/* Summary
+ This error is returned when a command that is disabled by USB is called.
+
+ Description
+ The remote wakeup capability should be exercised only if enabled by the
+ USB host. This error is returned when the CyAsUsbSignalRemoteWakeup API
+ is called when the feature has not been enabled by the USB host.
+ */
+#define CY_AS_ERROR_FEATURE_NOT_ENABLED (62)
+
+/* Summary
+ This error is returned when an Async storage read or write is called before a
+ query device call is issued.
+
+ Description
+ In order for the SDK to properly set up a DMA the block size of a given media
+ needs to be known. This is done by making a call to CyAsStorageQueryDevice.
+ This call only needs to be made once per device. If this call is not issued
+ before an Async read or write is issued this error code is returned.
+ */
+#define CY_AS_ERROR_QUERY_DEVICE_NEEDED (63)
+
+/* Summary
+ This error is returned when a call is made to USB or STORAGE Start or
+ Stop before a prior Start or Stop has finished.
+
+ Description
+ The USB and STORAGE start and stop functions can only be called if a
+ prior start or stop function call has fully completed. This means when
+ an async EX call is made you must wait until the callback for that call
+ has been completed before calling start or stop again.
+ */
+#define CY_AS_ERROR_STARTSTOP_PENDING (64)
+
+/* Summary
+ This error is returned when a request is made for a bus that does not exist
+
+ Description
+ This error is returned when a request is made that references a bus
+ number that does not exist. This error is returned when the bus number
+ is not present in the current system, or if the bus number given is not
+ valid.
+
+ See Also
+ * CyAsMiscSetTraceLevel
+ * CyAsStorageClaim
+ * CyAsStorageRelease
+ * CyAsStorageRead
+ * CyAsStorageWrite
+ * CyAsStorageReadAsync
+ * CyAsStorageWriteAsync
+*/
+#define CY_AS_ERROR_NO_SUCH_BUS (65)
+
+/* Summary
+ This error is returned when the bus corresponding to a media type cannot
+ be resolved.
+
+ Description
+ In some S-Port configurations, the same media type may be supported on
+ multiple buses. In this case, it is not possible to resolve the target
+ address based on the media type. This error indicates that only
+ bus-based addressing is supported in a particular run-time
+ configuration.
+
+ See Also
+ * CyAsMediaType
+ * CyAsBusNumber_t
+ */
+#define CY_AS_ERROR_ADDRESS_RESOLUTION_ERROR (66)
+
+/* Summary
+ This error is returned when an invalid command is passed to the
+ CyAsStorageSDIOSync() function.
+
+ Description
+ This error indiactes an unknown Command type was passed to the SDIO
+ command handler function.
+ */
+
+#define CY_AS_ERROR_INVALID_COMMAND (67)
+
+
+/* Summary
+ This error is returned when an invalid function /uninitialized
+ function is passed to an SDIO function.
+
+ Description
+ This error indiactes an unknown/uninitialized function number was
+ passed to a SDIO function.
+ */
+#define CY_AS_ERROR_INVALID_FUNCTION (68)
+
+/* Summary
+ This error is returned when an invalid block size is passed to
+ CyAsSdioSetBlocksize().
+
+ Description
+ This error is returned when an invalid block size (greater than
+ maximum block size supported) is passed to CyAsSdioSetBlocksize().
+ */
+
+#define CY_AS_ERROR_INVALID_BLOCKSIZE (69)
+
+/* Summary
+ This error is returned when an tuple requested is not found.
+
+ Description
+ This error is returned when an tuple requested is not found.
+ */
+#define CY_AS_ERROR_TUPLE_NOT_FOUND (70)
+
+/* Summary
+ This error is returned when an extended IO operation to an SDIO function is
+ Aborted.
+ Description
+ This error is returned when an extended IO operation to an SDIO function is
+ Aborted. */
+#define CY_AS_ERROR_IO_ABORTED (71)
+
+/* Summary
+ This error is returned when an extended IO operation to an SDIO function is
+ Suspended.
+ Description
+ This error is returned when an extended IO operation to an SDIO function is
+ Suspended. */
+#define CY_AS_ERROR_IO_SUSPENDED (72)
+
+/* Summary
+ This error is returned when IO is attempted to a Suspended SDIO function.
+ Description
+ This error is returned when IO is attempted to a Suspended SDIO function. */
+#define CY_AS_ERROR_FUNCTION_SUSPENDED (73)
+
+/* Summary
+ This error is returned if an MTP function is called before MTPStart
+ has completed.
+ Description
+ This error is returned if an MTP function is called before MTPStart
+ has completed.
+*/
+#define CY_AS_ERROR_MTP_NOT_STARTED (74)
+
+/* Summary
+ This error is returned by API functions that are not valid in MTP
+ mode (CyAsStorageClaim for example)
+ Description
+ This error is returned by API functions that are not valid in MTP
+ mode (CyAsStorageClaim for example)
+*/
+#define CY_AS_ERROR_NOT_VALID_IN_MTP (75)
+
+/* Summary
+ This error is returned when an attempt is made to partition a
+ storage device that is already partitioned.
+
+ Description
+ This error is returned when an attempt is made to partition a
+ storage device that is already partitioned.
+*/
+#define CY_AS_ERROR_ALREADY_PARTITIONED (76)
+
+/* Summary
+ This error is returned when a call is made to
+ CyAsUsbSelectMSPartitions after CyAsUsbSetEnumConfig is called.
+
+ Description
+ This error is returned when a call is made to
+ CyAsUsbSelectMSPartitions after CyAsUsbSetEnumConfig is called.
+ */
+#define CY_AS_ERROR_INVALID_CALL_SEQUENCE (77)
+
+/* Summary
+ This error is returned when a StorageWrite opperation is attempted
+ during an ongoing MTP transfer.
+ Description
+ This error is returned when a StorageWrite opperation is attempted
+ during an ongoing MTP transfer. A MTP transfer is initiated by a
+ call to CyAsMTPInitSendObject or CyAsMTPInitGetObject and is not
+ finished until the CyAsMTPSendObjectComplete or
+ CyAsMTPGetObjectComplete event is generated.
+*/
+#define CY_AS_ERROR_NOT_VALID_DURING_MTP (78)
+
+/* Summary
+ This error is returned when a StorageRead or StorageWrite is
+ attempted while a UsbRead or UsbWrite on a Turbo endpoint (2 or 6) is
+ pending, or visa versa.
+ Description
+ When there is a pending usb read or write on a turbo endpoint (2 or 6)
+ a storage read or write call may not be performed. Similarly when there
+ is a pending storage read or write a usb read or write may not be
+ performed on a turbo endpoint (2 or 6).
+*/
+#define CY_AS_ERROR_STORAGE_EP_TURBO_EP_CONFLICT (79)
+
+/* Summary
+ This error is returned when processor requests to reserve greater
+ number of zones than available for proc booting via lna firmware.
+
+ Description
+ Astoria does not allocate any nand zones for the processor in this case.
+*/
+#define CY_AS_ERROR_EXCEEDED_NUM_ZONES_AVAIL (80)
+
+#endif /* _INCLUDED_CYASERR_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashal.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashal.h
new file mode 100644
index 0000000..b695ba1
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashal.h
@@ -0,0 +1,108 @@
+/* Cypress West Bridge API header file (cyashal.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASHAL_H_
+#define _INCLUDED_CYASHAL_H_
+
+#if !defined(__doxygen__)
+
+/* The possible HAL layers defined and implemented by Cypress */
+
+#ifdef __CY_ASTORIA_FPGA_HAL__
+#ifdef CY_HAL_DEFINED
+#error only one HAL layer can be defined
+#endif
+
+#define CY_HAL_DEFINED
+
+#include "cyashalfpga.h"
+#endif
+
+/***** SCM User space HAL ****/
+#ifdef __CY_ASTORIA_SCM_HAL__
+#ifdef CY_HAL_DEFINED
+#error only one HAL layer can be defined
+#endif
+
+#define CY_HAL_DEFINEDŚŚ
+
+#include "cyanhalscm.h"
+#endif
+/***** SCM User space HAL ****/
+
+/***** SCM Kernel HAL ****/
+#ifdef __CY_ASTORIA_SCM_KERNEL_HAL__
+#ifdef CY_HAL_DEFINED
+#error only one HAL layer can be defined
+#endif
+
+#define CY_HAL_DEFINEDÅš
+
+#include "cyanhalscm_kernel.h"
+#endif
+/***** SCM Kernel HAL ****/
+
+/***** OMAP5912 Kernel HAL ****/
+#ifdef __CY_ASTORIA_OMAP_5912_KERNEL_HAL__
+ #ifdef CY_HAL_DEFINED
+ #error only one HAL layer can be defined
+ #endif
+
+ #define CY_HAL_DEFINED
+
+ #include "cyanhalomap_kernel.h"
+#endif
+/***** eof OMAP5912 Kernel HAL ****/
+
+
+
+/***** OMAP3430 Kernel HAL ****/
+#ifdef CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL
+
+ #ifdef CY_HAL_DEFINED
+ #error only one HAL layer can be defined
+ #endif
+
+ #define CY_HAL_DEFINED
+/* moved to staging location, eventual implementation
+ * considered is here
+ * #include mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h>
+*/
+ #include "../../../arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h"
+
+#endif
+/*****************************/
+
+
+/******/
+#ifdef __CY_ASTORIA_CUSTOMER_HAL__
+#ifdef CY_HAL_DEFINED
+#error only one HAL layer can be defined
+#endif
+br
+#define CY_HAL_DEFINED
+#include "cyashal_customer.h"
+
+#endif
+
+#endif /* __doxygen__ */
+
+#endif /* _INCLUDED_CYASHAL_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashalcb.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashalcb.h
new file mode 100644
index 0000000..4d1670e
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashalcb.h
@@ -0,0 +1,44 @@
+/* Cypress West Bridge API header file (cyashalcb.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASHALCB_H_
+#define _INCLUDED_CYASHALCB_H_
+
+/* Summary
+ This type defines a callback function type called when a
+ DMA operation has completed.
+
+ Description
+
+ See Also
+ * CyAsHalDmaRegisterCallback
+ * CyAsHalDmaSetupWrite
+ * CyAsHalDmaSetupRead
+*/
+typedef void (*cy_as_hal_dma_complete_callback)(
+ cy_as_hal_device_tag tag,
+ cy_as_end_point_number_t ep,
+ uint32_t cnt,
+ cy_as_return_status_t ret);
+
+typedef cy_as_hal_dma_complete_callback \
+ cy_an_hal_dma_complete_callback;
+#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h
new file mode 100644
index 0000000..28136ad
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h
@@ -0,0 +1,800 @@
+/* Cypress West Bridge API header file (cyashaldoc.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASHALDOC_H_
+#define _INCLUDED_CYASHALDOC_H_
+
+#include "cyashaldef.h"
+
+/*@@Hardware Abstraction Layer (HAL)
+ Summary
+ This software module is supplied by the user of the West Bridge
+ API. This module contains the software that is specific to the
+ hardware implementation or operating system of the client
+ system.
+
+ * Sleep Channels *
+ A sleep channel is a operating system object that provides that
+ capability for one thread or process to sleep while waiting on
+ the completion of some hardware event. The hardware event is
+ usually processed by a hardware interrupt and the interrupt
+ handler then wakes the thread or process that is sleeping.
+
+ A sleep channel provides the mechanism for this operation. A
+ sleep channel is created and initialized during the API
+ initialization. When the API needs to wait for the hardware,
+ the API performs a SleepOn() operation on the sleep channel.
+ When hardware event occurs, an interrupt handler processes the
+ event and then performs a Wake() operation on the sleep channel
+ to wake the sleeping process or thread.
+
+ * DMA Model *
+ When the West Bridge API needs to transfer USB or storage data
+ to/from the West Bridge device, this is done using a "DMA"
+ operation. In this context the term DMA is used loosely as the
+ West Bridge API does not really care if the data is transferred
+ using a burst read or write operation, or if the data is
+ transferred using programmed I/O operations. When a "DMA"
+ operation is needed, the West Bridge API calls either
+ CyAsHalDmaSetupRead() or CyAsHalDmaSetupWrite() depending on the
+ direction of the data flow. The West Bridge API expects the
+ "DMA" operation requested in the call to be completed and the
+ registered "DMA complete" callback to be called.
+
+ The West Bridge API looks at several factors to determine the
+ size of the "DMA" request to pass to the HAL layer. First the
+ West Bridge API calls CyAsHalDmaMaxRequestSize() to determine
+ the maximum amount of data the HAL layer can accept for a "DMA"
+ operation on the requested endpoint. The West Bridge API will
+ never exceed this value in a "DMA" request to the HAL layer.
+ The West Bridge API also sends the maximum amount of data the
+ West Bridge device can accept as part of the "DMA" request. If
+ the amount of data in the "DMA" request to the HAL layer
+ exceeds the amount of data the West Bridge device can accept,
+ it is expected that the HAL layer has the ability to break the
+ request into multiple operations.
+
+ If the HAL implementation requires the API to handle the size
+ of the "DMA" requests for one or more endpoints, the value
+ CY_AS_DMA_MAX_SIZE_HW_SIZE can be returned from the
+ CyAsHalDmaMaxRequestSize() call. In this case, the API assumes
+ that the maximum size of each "DMA" request should be limited
+ to the maximum that can be accepted by the endpoint in question.
+
+ Notes
+ See the <install>/api/hal/scm_kernel/cyashalscm_kernel.c file
+ for an example of how the DMA request size can be managed by
+ the HAL implementation.
+
+ * Interrupt Handling *
+ The HAL implementation is required to handle interrupts arriving
+ from the West Bridge device, and call the appropriate handlers.
+ If the interrupt arriving is one of PLLLOCKINT, PMINT, MBINT or
+ MCUINT, the CyAsIntrServiceInterrupt API should be called to
+ service the interrupt. If the interrupt arriving is DRQINT, the
+ HAL should identify the endpoint corresponding to which the DRQ
+ is being generated and perform the read/write transfer from the
+ West Bridge. See the <install>/api/hal/scm_kernel/
+ cyashalscm_kernel.c or <install>/api/hal/fpga/cyashalfpga.c
+ reference HAL implementations for examples.
+
+ The HAL implementation can choose to poll the West Bridge
+ interrupt status register instead of using interrupts. In this
+ case, the polling has to be performed from a different thread/
+ task than the one running the APIs. This is required because
+ there are API calls that block on the reception of data from the
+ West Bridge, which is delivered only through the interrupt
+ handlers.
+
+ * Required Functions *
+ This section defines the types and functions that must be
+ supplied in order to provide a complete HAL layer for the
+ West Bridge API.
+
+ Types that must be supplied:
+ * CyAsHalSleepChannel
+
+ Hardware functions that must be supplied:
+ * CyAsHalWriteRegister
+ * CyAsHalReadRegister
+ * CyAsHalDmaSetupWrite
+ * CyAsHalDmaSetupRead
+ * CyAsHalDmaCancelRequest
+ * CyAsHalDmaRegisterCallback
+ * CyAsHalDmaMaxRequestSize
+ * CyAsHalSetWakeupPin
+ * CyAsHalSyncDeviceClocks
+ * CyAsHalInitDevRegisters
+ * CyAsHalReadRegsBeforeStandby
+ * CyAsHalRestoreRegsAfterStandby
+
+ Operating system functions that must be supplied:
+ * CyAsHalAlloc
+ * CyAsHalFree
+ * CyAsHalCBAlloc
+ * CyAsHalCBFree
+ * CyAsHalMemSet
+ * CyAsHalCreateSleepChannel
+ * CyAsHalDestroySleepChannel
+ * CyAsHalSleepOn
+ * CyAsHalWake
+ * CyAsHalDisableInterrupts
+ * CyAsHalEnableInterrupts
+ * CyAsHalSleep150
+ * CyAsHalSleep
+ * CyAsHalAssert
+ * CyAsHalPrintMessage
+ * CyAsHalIsPolling
+*/
+
+/* Summary
+ This is the type that represents a sleep channel
+
+ Description
+ A sleep channel is an operating system object that, when a
+ thread of control waits on the sleep channel, the thread
+ sleeps until another thread signals the sleep object. This
+ object is generally used when a high level API is called
+ and must wait for a response that is supplied in an interrupt
+ handler. The thread calling the API is put into a sleep
+ state and when the reply arrives via the interrupt handler,
+ the interrupt handler wakes the sleeping thread to indicate
+ that the expect reply is available.
+*/
+typedef struct cy_as_hal_sleep_channel {
+ /* This structure is filled in with OS specific information
+ to implementat a sleep channel */
+ int m_channel;
+} cy_as_hal_sleep_channel;
+
+/* Summary
+ This function is called to write a register value
+
+ Description
+ This function is called to write a specific register to a
+ specific value. The tag identifies the device of interest.
+ The address is relative to the base address of the West
+ Bridge device.
+
+ Returns
+ Nothing
+
+ See Also
+ * CyAsHalDeviceTag
+ * CyAsHalReadRegister
+*/
+EXTERN void
+cy_as_hal_write_register(
+/* The tag to ID a specific West Bridge device */
+ cy_as_hal_device_tag tag,
+ /* The address we are writing to */
+ uint16_t addr,
+ /* The value to write to the register */
+ uint16_t value
+ );
+
+/* Summary
+ This function is called to read a register value
+
+ Description
+ This function is called to read the contents of a specific
+ register. The tag identifies the device of interest. The
+ address is relative to the base address of the West Bridge
+ device.
+
+ Returns
+ Contents of the register
+
+ See Also
+ * CyAsHalDeviceTag
+ * CyAsHalWriteRegister
+*/
+EXTERN uint16_t
+cy_as_hal_read_register(
+ /* The tag to ID a specific West Bridge device */
+ cy_as_hal_device_tag tag,
+ /* The address we are writing to */
+ uint16_t addr
+ );
+
+/* Summary
+ This function initiates a DMA write operation to write
+ to West Bridge
+
+ Description
+ This function initiates a DMA write operation. The request
+ size will not exceed the value the HAL layer returned via
+ CyAsHalDmaMaxRequestSize(). This request size may exceed
+ the size of what the West Bridge device will accept as on
+ packet and the HAL layer may need to divide the request
+ into multiple hardware DMA operations.
+
+ Returns
+ None
+
+ See Also
+ * CyAsHalDmaSetupRead
+ * CyAsHalDmaMaxRequestSize
+*/
+EXTERN void
+cy_as_hal_dma_setup_write(
+ /* The tag to ID a specific West Bridge device */
+ cy_as_hal_device_tag tag,
+ /* The endpoint we are writing to */
+ cy_as_end_point_number_t ep,
+ /* The data to write via DMA */
+ void *buf_p,
+ /* The size of the data at buf_p */
+ uint32_t size,
+ /* The maximum amount of data that the endpoint
+ * can accept as one packet */
+ uint16_t maxsize
+ );
+
+/* Summary
+ This function initiates a DMA read operation from West Bridge
+
+ Description
+ This function initiates a DMA read operation. The request
+ size will not exceed the value the HAL layer returned via
+ CyAsHalDmaMaxRequestSize(). This request size may exceed
+ the size of what the Anitoch will accept as one packet and
+ the HAL layer may need to divide the request into multiple
+ hardware DMA operations.
+
+ Returns
+ None
+
+ See Also
+ * CyAsHalDmaSetupRead
+ * CyAsHalDmaMaxRequestSize
+*/
+EXTERN void
+cy_as_hal_dma_setup_read(
+ /* The tag to ID a specific West Bridge device */
+ cy_as_hal_device_tag tag,
+ /* The endpoint we are reading from */
+ cy_as_end_point_number_t ep,
+ /* The buffer to read data into */
+ void *buf_p,
+ /* The amount of data to read */
+ uint32_t size,
+ /* The maximum amount of data that the endpoint
+ * can provide in one DMA operation */
+ uint16_t maxsize
+ );
+
+/* Summary
+ This function cancels a pending DMA request
+
+ Description
+ This function cancels a pending DMA request that has been
+ passed down to the hardware. The HAL layer can elect to
+ physically cancel the request if possible, or just ignore
+ the results of the request if it is not possible.
+
+ Returns
+ None
+*/
+EXTERN void
+cy_as_hal_dma_cancel_request(
+ /* The tag to ID a specific West Bridge device */
+ cy_as_hal_device_tag tag,
+ /* The endpoint we are reading from */
+ cy_as_end_point_number_t ep
+ );
+
+/* Summary
+ This function registers a callback function to be called when
+ a DMA request is completed
+
+ Description
+ This function registers a callback that is called when a request
+ issued via CyAsHalDmaSetupWrite() or CyAsHalDmaSetupRead() has
+ completed.
+
+ Returns
+ None
+
+ See Also
+ * CyAsHalDmaSetupWrite
+ * CyAsHalDmaSetupRead
+*/
+EXTERN void
+cy_as_hal_dma_register_callback(
+ /* The tag to ID a specific West Bridge device */
+ cy_as_hal_device_tag tag,
+ /* The callback to call when a request has completed */
+ cy_as_hal_dma_complete_callback cb
+ );
+
+/* Summary
+ This function returns the maximum size of a DMA request that can
+ be handled by the HAL.
+
+ Description
+ When DMA requests are passed to the HAL layer for processing,
+ the HAL layer may have a limit on the size of the request that
+ can be handled. This function is called by the DMA manager for
+ an endpoint when DMA is enabled to get the maximum size of data
+ the HAL layer can handle. The DMA manager insures that a request
+ is never sent to the HAL layer that exceeds the size returned by
+ this function.
+
+ Returns
+ the maximum size of DMA request the HAL layer can handle
+*/
+EXTERN uint32_t
+cy_as_hal_dma_max_request_size(
+ /* The tag to ID a specific West Bridge device */
+ cy_as_hal_device_tag tag,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep
+ );
+
+/* Summary
+ This function sets the WAKEUP pin to a specific state on the
+ West Bridge device.
+
+ Description
+ In order to enter the standby mode, the WAKEUP pin must be
+ de-asserted. In order to resume from standby mode, the WAKEUP
+ pin must be asserted. This function provides the mechanism to
+ do this.
+
+ Returns
+ 1 if the pin was changed, 0 if the HAL layer does not support
+ changing this pin
+*/
+EXTERN uint32_t
+cy_as_hal_set_wakeup_pin(
+ /* The tag to ID a specific West Bridge device */
+ cy_as_hal_device_tag tag,
+ /* The desired state of the wakeup pin */
+ cy_bool state
+ );
+
+/* Summary
+ Synchronise the West Bridge device clocks to re-establish device
+ connectivity.
+
+ Description
+ When the Astoria bridge device is working in SPI mode, a long
+ period of inactivity can cause a loss of serial synchronisation
+ between the processor and Astoria. This function is called by
+ the API when it detects such a condition, and is expected to take
+ the action required to re-establish clock synchronisation between
+ the devices.
+
+ Returns
+ CyTrue if the attempt to re-synchronise is successful,
+ CyFalse if not.
+ */
+EXTERN cy_bool
+cy_as_hal_sync_device_clocks(
+ /* The tag to ID a specific West Bridge device */
+ cy_as_hal_device_tag tag,
+ );
+
+/* Summary
+ Initialize West Bridge device registers that may have been
+ modified while the device was in standby.
+
+ Description
+ The content of some West Bridge registers may be lost when
+ the device is placed in standby mode. This function restores
+ these register contents so that the device can continue to
+ function normally after it wakes up from standby mode.
+
+ This function is required to perform operations only when the
+ API is being used with the Astoria device in one of the PNAND
+ modes or in the PSPI mode. It can be a no-operation in all
+ other cases.
+
+ Returns
+ None
+ */
+EXTERN void
+cy_as_hal_init_dev_registers(
+ /* The tag to ID a specific West Bridge device */
+ cy_as_hal_device_tag tag,
+ /* Indicates whether this is a wake-up from standby. */
+ cy_bool is_standby_wakeup
+ );
+
+/* Summary
+ This function reads a set of P-port accessible device registers and
+ stores their value for later use.
+
+ Description
+ The West Bridge Astoria device silicon has a known problem when
+ operating in SPI mode on the P-port, where some of the device
+ registers lose their value when the device goes in and out of
+ standby mode. The suggested work-around is to reset the Astoria
+ device as part of the wakeup procedure from standby.
+
+ This requires that the values of some of the P-port accessible
+ registers be restored to their pre-standby values after it has
+ been reset. This HAL function can be used to read and store
+ the values of these registers at the point where the device is
+ being placed in standby mode.
+
+ Returns
+ None
+
+ See Also
+ * CyAsHalRestoreRegsAfterStandby
+ */
+EXTERN void
+cy_as_hal_read_regs_before_standby(
+ /* The tag to ID a specific West Bridge device */
+ cy_as_hal_device_tag tag
+ );
+
+/* Summary
+ This function restores the old values to a set of P-port
+ accessible device registers.
+
+ Description
+ This function is part of the work-around to a known West
+ Bridge Astoria device error when operating in SPI mode on
+ the P-port. This function is used to restore a set of
+ P-port accessible registers to the values they had before
+ the device was placed in standby mode.
+
+ Returns
+ None
+
+ See Also
+ * CyAsHalRestoreRegsAfterStandby
+ */
+EXTERN void
+cy_as_hal_restore_regs_after_standby(
+ /* The tag to ID a specific West Bridge device */
+ cy_as_hal_device_tag tag
+ );
+
+/*
+ * The functions below this comment are part of the HAL layer,
+ * as the HAL layer consists of the abstraction to both the
+ * hardware platform and the operating system. However; the
+ * functions below this comment all relate to the operating
+ * environment and not specifically to the hardware platform
+ * or specific device.
+ */
+
+/* Summary
+ This function allocates a block of memory
+
+ Description
+ This is the HAL layer equivalent of the malloc() function.
+
+ Returns
+ a pointer to a block of memory
+
+ See Also
+ * CyAsHalFree
+*/
+EXTERN void *
+cy_as_hal_alloc(
+ /* The size of the memory block to allocate */
+ uint32_t size
+ );
+
+/* Summary
+ This function frees a previously allocated block of memory
+
+ Description
+ This is the HAL layer equivalent of the free() function.
+
+ Returns
+ None
+
+ See Also
+ * CyAsHalAlloc
+*/
+EXTERN void
+cy_as_hal_free(
+ /* Pointer to a memory block to free */
+ void *ptr
+ );
+
+/* Summary
+ This function is a malloc equivalent that can be used from an
+ interrupt context.
+
+ Description
+ This function is a malloc equivalent that will be called from the
+ API in callbacks. This function is required to be able to provide
+ memory in interrupt context.
+
+ Notes
+ For platforms where it is not possible to allocate memory in interrupt
+ context, we provide a reference allocator that takes memory during
+ initialization and implements malloc/free using this memory.
+ See the <install>/api/hal/fpga/cyashalblkalloc.[ch] files for the
+ implementation, and the <install>/api/hal/fpga/cyashalfpga.c file
+ for an example of the use of this allocator.
+
+ Returns
+ A pointer to the allocated block of memory
+
+ See Also
+ * CyAsHalCBFree
+ * CyAsHalAlloc
+*/
+EXTERN void *
+cy_as_hal_c_b_alloc(
+ /* The size of the memory block to allocate */
+ uint32_t size
+ );
+
+/* Summary
+ This function frees the memory allocated through the CyAsHalCBAlloc
+ call.
+
+ Description
+ This function frees memory allocated through the CyAsHalCBAlloc
+ call, and is also required to support calls from interrupt
+ context.
+
+ Returns
+ None
+
+ See Also
+ * CyAsHalCBAlloc
+ * CyAsHalFree
+*/
+EXTERN void
+cy_as_hal_c_b_free(
+ /* Pointer to the memory block to be freed */
+ void *ptr
+ );
+
+/* Summary
+ This function sets a block of memory to a specific value
+
+ Description
+ This function is the HAL layer equivalent of the memset() function.
+
+ Returns
+ None
+*/
+EXTERN void
+cy_as_mem_set(
+ /* A pointer to a block of memory to set */
+ void *ptr,
+ /* The value to set the memory to */
+ uint8_t value,
+ /* The number of bytes to set */
+ uint32_t cnt
+ );
+
+/* Summary
+ This function creates or initializes a sleep channel
+
+ Description
+ This function creates or initializes a sleep channel. The
+ sleep channel defined using the HAL data structure
+ CyAsHalSleepChannel.
+
+ Returns
+ CyTrue is the initialization was sucessful, and CyFalse otherwise
+
+ See Also
+ * CyAsHalSleepChannel
+ * CyAsHalDestroySleepChannel
+ * CyAsHalSleepOn
+ * CyAsHalWake
+*/
+EXTERN cy_bool
+cy_as_hal_create_sleep_channel(
+ /* Pointer to the sleep channel to create/initialize */
+ cy_as_hal_sleep_channel *chan
+ );
+
+/* Summary
+ This function destroys an existing sleep channel
+
+ Description
+ This function destroys an existing sleep channel. The sleep channel
+ is of type CyAsHalSleepChannel.
+
+ Returns
+ CyTrue if the channel was destroyed, and CyFalse otherwise
+
+ See Also
+ * CyAsHalSleepChannel
+ * CyAsHalCreateSleepChannel
+ * CyAsHalSleepOn
+ * CyAsHalWake
+*/
+EXTERN cy_bool
+cy_as_hal_destroy_sleep_channel(
+ /* The sleep channel to destroy */
+ cy_as_hal_sleep_channel chan
+ );
+
+/* Summary
+ This function causes the calling process or thread to sleep until
+ CyAsHalWake() is called
+
+ Description
+ This function causes the calling process or threadvto sleep.
+ When CyAsHalWake() is called on the same sleep channel, this
+ processes or thread is then wakened and allowed to run
+
+ Returns
+ CyTrue if the thread or process is asleep, and CyFalse otherwise
+
+ See Also
+ * CyAsHalSleepChannel
+ * CyAsHalWake
+*/
+EXTERN cy_bool
+cy_as_hal_sleep_on(
+ /* The sleep channel to sleep on */
+ cy_as_hal_sleep_channel chan,
+ /* The maximum time to sleep in milli-seconds */
+ uint32_t ms
+ );
+
+/* Summary
+ This function casues the process or thread sleeping on the given
+ sleep channel to wake
+
+ Description
+ This function causes the process or thread sleeping on the given
+ sleep channel to wake. The channel
+
+ Returns
+ CyTrue if the thread or process is awake, and CyFalse otherwise
+
+ See Also
+ * CyAsHalSleepChannel
+ * CyAsHalSleepOn
+*/
+EXTERN cy_bool
+cy_as_hal_wake(
+ /* The sleep channel to wake */
+ cy_as_hal_sleep_channel chan
+ );
+
+/* Summary
+ This function disables interrupts, insuring that short bursts
+ of code can be run without danger of interrupt handlers running.
+
+ Description
+ There are cases within the API when lists must be manipulated by
+ both the API and the associated interrupt handlers. In these
+ cases, interrupts must be disabled to insure the integrity of the
+ list during the modification. This function is used to disable
+ interrupts during the short intervals where these lists are being
+ changed.
+
+ The HAL must have the ability to nest calls to
+ CyAsHalDisableInterrupts and CyAsHalEnableInterrupts.
+
+ Returns
+ Any interrupt related state value which will be passed back into
+ the subsequent CyAsHalEnableInterrupts call.
+
+ See Also
+ * CyAsHalEnableInterrupts
+*/
+EXTERN uint32_t
+cy_as_hal_disable_interrupts();
+
+/* Summary
+ This function re-enables interrupts after a critical section of
+ code in the API has been completed.
+
+ Description
+ There are cases within the API when lists must be manipulated by
+ both the API and the associated interrupt handlers. In these
+ cases, interrupts must be disabled to insure the integrity of the
+ list during the modification. This function is used to enable
+ interrupts after the short intervals where these lists are being
+ changed.
+
+ See Also
+ * CyAsHalDisableInterrupts
+*/
+EXTERN void
+cy_as_hal_enable_interrupts(
+ /* Value returned by the previous CyAsHalDisableInterrupts call. */
+ uint32_t value
+ );
+
+/* Summary
+ This function sleeps for 150 ns.
+
+ Description
+ This function sleeps for 150 ns before allowing the calling function
+ to continue. This function is used for a specific purpose and the
+ sleep required is at least 150 ns.
+*/
+EXTERN void
+cy_as_hal_sleep150(
+ );
+
+/* Summary
+ This function sleeps for the given number of milliseconds
+
+ Description
+ This function sleeps for at least the given number of milliseonds
+*/
+EXTERN void
+cy_as_hal_sleep(
+ uint32_t ms
+ );
+
+/* Summary
+ This function asserts when the condition evaluates to zero
+
+ Description
+ Within the API there are conditions which are checked to insure
+ the integrity of the code. These conditions are checked only
+ within a DEBUG build. This function is used to check the condition
+ and if the result evaluates to zero, it should be considered a
+ fatal error that should be reported to Cypress.
+*/
+EXTERN void
+cy_as_hal_assert(
+ /* The condition to evaluate */
+ cy_bool cond
+ );
+
+/* Summary
+ This function prints a message from the API to a human readable device
+
+ Description
+ There are places within the West Bridge API where printing a message
+ is useful to the debug process. This function provides the mechanism
+ to print a message.
+
+ Returns
+ NONE
+*/
+EXTERN void
+cy_as_hal_print_message(
+ /* The message to print */
+ const char *fmt_p,
+ ... /* Variable arguments */
+ );
+
+/* Summary
+ This function reports whether the HAL implementation uses
+ polling to service data coming from the West Bridge.
+
+ Description
+ This function reports whether the HAL implementation uses
+ polling to service data coming from the West Bridge.
+
+ Returns
+ CyTrue if the HAL polls the West Bridge Interrupt Status registers
+ to complete operations, CyFalse if the HAL is interrupt driven.
+ */
+EXTERN cy_bool
+cy_as_hal_is_polling(
+ void);
+
+#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h
new file mode 100644
index 0000000..3d7063e
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h
@@ -0,0 +1,104 @@
+/* Cypress West Bridge API header file (cyasintr.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASINTR_H_
+#define _INCLUDED_CYASINTR_H_
+
+#include "cyasdevice.h"
+
+#include "cyas_cplus_start.h"
+
+/* Summary
+ Initialize the interrupt manager module
+
+ Description
+ This function is called to initialize the interrupt module.
+ This module enables interrupts as well as servies West Bridge
+ related interrupts by determining the source of the interrupt
+ and calling the appropriate handler function.
+
+ Notes
+ If the dmaintr parameter is TRUE, the initialization code
+ initializes the interrupt mask to have the DMA related interrupt
+ enabled via the general purpose interrupt. However, the interrupt
+ service function assumes that the DMA interrupt is handled by the
+ HAL layer before the interrupt module handler function is called.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the interrupt module was initialized
+ * correctly
+ * CY_AS_ERROR_ALREADY_RUNNING - the interrupt module was already
+ * started
+
+ See Also
+ * CyAsIntrStop
+ * CyAsServiceInterrupt
+*/
+cy_as_return_status_t
+cy_as_intr_start(
+ /* Device being initialized */
+ cy_as_device *dev_p,
+ /* If true, enable the DMA interrupt through the INT signal */
+ cy_bool dmaintr
+ );
+
+/* Summary
+ Stop the interrupt manager module
+
+ Description
+ This function stops the interrupt module and masks all interrupts
+ from the West Bridge device.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the interrupt module was stopped
+ * sucessfully
+ * CY_AS_ERROR_NOT_RUNNING - the interrupt module was not
+ * running
+
+ See Also
+ * CyAsIntrStart
+ * CyAsServiceInterrupt
+*/
+cy_as_return_status_t
+cy_as_intr_stop(
+ /* Device bein stopped */
+ cy_as_device *dev_p
+ );
+
+
+/* Summary
+ The interrupt service routine for West Bridge
+
+ Description
+ When an interrupt is detected, this function is called to
+ service the West Bridge interrupt. It is safe and efficient
+ for this function to be called when no West Bridge interrupt
+ has occurred. This function will determine it is not an West
+ Bridge interrupt quickly and return.
+*/
+void cy_as_intr_service_interrupt(
+ /* The USER supplied tag for this device */
+ cy_as_hal_device_tag tag
+ );
+
+#include "cyas_cplus_end.h"
+
+#endif /* _INCLUDED_CYASINTR_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslep2pep.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslep2pep.h
new file mode 100644
index 0000000..6626cc4
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslep2pep.h
@@ -0,0 +1,36 @@
+/* Cypress West Bridge API header file (cyaslep2pep.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASLEP2PEP_H_
+#define _INCLUDED_CYASLEP2PEP_H_
+
+#include "cyasdevice.h"
+
+extern cy_as_return_status_t
+cy_as_usb_map_logical2_physical(cy_as_device *dev_p);
+
+extern cy_as_return_status_t
+cy_as_usb_setup_dma(cy_as_device *dev_p);
+
+extern cy_as_return_status_t
+cy_as_usb_set_dma_sizes(cy_as_device *dev_p);
+
+#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslowlevel.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslowlevel.h
new file mode 100644
index 0000000..5c7972f
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslowlevel.h
@@ -0,0 +1,366 @@
+/* Cypress West Bridge API header file (cyaslowlevel.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASLOWLEVEL_H_
+#define _INCLUDED_CYASLOWLEVEL_H_
+
+/*@@Low Level Communications
+
+ Summary
+ The low level communications module is responsible for
+ communications between the West Bridge device and the P
+ port processor. Communications is organized as a series
+ of requests and subsequent responses. For each request
+ there is a one and only one response. Requests may go
+ from the West Bridge device to the P port processor, or
+ from the P Port processor to the West Bridge device.
+
+ Description
+ Requests are issued across what is called a context. A
+ context is a single channel of communications from one
+ processor to another processor. There can be only a single
+ request outstanding on a context at a given time. Contexts
+ are used to identify subsystems that can only process a
+ single request at a time, but are independent of other
+ contexts in the system. For instance, there is a context
+ for communicating storage commands from the P port processor
+ to the West Bridge device. There is also a context for
+ communicating USB commands from the P port processor to the
+ West Bridge device.
+
+ Requests and responses are identical with the exception of
+ the type bit in the request/response header. If the type
+ bit is one, the packet is a request. If this bit is zero,
+ the packet is a response. Also encoded within the header of
+ the request/response is the code. The code is a command
+ code for a request, or a response code for a response. For
+ a request, the code is a function of the context. The code
+ 0 has one meaning for the storage context and a different
+ meaning for the USB context. The code is treated differently
+ in the response. If the code in the response is less than 16,
+ then the meaning of the response is global across all
+ contexts. If the response is greater than or equal to 16,
+ then the response is specific to the associated context.
+
+ Requests and responses are transferred between processors
+ through the mailbox registers. It may take one or more cycles
+ to transmit a complete request or response. The context is
+ encoded into each cycle of the transfer to insure the
+ receiving processor can route the data to the appropriate
+ context for processing. In this way, the traffic from multiple
+ contexts can be multiplexed into a single data stream through
+ the mailbox registers by the sending processor, and
+ demultiplexed from the mailbox registers by the receiving
+ processor.
+
+ * Firmware Assumptions *
+ The firmware assumes that mailbox contents will be consumed
+ immediately. Therefore for multi-cycle packets, the data is
+ sent in a tight polling loop from the firmware. This implies
+ that the data must be read from the mailbox register on the P
+ port side and processed immediately or performance of the
+ firmware will suffer. In order to insure this is the case,
+ the data from the mailboxes is read and stored immediately
+ in a per context buffer. This occurs until the entire packet
+ is received at which time the request packet is processed.
+ Since the protocol is designed to allow for only one
+ outstanding packet at a time, the firmware can never be in a
+ position of waiting on the mailbox registers while the P port
+ is processing a request. Only after the response to the
+ previous request is sent will another request be sent.
+*/
+
+#include "cyashal.h"
+#include "cyasdevice.h"
+
+#include "cyas_cplus_start.h"
+
+/*
+ * Constants
+ */
+#define CY_AS_REQUEST_RESPONSE_CODE_MASK (0x00ff)
+#define CY_AS_REQUEST_RESPONSE_CONTEXT_MASK (0x0F00)
+#define CY_AS_REQUEST_RESPONSE_CONTEXT_SHIFT (8)
+#define CY_AS_REQUEST_RESPONSE_TYPE_MASK (0x4000)
+#define CY_AS_REQUEST_RESPONSE_LAST_MASK (0x8000)
+#define CY_AS_REQUEST_RESPONSE_CLEAR_STR_FLAG (0x1000)
+
+/*
+ * These macros extract the data from a 16 bit value
+ */
+#define cy_as_mbox_get_code(c) \
+ ((uint8_t)((c) & CY_AS_REQUEST_RESPONSE_CODE_MASK))
+#define cy_as_mbox_get_context(c) \
+ ((uint8_t)(((c) & CY_AS_REQUEST_RESPONSE_CONTEXT_MASK) \
+ >> CY_AS_REQUEST_RESPONSE_CONTEXT_SHIFT))
+#define cy_as_mbox_is_last(c) \
+ ((c) & CY_AS_REQUEST_RESPONSE_LAST_MASK)
+#define cy_as_mbox_is_request(c) \
+ (((c) & CY_AS_REQUEST_RESPONSE_TYPE_MASK) != 0)
+#define cy_as_mbox_is_response(c) \
+ (((c) & CY_AS_REQUEST_RESPONSE_TYPE_MASK) == 0)
+
+/*
+ * These macros (not yet written) pack data into or extract data
+ * from the m_box0 field of the request or response
+ */
+#define cy_as_ll_request_response__set_code(req, code) \
+ ((req)->box0 = \
+ ((req)->box0 & ~CY_AS_REQUEST_RESPONSE_CODE_MASK) | \
+ (code & CY_AS_REQUEST_RESPONSE_CODE_MASK))
+
+#define cy_as_ll_request_response__get_code(req) \
+ cy_as_mbox_get_code((req)->box0)
+
+#define cy_as_ll_request_response__set_context(req, context) \
+ ((req)->box0 |= ((context) << \
+ CY_AS_REQUEST_RESPONSE_CONTEXT_SHIFT))
+
+#define cy_as_ll_request_response__set_clear_storage_flag(req) \
+ ((req)->box0 |= CY_AS_REQUEST_RESPONSE_CLEAR_STR_FLAG)
+
+#define cy_as_ll_request_response__get_context(req) \
+ cy_as_mbox_get_context((req)->box0)
+
+#define cy_as_ll_request_response__is_last(req) \
+ cy_as_mbox_is_last((req)->box0)
+
+#define CY_an_ll_request_response___set_last(req) \
+ ((req)->box0 |= CY_AS_REQUEST_RESPONSE_LAST_MASK)
+
+#define cy_as_ll_request_response__is_request(req) \
+ cy_as_mbox_is_request((req)->box0)
+
+#define cy_as_ll_request_response__set_request(req) \
+ ((req)->box0 |= CY_AS_REQUEST_RESPONSE_TYPE_MASK)
+
+#define cy_as_ll_request_response__set_response(req) \
+ ((req)->box0 &= ~CY_AS_REQUEST_RESPONSE_TYPE_MASK)
+
+#define cy_as_ll_request_response__is_response(req) \
+ cy_as_mbox_is_response((req)->box0)
+
+#define cy_as_ll_request_response__get_word(req, offset) \
+ ((req)->data[(offset)])
+
+#define cy_as_ll_request_response__set_word(req, offset, \
+ value) ((req)->data[(offset)] = value)
+
+typedef enum cy_as_remove_request_result_t {
+ cy_as_remove_request_sucessful,
+ cy_as_remove_request_in_transit,
+ cy_as_remove_request_not_found
+} cy_as_remove_request_result_t;
+
+/* Summary
+ Start the low level communications module
+
+ Description
+*/
+cy_as_return_status_t
+cy_as_ll_start(
+ cy_as_device *dev_p
+ );
+
+cy_as_return_status_t
+cy_as_ll_stop(
+ cy_as_device *dev_p
+ );
+
+
+cy_as_ll_request_response *
+cy_as_ll_create_request(
+ cy_as_device *dev_p,
+ uint16_t code,
+ uint8_t context,
+ /* Length of the request in 16 bit words */
+ uint16_t length
+ );
+
+void
+cy_as_ll_init_request(
+ cy_as_ll_request_response *req_p,
+ uint16_t code,
+ uint16_t context,
+ uint16_t length);
+
+void
+cy_as_ll_init_response(
+ cy_as_ll_request_response *req_p,
+ uint16_t length);
+
+void
+cy_as_ll_destroy_request(
+ cy_as_device *dev_p,
+ cy_as_ll_request_response *);
+
+cy_as_ll_request_response *
+cy_as_ll_create_response(
+ cy_as_device *dev_p,
+ /* Length of the request in 16 bit words */
+ uint16_t length
+ );
+
+cy_as_remove_request_result_t
+cy_as_ll_remove_request(
+ cy_as_device *dev_p,
+ cy_as_context *ctxt_p,
+ cy_as_ll_request_response *req_p,
+ cy_bool force
+ );
+void
+cy_as_ll_remove_all_requests(cy_as_device *dev_p,
+ cy_as_context *ctxt_p);
+
+void
+cy_as_ll_destroy_response(
+ cy_as_device *dev_p,
+ cy_as_ll_request_response *);
+
+cy_as_return_status_t
+cy_as_ll_send_request(
+ /* The West Bridge device */
+ cy_as_device *dev_p,
+ /* The request to send */
+ cy_as_ll_request_response *req,
+ /* Storage for a reply, must be sure it is of sufficient size */
+ cy_as_ll_request_response *resp,
+ /* If true, this is a sync request */
+ cy_bool sync,
+ /* Callback to call when reply is received */
+ cy_as_response_callback cb
+);
+
+cy_as_return_status_t
+cy_as_ll_send_request_wait_reply(
+ /* The West Bridge device */
+ cy_as_device *dev_p,
+ /* The request to send */
+ cy_as_ll_request_response *req,
+ /* Storage for a reply, must be sure it is of sufficient size */
+ cy_as_ll_request_response *resp
+);
+
+/* Summary
+ This function registers a callback function to be called when a
+ request arrives on a given context.
+
+ Description
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+*/
+extern cy_as_return_status_t
+cy_as_ll_register_request_callback(
+ cy_as_device *dev_p,
+ uint8_t context,
+ cy_as_response_callback cb
+ );
+
+/* Summary
+ This function packs a set of bytes given by the data_p pointer
+ into a request, reply structure.
+*/
+extern void
+cy_as_ll_request_response__pack(
+ /* The destintation request or response */
+ cy_as_ll_request_response *req,
+ /* The offset of where to pack the data */
+ uint32_t offset,
+ /* The length of the data to pack in bytes */
+ uint32_t length,
+ /* The data to pack */
+ void *data_p
+ );
+
+/* Summary
+ This function unpacks a set of bytes from a request/reply
+ structure into a segment of memory given by the data_p pointer.
+*/
+extern void
+cy_as_ll_request_response__unpack(
+ /* The source of the data to unpack */
+ cy_as_ll_request_response *req,
+ /* The offset of the data to unpack */
+ uint32_t offset,
+ /* The length of the data to unpack in bytes */
+ uint32_t length,
+ /* The destination of the unpack operation */
+ void *data_p
+ );
+
+/* Summary
+ This function sends a status response back to the West Bridge
+ device in response to a previously send request
+*/
+extern cy_as_return_status_t
+cy_as_ll_send_status_response(
+ /* The West Bridge device */
+ cy_as_device *dev_p,
+ /* The context to send the response on */
+ uint8_t context,
+ /* The success/failure code to send */
+ uint16_t code,
+ /* Flag to clear wait on storage context */
+ uint8_t clear_storage);
+
+/* Summary
+ This function sends a response back to the West Bridge device.
+
+ Description
+ This function sends a response back to the West Bridge device.
+ The response is sent on the context given by the 'context'
+ variable. The code for the response is given by the 'code'
+ argument. The data for the response is given by the data and
+ length arguments.
+*/
+extern cy_as_return_status_t
+cy_as_ll_send_data_response(
+ /* The West Bridge device */
+ cy_as_device *dev_p,
+ /* The context to send the response on */
+ uint8_t context,
+ /* The response code to use */
+ uint16_t code,
+ /* The length of the data for the response */
+ uint16_t length,
+ /* The data for the response */
+ void *data
+);
+
+/* Summary
+ This function removes any requests of the given type
+ from the given context.
+
+ Description
+ This function removes requests of a given type from the
+ context given via the context number.
+*/
+extern cy_as_return_status_t
+cy_as_ll_remove_ep_data_requests(
+ /* The West Bridge device */
+ cy_as_device *dev_p,
+ cy_as_end_point_number_t ep
+ );
+
+#include "cyas_cplus_end.h"
+
+#endif /* _INCLUDED_CYASLOWLEVEL_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmedia.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmedia.h
new file mode 100644
index 0000000..0e25ea9
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmedia.h
@@ -0,0 +1,54 @@
+/* Cypress West Bridge API header file (cyasmedia.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASMEDIA_H_
+#define _INCLUDED_CYASMEDIA_H_
+
+#include "cyas_cplus_start.h"
+
+
+/* Summary
+ Specifies a specific type of media supported by West Bridge
+
+ Description
+ The West Bridge device supports five specific types of media
+ as storage/IO devices attached to it's S-Port. This type is
+ used to indicate the type of media being referenced in any
+ API call.
+*/
+typedef enum cy_as_media_type {
+ /* Flash NAND memory (may be SLC or MLC) */
+ cy_as_media_nand = 0x00,
+ /* An SD flash memory device */
+ cy_as_media_sd_flash = 0x01,
+ /* An MMC flash memory device */
+ cy_as_media_mmc_flash = 0x02,
+ /* A CE-ATA disk drive */
+ cy_as_media_ce_ata = 0x03,
+ /* SDIO device. */
+ cy_as_media_sdio = 0x04,
+ cy_as_media_max_media_value = 0x05
+
+} cy_as_media_type;
+
+#include "cyas_cplus_end.h"
+
+#endif /* _INCLUDED_CYASMEDIA_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h
new file mode 100644
index 0000000..b555c6c
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h
@@ -0,0 +1,1549 @@
+/* Cypress West Bridge API header file (cyasmisc.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASMISC_H_
+#define _INCLUDED_CYASMISC_H_
+
+#include "cyashal.h"
+#include "cyastypes.h"
+#include "cyasmedia.h"
+
+#include "cyas_cplus_start.h"
+
+#define CY_AS_LEAVE_STANDBY_DELAY_CLOCK (1)
+#define CY_AS_RESET_DELAY_CLOCK (1)
+
+#define CY_AS_LEAVE_STANDBY_DELAY_CRYSTAL (5)
+#define CY_AS_RESET_DELAY_CRYSTAL (5)
+
+/* The maximum number of buses supported */
+#define CY_AS_MAX_BUSES (2)
+
+/* The maximum number of storage devices supported per bus */
+#define CY_AS_MAX_STORAGE_DEVICES (1)
+
+#define CY_AS_FUNCTCBTYPE_DATA_MASK (0x60000000U)
+#define CY_AS_FUNCTCBTYPE_TYPE_MASK (0x1FFFFFFFU)
+
+#define cy_as_funct_c_b_type_get_type(t) \
+ ((cy_as_funct_c_b_type)((t) & CY_AS_FUNCTCBTYPE_TYPE_MASK))
+#define cy_as_funct_c_b_type_contains_data(t) \
+ (((cy_as_funct_c_b_type)((t) & \
+ CY_AS_FUNCTCBTYPE_DATA_MASK)) == CY_FUNCT_CB_DATA)
+
+/**************************************
+ * West Bridge Types
+ **************************************/
+
+/* Summary
+ Specifies a handle to an West Bridge device
+
+ Description
+ This type represents an opaque handle to an West Bridge device.
+ This handle is created via the CyAsMiscCreateDevice() function
+ and is used in all subsequent calls that communicate to the West
+ Bridge device.
+
+ See Also
+ * CyAsMiscCreateDevice
+ * CyAsMiscDestroyDevice
+*/
+typedef void *cy_as_device_handle;
+
+/* Summary
+ This data type gives the mode for the DACK# signal
+*/
+typedef enum cy_as_device_dack_mode {
+ cy_as_device_dack_ack, /* Operate in the ACK mode */
+ cy_as_device_dack_eob /* Operate in the EOB mode */
+} cy_as_device_dack_mode;
+
+/* Summary
+ This data structure gives the options for all hardware features.
+
+ Description
+ This structure contains the information required to initialize the
+ West Bridge hardware. Any features of the device that can be
+ configured by the caller are specified here.
+
+ See Also
+ * CyAsMiscConfigure
+*/
+typedef struct cy_as_device_config {
+ /* If TRUE, the P port is running in SRAM mode. */
+ cy_bool srammode;
+ /* If TRUE, the P port is synchronous, otherwise async */
+ cy_bool sync;
+ /* If TRUE, DMA req will be delivered via the interrupt signal */
+ cy_bool dmaintr;
+ /* Mode for the DACK# signal */
+ cy_as_device_dack_mode dackmode;
+ /* If TRUE, the DRQ line is active high, otherwise active low */
+ cy_bool drqpol;
+ /* If TRUE, the DACK line is active high, otherwise active low */
+ cy_bool dackpol;
+ /* If TRUE, the clock is connected to a crystal, otherwise it is
+ connected to a clock */
+ cy_bool crystal;
+} cy_as_device_config;
+
+
+/* Summary
+ Specifies a resource that can be owned by either the West Bridge
+ device or by the processor.
+
+ Description
+ This enumerated type identifies a resource that can be owned
+ either by the West Bridge device, or by the processor attached to
+ the P port of the West Bridge device.
+
+ See Also
+ * CyAsMiscAcquireResource
+ * CyAsMiscReleaseResource
+*/
+typedef enum cy_as_resource_type {
+ cy_as_bus_u_s_b = 0, /* The USB D+ and D- pins */
+ cy_as_bus_1 = 1, /* The SDIO bus */
+ cy_as_bus_0 = 2 /* The NAND bus (not implemented) */
+} cy_as_resource_type;
+
+/* Summary
+ Specifies the reset type for a software reset operation.
+
+ Description
+ When the West Bridge device is reset, there are two types of
+ reset that arE possible. This type indicates the type of reset
+ requested.
+
+ Notes
+ Both of these reset types are software based resets; and are
+ distinct from a chip level HARD reset that is applied through
+ the reset pin on the West Bridge.
+
+ The CyAsResetSoft type resets only the on-chip micro-controller
+ in the West Bridge. In this case, the previously loaded firmware
+ will continue running. However, the Storage and USB stack
+ operations will need to be restarted, as any state relating to
+ these would have been lost.
+
+ The CyAsResetHard type resets the entire West Bridge chip, and will
+ need a fresh configuration and firmware download.
+
+ See Also
+ * <LINK CyAsMiscReset>
+ */
+
+typedef enum cy_as_reset_type {
+ /* Just resets the West Bridge micro-controller */
+ cy_as_reset_soft,
+ /* Resets entire device, firmware must be reloaded and
+ the west bridge device must be re-initialized */
+ cy_as_reset_hard
+} cy_as_reset_type;
+
+
+
+/* Summary
+ This type specifies the polarity of the SD power pin.
+
+ Description
+ Sets the SD power pin ( port C, bit 6) to active low or
+ active high.
+
+*/
+
+typedef enum cy_as_misc_signal_polarity {
+ cy_as_misc_active_high,
+ cy_as_misc_active_low
+
+} cy_as_misc_signal_polarity;
+
+
+
+/* Summary
+ This type specifies the type of the data returned by a Function
+ Callback.
+
+ Description
+ CY_FUNCT_CB_NODATA - This callback does not return any additional
+ information in the data field.
+ CY_FUNCT_CB_DATA - The data field is used, and the CyAsFunctCBType
+ will also contain the type of this data.
+
+ See Also
+ CyAsFunctionCallback
+*/
+typedef enum cy_as_funct_c_b_type {
+ CY_FUNCT_CB_INVALID = 0x0U,
+ /* Data from a CyAsMiscGetFirmwareVersion call. */
+ CY_FUNCT_CB_MISC_GETFIRMWAREVERSION,
+ /* Data from a CyAsMiscHeartBeatControl call. */
+ CY_FUNCT_CB_MISC_HEARTBEATCONTROL,
+ /* Data from a CyAsMiscAcquireResource call. */
+ CY_FUNCT_CB_MISC_ACQUIRERESOURCE,
+ /* Data from a CyAsMiscReadMCURegister call. */
+ CY_FUNCT_CB_MISC_READMCUREGISTER,
+ /* Data from a CyAsMiscWriteMCURegister call. */
+ CY_FUNCT_CB_MISC_WRITEMCUREGISTER,
+ /* Data from a CyAsMiscSetTraceLevel call. */
+ CY_FUNCT_CB_MISC_SETTRACELEVEL,
+ /* Data from a CyAsMiscStorageChanged call. */
+ CY_FUNCT_CB_MISC_STORAGECHANGED,
+ /* Data from a CyAsMiscGetGpioValue call. */
+ CY_FUNCT_CB_MISC_GETGPIOVALUE,
+ /* Data from a CyAsMiscSetGpioValue call. */
+ CY_FUNCT_CB_MISC_SETGPIOVALUE,
+ /* Data from a CyAsMiscDownloadFirmware call. */
+ CY_FUNCT_CB_MISC_DOWNLOADFIRMWARE,
+ /* Data from a CyAsMiscEnterStandby call. */
+ CY_FUNCT_CB_MISC_ENTERSTANDBY,
+ /* Data from a CyAsMiscEnterSuspend call. */
+ CY_FUNCT_CB_MISC_ENTERSUSPEND,
+ /* Data from a CyAsMiscLeaveSuspend call. */
+ CY_FUNCT_CB_MISC_LEAVESUSPEND,
+ /* Data from a CyAsMiscReset call. */
+ CY_FUNCT_CB_MISC_RESET,
+ /* Data from a CyAsMiscSetLowSpeedSDFreq or
+ * CyAsMiscSetHighSpeedSDFreq call. */
+ CY_FUNCT_CB_MISC_SETSDFREQ,
+ /* Data from a CyAsMiscSwitchPnandMode call */
+ CY_FUNCT_CB_MISC_RESERVELNABOOTAREA,
+ /* Data from a CyAsMiscSetSDPowerPolarity call */
+ CY_FUNCT_CB_MISC_SETSDPOLARITY,
+
+ /* Data from a CyAsStorageStart call. */
+ CY_FUNCT_CB_STOR_START,
+ /* Data from a CyAsStorageStop call. */
+ CY_FUNCT_CB_STOR_STOP,
+ /* Data from a CyAsStorageClaim call. */
+ CY_FUNCT_CB_STOR_CLAIM,
+ /* Data from a CyAsStorageRelease call. */
+ CY_FUNCT_CB_STOR_RELEASE,
+ /* Data from a CyAsStorageQueryMedia call. */
+ CY_FUNCT_CB_STOR_QUERYMEDIA,
+ /* Data from a CyAsStorageQueryBus call. */
+ CY_FUNCT_CB_STOR_QUERYBUS,
+ /* Data from a CyAsStorageQueryDevice call. */
+ CY_FUNCT_CB_STOR_QUERYDEVICE,
+ /* Data from a CyAsStorageQueryUnit call. */
+ CY_FUNCT_CB_STOR_QUERYUNIT,
+ /* Data from a CyAsStorageDeviceControl call. */
+ CY_FUNCT_CB_STOR_DEVICECONTROL,
+ /* Data from a CyAsStorageSDRegisterRead call. */
+ CY_FUNCT_CB_STOR_SDREGISTERREAD,
+ /* Data from a CyAsStorageCreatePartition call. */
+ CY_FUNCT_CB_STOR_PARTITION,
+ /* Data from a CyAsStorageGetTransferAmount call. */
+ CY_FUNCT_CB_STOR_GETTRANSFERAMOUNT,
+ /* Data from a CyAsStorageErase call. */
+ CY_FUNCT_CB_STOR_ERASE,
+ /* Data from a CyAsStorageCancelAsync call. */
+ CY_FUNCT_CB_ABORT_P2S_XFER,
+ /* Data from a CyAsUsbStart call. */
+ CY_FUNCT_CB_USB_START,
+ /* Data from a CyAsUsbStop call. */
+ CY_FUNCT_CB_USB_STOP,
+ /* Data from a CyAsUsbConnect call. */
+ CY_FUNCT_CB_USB_CONNECT,
+ /* Data from a CyAsUsbDisconnect call. */
+ CY_FUNCT_CB_USB_DISCONNECT,
+ /* Data from a CyAsUsbSetEnumConfig call. */
+ CY_FUNCT_CB_USB_SETENUMCONFIG,
+ /* Data from a CyAsUsbGetEnumConfig call. */
+ CY_FUNCT_CB_USB_GETENUMCONFIG,
+ /* Data from a CyAsUsbSetDescriptor call. */
+ CY_FUNCT_CB_USB_SETDESCRIPTOR,
+ /* Data from a CyAsUsbGetDescriptor call. */
+ CY_FUNCT_CB_USB_GETDESCRIPTOR,
+ /* Data from a CyAsUsbCommitConfig call. */
+ CY_FUNCT_CB_USB_COMMITCONFIG,
+ /* Data from a CyAsUsbGetNak call. */
+ CY_FUNCT_CB_USB_GETNAK,
+ /* Data from a CyAsUsbGetStall call. */
+ CY_FUNCT_CB_USB_GETSTALL,
+ /* Data from a CyAsUsbSignalRemoteWakeup call. */
+ CY_FUNCT_CB_USB_SIGNALREMOTEWAKEUP,
+ /* Data from a CyAnUsbClearDescriptors call. */
+ CY_FUNCT_CB_USB_CLEARDESCRIPTORS,
+ /* Data from a CyAnUsbSetMSReportThreshold call. */
+ CY_FUNCT_CB_USB_SET_MSREPORT_THRESHOLD,
+ /* Data from a CyAsMTPStart call. */
+ CY_FUNCT_CB_MTP_START,
+ /* Data from a CyAsMTPStop call. */
+ CY_FUNCT_CB_MTP_STOP,
+ /* Data from a CyAsMTPInitSendObject call. */
+ CY_FUNCT_CB_MTP_INIT_SEND_OBJECT,
+ /* Data from a CyAsMTPCancelSendObject call. */
+ CY_FUNCT_CB_MTP_CANCEL_SEND_OBJECT,
+ /* Data from a CyAsMTPInitGetObject call. */
+ CY_FUNCT_CB_MTP_INIT_GET_OBJECT,
+ /* Data from a CyAsMTPCancelGetObject call. */
+ CY_FUNCT_CB_MTP_CANCEL_GET_OBJECT,
+ /* Data from a CyAsMTPSendBlockTable call. */
+ CY_FUNCT_CB_MTP_SEND_BLOCK_TABLE,
+ /* Data from a CyAsMTPStopStorageOnly call. */
+ CY_FUNCT_CB_MTP_STOP_STORAGE_ONLY,
+ CY_FUNCT_CB_NODATA = 0x40000000U,
+ CY_FUNCT_CB_DATA = 0x20000000U
+} cy_as_funct_c_b_type;
+
+/* Summary
+ This type specifies the general West Bridge function callback.
+
+ Description
+ This callback is supplied as an argument to all asynchronous
+ functions in the API. It iS called after the asynchronous function
+ has completed.
+
+ See Also
+ CyAsFunctCBType
+*/
+typedef void (*cy_as_function_callback)(
+ cy_as_device_handle handle,
+ cy_as_return_status_t status,
+ uint32_t client,
+ cy_as_funct_c_b_type type,
+ void *data);
+
+/* Summary
+ This type specifies the general West Bridge event that has
+ occurred.
+
+ Description
+ This type is used in the West Bridge misc callback function to
+ indicate the type of callback.
+
+ See Also
+*/
+typedef enum cy_as_misc_event_type {
+ /* This event is sent when West Bridge has finished
+ initialization and is ready to respond to API calls. */
+ cy_as_event_misc_initialized = 0,
+
+ /* This event is sent when West Bridge has left the
+ standby state and is ready to respond to commands again. */
+ cy_as_event_misc_awake,
+
+ /* This event is sent periodically from the firmware
+ to the processor. */
+ cy_as_event_misc_heart_beat,
+
+ /* This event is sent when the West Bridge has left the
+ suspend mode and is ready to respond to commands
+ again. */
+ cy_as_event_misc_wakeup,
+
+ /* This event is sent when the firmware image downloaded
+ cannot run on the active west bridge device. */
+ cy_as_event_misc_device_mismatch
+} cy_as_misc_event_type;
+
+/* Summary
+ This type is the type of a callback function that is called when a
+ West Bridge misc event occurs.
+
+ Description
+ At times West Bridge needs to inform the P port processor of events
+ that have occurred. These events are asynchronous to the thread of
+ control on the P port processor and as such are generally delivered
+ via a callback function that is called as part of an interrupt
+ handler. This type defines the type of function that must be provided
+ as a callback function for West Bridge misc events.
+
+ See Also
+ * CyAsMiscEventType
+*/
+typedef void (*cy_as_misc_event_callback)(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* The event type being reported */
+ cy_as_misc_event_type ev,
+ /* The data assocaited with the event being reported */
+ void *evdata
+);
+
+#ifndef __doxygen__
+/* Summary
+ This enum provides info of various firmware trace levels.
+
+ Description
+
+ See Also
+ * CyAsMiscSetTraceLevel
+*/
+enum {
+ CYAS_FW_TRACE_LOG_NONE = 0, /* Log nothing. */
+ CYAS_FW_TRACE_LOG_STATE, /* Log state information. */
+ CYAS_FW_TRACE_LOG_CALLS, /* Log function calls. */
+ CYAS_FW_TRACE_LOG_STACK_TRACE, /* Log function calls with args. */
+ CYAS_FW_TRACE_MAX_LEVEL /* Max trace level sentinel. */
+};
+#endif
+
+/* Summary
+ This enum lists the controllable GPIOs of the West Bridge device.
+
+ Description
+ The West Bridge device has GPIOs that can be used for user defined functions.
+ This enumeration lists the GPIOs that are available on the device.
+
+ Notes
+ All of the GPIOs except UVALID can only be accessed when using West Bridge
+ firmware images that support only SD/MMC/MMC+ storage devices. This
+ functionality is not supported in firmware images that support NAND
+ storage.
+
+ See Also
+ * CyAsMiscGetGpioValue
+ * CyAsMiscSetGpioValue
+ */
+typedef enum {
+ cy_as_misc_gpio_0 = 0, /* GPIO[0] pin */
+ cy_as_misc_gpio_1, /* GPIO[1] pin */
+ cy_as_misc_gpio__nand_CE, /* NAND_CE pin, output only */
+ cy_as_misc_gpio__nand_CE2, /* NAND_CE2 pin, output only */
+ cy_as_misc_gpio__nand_WP, /* NAND_WP pin, output only */
+ cy_as_misc_gpio__nand_CLE, /* NAND_CLE pin, output only */
+ cy_as_misc_gpio__nand_ALE, /* NAND_ALE pin, output only */
+ /* SD_POW pin, output only, do not drive low while storage is active */
+ cy_as_misc_gpio_SD_POW,
+ cy_as_misc_gpio_U_valid /* UVALID pin */
+} cy_as_misc_gpio;
+
+/* Summary
+ This enum lists the set of clock frequencies that are supported for
+ working with low speed SD media.
+
+ Description
+ West Bridge firmware uses a clock frequency less than the maximum
+ possible rate for low speed SD media. This can be changed to a
+ setting equal to the maximum frequency as desired by the user. This
+ enumeration lists the different frequency settings that are
+ supported.
+
+ See Also
+ * CyAsMiscSetLowSpeedSDFreq
+ */
+typedef enum cy_as_low_speed_sd_freq {
+ /* Approx. 21.82 MHz, default value */
+ CY_AS_SD_DEFAULT_FREQ = 0,
+ /* 24 MHz */
+ CY_AS_SD_RATED_FREQ
+} cy_as_low_speed_sd_freq;
+
+/* Summary
+ This enum lists the set of clock frequencies that are supported
+ for working with high speed SD media.
+
+ Description
+ West Bridge firmware uses a 48 MHz clock by default to interface
+ with high speed SD/MMC media. This can be changed to 24 MHz if
+ so desired by the user. This enum lists the different frequencies
+ that are supported.
+
+ See Also
+ * CyAsMiscSetHighSpeedSDFreq
+ */
+typedef enum cy_as_high_speed_sd_freq {
+ CY_AS_HS_SD_FREQ_48, /* 48 MHz, default value */
+ CY_AS_HS_SD_FREQ_24 /* 24 MHz */
+} cy_as_high_speed_sd_freq;
+
+/* Summary
+ Struct encapsulating all information returned by the
+ CyAsMiscGetFirmwareVersion call.
+
+ Description
+ This struct encapsulates all return values from the asynchronous
+ CyAsMiscGetFirmwareVersion call, so that a single data argument
+ can be passed to the user provided callback function.
+
+ See Also
+ * CyAsMiscGetFirmwareVersion
+ */
+typedef struct cy_as_get_firmware_version_data {
+ /* Return value for major version number for the firmware */
+ uint16_t major;
+ /* Return value for minor version number for the firmware */
+ uint16_t minor;
+ /* Return value for build version number for the firmware */
+ uint16_t build;
+ /* Return value for media types supported in the current firmware */
+ uint8_t media_type;
+ /* Return value to indicate the release or debug mode of firmware */
+ cy_bool is_debug_mode;
+} cy_as_get_firmware_version_data;
+
+
+/*****************************
+ * West Bridge Functions
+ *****************************/
+
+/* Summary
+ This function creates a new West Bridge device and returns a
+ handle to the device.
+
+ Description
+ This function initializes the API object that represents the West
+ Bridge device and returns a handle to this device. This handle is
+ required for all West Bridge related functions to identify the
+ specific West Bridge device.
+
+ * Valid In Asynchronous Callback: NO
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+ * CY_AS_ERROR_OUT_OF_MEMORY
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_create_device(
+ /* Return value for handle to created device */
+ cy_as_device_handle *handle_p,
+ /* The HAL specific tag for this device */
+ cy_as_hal_device_tag tag
+ );
+
+/* Summary
+ This functions destroys a previously created West Bridge device.
+
+ Description
+ When an West Bridge device is created, an opaque handle is returned
+ that represents the device. This function destroys that handle and
+ frees all resources associated with the handle.
+
+ * Valid In Asynchronous Callback: NO
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_STILL_RUNNING - The USB or STORAGE stacks are still
+ * running, they must be stopped before the device can be destroyed
+ * CY_AS_ERROR_DESTROY_SLEEP_CHANNEL_FAILED - the HAL layer failed to
+ * destroy a sleep channel
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_destroy_device(
+ /* Handle to the device to destroy */
+ cy_as_device_handle handle
+ );
+
+/* Summary
+ This function initializes the hardware for basic communication with
+ West Bridge.
+
+ Description
+ This function intializes the hardware to establish basic
+ communication with the West Bridge device. This is always the first
+ function called to initialize communication with the West Bridge
+ device.
+
+ * Valid In Asynchronous Callback: NO
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the basic initialization was completed
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_IN_STANDBY
+ * CY_AS_ERROR_ALREADY_RUNNING
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_NO_ANTIOCH - cannot find the West Bridge device
+ * CY_AS_ERROR_CREATE_SLEEP_CHANNEL_FAILED -
+ * the HAL layer falied to create a sleep channel
+
+ See Also
+ * CyAsDeviceConfig
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_configure_device(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* Configuration information */
+ cy_as_device_config *config_p
+ );
+
+/* Summary
+ This function returns non-zero if West Bridge is in standby and
+ zero otherwise.
+
+ Description
+ West Bridge supports a standby mode. This function is used to
+ query West Bridge to determine if West Bridge is in a standby
+ mode.
+
+ * Valid In Asynchronous Callback: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+ * CY_AS_ERROR_INVALID_HANDLE
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_in_standby(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* Return value for standby state */
+ cy_bool *standby
+ );
+
+/* Summary
+ This function downloads the firmware to West Bridge device.
+
+ Description
+ This function downloads firmware from a given location and with a
+ given size to the West Bridge device. After the firmware is
+ downloaded the West Bridge device is moved out of configuration
+ mode causing the firmware to be executed. It is an error to call
+ this function when the device is not in configuration mode. The
+ device is in configuration mode on power up and may be placed in
+ configuration mode after power up with a hard reset.
+
+ Notes
+ The firmware must be on a word align boundary.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the firmware was sucessfully downloaded
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * was not configured
+ * CY_AS_ERROR_NOT_IN_CONFIG_MODE
+ * CY_AS_ERROR_INVALID_SIZE - the size of the firmware
+ * exceeded 32768 bytes
+ * CY_AS_ERROR_ALIGNMENT_ERROR
+ * CY_AS_ERROR_IN_STANDBY - trying to download
+ * while in standby mode
+ * CY_AS_ERROR_TIMEOUT
+
+ See Also
+ * CyAsMiscReset
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_download_firmware(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* Pointer to the firmware to be downloaded */
+ const void *fw_p,
+ /* The size of the firmware in bytes */
+ uint16_t size,
+ /* Callback to call when the operation is complete. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+
+/* Summary
+ This function returns the version number of the firmware running in
+ the West Bridge device.
+
+ Description
+ This function queries the West Bridge device and retreives the
+ firmware version number. If the firmware is not loaded an error is
+ returned indicated no firmware has been loaded.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the firmware version number was retreived
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been downloaded
+ * to the device
+ * CY_AS_ERROR_IN_STANDBY
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_TIMEOUT - there was a timeout waiting for a response
+ * from the West Bridge firmware
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_get_firmware_version(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* Return values indicating the firmware version. */
+ cy_as_get_firmware_version_data *data,
+ /* Callback to call when the operation is complete. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+#if !defined(__doxygen__)
+
+/* Summary
+ This function reads and returns the contents of an MCU accessible
+ register on the West Bridge.
+
+ Description
+ This function requests the firmware to read and return the contents
+ of an MCU accessible register through the mailboxes.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the register content was retrieved.
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_TIMEOUT - there was a timeout waiting for a response
+ * from the West Bridge firmware
+ * CY_AS_ERROR_INVALID_RESPONSE - the firmware build does not
+ * support this command.
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_read_m_c_u_register(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* Address of the register to read */
+ uint16_t address,
+ /* Return value for the MCU register content */
+ uint8_t *value,
+ /* Callback to call when the operation is complete. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+/* Summary
+ This function writes to an MCU accessible register on the West Bridge.
+
+ Description
+ This function requests the firmware to write a specified value to an
+ MCU accessible register through the mailboxes.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Notes
+ This function is only for internal use by the West Bridge API layer.
+ Calling this function directly can cause device malfunction.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the register content was updated.
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_TIMEOUT - there was a timeout waiting for a response
+ * from the West Bridge firmware
+ * CY_AS_ERROR_INVALID_RESPONSE - the firmware build does not support
+ * this command.
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_write_m_c_u_register(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* Address of the register to write */
+ uint16_t address,
+ /* Mask to be applied on the register contents. */
+ uint8_t mask,
+ /* Data to be ORed with the register contents. */
+ uint8_t value,
+ /* Callback to call when the operation is complete. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+#endif
+
+/* Summary
+ This function will reset the West Bridge device and software API.
+
+ Description
+ This function will reset the West Bridge device and software API.
+ The reset operation can be a hard reset or a soft reset. A hard
+ reset will reset all aspects of the West Bridge device. The device
+ will enter the configuration state and the firmware will have to be
+ reloaded. The device will also have to be re-initialized. A soft
+ reset just resets the West Bridge micro-controller.
+
+ * Valid In Asynchronous Callback: NO
+
+ Notes
+ When a hard reset is issued, the firmware that may have been
+ previously loaded will be lost and any configuration information set
+ via CyAsMiscConfigureDevice() will be lost. This will be reflected
+ in the API maintained state of the device. In order to re-establish
+ communications with the West Bridge device, CyAsMiscConfigureDevice()
+ and CyAsMiscDownloadFirmware() must be called again.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the device has been reset
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE
+ * CY_AS_ERROR_NOT_YET_SUPPORTED - current soft reset is not supported
+ * CY_AS_ERROR_ASYNC_PENDING - Reset is unable to flush pending async
+ * reads/writes in polling mode.
+
+
+ See Also
+ * CyAsMiscReset
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_reset(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* The type of reset to perform */
+ cy_as_reset_type type,
+ /* If true, flush all pending writes to mass storage
+ before performing the reset. */
+ cy_bool flush,
+ /* Callback to call when the operation is complete. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+/* Summary
+ This function acquires a given resource.
+
+ Description
+ There are resources in the system that are shared between the
+ West Bridge device and the processor attached to the P port of
+ the West Bridge device. This API provides a mechanism for the
+ P port processor to acquire ownership of a resource.
+
+ Notes
+ The ownership of the resources controlled by CyAsMiscAcquireResource()
+ and CyAsMiscReleaseResource() defaults to a known state at hardware
+ reset. After the firmware is loaded and begins execution the state of
+ these resources may change. At any point if the P Port processor needs
+ to acquire a resource it should do so explicitly to be sure of
+ ownership.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the p port sucessfully acquired the
+ * resource of interest
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE
+ * CY_AS_ERROR_INVALID_RESOURCE
+ * CY_AS_ERROR_RESOURCE_ALREADY_OWNED - the p port already
+ * owns this resource
+ * CY_AS_ERROR_NOT_ACQUIRED - the resource cannot be acquired
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_TIMEOUT - there was a timeout waiting for a
+ * response from the West Bridge firmware
+
+ See Also
+ * CyAsResourceType
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_acquire_resource(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* The resource to acquire */
+ cy_as_resource_type *resource,
+ /* If true, force West Bridge to release the resource */
+ cy_bool force,
+ /* Callback to call when the operation is complete. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+/* Summary
+ This function releases a given resource.
+
+ Description
+ There are resources in the system that are shared between the
+ West Bridge device and the processor attached to the P port of
+ the West Bridge device. This API provides a mechanism for the
+ P port processor to release a resource that has previously been
+ acquired via the CyAsMiscAcquireResource() call.
+
+ * Valid In Asynchronous Callback: NO
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the p port sucessfully released
+ * the resource of interest
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE
+ * CY_AS_ERROR_INVALID_RESOURCE
+ * CY_AS_ERROR_RESOURCE_NOT_OWNED - the p port does not own the
+ * resource of interest
+
+ See Also
+ * CyAsResourceType
+ * CyAsMiscAcquireResource
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_release_resource(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* The resource to release */
+ cy_as_resource_type resource
+ );
+
+#ifndef __doxygen__
+/* Summary
+ This function sets the trace level for the West Bridge firmware.
+
+ Description
+ The West Bridge firmware has the ability to store information
+ about the state and execution path of the firmware on a mass storage
+ device attached to the West Bridge device. This function configures
+ the specific mass storage device to be used and the type of information
+ to be stored. This state information is used for debugging purposes
+ and must be interpreted by a Cypress provided tool.
+
+ *Trace Level*
+ The trace level indicates the amount of information to output.
+ * 0 = no trace information is output
+ * 1 = state information is output
+ * 2 = function call information is output
+ * 3 = function call, arguments, and return value information is output
+
+ * Valid In Asynchronous Callback: NO
+
+ Notes
+ The media device and unit specified in this call will be overwritten
+ and any data currently stored on this device and unit will be lost.
+
+ * NOT IMPLEMENTED YET
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the trace configuration has been
+ * sucessfully changed
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
+ * pair does not exist
+ * CY_AS_ERROR_NO_SUCH_UNIT - the unit specified does not exist
+ * CY_AS_ERROR_INVALID_TRACE_LEVEL - the trace level requested
+ * does not exist
+ * CY_AS_ERROR_TIMEOUT - there was a timeout waiting for a
+ * response from the West Bridge firmware
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_set_trace_level(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* The trace level */
+ uint8_t level,
+ /* The bus for the output */
+ cy_as_bus_number_t bus,
+ /* The device for the output */
+ uint32_t device,
+ /* The unit for the output */
+ uint32_t unit,
+ /* Callback to call when the operation is complete. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+#endif
+
+/* Summary
+ This function places West Bridge into the low power standby mode.
+
+ Description
+ This function places West Bridge into a low power (sleep) mode, and
+ cannot be called while the USB stack is active. This function first
+ instructs the West Bridge firmware that the device is about to be
+ placed into sleep mode. This allows West Bridge to complete any pending
+ storage operations. After the West Bridge device has responded that
+ pending operations are complete, the device is placed in standby mode.
+
+ There are two methods of placing the device in standby mode. If the
+ WAKEUP pin of the West Bridge is connected to a GPIO on the processor,
+ the pin is de-asserted (via the HAL layer) and West Bridge enters into
+ a sleep mode. If the WAKEUP pin is not accessible, the processor can
+ write into the power management control/status register on the West
+ Bridge to put the device into sleep mode.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the function completed and West Bridge
+ * is in sleep mode
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_ALREADY_STANDBY - the West Bridge device is already
+ * in sleep mode
+ * CY_AS_ERROR_TIMEOUT - there was a timeout waiting for a response
+ * from the West Bridge firmware
+ * CY_AS_ERROR_NOT_SUPPORTED - the HAL layer does not support changing
+ * the WAKEUP pin
+ * CY_AS_ERROR_USB_RUNNING - The USB stack is still running when the
+ * EnterStandby call is made
+ * CY_AS_ERROR_ASYNC_PENDING
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+ * CY_AS_ERROR_SETTING_WAKEUP_PIN
+ * CY_AS_ERROR_ASYNC_PENDING - In polling mode EnterStandby can not
+ * be called until all pending storage read/write requests have
+ * finished.
+
+ See Also
+ * CyAsMiscLeaveStandby
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_enter_standby_e_x_u(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* If true, use the wakeup pin, otherwise use the register */
+ cy_bool pin,
+ /* Set true to enable specific usages of the
+ UVALID signal, please refer to AN xx or ERRATA xx */
+ cy_bool uvalid_special,
+ /* Callback to call when the operation is complete. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+/* Summary
+ This function is provided for backwards compatibility.
+
+ Description
+ Calling this function is the same as calling CyAsMiscEnterStandbyEx
+ with True for the lowpower parameter.
+
+ See Also
+ * CyAsMiscEnterStandbyEx
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_enter_standby(cy_as_device_handle handle,
+ cy_bool pin,
+ cy_as_function_callback cb,
+ uint32_t client
+ );
+
+/* Summary
+ This function brings West Bridge out of sleep mode.
+
+ Description
+ This function asserts the WAKEUP pin (via the HAL layer). This
+ brings the West Bridge out of the sleep state and allows the
+ West Bridge firmware to process the event causing the wakeup.
+ When all processing associated with the wakeup is complete, a
+ callback function is called to tell the P port software that
+ the firmware processing associated with wakeup is complete.
+
+ * Valid In Asynchronous Callback: NO
+
+ Returns:
+ * CY_AS_ERROR_SUCCESS - the function completed and West Bridge
+ * is in sleep mode
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_SETTING_WAKEUP_PIN
+ * CY_AS_ERROR_NOT_IN_STANDBY - the West Bridge device is not in
+ * the sleep state
+ * CY_AS_ERROR_TIMEOUT - there was a timeout waiting for a
+ * response from the West Bridge firmware
+ * CY_AS_ERROR_NOT_SUPPORTED - the HAL layer does not support
+ * changing the WAKEUP pin
+
+ See Also
+ * CyAsMiscEnterStandby
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_leave_standby(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* The resource causing the wakeup */
+ cy_as_resource_type resource
+ );
+
+/* Summary
+ This function registers a callback function to be called when an
+ asynchronous West Bridge MISC event occurs.
+
+ Description
+ When asynchronous misc events occur, a callback function can be
+ called to alert the calling program. This functions allows the
+ calling program to register a callback.
+
+ * Valid In Asynchronous Callback: NO
+
+ Returns:
+ * CY_AS_ERROR_SUCCESS
+ * CY_AS_ERROR_INVALID_HANDLE
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_register_callback(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The function to call */
+ cy_as_misc_event_callback callback
+ );
+
+/* Summary
+ This function sets the logging level for log messages.
+
+ Description
+ The API can print messages via the CyAsHalPrintMessage capability.
+ This function sets the level of detail seen when printing messages
+ from the API.
+
+ * Valid In Asynchronous Callback:NO
+*/
+EXTERN void
+cy_as_misc_set_log_level(
+ /* Level to set, 0 is fewer messages, 255 is all */
+ uint8_t level
+ );
+
+
+/* Summary
+ This function tells West Bridge that SD or MMC media has been
+ inserted or removed.
+
+ Description
+ In some hardware configurations, SD or MMC media detection is
+ handled outside of the West Bridge device. This function is called
+ when a change is detected to inform the West Bridge firmware to check
+ for storage media changes.
+
+ * Valid In Asynchronous Callback: NO
+
+ Returns:
+ * CY_AS_ERROR_SUCCESS
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE
+ * CY_AS_ERROR_IN_STANDBY
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+ See Also
+ * CyAsMiscStorageChanged
+
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_storage_changed(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* Callback to call when the operation is complete. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+/* Summary
+ This function instructs the West Bridge firmware to start/stop
+ sending periodic heartbeat messages to the processor.
+
+ Description
+ The West Bridge firmware can send heartbeat messages through the
+ mailbox register once every 500 ms. This message can be an overhead
+ as it causes regular Mailbox interrupts to happen, and is turned
+ off by default. The message can be used to test and verify that the
+ West Bridge firmware is alive. This API can be used to enable or
+ disable the heartbeat message.
+
+ * Valid In Asynchronous Callback: NO
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the function completed successfully
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured yet
+ * CY_AS_ERROR_NO_FIRMWARE - firmware has not been downloaded to
+ * the West Bridge device
+
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_heart_beat_control(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* Message enable/disable selection */
+ cy_bool enable,
+ /* Callback to call when the operation is complete. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+/* Summary
+ This function gets the current state of a GPIO pin on the
+ West Bridge device.
+
+ Description
+ The West Bridge device has GPIO pins that can be used for user
+ defined functions. This function gets the current state of the
+ specified GPIO pin. Calling this function will configure the
+ corresponding pin as an input.
+
+ * Valid In Asynchronous Callback: NO
+
+ Notes
+ Only GPIO[0], GPIO[1] and UVALID pins can be used as GP inputs.
+ Of these pins, only the UVALID pin is supported by firmware images
+ that include NAND storage support.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the function completed successfully
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured yet
+ * CY_AS_ERROR_NO_FIRMWARE - firmware has not been downloaded
+ * to the West Bridge device
+ * CY_AS_ERROR_BAD_INDEX - an invalid GPIO was specified
+ * CY_AS_ERROR_NOT_SUPPORTED - this feature is not supported
+ * by the firmware
+
+ See Also
+ * CyAsMiscGpio
+ * CyAsMiscSetGpioValue
+ */
+EXTERN cy_as_return_status_t
+cy_as_misc_get_gpio_value(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* Id of the GPIO pin to query */
+ cy_as_misc_gpio pin,
+ /* Current value of the GPIO pin */
+ uint8_t *value,
+ /* Callback to call when the operation is complete. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+/* Summary
+ This function updates the state of a GPIO pin on the West
+ Bridge device.
+
+ Description
+ The West Bridge device has GPIO pins that can be used for
+ user defined functions. This function updates the output
+ value driven on a specified GPIO pin. Calling this function
+ will configure the corresponding pin as an output.
+
+ * Valid In Asynchronous Callback: NO
+
+ Notes
+ All of the pins listed under CyAsMiscGpio can be used as GP
+ outputs. This feature is note supported by firmware images
+ that include NAND storage device support.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the function completed successfully
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured yet
+ * CY_AS_ERROR_NO_FIRMWARE - firmware has not been downloaded
+ * to the West Bridge device
+ * CY_AS_ERROR_BAD_INDEX - an invalid GPIO was specified
+ * CY_AS_ERROR_NOT_SUPPORTED - this feature is not supported
+ * by firmware.
+
+ See Also
+ * CyAsMiscGpio
+ * CyAsMiscGetGpioValue
+ */
+EXTERN cy_as_return_status_t
+cy_as_misc_set_gpio_value(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* Id of the GPIO pin to set */
+ cy_as_misc_gpio pin,
+ /* Value to be set on the GPIO pin */
+ uint8_t value,
+ /* Callback to call when the operation is complete. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+/* Summary
+ Set the West Bridge device in the low power suspend mode.
+
+ Description
+ The West Bridge device has a low power suspend mode where the USB
+ core and the internal microcontroller are powered down. This
+ function sets the West Bridge device into this low power mode.
+ This mode can only be entered when there is no active USB
+ connection; i.e., when USB has not been connected or is suspended;
+ and there are no pending USB or storage asynchronous calls. The
+ device will exit the suspend mode and resume handling USB and
+ processor requests when any activity is detected on the CE#, D+/D-
+ or GPIO[0] lines.
+
+ * Valid In Asynchronous Callback: NO
+
+ Notes
+ The GPIO[0] pin needs to be configured as an input for the gpio
+ wakeup to work. This flag should not be enabled if the pin is
+ being used as a GP output.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the device was placed in suspend mode.
+ * CY_AS_ERROR_INVALID_HANDLE - the West Bridge handle passed
+ * in is invalid.
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * yet been configured.
+ * CY_AS_ERROR_NO_FIRMWARE - no firmware has been downloaded
+ * to the device.
+ * CY_AS_ERROR_IN_STANDBY - the device is already in sleep mode.
+ * CY_AS_ERROR_USB_CONNECTED - the USB connection is active.
+ * CY_AS_ERROR_ASYNC_PENDING - asynchronous storage/USB calls
+ * are pending.
+ * CY_AS_ERROR_OUT_OF_MEMORY - failed to allocate memory for
+ * the operation.
+ * CY_AS_ERROR_INVALID_RESPONSE - command not recognised by
+ * firmware.
+
+ See Also
+ * CyAsMiscLeaveSuspend
+ */
+EXTERN cy_as_return_status_t
+cy_as_misc_enter_suspend(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* Control the USB wakeup source */
+ cy_bool usb_wakeup_en,
+ /* Control the GPIO[0] wakeup source */
+ cy_bool gpio_wakeup_en,
+ /* Callback to call when suspend mode entry is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+/* Summary
+ Wake up the West Bridge device from suspend mode.
+
+ Description
+ This call wakes up the West Bridge device from suspend mode,
+ and makes it ready for accepting other commands from the API.
+ A CyAsEventMiscWakeup event will be delivered to the callback
+ registered with CyAsMiscRegisterCallback to indicate that the
+ wake up is complete.
+
+ The CyAsEventMiscWakeup event will also be delivered if the
+ wakeup happens due to USB or GPIO activity.
+
+ * Valid In Asynchronous Callback: NO
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the device was woken up from
+ * suspend mode.
+ * CY_AS_ERROR_INVALID_HANDLE - invalid device handle
+ * passed in.
+ * CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has
+ * not been configured.
+ * CY_AS_ERROR_NO_FIRMWARE - firmware has not been
+ * downloaded to the device.
+ * CY_AS_ERROR_NOT_IN_SUSPEND - the device is not in
+ * suspend mode.
+ * CY_AS_ERROR_OUT_OF_MEMORY - failed to allocate memory
+ * for the operation.
+ * CY_AS_ERROR_TIMEOUT - failed to wake up the device.
+
+ See Also
+ * CyAsMiscEnterSuspend
+ */
+EXTERN cy_as_return_status_t
+cy_as_misc_leave_suspend(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* Callback to call when device has resumed operation. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+/* Summary
+ Reserve first numzones zones of nand device for storing
+ processor boot image. LNA firmware works on the first
+ numzones zones of nand to enable the processor to boot.
+
+ Description
+ This function reserves first numzones zones of nand device
+ for storing processor boot image. This fonction MUST be
+ completed before starting the storage stack for the setting
+ to be taken into account.
+
+ * Valid In Asynchronous Callback: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS- zones are reserved.
+
+*/
+EXTERN cy_as_return_status_t
+cy_as_misc_reserve_l_n_a_boot_area(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* number of nand zones to reserve */
+ uint8_t numzones,
+ /* Callback to call when device has resumed operation. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+/* Summary
+ Select the clock frequency to be used when talking to low
+ speed (non-high speed) SD media.
+
+ Description
+ West Bridge firmware uses a clock frequency less than the
+ maximum possible rate for low speed SD media. This function
+ selects the frequency setting from between the default speed
+ and the maximum speed. This fonction MUST be completed before
+ starting the storage stack for the setting to be taken into
+ account.
+
+ * Valid in Asynchronous Callback: Yes (if cb is non-zero)
+ * Nestable: Yes
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the operation completed successfully.
+ * CY_AS_ERROR_INVALID_HANDLE - invalid device handle passed in.
+ * CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has not been
+ * configured.
+ * CY_AS_ERROR_NO_FIRMWARE - firmware has not been downloaded
+ * to the device.
+ * CY_AS_ERROR_OUT_OF_MEMORY - failed to allocate memory for
+ * the operation.
+ * CY_AS_ERROR_IN_SUSPEND - West Bridge is in low power suspend
+ * mode.
+ * CY_AS_ERROR_INVALID_PARAMETER - invalid frequency setting
+ * desired.
+ * CY_AS_ERROR_TIMEOUT - West Bridge device did not respond to
+ * the operation.
+ * CY_AS_ERROR_INVALID_RESPONSE - active firmware does not support
+ * the operation.
+
+ See Also
+ * CyAsLowSpeedSDFreq
+ */
+EXTERN cy_as_return_status_t
+cy_as_misc_set_low_speed_sd_freq(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* Frequency setting desired for low speed SD cards */
+ cy_as_low_speed_sd_freq setting,
+ /* Callback to call on completion */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ Select the clock frequency to be used when talking to high speed
+ SD/MMC media.
+
+ Description
+ West Bridge firmware uses a 48 MHz clock to interface with high
+ speed SD/MMC media. This clock rate can be restricted to 24 MHz
+ if desired. This function selects the frequency setting to be
+ used. This fonction MUST be completed before starting the storage
+ stack for the setting to be taken into account.
+
+ * Valid in Asynchronous Callback: Yes (if cb is non-zero)
+ * Nestable: Yes
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the operation completed successfully.
+ * CY_AS_ERROR_INVALID_HANDLE - invalid device handle passed in.
+ * CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has not been
+ * configured.
+ * CY_AS_ERROR_NO_FIRMWARE - firmware has not been downloaded to
+ * the device.
+ * CY_AS_ERROR_OUT_OF_MEMORY - failed to allocate memory for the
+ * operation.
+ * CY_AS_ERROR_IN_SUSPEND - West Bridge is in low power suspend mode.
+ * CY_AS_ERROR_INVALID_PARAMETER - invalid frequency setting desired.
+ * CY_AS_ERROR_TIMEOUT - West Bridge device did not respond to the
+ * operation.
+ * CY_AS_ERROR_INVALID_RESPONSE - active firmware does not support
+ * the operation.
+
+ See Also
+ * CyAsLowSpeedSDFreq
+ */
+EXTERN cy_as_return_status_t
+cy_as_misc_set_high_speed_sd_freq(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* Frequency setting desired for high speed SD cards */
+ cy_as_high_speed_sd_freq setting,
+ /* Callback to call on completion */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+/* Summary
+ Select the polarity of the SD_POW output driven by West Bridge.
+
+ Description
+ The SD_POW signal driven by West Bridge can be used to control
+ the supply of Vcc to the SD/MMC media connected to the device.
+ This signal is driven as an active high signal by default. This
+ function can be used to change the polarity of this signal if
+ required. This fonction MUST be completed before starting the
+ storage stack for the setting to be taken into account.
+
+ * Valid in Asynchronous Callback: Yes (if cb is non-zero)
+ * Nestable: Yes
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the operation completed successfully.
+ * CY_AS_ERROR_INVALID_HANDLE - invalid device handle passed in.
+ * CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has not been
+ * configured.
+ * CY_AS_ERROR_NO_FIRMWARE - firmware has not been downloaded
+ * to the device.
+ * CY_AS_ERROR_OUT_OF_MEMORY - failed to allocate memory for
+ * the operation.
+ * CY_AS_ERROR_IN_SUSPEND - West Bridge is in low power
+ * suspend mode.
+ * CY_AS_ERROR_INVALID_PARAMETER - invalid frequency setting
+ * desired.
+ * CY_AS_ERROR_TIMEOUT - West Bridge device did not respond to
+ * the operation.
+ * CY_AS_ERROR_INVALID_RESPONSE - active firmware does not
+ * support the operation.
+
+ See Also
+ * CyAsMiscSignalPolarity
+ */
+EXTERN cy_as_return_status_t
+cy_as_misc_set_sd_power_polarity(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* Desired polarity setting to the SD_POW signal. */
+ cy_as_misc_signal_polarity polarity,
+ /* Callback to call on completion. */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback. */
+ uint32_t client
+ );
+
+/* For supporting deprecated functions */
+#include "cyasmisc_dep.h"
+
+#include "cyas_cplus_end.h"
+
+#endif /* _INCLUDED_CYASMISC_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc_dep.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc_dep.h
new file mode 100644
index 0000000..8b258ef
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc_dep.h
@@ -0,0 +1,53 @@
+/* Cypress West Bridge API header file (cyasmisc_dep.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+/* This header will contain Antioch specific declaration
+ * of the APIs that are deprecated in Astoria SDK. This is
+ * for maintaining backward compatibility with prior releases
+ * of the Antioch SDK.
+ */
+#ifndef __INCLUDED_CYASMISC_DEP_H__
+#define __INCLUDED_CYASMISC_DEP_H__
+
+#ifndef __doxygen__
+
+EXTERN cy_as_return_status_t
+cy_as_misc_acquire_resource_dep(cy_as_device_handle handle,
+ cy_as_resource_type resource,
+ cy_bool force);
+EXTERN cy_as_return_status_t
+cy_as_misc_get_firmware_version_dep(cy_as_device_handle handle,
+ uint16_t *major,
+ uint16_t *minor,
+ uint16_t *build,
+ uint8_t *media_type,
+ cy_bool *is_debug_mode);
+EXTERN cy_as_return_status_t
+cy_as_misc_set_trace_level_dep(cy_as_device_handle handle,
+ uint8_t level,
+ cy_as_media_type media,
+ uint32_t device,
+ uint32_t unit,
+ cy_as_function_callback cb,
+ uint32_t client);
+#endif /*__doxygen*/
+
+#endif /*__INCLUDED_CYANSTORAGE_DEP_H__*/
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmtp.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmtp.h
new file mode 100644
index 0000000..05d3449
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmtp.h
@@ -0,0 +1,646 @@
+/* Cypress West Bridge API header file (cyasmtp.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASMTP_H_
+#define _INCLUDED_CYASMTP_H_
+
+#include "cyasmisc.h"
+
+#include "cyas_cplus_start.h"
+
+/*@@Media Transfer Protocol (MTP) Overview
+ Summary
+ The MTP API has been designed to allow MTP enabled West Bridge
+ devices to implement the MTP protocol while maintaining high
+ performance. West Bridge has the capability to enter into a
+ Turbo mode during a MTP SendObject or GetObject operation
+ enabling it to directly stream the data into or out of the
+ attached SD card with minimal involvement from the Processor.
+
+ Description
+ The MTP API is designed to act as a pass through implementation
+ of the MTP protocol for all operations. Each MTP transaction
+ received from the Host is passed through West Bridge and along
+ to the Processor. The Processor can then respond to the
+ transaction and pass data and/or responses back to the Host
+ through West Bridge.
+
+ The MTP API also allows for a high speed handling of MTP
+ SendObject and GetObject operations, referred to as Turbo MTP.
+ During a Turbo MTP operation West Bridge is responsible for
+ reading or writing the data for the MTP operation directly from
+ or to the SD card with minimal interaction from the Processor.
+ The is done by having the Processor transfer a Block Table
+ to West Bridge which contains the locations on the SD card that
+ need to be read or written. During the handling of a Turbo
+ Operation the Processor will then only periodically need to
+ send a new Block Table to West Bridge when the first is used up.
+ See the CyAsMTPInitSendObject and CyAsMTPInitGetObject functions
+ for more details.
+
+ In order to enable the MTP API you must first have a MTP enabled
+ West Bridge loaded with MTP firmware. You then must start the USB
+ and Storage APIs before starting the MTP API. See CyAsMTPStart
+ for more details.
+*/
+
+/*@@Endpoints
+ Summary
+ When using MTP firmware endpoints 2 and 6 are dedicated
+ to bulk MTP traffic and endpoint 1 is available for MTP
+ events.
+
+ Description
+ When using a MTP enabled West Brdige device endpoints 2 and
+ 6 are made available for use to implement the MTP protocol.
+ These endpoints have a few special restrictions noted below
+ but otherwise the existing USB APIs can be used normally with
+ these endpoints.
+
+ 1. CyAsUsbSetNak, CyAsUsbClearNak, and CyAsUsbGetNak are
+ disabled for these endpoints
+ 2. During a turbo operation CyAsUsbSetStall, CyAsUsbClearStall,
+ and CyAsUsbGetStall are disabled.
+
+*/
+
+
+/* Summary
+ This constants defines the maximum number of
+ entries in the Block Table used to describe
+ the locations for Send/GetObject operations.
+
+ See Also
+ * CyAsMtpSendObject
+ * CyAsMtpGetObject
+*/
+#define CY_AS_MAX_BLOCK_TABLE_ENTRIES 64
+
+/* Summary
+ Endpoint to be used for MTP reads from the USB host.
+ */
+#define CY_AS_MTP_READ_ENDPOINT (2)
+
+/* Summary
+ Endpoint to be used fro MTP writes to the USB host.
+ */
+#define CY_AS_MTP_WRITE_ENDPOINT (6)
+
+/******************************************
+ * MTP Types
+ ******************************************/
+
+/* Summary
+ The BlockTable used for turbo operations.
+
+ Description
+ This struct is used to specify the blocks
+ to be used for both read/write and send/getObject
+ operations.
+
+ The start block is a starting Logical Block Address
+ and num block is the number of blocks in that contiguous
+ region.
+
+ start_blocks[i]->[-------] <- start_blocks[i] + num_blocks[i]
+
+ If you need fewer than CY_AS_MAX_BLOCK_TABLE_ENTRIES
+ the remainder should be left empty. Empty is defined
+ as num_blocks equal to 0.
+
+ See Also
+ * CyAsMTPInitSendObject
+ * CyAsMTPInitGetObject
+
+*/
+typedef struct cy_as_mtp_block_table {
+ uint32_t start_blocks[CY_AS_MAX_BLOCK_TABLE_ENTRIES];
+ uint16_t num_blocks[CY_AS_MAX_BLOCK_TABLE_ENTRIES];
+} cy_as_mtp_block_table;
+
+/* Summary
+ This type specifies the type of MTP event that has occurred.
+
+ Description
+ MTP events are used to communicate that West Bridge has
+ either finished the handling of the given operation, or
+ that it requires additional data to complete the operation.
+
+ In no case does West Bridge send any MTP protocol responses,
+ this always remain the responsibility of the client.
+
+ See Also
+ * CyAsMTPInitSendObject
+ * CyAsMTPInitGetObject
+ * CyAsMTPSendBlockTable
+
+*/
+typedef enum cy_as_mtp_event {
+ /* This event is sent when West Bridge
+ has finished writing the data from a
+ send_object. west bridge will -not- send
+ the MTP response. */
+ cy_as_mtp_send_object_complete,
+
+ /* This event is sent when West Bridge
+ has finished sending the data for a
+ get_object operation. west bridge will
+ -not- send the MTP response. */
+ cy_as_mtp_get_object_complete,
+
+ /* This event is called when West Bridge
+ needs a new block_table. this is only a
+ notification, to transfer a block_table
+ to west bridge the cy_as_mtp_send_block_table
+ use the function. while west bridge is waiting
+ for a block_table during a send_object it
+ may need to NAK the endpoint. it is important
+ that the cy_as_mtp_send_block_table call is made
+ in a timely manner as eventually a delay
+ will result in an USB reset. this event has
+ no data */
+ cy_as_mtp_block_table_needed
+} cy_as_mtp_event;
+
+/* Summary
+ Data for the CyAsMTPSendObjectComplete event.
+
+ Description
+ Notification that a SendObject operation has been
+ completed. The status of the operation is given
+ (to distinguish between a cancelled and a success
+ for example) as well as the block count. The blocks
+ are used in order based on the current block table.
+ If more than one block table was used for a given
+ SendObject the count will include the total number
+ of blocks written.
+
+ This callback will be made only once per SendObject
+ operation and it will only be called after all of
+ the data has been committed to the SD card.
+
+ See Also
+ * CyAsMTPEvent
+
+ */
+typedef struct cy_as_mtp_send_object_complete_data {
+ cy_as_return_status_t status;
+ uint32_t byte_count;
+ uint32_t transaction_id;
+} cy_as_mtp_send_object_complete_data;
+
+/* Summary
+ Data for the CyAsMTPGetObjectComplete event.
+
+ Description
+ Notification that a GetObject has finished. This
+ event allows the P side to know when to send the MTP
+ response for the GetObject operation.
+
+ See Also
+ * CyAsMTPEvent
+
+*/
+typedef struct cy_as_mtp_get_object_complete_data {
+ cy_as_return_status_t status;
+ uint32_t byte_count;
+} cy_as_mtp_get_object_complete_data;
+
+/* Summary
+ MTP Event callback.
+
+ Description
+ Callback used to communicate that a SendObject
+ operation has finished.
+
+ See Also
+ * CyAsMTPEvent
+*/
+typedef void (*cy_as_mtp_event_callback)(
+ cy_as_device_handle handle,
+ cy_as_mtp_event evtype,
+ void *evdata
+ );
+
+/* Summary
+ This is the callback function called after asynchronous API
+ functions have completed.
+
+ Description
+ When calling API functions from callback routines (interrupt
+ handlers usually) the async version of these functions must
+ be used. This callback is called when an asynchronous API
+ function has completed.
+*/
+typedef void (*cy_as_mtp_function_callback)(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* The error status of the operation */
+ cy_as_return_status_t status,
+ /* A client supplied 32 bit tag */
+ uint32_t client
+);
+
+/**************************************
+ * MTP Functions
+ **************************************/
+
+/* Summary
+ This function starts the MTP stack.
+
+ Description
+ Initializes West Bridge for MTP activity and registers the MTP
+ event callback.
+
+ Before calling CyAsMTPStart, CyAsUsbStart and CyAsStorageStart must be
+ called (in either order).
+
+ MTPStart must be called before the device is enumerated. Please
+ see the documentation for CyAsUsbSetEnumConfig and CyAsUsbEnumControl
+ for details on enumerating a device for MTP.
+
+ Calling MTPStart will not affect any ongoing P<->S traffic.
+
+ This requires a MTP firmware image to be loaded on West Bridge.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE
+ * CY_AS_ERROR_IN_SUSPEND
+ * CY_AS_ERROR_INVALID_IN_CALLBACK
+ * CY_AS_ERROR_STARTSTOP_PENDING
+ * CY_AS_ERROR_NOT_RUNNING - CyAsUsbStart or CyAsStorageStart
+ * have not been called
+ * CY_AS_ERROR_NOT_SUPPORTED - West Bridge is not running
+ * firmware with MTP support
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+
+ See Also
+ * CyAsMTPStop
+ * CyAsUsbStart
+ * CyAsStorageStart
+ * CyAsUsbSetEnumConfig
+ * CyAsUsbEnumControl
+*/
+cy_as_return_status_t
+cy_as_mtp_start(
+ cy_as_device_handle handle,
+ cy_as_mtp_event_callback event_c_b,
+ cy_as_function_callback cb,
+ uint32_t client
+ );
+
+
+/* Summary
+ This function stops the MTP stack.
+
+ Description
+ Stops all MTP activity. Any ongoing transfers are
+ canceled.
+
+ This will not cause a UsbDisconnect but all
+ MTP activity (both pass through and turbo) will
+ stop.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE
+ * CY_AS_ERROR_NOT_RUNNING
+ * CY_AS_ERROR_IN_SUSPEND
+ * CY_AS_ERROR_INVALID_IN_CALLBACK
+ * CY_AS_ERROR_STARTSTOP_PENDING
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+
+ See Also
+ * CyAsMTPStart
+*/
+cy_as_return_status_t
+cy_as_mtp_stop(
+ cy_as_device_handle handle,
+ cy_as_function_callback cb,
+ uint32_t client
+ );
+
+/* Summary
+ This function sets up a Turbo SendObject operation.
+
+ Description
+ Calling this function will setup West Bridge to
+ enable Tubo handling of the next SendObject
+ operation received. This will pass down the initial
+ block table to the firmware and setup a direct u->s
+ write for the SendObject operation.
+
+ If this function is not called before a SendObject
+ operation is seen the SendObject operation and data
+ will be passed along to the P port like any other MTP
+ command. It would then be the responsibility of the
+ client to perform a normal StorageWrite call to
+ store the data on the SD card. N.B. This will be
+ very slow compared with the Turbo handling.
+
+ The completion of this function only signals that
+ West Bridge has been set up to receive the next SendObject
+ operation. When the SendObject operation has been fully
+ handled and the data written to the SD card a separate
+ event will be triggered.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE
+ * CY_AS_ERROR_IN_SUSPEND
+ * CY_AS_ERROR_NOT_RUNNING
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_ASYNC_PENDING
+ * CY_AS_ERROR_INVALID_RESPONSE
+ * CY_AS_ERROR_NOT_SUPPORTED - West Bridge is not running
+ * firmware with MTP support
+
+ See Also
+ * CyAsMTPCancelSendObject
+ * CyAsMTPInitGetObject
+ * CyAsMTPEvent
+ * CyAsMTPSendBlockTable
+*/
+cy_as_return_status_t
+cy_as_mtp_init_send_object(
+ cy_as_device_handle handle,
+ cy_as_mtp_block_table *blk_table,
+ uint32_t num_bytes,
+ cy_as_function_callback cb,
+ uint32_t client
+ );
+
+/* Summary
+ This function cancels an ongoing MTP operation.
+
+ Description
+ Causes West Bridge to cancel an ongoing SendObject
+ operation. Note this is only a cancel to West Bridge,
+ the MTP operation still needs to be canceled by
+ sending a response.
+
+ West Bridge will automatically set a Stall on the endpoint
+ when the cancel is received.
+
+ This function is only valid after CyAsMTPInitSendObject
+ has been called, but before the CyAsMTPSendObjectComplete
+ event has been sent.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_RUNNING
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+ * CY_AS_ERROR_NOT_SUPPORTED - West Bridge is not running
+ * firmware with MTP support
+ * CY_AS_ERROR_NO_OPERATION_PENDING
+
+ See Also
+ * CyAsMTPInitSendObject
+*/
+cy_as_return_status_t
+cy_as_mtp_cancel_send_object(
+ cy_as_device_handle handle,
+ cy_as_function_callback cb,
+ uint32_t client
+ );
+
+/* Summary
+ This function sets up a turbo GetObject operation.
+
+ Description
+ Called by the P in response to a GetObject
+ operation. This provides West Bridge with the block
+ addresses for the Object data that needs to be
+ transferred.
+
+ It is the responsibility of the Processor to send the MTP
+ operation before calling CyAsMTPInitGetObject. West Bridge
+ will then send the data phase of the transaction,
+ automatically creating the required container for Data.
+ Once all of the Data has been transferred a callback will
+ be issued to inform the Processor that the Data phase has
+ completed allowing it to send the required MTP response.
+
+ If an entire Block Table is used then after the
+ last block is transferred the CyAsMTPBtCallback
+ will be called to allow an additional Block Table(s)
+ to be specified.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE
+ * CY_AS_ERROR_NOT_RUNNING
+ * CY_AS_ERROR_IN_SUSPEND
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_ASYNC_PENDING
+ * CY_AS_ERROR_INVALID_RESPONSE
+ * CY_AS_ERROR_NOT_SUPPORTED - West Bridge is not running
+ * firmware with MTP support
+
+ See Also
+ * CyAsMTPInitSendObject
+ * CyAsMTPCancelGetObject
+ * CyAsMTPEvent
+ * CyAsMTPSendBlockTable
+*/
+cy_as_return_status_t
+cy_as_mtp_init_get_object(
+ cy_as_device_handle handle,
+ cy_as_mtp_block_table *table_p,
+ uint32_t num_bytes,
+ uint32_t transaction_id,
+ cy_as_function_callback cb,
+ uint32_t client
+ );
+
+/* Summary
+ This function cancels an ongoing turbo GetObject
+ operation.
+
+ Description
+ Causes West Bridge to cancel an ongoing GetObject
+ operation. Note this is only a cancel to West Bridge,
+ the MTP operation still needs to be canceled by
+ sending a response.
+
+ This function is only valid after CyAsMTPGetSendObject
+ has been called, but before the CyAsMTPGetObjectComplete
+ event has been sent.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_RUNNING
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+ * CY_AS_ERROR_NOT_SUPPORTED - West Bridge is not running
+ * firmware with MTP support
+ * CY_AS_ERROR_NO_OPERATION_PENDING
+
+ See Also
+ * CyAsMTPInitGetObject
+*/
+cy_as_return_status_t
+cy_as_mtp_cancel_get_object(
+ cy_as_device_handle handle,
+ cy_as_function_callback cb,
+ uint32_t client
+ );
+
+/* Summary
+ This function is used to transfer a BlockTable as part of
+ an ongoing MTP operation.
+
+ Description
+ This function is called in response to the
+ CyAsMTPBlockTableNeeded event. This allows the client to
+ pass in a BlockTable structure to West Bridge.
+
+ The memory associated with the table will be copied and
+ can be safely disposed of when the function returns if
+ called synchronously, or when the callback is made if
+ called asynchronously.
+
+ This function is used for both SendObject and GetObject
+ as both can generate the CyAsMTPBlockTableNeeded event.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_NOT_CONFIGURED
+ * CY_AS_ERROR_NO_FIRMWARE
+ * CY_AS_ERROR_NOT_RUNNING
+ * CY_AS_ERROR_IN_SUSPEND
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_ASYNC_PENDING
+ * CY_AS_ERROR_INVALID_RESPONSE
+ * CY_AS_ERROR_NOT_SUPPORTED - West Bridge is not running
+ * firmware with MTP support
+
+ See Also
+ * CyAsMTPInitSendObject
+ * CyAsMTPInitGetObject
+*/
+cy_as_return_status_t
+cy_as_mtp_send_block_table(
+ cy_as_device_handle handle,
+ cy_as_mtp_block_table *table,
+ cy_as_function_callback cb,
+ uint32_t client
+ );
+
+/* Summary
+ This function is used to mark the start of a storage
+ read/write burst from the P port processor.
+
+ Description
+ This function is used to mark the start of a storage
+ read/write burst from the processor. All USB host access
+ into the mass storage / MTP endpoints will be blocked
+ while the read/write burst is ongoing, and will be allowed
+ to resume only after CyAsMTPStorageOnlyStop is called.
+ The burst mode is used to reduce the firmware overhead
+ due to configuring the internal data paths repeatedly,
+ and can help improve performance when a sequence of
+ read/writes is performed in a burst.
+
+ This function will not generate a special mailbox request,
+ it will only set a flag on the next Storage Read/Write
+ operation. Until such a call is made West Bridge will
+ continue to accept incoming packets from the Host.
+
+ * Valid in Asynchronous Callback: YES
+
+ Returns
+ * CY_AS_ERROR_INVALID_HANDLE - Invalid West Bridge device
+ * handle was passed in.
+ * CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has not
+ * been configured.
+ * CY_AS_ERROR_NO_FIRMWARE - Firmware is not active on West
+ * Bridge device.
+ * CY_AS_ERROR_NOT_RUNNING - Storage stack is not running.
+ * CY_AS_ERROR_SUCCESS - Burst mode has been started.
+
+ See Also
+ * CyAsStorageReadWriteBurstStop
+ */
+cy_as_return_status_t
+cy_as_mtp_storage_only_start(
+ /* Handle to the West Bridge device. */
+ cy_as_device_handle handle
+ );
+
+/* Summary
+ This function is used to mark the end of a storage read/write
+ burst from the P port processor.
+
+ Description
+ This function is used to mark the end of a storage read/write
+ burst from the processor. At this point, USB access to the
+ mass storage / MTP endpoints on the West Bridge device will be
+ re-enabled.
+
+ * Valid in Asynchronous Callback: NO
+
+ Returns
+ * CY_AS_ERROR_INVALID_HANDLE - Invalid West Bridge device handle
+ * was passed in.
+ * CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has not been
+ * configured.
+ * CY_AS_ERROR_NO_FIRMWARE - Firmware is not active on West Bridge
+ * device.
+ * CY_AS_ERROR_NOT_RUNNING - Storage stack is not running.
+ * CY_AS_ERROR_INVALID_IN_CALLBACK - This API cannot be called
+ * from a callback.
+ * CY_AS_ERROR_OUT_OF_MEMORY - Failed to allocate memory to
+ * process the request.
+ * CY_AS_ERROR_TIMEOUT - Failed to send request to firmware.
+ * CY_AS_ERROR_SUCCESS - Burst mode has been stopped.
+
+ See Also
+ * CyAsStorageReadWriteBurstStart
+ */
+cy_as_return_status_t
+cy_as_mtp_storage_only_stop(
+ /* Handle to the West Bridge device. */
+ cy_as_device_handle handle,
+ cy_as_function_callback cb,
+ uint32_t client
+ );
+
+#include "cyas_cplus_end.h"
+
+#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasprotocol.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasprotocol.h
new file mode 100644
index 0000000..317805f
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasprotocol.h
@@ -0,0 +1,3838 @@
+/* Cypress West Bridge API header file (cyasprotocol.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASPROTOCOL_H_
+#define _INCLUDED_CYASPROTOCOL_H_
+
+/*
+ * Constants defining the per context buffer sizes
+ */
+#ifndef __doxygen__
+#define CY_CTX_GEN_MAX_DATA_SIZE (8)
+#define CY_CTX_RES_MAX_DATA_SIZE (8)
+#define CY_CTX_STR_MAX_DATA_SIZE (64)
+#define CY_CTX_USB_MAX_DATA_SIZE (130 + 23)
+#define CY_CTX_TUR_MAX_DATA_SIZE (12)
+#endif
+
+/* Summary
+ This response indicates a command has been processed
+ and returned a status.
+
+ Direction
+ West Bridge -> P Port Processor
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = all
+ * Response Code = 0
+
+ D0
+ * 0 = success (CY_AS_ERROR_SUCCESS)
+ * non-zero = error code
+
+ Description
+ This response indicates that a request was processed
+ and no data was generated as a result of the request
+ beyond a single 16 bit status value. This response
+ contains the 16 bit data value.
+ */
+#define CY_RESP_SUCCESS_FAILURE (0)
+
+/* Summary
+ This response indicates an invalid request was sent
+
+ Direction
+ West Bridge -> P Port Processor
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = all
+ * Response Code = 1
+
+ D0
+ * Mailbox contents for invalid request
+
+ Description
+ This response is returned when a request is sent
+ that contains an invalid
+ context or request code.
+*/
+#define CY_RESP_INVALID_REQUEST (1)
+
+/* Summary
+ This response indicates a request of invalid length was sent
+
+ Direction
+ West Bridge -> P Port Processor
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = all
+ * Response Code = 2
+
+ D0
+ * Mailbox contenxt for invalid request
+ * Length for invalid request
+
+ Description
+ The software API and firmware sends requests across the
+ P Port to West Bridge interface on different contexts.
+ Each contexts has a maximum size of the request packet
+ that can be received. The size of a request can be
+ determined during the first cycle of a request transfer.
+ If the request is larger than can be handled by the
+ receiving context this response is returned. Note that
+ the complete request is received before this response is
+ sent, but that the request is dropped after this response
+ is sent.
+*/
+#define CY_RESP_INVALID_LENGTH (2)
+
+
+/* Summary
+ This response indicates a request was made to an
+ invalid storage address.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = all
+ * Response Code = 0
+
+ D0
+ Bits 15 - 12 : Media Type
+ * 0 = NAND
+ * 1 = SD Flash
+ * 2 = MMC Flash
+ * 3 = CE-ATA
+
+ Bits 11 - 8 : Zero based device index
+
+ Bits 7 - 0 : Zero based unit index
+
+ D1
+ Upper 16 bits of block address
+
+ D2
+ Lower 16 bits of block address
+
+ D3
+ Portion of address that is invalid
+ * 0 = Media Type
+ * 1 = Device Index
+ * 2 = Unit Index
+ * 3 = Block Address
+
+ Description
+ This response indicates a request to an invalid storage media
+ address
+ */
+#define CY_RESP_NO_SUCH_ADDRESS (3)
+
+
+/******************************************************/
+
+/*@@General requests
+ Summary
+ The general requests include:
+ * CY_RQT_GET_FIRMWARE_VERSION
+ * CY_RQT_SET_TRACE_LEVEL
+ * CY_RQT_INITIALIZATION_COMPLETE
+ * CY_RQT_READ_MCU_REGISTER
+ * CY_RQT_WRITE_MCU_REGISTER
+ * CY_RQT_STORAGE_MEDIA_CHANGED
+ * CY_RQT_CONTROL_ANTIOCH_HEARTBEAT
+ * CY_RQT_PREPARE_FOR_STANDBY
+ * CY_RQT_ENTER_SUSPEND_MODE
+ * CY_RQT_OUT_OF_SUSPEND
+ * CY_RQT_GET_GPIO_STATE
+ * CY_RQT_SET_GPIO_STATE
+ * CY_RQT_SET_SD_CLOCK_FREQ
+ * CY_RQT_WB_DEVICE_MISMATCH
+ * CY_RQT_BOOTLOAD_NO_FIRMWARE
+ * CY_RQT_RESERVE_LNA_BOOT_AREA
+ * CY_RQT_ABORT_P2S_XFER
+ */
+
+#ifndef __doxygen__
+#define CY_RQT_GENERAL_RQT_CONTEXT (0)
+#endif
+
+/* Summary
+ This command returns the firmware version number,
+ media types supported and debug/release mode information.
+
+ Direction
+ P Port Processor-> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 0
+ * Request Code = 0
+
+ Description
+ The response contains the 16-bit major version, the
+ 16-bit minor version, the 16 bit build number, media
+ types supported and release/debug mode information.
+
+ Responses
+ * CY_RESP_FIRMWARE_VERSION
+ */
+#define CY_RQT_GET_FIRMWARE_VERSION (0)
+
+
+/* Summary
+ This command changes the trace level and trace information
+ destination within the West Bridge firmware.
+
+ Direction
+ P Port Processor-> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 0
+ * Request Code = 1
+
+ D0
+ Trace Level
+ * 0 = no trace information
+ * 1 = state information
+ * 2 = function call
+ * 3 = function call with args/return value
+
+ D1
+ Bits 12 - 15 : MediaType
+ * 0 = NAND
+ * 1 = SDIO Flash
+ * 2 = MMC Flash
+ * 3 = CE-ATA
+
+ Bits 8 - 11 : Zero based device index
+
+ Bits 0 - 7 : Zero based unit index
+
+ Description
+ The West Bridge firmware contains debugging facilities that can
+ be used to trace the execution of the firmware. This request
+ sets the level of tracing information that is stored and the
+ location where it is stored.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_NO_SUCH_ADDRESS
+ */
+#define CY_RQT_SET_TRACE_LEVEL (1)
+
+/* Summary
+ This command indicates that the firmware is up and ready
+ for communications with the P port processor.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 2
+
+ Mailbox0
+ * Context = 0
+ * Request Code = 3
+
+ D0
+ Major Version
+
+ D1
+ Minor Version
+
+ D2
+ Build Number
+
+ D3
+ Bits 15-8: Media types supported on Bus 1.
+ Bits 7-0: Media types supported on Bus 0.
+ Bits 8, 0: NAND support.
+ * 0: NAND is not supported.
+ * 1: NAND is supported.
+ Bits 9, 1: SD memory card support.
+ * 0: SD memory card is not supported.
+ * 1: SD memory card is supported.
+ Bits 10, 2: MMC card support.
+ * 0: MMC card is not supported.
+ * 1: MMC card is supported.
+ Bits 11, 3: CEATA drive support
+ * 0: CEATA drive is not supported.
+ * 1: CEATA drive is supported.
+ Bits 12, 4: SD IO card support.
+ * 0: SD IO card is not supported.
+ * 1: SD IO card is supported.
+
+ D4
+ Bits 15 - 8 : MTP information
+ * 0 : MTP not supported in firmware
+ * 1 : MTP supported in firmware
+ Bits 7 - 0 : Debug/Release mode information.
+ * 0 : Release mode
+ * 1 : Debug mode
+
+ Description
+ When the West Bridge firmware is loaded it being by performing
+ initialization. Initialization must be complete before West
+ Bridge is ready to accept requests from the P port processor.
+ This request is sent from West Bridge to the P port processor
+ to indicate that initialization is complete.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_INITIALIZATION_COMPLETE (3)
+
+/* Summary
+ This command requests the firmware to read and return the contents
+ of a MCU accessible
+ register.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 0
+ * Request code = 4
+
+ D0
+ Address of register to read
+
+ Description
+ This debug command allows the processor to read the contents of
+ a MCU accessible register.
+
+ Responses
+ * CY_RESP_MCU_REGISTER_DATA
+ */
+#define CY_RQT_READ_MCU_REGISTER (4)
+
+/* Summary
+ This command requests the firmware to write to an MCU
+ accessible register.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 0
+ * Request code = 5
+
+ D0
+ Address of register to be written
+
+ D1
+ Bits 15 - 8 : Mask to be applied to existing data.
+ Bits 7 - 0 : Data to be ORed with masked data.
+
+ Description
+ This debug command allows the processor to write to an MCU
+ accessible register.
+ Note: This has to be used with caution, and is supported by
+ the firmware only in special debug builds.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_WRITE_MCU_REGISTER (5)
+
+/* Summary
+ This command tells the West Bridge firmware that a change in
+ storage media has been detected.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 0
+ * Request code = 6
+
+ Description
+ If the insertion or removal of SD or MMC cards is detected by
+ hardware external to West Bridge, this command is used to tell
+ the West Bridge firmware to re-initialize the storage controlled
+ by the device.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+*/
+#define CY_RQT_STORAGE_MEDIA_CHANGED (6)
+
+/* Summary
+ This command enables/disables the periodic heartbeat message
+ from the West Bridge firmware to the processor.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 0
+ * Request code = 7
+
+ Description
+ This command enables/disables the periodic heartbeat message
+ from the West Bridge firmware to the processor. The heartbeat
+ message is left enabled by default, and can lead to a loss
+ in performance on the P port interface.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_CONTROL_ANTIOCH_HEARTBEAT (7)
+
+/* Summary
+ This command requests the West Bridge firmware to prepare for
+ the device going into standby
+ mode.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 0
+ * Request code = 8
+
+ Description
+ This command is sent by the processor to the West Bridge as
+ preparation for going into standby mode. The request allows the
+ firmware to complete any pending/cached storage operations before
+ going into the low power state.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_PREPARE_FOR_STANDBY (8)
+
+/* Summary
+ Requests the firmware to go into suspend mode.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 0
+ * Request code = 9
+
+ D0
+ Bits 7-0: Wakeup control information.
+
+ Description
+ This command is sent by the processor to the West Bridge to
+ request the device to be placed in suspend mode. The firmware
+ will complete any pending/cached storage operations before
+ going into the low power state.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_ENTER_SUSPEND_MODE (9)
+
+/* Summary
+ Indicates that the device has left suspend mode.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 0
+ * Request code = 10
+
+ Description
+ This message is sent by the West Bridge to the Processor
+ to indicate that the device has woken up from suspend mode,
+ and is ready to accept new requests.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_OUT_OF_SUSPEND (10)
+
+/* Summary
+ Request to get the current state of an West Bridge GPIO pin.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 0
+ * Request code = 11
+
+ D0
+ Bits 15 - 8 : GPIO pin identifier
+
+ Responses
+ * CY_RESP_GPIO_STATE
+
+ Description
+ Request from the processor to get the current state of
+ an West Bridge GPIO pin.
+ */
+#define CY_RQT_GET_GPIO_STATE (11)
+
+/* Summary
+ Request to update the output value on an West Bridge
+ GPIO pin.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 0
+ * Request code = 12
+
+ D0
+ Bits 15 - 8 : GPIO pin identifier
+ Bit 0 : Desired output state
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+
+ Description
+ Request from the processor to update the output value on
+ an West Bridge GPIO pin.
+ */
+#define CY_RQT_SET_GPIO_STATE (12)
+
+/* Summary
+ Set the clock frequency on the SD interface of the West
+ Bridge device.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 0
+ * Request code = 13
+
+ D0
+ Bit 8: Type of SD/MMC media
+ 0 = low speed media
+ 1 = high speed media
+ Bit 0: Clock frequency selection
+ 0 = Default frequency
+ 1 = Alternate frequency (24 MHz in both cases)
+
+ Description
+ This request is sent by the processor to set the operating clock
+ frequency used on the SD interface of the device.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_SET_SD_CLOCK_FREQ (13)
+
+/* Summary
+ Indicates the firmware downloaded to West Bridge cannot
+ run on the active device.
+
+ Direction
+ West Bridge -> P Port processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 0
+ * Request code = 14
+
+ Description
+ Some versions of West Bridge firmware can only run on specific
+ types/versions of the West Bridge device. This error is
+ returned when a firmware image is downloaded onto a device that
+ does not support it.
+
+ Responses
+ * None
+ */
+#define CY_RQT_WB_DEVICE_MISMATCH (14)
+
+/* Summary
+ This command is indicates that no firmware was found in the
+ storage media.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 0
+ * Request code = 15
+
+ Description
+ The command is received only in case of silicon with bootloader
+ ROM. The device sends the request if there is no firmware image
+ found in the storage media or the image is corrupted. The
+ device is waiting for P port to download a valid firmware image.
+
+ Responses
+ * None
+ */
+#define CY_RQT_BOOTLOAD_NO_FIRMWARE (15)
+
+/* Summary
+ This command reserves first numzones zones of nand device for
+ storing processor boot image.
+
+ Direction
+ P Port Processor-> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 0
+ * Request Code = 16
+
+ D0
+ Bits 7-0: numzones
+
+ Description
+ The first numzones zones in nand device will be used for storing
+ proc boot image. LNA firmware in Astoria will work on this nand
+ area and boots the processor which will then use the remaining
+ nand for usual purposes.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_RESERVE_LNA_BOOT_AREA (16)
+
+/* Summary
+ This command cancels the processing of a P2S operation in
+ firmware.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 0
+ * Request Code = 17
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+*/
+#define CY_RQT_ABORT_P2S_XFER (17)
+
+/*
+ * Used for debugging, ignore for normal operations
+ */
+#ifndef __doxygen__
+#define CY_RQT_DEBUG_MESSAGE (127)
+#endif
+
+/******************************************************/
+
+/*@@General responses
+ Summary
+ The general responses include:
+ * CY_RESP_FIRMWARE_VERSION
+ * CY_RESP_MCU_REGISTER_DATA
+ * CY_RESP_GPIO_STATE
+ */
+
+
+/* Summary
+ This response indicates success and contains the firmware
+ version number, media types supported by the firmware and
+ release/debug mode information.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 2
+
+ MailBox0
+ * Context = 0
+ * Response Code = 16
+
+ D0
+ Major Version
+
+ D1
+ Minor Version
+
+ D2
+ Build Number
+
+ D3
+ Bits 15-8: Media types supported on Bus 1.
+ Bits 7-0: Media types supported on Bus 0.
+ Bits 8, 0: NAND support.
+ * 0: NAND is not supported.
+ * 1: NAND is supported.
+ Bits 9, 1: SD memory card support.
+ * 0: SD memory card is not supported.
+ * 1: SD memory card is supported.
+ Bits 10, 2: MMC card support.
+ * 0: MMC card is not supported.
+ * 1: MMC card is supported.
+ Bits 11, 3: CEATA drive support
+ * 0: CEATA drive is not supported.
+ * 1: CEATA drive is supported.
+ Bits 12, 4: SD IO card support.
+ * 0: SD IO card is not supported.
+ * 1: SD IO card is supported.
+
+ D4
+ Bits 15 - 8 : MTP information
+ * 0 : MTP not supported in firmware
+ * 1 : MTP supported in firmware
+ Bits 7 - 0 : Debug/Release mode information.
+ * 0 : Release mode
+ * 1 : Debug mode
+
+ Description
+ This reponse is sent to return the firmware version
+ number to the requestor.
+ */
+#define CY_RESP_FIRMWARE_VERSION (16)
+
+/* Summary
+ This response returns the contents of a MCU accessible
+ register to the processor.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 0
+ * Response code = 17
+
+ D0
+ Bits 7 - 0 : MCU register contents
+
+ Description
+ This response is sent by the firmware in response to the
+ CY_RQT_READ_MCU_REGISTER
+ command.
+ */
+#define CY_RESP_MCU_REGISTER_DATA (17)
+
+/* Summary
+ Reports the current state of an West Bridge GPIO pin.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 0
+ * Request code = 18
+
+ D0
+ Bit 0: Current state of the GP input pin
+
+ Description
+ This response is sent by the West Bridge to report the
+ current state observed on a general purpose input pin.
+ */
+#define CY_RESP_GPIO_STATE (18)
+
+
+/* Summary
+ This command notifies West Bridge the polarity of the
+ SD power pin
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 0
+ * Request Code = 19
+ D0: CyAnMiscActivehigh / CyAnMiscActivelow
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+
+ */
+
+#define CY_RQT_SDPOLARITY (19)
+
+/******************************/
+
+/*@@Resource requests
+ Summary
+
+ The resource requests include:
+ * CY_RQT_ACQUIRE_RESOURCE
+ * CY_RQT_RELEASE_RESOURCE
+ */
+
+
+
+
+
+#ifndef __doxygen__
+#define CY_RQT_RESOURCE_RQT_CONTEXT (1)
+#endif
+
+
+/* Summary
+ This command is a request from the P port processor
+ for ownership of a resource.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 1
+ * Request Code = 0
+
+ D0
+ Resource
+ * 0 = USB
+ * 1 = SDIO/MMC
+ * 2 = NAND
+
+ D1
+ Force Flag
+ * 0 = Normal
+ * 1 = Force
+
+ Description
+ The resource may be the USB pins, the SDIO/MMC bus,
+ or the NAND bus.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_NOT_RELEASED
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_BAD_RESOURCE
+ */
+#define CY_RQT_ACQUIRE_RESOURCE (0)
+
+
+/* Summary
+ This command is a request from the P port processor
+ to release ownership of a resource.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 1
+ * Request Code = 1
+
+ D0
+ Resource
+ * 0 = USB
+ * 1 = SDIO/MMC
+ * 2 = NAND
+
+ Description
+ The resource may be the USB pins, the SDIO/MMC bus, or
+ the NAND bus.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_NOT_OWNER
+ */
+#define CY_RQT_RELEASE_RESOURCE (1)
+
+
+/****************************/
+
+/*@@Storage requests
+ Summary
+ The storage commands include:
+ * CY_RQT_START_STORAGE
+ * CY_RQT_STOP_STORAGE
+ * CY_RQT_CLAIM_STORAGE
+ * CY_RQT_RELEASE_STORAGE
+ * CY_RQT_QUERY_MEDIA
+ * CY_RQT_QUERY_DEVICE
+ * CY_RQT_QUERY_UNIT
+ * CY_RQT_READ_BLOCK
+ * CY_RQT_WRITE_BLOCK
+ * CY_RQT_MEDIA_CHANGED
+ * CY_RQT_ANTIOCH_CLAIM
+ * CY_RQT_ANTIOCH_RELEASE
+ * CY_RQT_SD_INTERFACE_CONTROL
+ * CY_RQT_SD_REGISTER_READ
+ * CY_RQT_CHECK_CARD_LOCK
+ * CY_RQT_QUERY_BUS
+ * CY_RQT_PARTITION_STORAGE
+ * CY_RQT_PARTITION_ERASE
+ * CY_RQT_GET_TRANSFER_AMOUNT
+ * CY_RQT_ERASE
+ * CY_RQT_SDIO_READ_DIRECT
+ * CY_RQT_SDIO_WRITE_DIRECT
+ * CY_RQT_SDIO_READ_EXTENDED
+ * CY_RQT_SDIO_WRITE_EXTENDED
+ * CY_RQT_SDIO_INIT_FUNCTION
+ * CY_RQT_SDIO_QUERY_CARD
+ * CY_RQT_SDIO_GET_TUPLE
+ * CY_RQT_SDIO_ABORT_IO
+ * CY_RQT_SDIO_INTR
+ * CY_RQT_SDIO_SUSPEND
+ * CY_RQT_SDIO_RESUME
+ * CY_RQT_SDIO_RESET_DEV
+ * CY_RQT_P2S_DMA_START
+ */
+#ifndef __doxygen__
+#define CY_RQT_STORAGE_RQT_CONTEXT (2)
+#endif
+
+/* Summary
+ This command requests initialization of the storage stack.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 0
+
+ Description
+ This command is required before any other storage related command
+ can be send to the West Bridge firmware.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_ALREADY_RUNNING
+ */
+#define CY_RQT_START_STORAGE (0)
+
+
+/* Summary
+ This command requests shutdown of the storage stack.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 1
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_NOT_RUNNING
+ */
+#define CY_RQT_STOP_STORAGE (1)
+
+
+/* Summary
+ This command requests ownership of the given media
+ type by the P port processor.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 2
+
+ D0
+ Bits 12 - 15 : Bus Index
+ Bits 8 - 11 : Zero based device index
+
+ Responses
+ * CY_RESP_MEDIA_CLAIMED_RELEASED
+ * CY_RESP_NO_SUCH_ADDRESS
+ */
+#define CY_RQT_CLAIM_STORAGE (2)
+
+
+/* Summary
+ This command releases ownership of a given media type
+ by the P port processor.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 3
+
+ D0
+ Bits 12 - 15 : Bus Index
+ Bits 8 - 11 : Zero based device index
+
+ Responses
+ * CY_RESP_MEDIA_CLAIMED_RELEASED
+ * CY_RESP_NO_SUCH_ADDRESS
+ */
+#define CY_RQT_RELEASE_STORAGE (3)
+
+
+/* Summary
+ This command returns the total number of logical devices
+ of the given type of media.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 4
+
+ D0
+ Bits 12 - 15 : MediaType
+ * 0 = NAND
+ * 1 = SDIO Flash
+ * 2 = MMC Flash
+ * 3 = CE-ATA
+
+ Bits 8 - 11 : Not Used
+
+ Bits 0 - 7 : Not Used
+
+ Responses
+ * CY_RESP_MEDIA_DESCRIPTOR
+ * CY_RESP_NO_SUCH_ADDRESS
+ */
+#define CY_RQT_QUERY_MEDIA (4)
+
+
+/* Summary
+ This command queries a given device to determine
+ information about the number of logical units on
+ the given device.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 5
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Not Used
+
+ Responses
+ * CY_RESP_DEVICE_DESCRIPTOR
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_INVALID_PARTITION_TABLE
+ * CY_RESP_NO_SUCH_ADDRESS
+ */
+#define CY_RQT_QUERY_DEVICE (5)
+
+
+/* Summary
+ This command queries a given device to determine
+ information about the size and location of a logical unit
+ located on a physical device.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 6
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based unit index
+
+ Responses
+ * CY_RESP_UNIT_DESCRIPTOR
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_INVALID_PARTITION_TABLE
+ * CY_RESP_NO_SUCH_ADDRESS
+ */
+#define CY_RQT_QUERY_UNIT (6)
+
+
+/* Summary
+ This command initiates the read of a specific block
+ from the given media,
+ device and unit.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 2
+
+ MailBox0
+ * Context = 2
+ * Request Code = 7
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based unit index
+
+ D1
+ Upper 16 bits of block address
+
+ D2
+ Lower 16 bits of block address
+
+ D3
+ BIT 8 - 15 : Upper 8 bits of Number of blocks
+
+ BIT 0 - 7 : Reserved
+
+ * D4 *
+ BITS 8 - 15 : Lower 8 bits of Number of blocks
+ BITS 1 - 7 : Not Used
+ BIT 0 : Indicates whether this command is a
+ part of a P2S only burst.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_ANTIOCH_DEFERRED_ERROR
+ */
+#define CY_RQT_READ_BLOCK (7)
+
+
+/* Summary
+ This command initiates the write of a specific block
+ from the given media, device and unit.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 2
+
+ MailBox0
+ * Context = 2
+ * Request Code = 8
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based unit index
+
+ D1
+ Upper 16 bits of block address
+
+ D2
+ Lower 16 bits of block address
+
+ D3
+ BIT 8 - 15 : Upper 8 bits of Number of blocks
+
+ BIT 0 - 7 : Reserved
+
+ * D4 *
+ BITS 8 - 15 : Lower 8 bits of Number of blocks
+ BITS 1 - 7 : Not Used
+ BIT 0 : Indicates whether this command is a
+ part of a P2S only burst.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_ANTIOCH_DEFERRED_ERROR
+ */
+#define CY_RQT_WRITE_BLOCK (8)
+
+/* Summary
+ This request is sent when the West Bridge device detects
+ a change in the status of the media.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 2
+ * Request Code = 9
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 0 - 7 : Media type
+
+ D1
+ Bit 0 : Action
+ * 0 = Inserted
+ * 1 = Removed
+
+ Description
+ When the media manager detects the insertion or removal
+ of a media from the West Bridge port, this request is sent
+ from the West Bridge device to the P Port processor to
+ inform the processor of the change in status of the media.
+ This request is sent for both an insert operation and a
+ removal operation.
+
+ Responses
+ * CY_RESPO_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_MEDIA_CHANGED (9)
+
+/* Summary
+ This request is sent when the USB module wishes to claim
+ storage media.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 2
+ * Request Code = 10
+
+ D0
+ Bit 0:
+ * 0 = do not release NAND
+ * 1 = release NAND
+
+ Bit 1:
+ * 0 = do not release SD Flash
+ * 1 = release SD Flash
+
+ Bit 2:
+ * 0 = do not release MMC flash
+ * 1 = release MMC flash
+
+ Bit 3:
+ * 0 = do not release CE-ATA storage
+ * 1 = release CE-ATA storage
+
+ Bit 8:
+ * 0 = do not release storage on bus 0
+ * 1 = release storage on bus 0
+
+ Bit 9:
+ * 0 = do not release storage on bus 1
+ * 1 = release storage on bus 1
+
+ Description
+ When the USB cable is attached to the West Bridge device,
+ West Bridge will enumerate the storage devices per the USB
+ initialization of West Bridge. In order for West Bridge to
+ respond to requests received via USB for the mass storage
+ devices, the USB module must claim the storeage. This
+ request is a request to the P port processor to release the
+ storage medium. The medium will not be visible on the USB
+ host, until it has been released by the processor.
+*/
+#define CY_RQT_ANTIOCH_CLAIM (10)
+
+/* Summary
+ This request is sent when the P port has asked West Bridge to
+ release storage media, and the West Bridge device has
+ completed this.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 2
+ * Request Code = 11
+
+ D0
+ Bit 0:
+ * 0 = No change in ownership of NAND storage
+ * 1 = NAND ownership has been given to processor
+
+ Bit 1:
+ * 0 = No change in ownership of SD storage
+ * 1 = SD ownership has been given to processor
+
+ Bit 2:
+ * 0 = No change in ownership of MMC storage
+ * 1 = MMC ownership has been given to processor
+
+ Bit 3:
+ * 0 = No change in ownership of CE-ATA storage
+ * 1 = CE-ATA ownership has been given to processor
+
+ Bit 4:
+ * 0 = No change in ownership of SD IO device
+ * 1 = SD IO device ownership has been given to processor
+
+ Bit 8:
+ * 0 = No change in ownership of storage on bus 0
+ * 1 = Bus 0 ownership has been given to processor
+
+ Bit 9:
+ * 0 = No change in ownership of storage on bus 1
+ * 1 = Bus 1 ownership has been given to processor
+
+ Description
+ When the P port asks for control of a particular media, West
+ Bridge may be able to release the media immediately. West
+ Bridge may also need to complete the flush of buffers before
+ releasing the media. In the later case, West Bridge will
+ indicated a release is not possible immediately and West Bridge
+ will send this request to the P port when the release has been
+ completed.
+*/
+#define CY_RQT_ANTIOCH_RELEASE (11)
+
+/* Summary
+ This request is sent by the Processor to enable/disable the
+ handling of SD card detection and SD card write protection
+ by the firmware.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 2
+ * Request code = 12
+
+ D0
+ Bit 8: Enable/disable handling of card detection.
+ Bit 1: SDAT_3 = 0, GIPO_0 = 1
+ Bit 0: Enable/disable handling of write protection.
+
+ Description
+ This request is sent by the Processor to enable/disable
+ the handling of SD card detection and SD card write
+ protection by the firmware.
+ */
+#define CY_RQT_SD_INTERFACE_CONTROL (12)
+
+/* Summary
+ Request from the processor to read a register on the SD
+ card, and return the contents.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 2
+ * Request code = 13
+
+ D0
+ Bits 12 - 15 : MediaType
+ * 0 = Reserved
+ * 1 = SDIO Flash
+ * 2 = MMC Flash
+ * 3 = Reserved
+
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Type of register to read
+
+ Description
+ This request is sent by the processor to instruct the
+ West Bridge to read a register on the SD/MMC card, and
+ send the contents back through the CY_RESP_SD_REGISTER_DATA
+ response.
+ */
+#define CY_RQT_SD_REGISTER_READ (13)
+
+/* Summary
+ Check if the SD/MMC card connected to West Bridge is
+ password locked.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 2
+ * Request code = 14
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+
+ Description
+ This request is sent by the processor to check if the
+ SD/MMC connected to the West Bridge is locked with a
+ password.
+ */
+#define CY_RQT_CHECK_CARD_LOCK (14)
+
+/* Summary
+ This command returns the total number of logical devices on the
+ given bus
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 15
+
+ D0
+ Bits 12 - 15 : Bus Number
+
+ Bits 0 - 11: Not Used
+
+ Responses
+ * CY_RESP_BUS_DESCRIPTOR
+ * CY_RESP_NO_SUCH_BUS
+ */
+#define CY_RQT_QUERY_BUS (15)
+
+/* Summary
+ Divide a storage device into two partitions.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request code = 16
+
+ D0
+ Bits 12 - 15 : Bus number
+ Bits 8 - 11 : Device number
+ Bits 0 - 7 : Not used
+
+ D1
+ Size of partition 0 (MS word)
+
+ D2
+ Size of partition 0 (LS word)
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_PARTITION_STORAGE (16)
+
+/* Summary
+ Remove the partition table and unify all partitions on
+ a storage device.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request code = 17
+
+ D0
+ Bits 12 - 15 : Bus number
+ Bits 8 - 11 : Device number
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_PARTITION_ERASE (17)
+
+/* Summary
+ Requests the current transfer amount.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request code = 18
+
+ D0
+ Bits 12 - 15 : Bus number
+ Bits 8 - 11 : Device number
+
+ Responses
+ * CY_RESP_TRANSFER_COUNT
+ */
+#define CY_RQT_GET_TRANSFER_AMOUNT (18)
+
+/* Summary
+ Erases.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 2
+
+ MailBox0
+ * Context = 2
+ * Request code = 19
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based unit index
+
+ D1
+ Upper 16 bits of erase unit
+
+ D2
+ Lower 16 bits of erase unit
+
+ D3
+ BIT 8 - 15 : Upper 8 bits of Number of erase units
+ BIT 0 - 7 : Reserved
+
+ * D4 *
+ BIT 8 - 15 : Lower 8 bits of Number of erase units
+ BIT 0 - 7 : Not Used
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ */
+#define CY_RQT_ERASE (19)
+
+/* Summary
+ This command reads 1 byte from an SDIO card.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 23
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based function number
+
+ D1
+ Bits 8 - 15 : 0
+ Bit 7 : 0 to indicate a read
+ Bits 4 - 6 : Function number
+ Bit 3 : 0
+ Bit 2 : 1 if SDIO interrupt needs to be re-enabled.
+ Bits 0 - 1 : Two Most significant bits of Read address
+
+ D2
+ Bits 1 - 15 : 15 Least significant bits of Read address
+ Bit 0 : 0
+
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ * CY_RESP_SDIO_DIRECT
+*/
+#define CY_RQT_SDIO_READ_DIRECT (23)
+
+/* Summary
+ This command writes 1 byte to an SDIO card.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 24
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based function number
+
+ D1
+ Bits 8 - 15 : Data to write
+ Bit 7 : 1 to indicate a write
+ Bits 4 - 6 : Function number
+ Bit 3 : 1 if Read after write is enabled
+ Bit 2 : 1 if SDIO interrupt needs to be re-enabled.
+ Bits 0 - 1 : Two Most significant bits of write address
+
+ D2
+ Bits 1 - 15 : 15 Least significant bits of write address
+ Bit 0 : 0
+
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SDIO_DIRECT
+*/
+#define CY_RQT_SDIO_WRITE_DIRECT (24)
+
+/* Summary
+ This command reads performs a multi block/byte read from
+ an SDIO card.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 25
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based function number
+
+ D1
+ Bit 15 : 0 to indicate a read
+ Bit 12 - 14 : Function Number
+ Bit 11 : Block Mode
+ Bit 10 : OpCode
+ Bits 0 - 9 : 10 Most significant bits of Read address
+
+ D2
+ Bits 9 - 15 : 7 Least significant bits of address
+ Bits 0 - 8 : Block/Byte Count
+
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SDIO_EXT
+*/
+#define CY_RQT_SDIO_READ_EXTENDED (25)
+
+/* Summary
+ This command reads performs a multi block/byte write
+ to an SDIO card.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 26
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based function number
+
+ D1
+ Bit 15 : 1 to indicate a write
+ Bit 12 - 14 : Function Number
+ Bit 11 : Block Mode
+ Bit 10 : OpCode
+ Bits 0 - 9 : 10 Most significant bits of Read address
+
+ D2
+ Bits 9 - 15 : 7 Least significant bits of address
+ Bits 0 - 8 : Block/Byte Count
+
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SDIO_EXT
+*/
+#define CY_RQT_SDIO_WRITE_EXTENDED (26)
+
+/* Summary
+ This command initialises an IO function on the SDIO card.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 27
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based function number
+
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_SDIO_INIT_FUNCTION (27)
+
+/* Summary
+ This command gets properties of the SDIO card.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 28
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_QUERY_CARD
+*/
+#define CY_RQT_SDIO_QUERY_CARD (28)
+
+/* Summary
+ This command reads a tuple from the CIS of an SDIO card.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 29
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based function number
+
+ D1
+ Bits 8 - 15 : Tuple ID to read
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SDIO_GET_TUPLE
+*/
+#define CY_RQT_SDIO_GET_TUPLE (29)
+
+/* Summary
+ This command Aborts an IO operation.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 30
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based function number
+
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_SDIO_ABORT_IO (30)
+
+/* Summary
+ SDIO Interrupt request sent to the processor from the West Bridge device.
+
+ Direction
+ West Bridge ->P Port Processor
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 31
+
+ D0
+ Bits 0 - 7 : Bus Index
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_SDIO_INTR (31)
+
+/* Summary
+ This command Suspends an IO operation.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 32
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based function number
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_SDIO_SUSPEND (32)
+
+/* Summary
+ This command resumes a suspended operation.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 33
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based function number
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SDIO_RESUME
+*/
+#define CY_RQT_SDIO_RESUME (33)
+
+/* Summary
+ This command resets an SDIO device.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request Code = 34
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : 0
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_SDIO_RESET_DEV (34)
+
+/* Summary
+ This command asks the API to start the DMA transfer
+ for a P2S operation.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Request code = 35
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_P2S_DMA_START (35)
+
+/******************************************************/
+
+/*@@Storage responses
+ Summary
+ The storage responses include:
+ * CY_RESP_MEDIA_CLAIMED_RELEASED
+ * CY_RESP_MEDIA_DESCRIPTOR
+ * CY_RESP_DEVICE_DESCRIPTOR
+ * CY_RESP_UNIT_DESCRIPTOR
+ * CY_RESP_ANTIOCH_DEFERRED_ERROR
+ * CY_RESP_SD_REGISTER_DATA
+ * CY_RESP_SD_LOCK_STATUS
+ * CY_RESP_BUS_DESCRIPTOR
+ * CY_RESP_TRANSFER_COUNT
+ * CY_RESP_SDIO_EXT
+ * CY_RESP_SDIO_INIT_FUNCTION
+ * CY_RESP_SDIO_QUERY_CARD
+ * CY_RESP_SDIO_GET_TUPLE
+ * CY_RESP_SDIO_DIRECT
+ * CY_RESP_SDIO_INVALID_FUNCTION
+ * CY_RESP_SDIO_RESUME
+ */
+
+/* Summary
+ Based on the request sent, the state of a given media was
+ changed as indicated by this response.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Response Code = 16
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+
+ D1
+ State of Media
+ * 0 = released
+ * 1 = claimed
+ */
+#define CY_RESP_MEDIA_CLAIMED_RELEASED (16)
+
+
+/* Summary
+ This response gives the number of physical devices
+ associated with a given media type.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Response Code = 17
+
+ D0
+ Media Type
+ Bits 12 - 15
+ * 0 = NAND
+ * 1 = SDIO Flash
+ * 2 = MMC Flash
+ * 3 = CE-ATA
+
+ D1
+ Number of devices
+ */
+#define CY_RESP_MEDIA_DESCRIPTOR (17)
+
+
+/* Summary
+ This response gives description of a physical device.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 2
+
+ MailBox0
+ * Context = 2
+ * Response Code = 18
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Type of media present on bus
+
+ D1
+ Block Size in bytes
+
+ D2
+ Bit 15 : Is device removable
+ Bit 9 : Is device password locked
+ Bit 8 : Is device writeable
+ Bits 0 - 7 : Number Of Units
+
+ D3
+ ERASE_UNIT_SIZE high 16 bits
+
+ D4
+ ERASE_UNIT_SIZE low 16 bits
+
+ */
+#define CY_RESP_DEVICE_DESCRIPTOR (18)
+
+
+/* Summary
+ This response gives description of a unit on a
+ physical device.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 6
+
+ MailBox0
+ * Context = 2
+ * Response Code = 19
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based unit index
+
+ D1
+ Bits 0 - 7 : Media type
+ * 1 = NAND
+ * 2 = SD FLASH
+ * 4 = MMC FLASH
+ * 8 = CEATA
+ * 16 = SD IO
+
+ D2
+ Block Size in bytes
+
+ D3
+ Start Block Low 16 bits
+
+ D4
+ Start Block High 16 bits
+
+ D5
+ Unit Size Low 16 bits
+
+ D6
+ Unit Size High 16 bits
+ */
+#define CY_RESP_UNIT_DESCRIPTOR (19)
+
+
+/* Summary
+ This response is sent as error status for P2S
+ Storage operation.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 2
+
+ Mailbox0
+ * Context = 2
+ * Request Code = 20
+
+ D0
+ Bit 8 : Type of operation (Read / Write)
+ Bits 7 - 0 : Error code
+
+ D1
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Zero based unit index
+
+ *D2 - D3*
+ Address where the error occurred.
+
+ D4
+ Length of the operation in blocks.
+
+ Description
+ This error is returned by the West Bridge to the
+ processor if a storage operation fails due to a
+ medium error.
+*/
+#define CY_RESP_ANTIOCH_DEFERRED_ERROR (20)
+
+/* Summary
+ Contents of a register on the SD/MMC card connected to
+ West Bridge.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ Variable
+
+ Mailbox0
+ * Context = 2
+ * Request code = 21
+
+ D0
+ Length of data in bytes
+
+ D1 - Dn
+ The register contents
+
+ Description
+ This is the response to a CY_RQT_SD_REGISTER_READ
+ request.
+*/
+#define CY_RESP_SD_REGISTER_DATA (21)
+
+/* Summary
+ Status of whether the SD card is password locked.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 2
+ * Request code = 22
+
+ D0
+ Bit 0 : The card's lock status
+
+ Description
+ Status of whether the SD card is password locked.
+*/
+#define CY_RESP_SD_LOCK_STATUS (22)
+
+
+/* Summary
+ This response gives the types of physical devices
+ attached to a given bus.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 2
+ * Response Code = 23
+
+ D0
+ Bus Number
+ Bits 12 - 15
+
+ D1
+ Media present on addressed bus
+ */
+#define CY_RESP_BUS_DESCRIPTOR (23)
+
+/* Summary
+ Amount of data read/written through the USB mass
+ storage/MTP device.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 2
+
+ MailBox0
+ * Context = 2
+ * Request code = 24
+
+ D0
+ MS 16 bits of number of sectors written
+
+ D1
+ LS 16 bits of number of sectors written
+
+ D2
+ MS 16 bits of number of sectors read
+
+ D3
+ LS 16 bits of number of sectors read
+
+ Description
+ This is the response to the CY_RQT_GET_TRANSFER_AMOUNT
+ request, and represents the number of sectors of data
+ that has been written to or read from the storage device
+ through the USB Mass storage or MTP interface.
+ */
+#define CY_RESP_TRANSFER_COUNT (24)
+
+/* Summary
+ Status of SDIO Extended read/write operation.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 2
+ * Request code = 34
+
+ D0
+ Bit 8 : 1 if Read response, 0 if write response
+ Bits 0-7: Error Status
+
+ Description
+ Status of SDIO Extended read write operation.
+*/
+
+#define CY_RESP_SDIO_EXT (34)
+
+/* Summary
+ Status of SDIO operation to Initialize a function
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 2
+
+ Mailbox0
+ * Context = 2
+ * Request code = 35
+
+
+ D0
+ Bits 8-15 : Function Interface Code
+ Bits 0-7: Extended Function Interface Code
+
+ D1
+ Bits 0-15 : Function Block Size
+
+ D2
+ Bits 0-15 : Most significant Word of Function PSN
+
+ D3
+ Bits 0-15 : Least significant Word of Function PSN
+
+ D4
+ Bit 15 : CSA Enabled Status
+ Bit 14 : CSA Support Status
+ Bit 9 : CSA No Format Status
+ Bit 8 : CSA Write Protect Status
+ Bit 0 : Function Wake Up Support status
+
+ Description
+ Status of SDIO Function Initialization operation.
+*/
+#define CY_RESP_SDIO_INIT_FUNCTION (35)
+
+/* Summary
+ Status of SDIO operation to query the Card
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 2
+
+ Mailbox0
+ * Context = 2
+ * Request code = 36
+
+
+ D0
+ Bits 8-15 : Number of IO functions present
+ Bit 0: 1 if memory is present
+
+ D1
+ Bits 0-15 : Card Manufacturer ID
+
+ D2
+ Bits 0-15 : Card Manufacturer Additional Information
+
+ D3
+ Bits 0-15 : Function 0 Block Size
+
+ D4
+ Bits 8-15 :SDIO Card Capability register
+ Bits 0-7: SDIO Version
+
+
+ Description
+ Status of SDIO Card Query operation.
+ */
+#define CY_RESP_SDIO_QUERY_CARD (36)
+/* Summary
+ Status of SDIO CIS read operation
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 2
+ * Request code = 37
+
+ D0
+ Bit 8 : 1
+ Bits 0-7: Error Status
+
+ D1
+ Bits 0 - 7 : Size of data read.
+
+ Description
+ Status of SDIO Get Tuple Read operation.
+ */
+#define CY_RESP_SDIO_GET_TUPLE (37)
+
+/* Summary
+ Status of SDIO Direct read/write operation.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 2
+ * Request code = 38
+
+ D0
+ Bit 8 : Error Status
+ Bits 0-7: Data Read(If any)
+
+ Description
+ Status of SDIO Direct read write operation.
+
+*/
+#define CY_RESP_SDIO_DIRECT (38)
+
+/* Summary
+ Indicates an un-initialized function has been used for IO
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 2
+ * Request code = 39
+
+ Description
+ Indicates an IO request on an uninitialized function.
+*/
+#define CY_RESP_SDIO_INVALID_FUNCTION (39)
+
+/* Summary
+ Response to a Resume request
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 2
+ * Request code = 40
+
+ D0
+ Bits 8-15 : Error Status
+ Bit 0: 1 if data is available. 0 otherwise.
+
+ Description
+ Response to a Resume request. Indicates if data is
+ available after resum or not.
+*/
+#define CY_RESP_SDIO_RESUME (40)
+
+/******************************************************/
+
+/*@@USB requests
+ Summary
+ The USB requests include:
+ * CY_RQT_START_USB
+ * CY_RQT_STOP_USB
+ * CY_RQT_SET_CONNECT_STATE
+ * CY_RQT_GET_CONNECT_STATE
+ * CY_RQT_SET_USB_CONFIG
+ * CY_RQT_GET_USB_CONFIG
+ * CY_RQT_STALL_ENDPOINT
+ * CY_RQT_GET_STALL
+ * CY_RQT_SET_DESCRIPTOR
+ * CY_RQT_GET_DESCRIPTOR
+ * CY_RQT_SET_USB_CONFIG_REGISTERS
+ * CY_RQT_USB_EVENT
+ * CY_RQT_USB_EP_DATA
+ * CY_RQT_ENDPOINT_SET_NAK
+ * CY_RQT_GET_ENDPOINT_NAK
+ * CY_RQT_ACK_SETUP_PACKET
+ * CY_RQT_SCSI_INQUIRY_COMMAND
+ * CY_RQT_SCSI_START_STOP_COMMAND
+ * CY_RQT_SCSI_UNKNOWN_COMMAND
+ * CY_RQT_USB_REMOTE_WAKEUP
+ * CY_RQT_CLEAR_DESCRIPTORS
+ * CY_RQT_USB_STORAGE_MONITOR
+ * CY_RQT_USB_ACTIVITY_UPDATE
+ * CY_RQT_MS_PARTITION_SELECT
+ */
+#ifndef __doxygen__
+#define CY_RQT_USB_RQT_CONTEXT (3)
+#endif
+
+/* Summary
+ This command requests initialization of the USB stack.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Request Code = 0
+
+ Description
+ This command is required before any other USB related command can be
+ sent to the West Bridge firmware.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_ALREADY_RUNNING
+ */
+#define CY_RQT_START_USB (0)
+
+
+/* Summary
+ This command requests shutdown of the USB stack.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Request Code = 1
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_NOT_RUNNING
+ */
+#define CY_RQT_STOP_USB (1)
+
+
+/* Summary
+ This command requests that the USB pins be connected
+ or disconnected to/from the West Bridge device.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Request Code = 2
+
+ D0
+ Desired Connect State
+ * 0 = DISCONNECTED
+ * 1 = CONNECTED
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_NOT_RUNNING
+ */
+#define CY_RQT_SET_CONNECT_STATE (2)
+
+
+/* Summary
+ This command requests the connection state of the
+ West Bridge USB pins.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Request Code = 3
+
+ Responses
+ * CY_RESP_CONNECT_STATE
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_NOT_RUNNING
+ */
+#define CY_RQT_GET_CONNECT_STATE (3)
+
+
+/* Summary
+ This request configures the USB subsystem.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 2
+
+ MailBox0
+ * Context = 3
+ * Request Code = 4
+
+ D0
+ Bits 8 - 15: Media to enumerate (bit mask)
+ Bits 0 - 7: Enumerate Mass Storage (bit mask)
+ * 1 = Enumerate device on bus 0
+ * 2 = Enumerate device on bus 1
+
+ D1
+ Enumeration Methodology
+ * 1 = West Bridge enumeration
+ * 0 = P Port enumeration
+
+ D2
+ Mass storage interface number - Interface number to
+ be used for the mass storage interface
+
+ D3
+ Mass storage callbacks
+ * 1 = relay to P port
+ * 0 = completely handle in firmware
+
+ Description
+ This indicates how enumeration should be handled.
+ Enumeration can be handled by the West Bridge device
+ or by the P port processor.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_INVALID_MASK
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_INVALID_STORAGE_MEDIA
+ */
+#define CY_RQT_SET_USB_CONFIG (4)
+
+
+/* Summary
+ This request retrieves the current USB configuration from
+ the West Bridge device.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Request Code = 5
+
+ Responses
+ * CY_RESP_USB_CONFIG
+ */
+#define CY_RQT_GET_USB_CONFIG (5)
+
+
+/* Summary
+ This request stalls the given endpoint.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Request Code = 6
+
+ D0
+ Endpoint Number
+
+ D1
+ * 1 = Stall Endpoint
+ * 0 = Clear Stall
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_INVALID_ENDPOINT
+ */
+#define CY_RQT_STALL_ENDPOINT (6)
+
+
+/* Summary
+ This request retrieves the stall status of the
+ requested endpoint.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Request Code = 7
+
+ D0
+ Endpoint number
+
+ Responses
+ * CY_RESP_ENDPOINT_STALL
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_INVALID_ENDPOINT
+ */
+#define CY_RQT_GET_STALL (7)
+
+
+/* Summary
+ This command sets the contents of a descriptor.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Request Code = 8
+
+ D0
+ Bit 15 - Bit 8
+ Descriptor Index
+
+ Bit 7 - Bit 0
+ Descriptor Type
+ * Device = 1
+ * Device Qualifier = 2
+ * Full Speed Configuration = 3
+ * High Speed Configuration = 4
+
+ * D1 - DN *
+ Actual data for the descriptor
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_BAD_TYPE
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_BAD_INDEX
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_BAD_LENGTH
+ */
+#define CY_RQT_SET_DESCRIPTOR (8)
+
+/* Summary
+ This command gets the contents of a descriptor.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Request Code = 9
+
+ D0
+ Bit 15 - Bit 8
+ Descriptor Index
+
+ Bit 7 - Bit 0
+ Descriptor Type
+ * Device = 1
+ * Device Qualifier = 2
+ * Full Speed Configuration = 3
+ * High Speed Configuration = 4
+
+ Responses
+ * CY_RESP_USB_DESCRIPTOR
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_BAD_TYPE
+ * CY_RESP_SUCCESS_FAILURE:CY_ERR_BAD_INDEX
+ */
+#define CY_RQT_GET_DESCRIPTOR (9)
+
+/* Summary
+ This request is sent from the P port processor to the
+ West Bridge device to physically configure the endpoints
+ in the device.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 3
+
+ MailBox0
+ * Context = 3
+ * Request Code = 10
+
+ D0
+ Bit 15 - Bit 8
+ EP1OUTCFG register value
+ Bit 7 - Bit 0
+ EP1INCFG register value
+
+ * D1 - D2 *
+ PEPxCFS register values where x = 3, 5, 7, 9
+
+ * D3 - D7 *
+ LEPxCFG register values where x = 3, 5, 7, 9, 10,
+ 11, 12, 13, 14, 15
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_SET_USB_CONFIG_REGISTERS (10)
+
+/* Summary
+ This request is sent to the P port processor when a
+ USB event occurs and needs to be relayed to the
+ P port.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 3
+ * Request Code = 11
+
+ D0
+ Event Type
+ * 0 = Reserved
+ * 1 = Reserved
+ * 2 = USB Suspend
+ * 3 = USB Resume
+ * 4 = USB Reset
+ * 5 = USB Set Configuration
+ * 6 = USB Speed change
+
+ D1
+ If EventTYpe is USB Speed change
+ * 0 = Full Speed
+ * 1 = High Speed
+
+ If EventType is USB Set Configuration
+ * The number of the configuration to use
+ * (may be zero to unconfigure)
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_USB_EVENT (11)
+
+/* Summary
+ This request is sent in both directions to transfer
+ endpoint data for endpoints 0 and 1.
+
+ Direction
+ West Bridge -> P Port Processor
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ Variable
+
+ Mailbox0
+ * Context = 3
+ * Request Code = 12
+
+ D0
+ Bit 15 - 14 Data Type
+ * 0 = Setup (payload should be the 8 byte setup packet)
+ * 1 = Data
+ * 2 = Status (payload should be empty)
+
+ Bit 13 Endpoint Number (only 0 and 1 supported)
+ Bit 12 First Packet (only supported for Host ->
+ West Bridge traffic)
+ Bit 11 Last Packet (only supported for Host ->
+ West Bridge traffic)
+
+ Bit 9 - 0 Data Length (real max data length is 64 bytes
+ for EP0 and EP1)
+
+ *D1-Dn*
+ Endpoint data
+*/
+#define CY_RQT_USB_EP_DATA (12)
+
+
+/* Summary
+ This request sets the NAK bit on an endpoint.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Request Code = 13
+
+ D0
+ Endpoint Number
+
+ D1
+ * 1 = NAK Endpoint
+ * 0 = Clear NAK
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_INVALID_ENDPOINT
+ */
+#define CY_RQT_ENDPOINT_SET_NAK (13)
+
+
+/* Summary
+ This request retrieves the NAK config status of the
+ requested endpoint.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Request Code = 14
+
+ D0
+ Endpoint number
+
+ Responses
+ * CY_RESP_ENDPOINT_NAK
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_INVALID_ENDPOINT
+ */
+#define CY_RQT_GET_ENDPOINT_NAK (14)
+
+/* Summary
+ This request acknowledges a setup packet that does not
+ require any data transfer.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox
+ * Context = 3
+ * Request Code = 15
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_ACK_SETUP_PACKET (15)
+
+/* Summary
+ This request is sent when the USB storage driver within
+ West Bridge receives an Inquiry request.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ x - variable
+
+ Mailbox0
+ * Context = 3
+ * Request Code = 16
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Media type being addressed
+
+ D1
+ Bits 8 : EVPD bit from request
+ Bits 0 - 7 : Codepage from the inquiry request
+
+ D2
+ Length of the inquiry response in bytes
+
+ * D3 - Dn *
+ The inquiry response
+
+ Description
+ When the West Bridge firmware receives an SCSI Inquiry
+ request from the USB host, the response to this mass
+ storage command is created by West Bridge and forwarded to
+ the P port processor. The P port processor may change
+ this response before it is returned to the USB host. This
+ request is the method by which this may happen.
+*/
+#define CY_RQT_SCSI_INQUIRY_COMMAND (16)
+
+/* Summary
+ This request is sent when the USB storage driver within
+ West Bridge receives a Start/Stop request.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 3
+ * Request Code = 17
+
+ D0
+ Bits 12 - 15 : Bus index
+ Bits 8 - 11 : Zero based device index
+ Bits 0 - 7 : Media type being addressed
+
+ D1
+ Bit 1
+ * LoEj Bit (See SCSI-3 specification)
+
+ Bit 0
+ * Start Bit (See SCSI-3 specification)
+
+ Description
+ When the West Bridge firmware received a SCSI Start/Stop
+ request from the USB host, this request is relayed to the
+ P port processor. This request is used to relay the command.
+ The USB firmware will not response to the USB command until
+ the response to this request is recevied by the firmware.
+*/
+#define CY_RQT_SCSI_START_STOP_COMMAND (17)
+
+/* Summary
+ This request is sent when the USB storage driver
+ receives an unknown CBW on mass storage.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 4
+
+ Mailbox0
+ * Context = 3
+ * Request Code = 18
+
+ D0
+ Bits 12 - 15 : MediaType
+ * 0 = NAND
+ * 1 = SDIO Flash
+ * 2 = MMC Flash
+ * 3 = CE-ATA
+
+ D1
+ The length of the request in bytes
+
+ D2 - Dn
+ CBW command block from the SCSI host controller.
+
+ Description
+ When the firmware recevies a SCSI request that is not
+ understood, this request is relayed to the
+ P port processor.
+*/
+#define CY_RQT_SCSI_UNKNOWN_COMMAND (18)
+
+/* Summary
+ Request the West Bridge to signal remote wakeup
+ to the USB host.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 3
+ * Request code = 19
+
+ Description
+ Request from the processor to West Bridge, to signal
+ remote wakeup to the USB host.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_USB_REMOTE_WAKEUP (19)
+
+/* Summary
+ Request the West Bridge to clear all descriptors tha
+ were set previously
+ using the Set Descriptor calls.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 3
+ * Request code = 20
+
+ Description
+ Request from the processor to West Bridge, to clear
+ all descriptor information that was previously stored
+ on the West Bridge using CyAnUsbSetDescriptor calls.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_CLEAR_DESCRIPTORS (20)
+
+/* Summary
+ Request the West Bridge to monitor USB to storage activity
+ and send periodic updates.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 2
+
+ Mailbox0
+ * Context = 3
+ * Request code = 21
+
+ D0
+ Upper 16 bits of write threshold
+
+ D1
+ Lower 16 bits of write threshold
+
+ D2
+ Upper 16 bits of read threshold
+
+ D3
+ Lower 16 bits of read threshold
+
+ Description
+ Request from the processor to West Bridge, to start
+ monitoring the level of read/write activity on the
+ USB mass storage drive and to set the threshold
+ level at which progress reports are sent.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_USB_STORAGE_MONITOR (21)
+
+/* Summary
+ Event from the West Bridge showing that U2S activity
+ since the last event has crossed the threshold.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 2
+
+ Mailbox0
+ * Context = 3
+ * Request code = 22
+
+ D0
+ Upper 16 bits of sectors written since last event.
+
+ D1
+ Lower 16 bits of sectors written since last event.
+
+ D2
+ Upper 16 bits of sectors read since last event.
+
+ D3
+ Lower 16 bits of sectors read since last event.
+
+ Description
+ Event notification from the West Bridge indicating
+ that the number of read/writes on the USB mass
+ storage device have crossed a pre-defined threshold
+ level.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_USB_ACTIVITY_UPDATE (22)
+
+/* Summary
+ Request to select the partitions to be enumerated on a
+ storage device with partitions.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 3
+ * Request code = 23
+
+ D0
+ Bits 8-15 : Bus index
+ Bits 0- 7 : Device index
+
+ D1
+ Bits 8-15 : Control whether to enumerate partition 1.
+ Bits 0- 7 : Control whether to enumerate partition 0.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE
+ */
+#define CY_RQT_MS_PARTITION_SELECT (23)
+
+/************/
+
+/*@@USB responses
+ Summary
+ The USB responses include:
+ * CY_RESP_USB_CONFIG
+ * CY_RESP_ENDPOINT_CONFIG
+ * CY_RESP_ENDPOINT_STALL
+ * CY_RESP_CONNECT_STATE
+ * CY_RESP_USB_DESCRIPTOR
+ * CY_RESP_USB_INVALID_EVENT
+ * CY_RESP_ENDPOINT_NAK
+ * CY_RESP_INQUIRY_DATA
+ * CY_RESP_UNKNOWN_SCSI_COMMAND
+ */
+
+/* Summary
+ This response contains the enumeration configuration
+ information for the USB module.
+
+ Direction
+ 8051->P
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Response Code = 32
+
+ D0
+ Bits 8 - 15: Media to enumerate (bit mask)
+ Bits 0 - 7: Buses to enumerate (bit mask)
+ * 1 = Bus 0
+ * 2 = Bus 1
+
+ D1
+ Enumeration Methodology
+ * 0 = West Bridge enumeration
+ * 1 = P Port enumeration
+
+ D2
+ Bits 7 - 0 : Interface Count - the number of interfaces
+ Bits 15 - 8 : Mass storage callbacks
+
+ */
+#define CY_RESP_USB_CONFIG (32)
+
+
+/* Summary
+ This response contains the configuration information
+ for the specified endpoint.
+
+ Direction
+ 8051->P
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Response Code = 33
+
+ D0
+ Bits 15 - 12 : Endpoint Number (0 - 15)
+
+ Bits 11 - 10 : Endpoint Type
+ * 0 = Control
+ * 1 = Bulk
+ * 2 = Interrupt
+ * 3 = Isochronous
+
+ Bits 9 : Endpoint Size
+ * 0 = 512
+ * 1 = 1024
+
+ Bits 8 - 7 : Buffering
+ * 0 = Double
+ * 1 = Triple
+ * 2 = Quad
+
+ Bits 6 : Bit Direction
+ * 0 = Input
+ * 1 = Output
+ */
+#define CY_RESP_ENDPOINT_CONFIG (33)
+
+
+/* Summary
+ This response contains the stall status for
+ the specified endpoint.
+
+ Direction
+ 8051->P
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Response Code = 34
+
+ D0
+ Stall status
+ * 0 = Active
+ * 1 = Stalled
+ */
+#define CY_RESP_ENDPOINT_STALL (34)
+
+
+/* Summary
+ This response contains the connected/disconnected
+ state of the West Bridge USB pins.
+
+ Direction
+ 8051->P
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 3
+ * Response Code = 35
+
+ D0
+ Connect state
+ * 0 = Disconnected
+ * 1 = Connected
+ */
+#define CY_RESP_CONNECT_STATE (35)
+
+/* Summary
+ This response contains the information
+ about the USB configuration
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length
+ x bytes
+
+ Mailbox0
+ * Context = 3
+ * Response Code = 36
+
+ D0
+ Length in bytes of the descriptor
+
+ * D1 - DN *
+ Descriptor contents
+*/
+#define CY_RESP_USB_DESCRIPTOR (36)
+
+/* Summary
+ This response is sent in response to a bad USB event code
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length
+ 1 word (2 bytes)
+
+ Mailbox0
+ * Context = 3
+ * Response Code = 37
+
+ D0
+ The invalid event code in the request
+*/
+#define CY_RESP_USB_INVALID_EVENT (37)
+
+/* Summary
+ This response contains the current NAK status of
+ a USB endpoint.
+
+ Direction
+ West Bridge -> P port processor
+
+ Length
+ 1 transfer
+
+ Mailbox0
+ * Context = 3
+ * Response Code = 38
+
+ D0
+ The NAK status of the endpoint
+ 1 : NAK bit set
+ 0 : NAK bit clear
+*/
+#define CY_RESP_ENDPOINT_NAK (38)
+
+/* Summary
+ This response gives the contents of the inquiry
+ data back to West Bridge to returns to the USB host.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length
+ Variable
+
+ MailBox0
+ * Context = 3
+ * Response Code = 39
+
+ D0
+ Length of the inquiry response
+
+ *D1 - Dn*
+ Inquiry data
+*/
+#define CY_RESP_INQUIRY_DATA (39)
+
+/* Summary
+ This response gives the status of an unknown SCSI command.
+ This also gives three bytes of sense information.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 3
+ * Response Code = 40
+
+ D0
+ The length of the reply in bytes
+
+ D1
+ * Status of the command
+ * Sense Key
+
+ D2
+ * Additional Sense Code (ASC)
+ * Additional Sense Code Qualifier (ASCQ)
+*/
+#define CY_RESP_UNKNOWN_SCSI_COMMAND (40)
+/*******************************************************/
+
+/*@@Turbo requests
+ Summary
+ The Turbo requests include:
+ * CY_RQT_START_MTP
+ * CY_RQT_STOP_MTP
+ * CY_RQT_INIT_SEND_OBJECT
+ * CY_RQT_CANCEL_SEND_OBJECT
+ * CY_RQT_INIT_GET_OBJECT
+ * CY_RQT_CANCEL_GET_OBJECT
+ * CY_RQT_SEND_BLOCK_TABLE
+ * CY_RQT_MTP_EVENT
+ * CY_RQT_TURBO_CMD_FROM_HOST
+ * CY_RQT_TURBO_SEND_RESP_DATA_TO_HOST
+ * CY_RQT_TURBO_SWITCH_ENDPOINT
+ * CY_RQT_TURBO_START_WRITE_DMA
+ * CY_RQT_ENABLE_USB_PATH
+ * CY_RQT_CANCEL_ASYNC_TRANSFER
+ */
+#ifndef __doxygen__
+#define CY_RQT_TUR_RQT_CONTEXT (4)
+#endif
+
+/* Summary
+ This command requests initialization of the MTP stack.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 4
+ * Request Code = 0
+
+ Description
+ This command is required before any other MTP related
+ command can be sent to the West Bridge firmware.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_ALREADY_RUNNING
+ */
+#define CY_RQT_START_MTP (0)
+
+/* Summary
+ This command requests shutdown of the MTP stack.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 4
+ * Request Code = 1
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_NOT_RUNNING
+ */
+#define CY_RQT_STOP_MTP (1)
+
+/* Summary
+ This command sets up an MTP SendObject operation.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 4
+ * Request Code = 2
+
+ D0
+ Total bytes for send object Low 16 bits
+
+ D1
+ Total bytes for send object High 16 bits
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_NOT_RUNNING
+ */
+#define CY_RQT_INIT_SEND_OBJECT (2)
+
+/* Summary
+ This command cancels West Bridges handling of
+ an ongoing MTP SendObject operation. This
+ does NOT send an MTP response.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 4
+ * Request Code = 3
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_NOT_RUNNING
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_NO_OPERATION_PENDING
+ */
+#define CY_RQT_CANCEL_SEND_OBJECT (3)
+
+/* Summary
+ This command sets up an MTP GetObject operation.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 2
+
+ MailBox0
+ * Context = 4
+ * Request Code = 4
+
+ D0
+ Total bytes for get object Low 16 bits
+
+ D1
+ Total bytes for get object High 16 bits
+
+ D2
+ Transaction Id for get object Low 16 bits
+
+ D3
+ Transaction Id for get object High 16 bits
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_NOT_RUNNING
+ */
+#define CY_RQT_INIT_GET_OBJECT (4)
+
+/* Summary
+ This command notifies West Bridge of a new
+ BlockTable transfer.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 4
+ * Request Code = 5
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_NOT_RUNNING
+ */
+#define CY_RQT_SEND_BLOCK_TABLE (5)
+
+/* Summary
+ This request is sent to the P port processor when a MTP event occurs
+ and needs to be relayed to the P port.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 2
+
+ Mailbox0
+ * Context = 4
+ * Request Code = 6
+
+ D0
+ Bits 15 - 8 : Return Status for GetObject/SendObject
+ Bits 7 - 0 : Event Type
+ * 0 = MTP SendObject Complete
+ * 1 = MTP GetObject Complete
+ * 2 = BlockTable Needed
+
+ D1
+ Lower 16 bits of the length of the data that got transferred
+ in the Turbo Endpoint.(Applicable to "MTP SendObject Complete"
+ and "MTP GetObject Complete" events)
+
+ D2
+ Upper 16 bits of the length of the data that got transferred
+ in the Turbo Endpoint. (Applicable to "MTP SendObject Complete"
+ and "MTP GetObject Complete" events)
+
+ D3
+ Lower 16 bits of the Transaction Id of the MTP_SEND_OBJECT
+ command. (Applicable to "MTP SendObject Complete" event)
+
+ D4
+ Upper 16 bits of the Transaction Id of the MTP_SEND_OBJECT
+ command. (Applicable to "MTP SendObject Complete" event)
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_MTP_EVENT (6)
+
+/* Summary
+ This request is sent to the P port processor when a command
+ is received from Host in a Turbo Endpoint. Upon receiving
+ this event, P port should read the data from the endpoint as
+ soon as possible.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 4
+ * Request Code = 7
+
+ D0
+ This contains the EP number. (This will be always two now).
+
+ D1
+ Length of the data available in the Turbo Endpoint.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_TURBO_CMD_FROM_HOST (7)
+
+/* Summary
+ This request is sent to the West Bridge when the P port
+ needs to send data to the Host in a Turbo Endpoint.
+ Upon receiving this event, Firmware will make the end point
+ avilable for the P port. If the length is zero, then
+ firmware will send a zero length packet.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 2
+
+ Mailbox0
+ * Context = 4
+ * Request Code = 8
+
+ D0
+ This contains the EP number. (This will be always six now).
+
+ D1
+ Lower 16 bits of the length of the data that needs to be
+ sent in the Turbo Endpoint.
+
+ D2
+ Upper 16 bits of the length of the data that needs to be
+ sent in the Turbo Endpoint.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+*/
+#define CY_RQT_TURBO_SEND_RESP_DATA_TO_HOST (8)
+
+/* Summary
+ This command cancels West Bridges handling of
+ an ongoing MTP GetObject operation. This
+ does NOT send an MTP response.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 4
+ * Request Code = 9
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_NOT_RUNNING
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_NO_OPERATION_PENDING
+ */
+#define CY_RQT_CANCEL_GET_OBJECT (9)
+
+/* Summary
+ This command switches a Turbo endpoint
+ from the U port to the P port. If no data
+ is in the endpoint the endpoint is
+ primed to switch as soon as data is placed
+ in the endpoint. The endpoint will continue
+ to switch until all data has been transferd.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 2
+
+ MailBox0
+ * Context = 4
+ * Request Code = 10
+
+ D0
+ Whether the read is a packet read.
+
+ D1
+ Lower 16 bits of the length of the data to switch
+ the Turbo Endpoint for.
+
+ D2
+ Upper 16 bits of the length of the data to switch
+ the Turbo Endpoint for.
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ * CY_RESP_SUCCESS_FAILURE:CY_RESP_NOT_RUNNING
+ */
+#define CY_RQT_TURBO_SWITCH_ENDPOINT (10)
+
+/* Summary
+ This command requests the API to start the DMA
+ transfer of a packet of MTP data to the Antioch.
+
+ Direction
+ West Bridge -> P Port Processor
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 4
+ * Request Code = 11
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ */
+#define CY_RQT_TURBO_START_WRITE_DMA (11)
+
+/* Summary
+ This command requests the firmware to switch the
+ internal data paths to enable USB access to the
+ Mass storage / MTP endpoints.
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ MailBox0
+ * Context = 4
+ * Request code = 12
+
+ Responses
+ * CY_RESP_SUCCESS_FAILURE:CY_AS_ERROR_SUCCESS
+ */
+#define CY_RQT_ENABLE_USB_PATH (12)
+
+/* Summary
+ Request to cancel an asynchronous MTP write from
+ the processor side.
+
+ Direction
+ P Port processor -> West Bridge
+
+ Length (in transfers)
+ 1
+
+ Mailbox0
+ * Context = 4
+ * Request code = 13
+
+ D0
+ * EP number
+
+ Description
+ This is a request to the firmware to update internal
+ state so that a pending write on the MTP endpoint
+ can be cancelled.
+ */
+#define CY_RQT_CANCEL_ASYNC_TRANSFER (13)
+
+/******************************************************/
+
+/*@@Turbo responses
+ Summary
+ The Turbo responses include:
+ * CY_RESP_MTP_INVALID_EVENT
+ */
+
+/* Summary
+ This response is sent in response to a bad MTP event code
+
+ Direction
+ P Port Processor -> West Bridge
+
+ Length
+ 1 word (2 bytes)
+
+ Mailbox0
+ * Context = 4
+ * Response Code = 16
+
+ D0
+ The invalid event code in the request
+*/
+#define CY_RESP_MTP_INVALID_EVENT (16)
+
+#ifndef __doxygen__
+#define CY_RQT_CONTEXT_COUNT (5)
+#endif
+
+#endif /* _INCLUDED_CYASPROTOCOL_H_ */
+
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasregs.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasregs.h
new file mode 100644
index 0000000..f049d7e
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasregs.h
@@ -0,0 +1,201 @@
+/* Cypress West Bridge API header file (cyasregs.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASREG_H_
+#define _INCLUDED_CYASREG_H_
+
+#if !defined(__doxygen__)
+
+#define CY_AS_MEM_CM_WB_CFG_ID (0x80)
+#define CY_AS_MEM_CM_WB_CFG_ID_VER_MASK (0x000F)
+#define CY_AS_MEM_CM_WB_CFG_ID_HDID_MASK (0xFFF0)
+#define CY_AS_MEM_CM_WB_CFG_ID_HDID_ANTIOCH_VALUE (0xA100)
+#define CY_AS_MEM_CM_WB_CFG_ID_HDID_ASTORIA_FPGA_VALUE (0x6800)
+#define CY_AS_MEM_CM_WB_CFG_ID_HDID_ASTORIA_VALUE (0xA200)
+
+
+#define CY_AS_MEM_RST_CTRL_REG (0x81)
+#define CY_AS_MEM_RST_CTRL_REG_HARD (0x0003)
+#define CY_AS_MEM_RST_CTRL_REG_SOFT (0x0001)
+#define CY_AS_MEM_RST_RSTCMPT (0x0004)
+
+#define CY_AS_MEM_P0_ENDIAN (0x82)
+#define CY_AS_LITTLE_ENDIAN (0x0000)
+#define CY_AS_BIG_ENDIAN (0x0101)
+
+#define CY_AS_MEM_P0_VM_SET (0x83)
+#define CY_AS_MEM_P0_VM_SET_VMTYPE_MASK (0x0007)
+#define CY_AS_MEM_P0_VM_SET_VMTYPE_RAM (0x0005)
+#define CY_AS_MEM_P0_VM_SET_VMTYPE_SRAM (0x0007)
+#define CY_AS_MEM_P0_VM_SET_VMTYPE_VMWIDTH (0x0008)
+#define CY_AS_MEM_P0_VM_SET_VMTYPE_FLOWCTRL (0x0010)
+#define CY_AS_MEM_P0_VM_SET_IFMODE (0x0020)
+#define CY_AS_MEM_P0_VM_SET_CFGMODE (0x0040)
+#define CY_AS_MEM_P0_VM_SET_DACKEOB (0x0080)
+#define CY_AS_MEM_P0_VM_SET_OVERRIDE (0x0100)
+#define CY_AS_MEM_P0_VM_SET_INTOVERD (0x0200)
+#define CY_AS_MEM_P0_VM_SET_DRQOVERD (0x0400)
+#define CY_AS_MEM_P0_VM_SET_DRQPOL (0x0800)
+#define CY_AS_MEM_P0_VM_SET_DACKPOL (0x1000)
+
+
+#define CY_AS_MEM_P0_NV_SET (0x84)
+#define CY_AS_MEM_P0_NV_SET_WPSWEN (0x0001)
+#define CY_AS_MEM_P0_NV_SET_WPPOLAR (0x0002)
+
+#define CY_AS_MEM_PMU_UPDATE (0x85)
+#define CY_AS_MEM_PMU_UPDATE_UVALID (0x0001)
+#define CY_AS_MEM_PMU_UPDATE_USBUPDATE (0x0002)
+#define CY_AS_MEM_PMU_UPDATE_SDIOUPDATE (0x0004)
+
+#define CY_AS_MEM_P0_INTR_REG (0x90)
+#define CY_AS_MEM_P0_INTR_REG_MCUINT (0x0020)
+#define CY_AS_MEM_P0_INTR_REG_DRQINT (0x0800)
+#define CY_AS_MEM_P0_INTR_REG_MBINT (0x1000)
+#define CY_AS_MEM_P0_INTR_REG_PMINT (0x2000)
+#define CY_AS_MEM_P0_INTR_REG_PLLLOCKINT (0x4000)
+
+#define CY_AS_MEM_P0_INT_MASK_REG (0x91)
+#define CY_AS_MEM_P0_INT_MASK_REG_MMCUINT (0x0020)
+#define CY_AS_MEM_P0_INT_MASK_REG_MDRQINT (0x0800)
+#define CY_AS_MEM_P0_INT_MASK_REG_MMBINT (0x1000)
+#define CY_AS_MEM_P0_INT_MASK_REG_MPMINT (0x2000)
+#define CY_AS_MEM_P0_INT_MASK_REG_MPLLLOCKINT (0x4000)
+
+#define CY_AS_MEM_MCU_MB_STAT (0x92)
+#define CY_AS_MEM_P0_MCU_MBNOTRD (0x0001)
+
+#define CY_AS_MEM_P0_MCU_STAT (0x94)
+#define CY_AS_MEM_P0_MCU_STAT_CARDINS (0x0001)
+#define CY_AS_MEM_P0_MCU_STAT_CARDREM (0x0002)
+
+#define CY_AS_MEM_PWR_MAGT_STAT (0x95)
+#define CY_AS_MEM_PWR_MAGT_STAT_WAKEUP (0x0001)
+
+#define CY_AS_MEM_P0_RSE_ALLOCATE (0x98)
+#define CY_AS_MEM_P0_RSE_ALLOCATE_SDIOAVI (0x0001)
+#define CY_AS_MEM_P0_RSE_ALLOCATE_SDIOALLO (0x0002)
+#define CY_AS_MEM_P0_RSE_ALLOCATE_NANDAVI (0x0004)
+#define CY_AS_MEM_P0_RSE_ALLOCATE_NANDALLO (0x0008)
+#define CY_AS_MEM_P0_RSE_ALLOCATE_USBAVI (0x0010)
+#define CY_AS_MEM_P0_RSE_ALLOCATE_USBALLO (0x0020)
+
+#define CY_AS_MEM_P0_RSE_MASK (0x9A)
+#define CY_AS_MEM_P0_RSE_MASK_MSDIOBUS_RW (0x0003)
+#define CY_AS_MEM_P0_RSE_MASK_MNANDBUS_RW (0x00C0)
+#define CY_AS_MEM_P0_RSE_MASK_MUSBBUS_RW (0x0030)
+
+#define CY_AS_MEM_P0_DRQ (0xA0)
+#define CY_AS_MEM_P0_DRQ_EP2DRQ (0x0004)
+#define CY_AS_MEM_P0_DRQ_EP3DRQ (0x0008)
+#define CY_AS_MEM_P0_DRQ_EP4DRQ (0x0010)
+#define CY_AS_MEM_P0_DRQ_EP5DRQ (0x0020)
+#define CY_AS_MEM_P0_DRQ_EP6DRQ (0x0040)
+#define CY_AS_MEM_P0_DRQ_EP7DRQ (0x0080)
+#define CY_AS_MEM_P0_DRQ_EP8DRQ (0x0100)
+#define CY_AS_MEM_P0_DRQ_EP9DRQ (0x0200)
+#define CY_AS_MEM_P0_DRQ_EP10DRQ (0x0400)
+#define CY_AS_MEM_P0_DRQ_EP11DRQ (0x0800)
+#define CY_AS_MEM_P0_DRQ_EP12DRQ (0x1000)
+#define CY_AS_MEM_P0_DRQ_EP13DRQ (0x2000)
+#define CY_AS_MEM_P0_DRQ_EP14DRQ (0x4000)
+#define CY_AS_MEM_P0_DRQ_EP15DRQ (0x8000)
+
+#define CY_AS_MEM_P0_DRQ_MASK (0xA1)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP2DRQ (0x0004)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP3DRQ (0x0008)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP4DRQ (0x0010)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP5DRQ (0x0020)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP6DRQ (0x0040)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP7DRQ (0x0080)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP8DRQ (0x0100)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP9DRQ (0x0200)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP10DRQ (0x0400)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP11DRQ (0x0800)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP12DRQ (0x1000)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP13DRQ (0x2000)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP14DRQ (0x4000)
+#define CY_AS_MEM_P0_DRQ_MASK_MEP15DRQ (0x8000)
+
+#define CY_AS_MEM_P0_EP2_DMA_REG (0xA2)
+#define CY_AS_MEM_P0_E_pn_DMA_REG_COUNT_MASK (0x7FF)
+#define CY_AS_MEM_P0_E_pn_DMA_REG_DMAVAL (1 << 12)
+#define CY_AS_MEM_P0_EP3_DMA_REG (0xA3)
+#define CY_AS_MEM_P0_EP4_DMA_REG (0xA4)
+#define CY_AS_MEM_P0_EP5_DMA_REG (0xA5)
+#define CY_AS_MEM_P0_EP6_DMA_REG (0xA6)
+#define CY_AS_MEM_P0_EP7_DMA_REG (0xA7)
+#define CY_AS_MEM_P0_EP8_DMA_REG (0xA8)
+#define CY_AS_MEM_P0_EP9_DMA_REG (0xA9)
+#define CY_AS_MEM_P0_EP10_DMA_REG (0xAA)
+#define CY_AS_MEM_P0_EP11_DMA_REG (0xAB)
+#define CY_AS_MEM_P0_EP12_DMA_REG (0xAC)
+#define CY_AS_MEM_P0_EP13_DMA_REG (0xAD)
+#define CY_AS_MEM_P0_EP14_DMA_REG (0xAE)
+#define CY_AS_MEM_P0_EP15_DMA_REG (0xAF)
+
+#define CY_AS_MEM_IROS_SLB_DATARET (0xC0)
+
+#define CY_AS_MEM_IROS_IO_CFG (0xC1)
+#define CY_AS_MEM_IROS_IO_CFG_GPIODRVST_MASK (0x0003)
+#define CY_AS_MEM_IROS_IO_CFG_GPIOSLEW_MASK (0x0004)
+#define CY_AS_MEM_IROS_IO_CFG_PPIODRVST_MASK (0x0018)
+#define CY_AS_MEM_IROS_IO_CFG_PPIOSLEW_MASK (0x0020)
+#define CY_AS_MEM_IROS_IO_CFG_SSIODRVST_MASK (0x0300)
+#define CY_AS_MEM_IROS_IO_CFG_SSIOSLEW_MASK (0x0400)
+#define CY_AS_MEM_IROS_IO_CFG_SNIODRVST_MASK (0x1800)
+#define CY_AS_MEM_IROS_IO_CFG_SNIOSLEW_MASK (0x2000)
+
+#define CY_AS_MEM_IROS_PLL_CFG (0xC2)
+
+#define CY_AS_MEM_IROS_PXB_DATARET (0xC3)
+
+#define CY_AS_MEM_PLL_LOCK_LOSS_STAT (0xC4)
+#define CY_AS_MEM_PLL_LOCK_LOSS_STAT_PLLSTAT (0x0800)
+
+#define CY_AS_MEM_IROS_SLEEP_CFG (0xC5)
+
+#define CY_AS_MEM_PNAND_CFG (0xDA)
+#define CY_AS_MEM_PNAND_CFG_IOWIDTH_MASK (0x0001)
+#define CY_AS_MEM_PNAND_CFG_IOWIDTH_8BIT (0x0000)
+#define CY_AS_MEM_PNAND_CFG_IOWIDTH_16BIT (0x0001)
+#define CY_AS_MEM_PNAND_CFG_BLKTYPE_MASK (0x0002)
+#define CY_AS_MEM_PNAND_CFG_BLKTYPE_SMALL (0x0002)
+#define CY_AS_MEM_PNAND_CFG_BLKTYPE_LARGE (0x0000)
+#define CY_AS_MEM_PNAND_CFG_EPABYTE_POS (4)
+#define CY_AS_MEM_PNAND_CFG_EPABYTE_MASK (0x0030)
+#define CY_AS_MEM_PNAND_CFG_EPABIT_POS (6)
+#define CY_AS_MEM_PNAND_CFG_EPABIT_MASK (0x00C0)
+#define CY_AS_MEM_PNAND_CFG_LNAEN_MASK (0x0100)
+
+#define CY_AS_MEM_P0_MAILBOX0 (0xF0)
+#define CY_AS_MEM_P0_MAILBOX1 (0xF1)
+#define CY_AS_MEM_P0_MAILBOX2 (0xF2)
+#define CY_AS_MEM_P0_MAILBOX3 (0xF3)
+
+#define CY_AS_MEM_MCU_MAILBOX0 (0xF8)
+#define CY_AS_MEM_MCU_MAILBOX1 (0xF9)
+#define CY_AS_MEM_MCU_MAILBOX2 (0xFA)
+#define CY_AS_MEM_MCU_MAILBOX3 (0xFB)
+
+#endif /* !defined(__doxygen__) */
+
+#endif /* _INCLUDED_CYASREG_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h
new file mode 100644
index 0000000..64f078c
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h
@@ -0,0 +1,2759 @@
+/* Cypress West Bridge API header file (cyasstorage.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASSTORAGE_H_
+#define _INCLUDED_CYASSTORAGE_H_
+
+#include "cyasmedia.h"
+#include "cyasmisc.h"
+#include "cyas_cplus_start.h"
+
+
+/*@@Storage APIs
+ Summary
+ This section documents the storage APIs supported by the
+ West Bridge API.
+
+ Description
+ The storage API is based on some specific concepts which
+ are referenced here.
+ * <LINK Storage API Overview>
+ * Addressing
+ * Ownership
+ * <LINK Asynchronous Versus Synchronous Operation>
+*/
+
+/*@@Storage API Overview
+ Summary
+ Storage devices are identified by media type. Each media
+ type is considered a single logical device.
+
+ Description
+ Each media type has a consistent block size and consists
+ of a set of logical blocks numbered from 0 to N - 1 where
+ N is the size of the
+ media type in blocks. The mass storage APIs defined below
+ provide the
+ capability to query for devices that are present, and
+ read/write data to/from
+ these devices.
+*/
+
+/*@@Addressing
+ Summary
+ Blocks within a storage device are address by a hierarchal
+ block address. This
+ address consists of the bus number, physical device,
+ logical unit, and finally
+ block address.
+
+ Description
+ While currently only a single device of each media type
+ is supported, the address
+ space reserves space in the future for multiple devices
+ of each type. Therefore
+ the second element of the address is the specific device
+ being addressed within
+ a given device type. For this release of the software,
+ this value will always be
+ zero to address the first device.
+
+ The third element of the address is the logical unit.
+ A device being managed
+ by West Bridge can be partitioned into multiple logical
+ units. This partition
+ information is stored on each device itself. Currently,
+ one of the storage devices
+ managed by West Bridge can be partitioned into two
+ logical units.
+
+ Finally a logical block address is given within the
+ logical unit to address an
+ individual block.
+*/
+
+/*@@Ownership
+ Summary
+ While West Bridge supports concurrent block level
+ operations from both the USB port and
+ the processor port, this is not desirable in most
+ situations as the file system
+ contained on the storage media cannot be accessed
+ concurrently. To insure access
+ by only one of USB and the processor, the West Bridge
+ API provides for ownership of storage
+ devices based on media type.
+
+ Description
+ The processor requests ownership of a given media type
+ by calling CyAsStorageClaim().
+ The firmware in West Bridge releases control of the
+ media and signals the processor through
+ the event callback registered with
+ CyAsStorageRegisterCallback(). The specific event is
+ the CyAsStorageProcessor. The processor can later
+ release the media via a call to
+ CyAsStorageRelease(). This call is immediate and
+ no callback is required.
+
+ If the processor has claimed storage and the USB port
+ is connected, West Bridge will need to
+ claim the storage to manage the mass storage device.
+ West Bridge requests the storage through
+ the event callback registered with
+ CyAsStorageRegisterCallback(). The specific event is
+ CyAsStorageAntioch and is named as such to reflect
+ the USB view of storage. This callback
+ is a request for the processor to release storage.
+ The storage is not actually released
+ until the processor calls CyAsStorageRelease().
+
+ Note that the CyAsStorageAntioch is only sent when the
+ USB storage device is enumerated and
+ NOT at every USB operation. The ownership of a given
+ storage media type is assumed to belong
+ to the processor until the USB connection is established.
+ At that point, the storage ownership
+ is transferred to West Bridge. After the USB connection
+ is broken, ownership can be transferred
+ back to the processor.
+*/
+
+/*@@Asynchronous Versus Synchronous Operation
+ Summary
+ When read or write operations are performed to the
+ storage devices, these operations may be
+ synchronous or asynchronous. A synchronous operation
+ is an operation where the read or write
+ operation is requested and the function does not return
+ until the operation is complete. This
+ type of function is the easiest to use but does not
+ provide for optimal usage of the P port processor time.
+
+ Description
+ An asynchronous operation is one where the function returns
+ as soon as the request is started.
+ The specific read and write request will complete at some
+ time in the future and the P port
+ processor will be notified via a callback function. While
+ asynchronous functions provide for
+ much better usage of the CPU, these function have more
+ stringent requirements for use. First,
+ any buffer use for data transfer must be valid from the
+ function call to request the operation
+ through when the callback function is called. This basically
+ implies that stack based buffers
+ are not acceptable for asynchronous calls. Second, error
+ handling must be deferred until the
+ callback function is called indicating any kind of error
+ that may have occurred.
+*/
+
+/*@@Partitioning
+ Summary
+ West Bridge API and firmware support the creation of up to
+ two logical partitions on one
+ of the storage devices that are managed by West Bridge. The
+ partitions are managed through
+ the CyAsStorageCreatePPartition and CyAsStorageRemovePPartition
+ APIs.
+
+ Description
+ The CyAsStorageCreatePPartition API is used to divide the total
+ storage on a storage
+ device into two logical units or partitions. Since the partition
+ information is stored
+ on the storage device in a custom format, partitions should
+ only be created on fixed
+ storage devices (i.e., no removable SD/MMC cards). Any data
+ stored on the device
+ before the creation of the partition, is liable to be lost when
+ a partition is created.
+
+ The CyAsStorageRemovePPartition API is used to remove the
+ stored partition information,
+ so that all of the device's capacity is treated as a single
+ partition again.
+
+ When a storage device with two partitions (units) is being
+ enumerated as a mass storage
+ device through the West Bridge, it is possible to select the
+ partitions to be made
+ visible to the USB host. This is done through the
+ CyAsUsbSelectMSPartitions API.
+*/
+
+/*********************************
+ * West Bridge Constants
+ **********************************/
+
+/* Summary
+ This constants indicates a raw device access to the read/write
+ functions
+
+ Description
+ When performing reading and writing operations on the
+ storage devices attached
+ to West Bridge, there are cases where writes need to
+ happen to raw devices, versus
+ the units contained within a device. This is
+ specifically required to manage
+ the partitions within physical devices. This constant
+ is used in calls to
+ CyAsStorageRead(), CyAsStorageReadAsync(),
+ CyAsStorageWrite() and
+ CyAsStorageWriteAsync(), to indicate that the raw
+ physical device is being
+ accessed and not any specific unit on the device.
+
+ See Also
+ * CyAsStorageRead
+ * CyAsStorageReadAsync
+ * CyAsStorageWrite
+ * CyAsStorageWriteAsync
+*/
+#define CY_AS_LUN_PHYSICAL_DEVICE (0xffffffff)
+
+/* Summary
+ This constant represents the maximum DMA burst length
+ supported on a storage endpoint
+
+ Description
+ West Bridge reserves separate endpoints for accessing
+ storage media through the
+ CyAsStorageRead() and CyAsStorageWrite() calls. The
+ maximum size of these
+ endpoints is always 512 bytes, regardless of status
+ and speed of the USB
+ connection.
+*/
+#define CY_AS_STORAGE_EP_SIZE (512)
+
+/********************************
+ * West Bridge Types
+ *******************************/
+
+/* Summary
+ This type indicates the type of event in an event
+ callback from West Bridge
+
+ Description
+ At times West Bridge needs to inform the P port
+ processor of events that have
+ occurred. These events are asynchronous to the
+ thread of control on the P
+ port processor and as such are generally delivered
+ via a callback function that
+ is called as part of an interrupt handler. This
+ type indicates the resonse for
+ the call to the callback function.
+
+ See Also
+ * CyAsStorageEventCallback
+ * CyAsStorageRegisterCallback
+*/
+typedef enum cy_as_storage_event {
+ /* This event occurs when the West Bridge device has
+ detected a USB connect and has enumerated the
+ storage controlled by west bridge to the USB port.
+ this event is the signal that the processor
+ needs to release the storage media. west bridge will
+ not have control of the storage media until the
+ processor calls cy_as_release_storage() to release
+ the specific media. */
+ cy_as_storage_antioch,
+
+ /* This event occurs when the processor has requested
+ ownership of a given media type and west bridge has
+ released the media. this event is an indicator
+ that the transfer of ownership is complete and the
+ processor now owns the given media type. */
+ cy_as_storage_processor,
+
+ /* This event occurs when a removable media type has
+ been removed. */
+ cy_as_storage_removed,
+
+ /* This event occurs when a removable media type has
+ been inserted. */
+ cy_as_storage_inserted,
+
+ /* This event occurs when the West Bridge device
+ * percieves an interrrupt from an SDIO card */
+ cy_as_sdio_interrupt
+
+} cy_as_storage_event;
+
+/* Summary
+ This type gives the type of the operation in a storage
+ operation callback
+
+ Description
+ This type is used in the callback function for asynchronous
+ operation. This type indicates whether it is a
+ CyAsStorageRead() or CyAsStorageWrite() operation that
+ has completed.
+
+ See Also
+ * <LINK Asynchronous Versus Synchronous Operation>
+ * CyAsStorageRead
+ * CyAsStorageWrite
+*/
+typedef enum cy_as_oper_type {
+ /* A data read operation */
+ cy_as_op_read,
+ /* A data write operation */
+ cy_as_op_write
+} cy_as_oper_type;
+
+/* Summary
+ This data structure describes a specific type of media
+
+ Description
+ This data structure is the return value from the
+ CyAsStorageQueryDevice function. This structure provides
+ information about the specific storage device being queried.
+
+ See Also
+ * CyAsStorageQueryDevice
+*/
+typedef struct cy_as_device_desc {
+ /* Type of device */
+ cy_as_media_type type;
+ /* Is the device removable */
+ cy_bool removable;
+ /* Is the device writeable */
+ cy_bool writeable;
+ /* Basic block size for device */
+ uint16_t block_size;
+ /* Number of LUNs on the device */
+ uint32_t number_units;
+ /* Is the device password locked */
+ cy_bool locked;
+ /* Size in bytes of an Erase Unit. Block erase operation
+ is only supported for SD storage, and the erase_unit_size
+ is invalid for all other kinds of storage. */
+ uint32_t erase_unit_size;
+} cy_as_device_desc;
+
+/* Summary
+ This data structure describes a specific unit on a
+ specific type of media
+
+ Description
+ This data structure is the return value from the
+ CyAsStorageQueryUnit function. This structure provides
+ information about the specific unit.
+
+ See Also
+ * CyAsStorageQueryUnit
+*/
+typedef struct cy_as_unit_desc {
+ /* Type of device */
+ cy_as_media_type type;
+ /* Basic block size for device */
+ uint16_t block_size;
+ /* Physical start block for LUN */
+ uint32_t start_block;
+ /* Number of blocks in the LUN */
+ uint32_t unit_size;
+} cy_as_unit_desc;
+
+/* Summary
+ This function type defines a callback to be called after an
+ asynchronous operation
+
+ Description
+ This function type defines a callback function that is called
+ at the completion of any asynchronous read or write operation.
+
+ See Also
+ * CyAsStorageReadAsync()
+ * CyAsStorageWriteAsync()
+*/
+typedef void (*cy_as_storage_callback)(
+ /* Handle to the device completing the storage operation */
+ cy_as_device_handle handle,
+ /* The bus completing the operation */
+ cy_as_bus_number_t bus,
+ /* The device completing the operation */
+ uint32_t device,
+ /* The unit completing the operation */
+ uint32_t unit,
+ /* The block number of the completed operation */
+ uint32_t block_number,
+ /* The type of operation */
+ cy_as_oper_type op,
+ /* The error status */
+ cy_as_return_status_t status
+ );
+
+/* Summary
+ This function type defines a callback to be called in the
+ event of a storage related event
+
+ Description
+ At times West Bridge needs to inform the P port processor
+ of events that have
+ occurred. These events are asynchronous to the thread of
+ control on the P
+ port processor and as such are generally delivered via a
+ callback function that
+ is called as part of an interrupt handler. This type
+ defines the type of function
+ that must be provided as a callback function.
+
+ See Also
+ * CyAsStorageEvent
+ * CyAsStorageRegisterCallback
+*/
+typedef void (*cy_as_storage_event_callback)(
+ /* Handle to the device sending the event notification */
+ cy_as_device_handle handle,
+ /* The bus where the event happened */
+ cy_as_bus_number_t bus,
+ /* The device where the event happened */
+ uint32_t device,
+ /* The event type */
+ cy_as_storage_event evtype,
+ /* Event related data */
+ void *evdata
+ );
+
+/* Summary
+ This function type defines a callback to be called after
+ an asynchronous sdio operation
+
+ Description
+ The Callback function is called at the completion of an
+ asynchronous sdio read or write operation.
+
+ See Also
+ * CyAsSdioExtendedRead()
+ * CyAsSdioExtendedWrite()
+*/
+typedef void (*cy_as_sdio_callback)(
+ /* Handle to the device completing the storage operation */
+ cy_as_device_handle handle,
+ /* The bus completing the operation */
+ cy_as_bus_number_t bus,
+ /* The device completing the operation */
+ uint32_t device,
+ /* The function number of the completing the operation.
+ if the status of the operation is either CY_AS_ERROR_IO_ABORTED
+ or CY_AS_IO_SUSPENDED then the most significant word parameter will
+ contain the number of blocks still pending. */
+ uint32_t function,
+ /* The base address of the completed operation */
+ uint32_t address,
+ /* The type of operation */
+ cy_as_oper_type op,
+ /* The status of the operation */
+ cy_as_return_status_t status
+ );
+
+/* Summary
+ Enumeration of SD/MMC card registers that can be read
+ through the API.
+
+ Description
+ Some of the registers on the SD/MMC card(s) attached to the
+ West Bridge can be read through the API layers. This type
+ enumerates the registers that can be read.
+
+ See Also
+ * CyAsStorageSDRegisterRead
+ */
+typedef enum cy_as_sd_card_reg_type {
+ cy_as_sd_reg_OCR = 0,
+ cy_as_sd_reg_CID,
+ cy_as_sd_reg_CSD
+} cy_as_sd_card_reg_type;
+
+/* Summary
+ Struct encapsulating parameters and return values for a
+ CyAsStorageQueryDevice call.
+
+ Description
+ This struct holds the input parameters and the return values
+ for an asynchronous CyAsStorageQueryDevice call.
+
+ See Also
+ * CyAsStorageQueryDevice
+ */
+typedef struct cy_as_storage_query_device_data {
+ /* The bus with the device to query */
+ cy_as_bus_number_t bus;
+ /* The logical device number to query */
+ uint32_t device;
+ /* The return value for the device descriptor */
+ cy_as_device_desc desc_p;
+} cy_as_storage_query_device_data;
+
+
+/* Summary
+ Struct encapsulating parameters and return values
+ for a CyAsStorageQueryUnit call.
+
+ Description
+ This struct holds the input parameters and the return
+ values for an asynchronous CyAsStorageQueryUnit call.
+
+ See Also
+ * CyAsStorageQueryUnit
+ */
+typedef struct cy_as_storage_query_unit_data {
+ /* The bus with the device to query */
+ cy_as_bus_number_t bus;
+ /* The logical device number to query */
+ uint32_t device;
+ /* The unit to query on the device */
+ uint32_t unit;
+ /* The return value for the unit descriptor */
+ cy_as_unit_desc desc_p;
+} cy_as_storage_query_unit_data;
+
+/* Summary
+ Struct encapsulating the input parameter and return
+ values for a CyAsStorageSDRegisterRead call.
+
+ Description
+ This struct holds the input parameter and return
+ values for an asynchronous CyAsStorageSDRegisterRead
+ call.
+
+ See Also
+ * CyAsStorageSDRegisterRead
+ */
+typedef struct cy_as_storage_sd_reg_read_data {
+ /* Pointer to the result buffer. */
+ uint8_t *buf_p;
+ /* Length of data to be copied in bytes. */
+ uint8_t length;
+} cy_as_storage_sd_reg_read_data;
+
+/* Summary
+ Controls which pins are used for card detection
+
+ Description
+ When a StorageDeviceControl call is made to enable or
+ disable card detection this enum is passed in to
+ control which pin is used for the detection.
+
+ See Also
+ * CyAsStorageDeviceControl
+*/
+typedef enum cy_as_storage_card_detect {
+ cy_as_storage_detect_GPIO,
+ cy_as_storage_detect_SDAT_3
+} cy_as_storage_card_detect;
+
+#ifndef __doxygen__
+#define cy_as_storage_detect_GPIO_0 cy_as_storage_detect_GPIO
+
+/* Length of OCR value in bytes. */
+#define CY_AS_SD_REG_OCR_LENGTH (4)
+/* Length of CID value in bytes. */
+#define CY_AS_SD_REG_CID_LENGTH (16)
+/* Length of CSD value in bytes. */
+#define CY_AS_SD_REG_CSD_LENGTH (16)
+/* Max. length of register response in words. */
+#define CY_AS_SD_REG_MAX_RESP_LENGTH (10)
+
+#endif
+
+/* Summary
+ This data structure is the data passed via the evdata
+ paramater on a usb event callback for the mass storage
+ device progress event.
+
+ Description
+ This data structure reports the number of sectors that have
+ been written and read on the USB mass storage device since
+ the last event report. The corresponding event is only sent
+ when either the number of writes, or the number of reads has
+ crossed a pre-set threshold.
+
+ See Also
+ * CyAsUsbEventCallback
+ * CyAsUsbRegisterCallback
+*/
+typedef struct cy_as_m_s_c_progress_data {
+ /* Number of sectors written since the last event. */
+ uint32_t wr_count;
+ /* Number of sectors read since the last event. */
+ uint32_t rd_count;
+} cy_as_m_s_c_progress_data;
+
+/* Summary
+Flag to set Direct Write operation to read back from the
+address written to.
+
+
+ See Also
+ *CyAsSdioDirectWrite()
+*/
+#define CY_SDIO_RAW (0x01)
+
+
+/* Summary
+Flag to set Extended Read and Write to perform IO
+using a FIFO i.e. read or write from the specified
+address only.
+
+ See Also
+ *CyAsSdioExtendedRead()
+ *CyAsSdioExtendedWrite()
+*/
+#define CY_SDIO_OP_FIFO (0x00)
+
+/* Summary
+Flag to set Extended Read and Write to perform incremental
+IO using the address provided as the base address.
+
+
+ See Also
+ *CyAsSdioExtendedRead()
+ *CyAsSdioExtendedWrite()
+*/
+#define CY_SDIO_OP_INCR (0x02)
+
+/* Summary
+Flag to set Extended Read and Write to Block Mode operation
+
+ See Also
+ *CyAsSdioExtendedRead()
+ *CyAsSdioExtendedWrite()
+*/
+#define CY_SDIO_BLOCKMODE (0x04)
+
+/* Summary
+Flag to set Extended Read and Write to Byte Mode operation
+
+ See Also
+ *CyAsSdioExtendedRead()
+ *CyAsSdioExtendedWrite()
+*/
+#define CY_SDIO_BYTEMODE (0x00)
+
+/* Summary
+Flag to force re/initialization of a function.
+
+Description
+If not set a call to CyAsSdioInitFunction()
+will not initialize a function that has been previously
+initialized.
+ See Also
+ *CyAsSdioInitFunction()
+ */
+#define CY_SDIO_FORCE_INIT (0x40)
+
+/* Summary
+Flag to re-enable the SDIO interrupts.
+
+Description
+Used with a direct read or direct write
+after the Interrupt triggerred by SDIO has been serviced
+and cleared to reset the West Bridge Sdio Interrupt.
+ See Also
+ *CyAsSdioDirectRead()
+ *CyAsSdioDirectWrite()
+*/
+
+#define CY_SDIO_REARM_INT (0x80)
+
+
+/* Summary
+ Flag to check if 4 bit support is enabled on a
+ low speed card
+ See Also
+ <link CyAsSDIOCard::card_capability>*/
+#define CY_SDIO_4BLS (0x80)
+
+/* Summary
+ Flag to check if card is a low speed card
+ See Also
+ <link CyAsSDIOCard::card_capability> */
+#define CY_SDIO_LSC (0x40)
+
+/* Summary
+ Flag to check if interrupt during multiblock data
+ transfer is enabled
+ See Also
+ <link CyAsSDIOCard::card_capability>*/
+#define CY_SDIO_E4MI (0x20)
+
+/* Summary
+ Flag to check if interrupt during multiblock data
+ transfer is supported
+ See Also
+ <link CyAsSDIOCard::card_capability> */
+#define CY_SDIO_S4MI (0x10)
+
+/* Summary
+ Flag to check if card supports function suspending.
+ See Also
+ <link CyAsSDIOCard::card_capability> */
+#define CY_SDIO_SBS (0x08)
+
+/* Summary
+ Flag to check if card supports SDIO Read-Wait
+ See Also
+ <link CyAsSDIOCard::card_capability> */
+#define CY_SDIO_SRW (0x04)
+
+/* Summary
+ Flag to check if card supports multi-block transfers
+ See Also
+ <link CyAsSDIOCard::card_capability> */
+#define CY_SDIO_SMB (0x02)
+
+/* Summary
+ Flag to check if card supports Direct IO commands
+ during execution of an Extended
+ IO function
+ See Also
+ <link CyAsSDIOCard::card_capability>*/
+#define CY_SDIO_SDC (0x01)
+
+/* Summary
+ Flag to check if function has a CSA area.
+ See Also
+ <link CyAsSDIOFunc::csa_bits> */
+#define CY_SDIO_CSA_SUP (0x40)
+
+/* Summary
+ Flag to check if CSA access is enabled.
+ See Also
+ <link CyAsSDIOFunc::csa_bits> */
+#define CY_SDIO_CSA_EN (0x80)
+
+/* Summary
+ Flag to check if CSA is Write protected.
+ See Also
+ <link CyAsSDIOFunc::csa_bits> */
+#define CY_SDIO_CSA_WP (0x01)
+
+/* Summary
+ Flag to check if CSA formatting is prohibited.
+ See Also
+ <link CyAsSDIOFunc::csa_bits>*/
+#define CY_SDIO_CSA_NF (0x02)
+
+/* Summary
+ Flag to check if the function allows wake-up from low
+ power mode using some vendor specific method.
+ See Also
+ <link CyAsSDIOFunc::wakeup_support>*/
+#define CY_SDIO_FN_WUS (0x01)
+
+
+/* Summary
+ This data structure stores SDIO function 0
+ parameters for a SDIO card
+*/
+typedef struct cy_as_sdio_card {
+ /* Number of functions present on the card. */
+ uint8_t num_functions;
+ /* Memory present(Combo card) or not */
+ uint8_t memory_present;
+ /* 16 bit manufacturer ID */
+ uint16_t manufacturer__id;
+ /* Additional vendor specific info */
+ uint16_t manufacturer_info;
+ /* Max Block size for function 0 */
+ uint16_t maxblocksize;
+ /* Block size used for function 0 */
+ uint16_t blocksize;
+ /* SDIO version supported by the card */
+ uint8_t sdio_version;
+ /* Card capability flags */
+ uint8_t card_capability;
+} cy_as_sdio_card;
+
+/* Summary
+ This data structure stores SDIO function 1-7 parameters
+ for a SDIO card
+*/
+typedef struct cy_as_sdio_func {
+ /* SDIO function code. 0 if non standard function */
+ uint8_t function_code;
+ /* Extended function type code for non-standard function */
+ uint8_t extended_func_code;
+ /* Max IO Blocksize supported by the function */
+ uint16_t maxblocksize;
+ /* IO Blocksize used by the function */
+ uint16_t blocksize;
+ /* 32 bit product serial number for the function */
+ uint32_t card_psn;
+ /* Code storage area variables */
+ uint8_t csa_bits;
+ /* Function wake-up support */
+ uint8_t wakeup_support;
+} cy_as_sdio_func;
+
+/***********************************
+ * West Bridge Functions
+ ************************************/
+
+/* Summary
+ This function starts the West Bridge storage module.
+
+ Description
+ This function initializes the West Bridge storage software
+ stack and readies this module to service storage related
+ requests. If the stack is already running, the reference
+ count for the stack is incremented.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
+ * CY_AS_ERROR_SUCCESS - the module started sucessfully
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+ See Also
+ * CyAsStorageStop
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_start(
+ /* Handle to the device */
+ cy_as_device_handle handle,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ This function stops the West Bridge storage module.
+
+ Description
+ This function decrements the reference count for the
+ storage stack and if this count is zero, the storage
+ stack is shut down. The shutdown frees all resources
+ associated with the storage stack.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Notes
+ While all resources associated with the storage stack
+ will be freed is a shutdown occurs,
+ resources associated with underlying layers of the
+ software will not be freed if they
+ are shared by the USB stack and the USB stack is
+ active. Specifically the DMA manager,
+ the interrupt manager, and the West Bridge
+ communications module are all shared by both the
+ USB stack and the storage stack.
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge
+ * device has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not
+ * been loaded into West Bridge
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_SUCCESS - this module was shut
+ * down sucessfully
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred
+ * communicating with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING
+ * CY_AS_ERROR_ASYNC_PENDING
+ * CY_AS_ERROR_OUT_OF_MEMORY
+
+ See Also
+ * CyAsStorageStart
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_stop(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ This function is used to register a callback function
+ for the storage API.
+
+ Description
+ At times West Bridge needs to inform the P port processor
+ of events that have occurred. These events are asynchronous
+ to the thread of control on the P
+ port processor and as such are generally delivered via a
+ callback function that
+ is called as part of an interrupt handler. This function
+ registers the callback
+ function that is called when an event occurs. Each call
+ to this function
+ replaces any old callback function with a new callback
+ function supplied on
+ the most recent call. This function can also be called
+ with a callback function
+ of NULL in order to remove any existing callback function
+
+ * Valid In Asynchronous Callback:YES
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has
+ * not been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle
+ * was passed in
+ * CY_AS_ERROR_SUCCESS - the function was registered
+ * sucessfully
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+
+ See Also
+ * CyAsStorageEventCallback
+ * CyAsStorageEvent
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_register_callback(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The callback function to call for async storage events */
+ cy_as_storage_event_callback callback
+ );
+
+/* Summary
+ This function claims a given media type.
+
+ Description
+ This function communicates to West Bridge that the
+ processor wants control of the
+ given storage media type. Each media type can be
+ claimed or released by the
+ processor independently. As the processor is the
+ master for the storage,
+ West Bridge should release control of the requested
+ media as soon as possible and
+ signal the processor via the CyAsStorageProcessor event.
+
+ * Valid In Asynchronous Callback: NO
+
+ Notes
+ This function just notifies West Bridge that the storage
+ is desired. The storage
+ has not actually been released by West Bridge until the
+ registered callback function
+ is called with the CyAsStorageProcessor event
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_SUCCESS - this request was sucessfully
+ * transmitted to the West Bridge device
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_MEDIA
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+ * CY_AS_ERROR_NOT_ACQUIRED
+
+ See Also:
+ * CyAsStorageClaim
+ * CyAsStorageRelease
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_claim(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The bus to claim */
+ cy_as_bus_number_t bus,
+ /* The device to claim */
+ uint32_t device,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ This function releases a given media type.
+
+ Description
+ This function communicates to West Bridge that the
+ processor has released control of
+ the given storage media type. Each media type can
+ be claimed or released by the
+ processor independently. As the processor is the
+ master for the storage, West Bridge
+ can now assume ownership of the media type. No callback
+ or event is generated.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle
+ * was passed in
+ * CY_AS_ERROR_SUCCESS - the media was sucessfully
+ * released
+ * CY_AS_ERROR_MEDIA_NOT_CLAIMED - the media was not
+ * claimed by the P port
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred
+ * communicating with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_MEDIA
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+ See Also
+ * CyAsStorageClaim
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_release(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The bus to release */
+ cy_as_bus_number_t bus,
+ /* The device to release */
+ uint32_t device,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ This function information about the number of devices present
+ on a given bus
+
+ Description
+ This function retrieves information about how many devices on
+ on the given
+ West Bridge bus.
+
+ * Valid In Asynchronous Callback: NO
+
+ Notes
+ While the current implementation of West Bridge only
+ supports one of logical device of
+ each media type, future versions WestBridge/Antioch may
+ support multiple devices.
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_SUCCESS - the media information was
+ * returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred
+ * communicating with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+ See Also
+ * CyAsStorageQueryDevice
+ * CyAsStorageQueryUnit
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_query_bus(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The bus to query */
+ cy_as_bus_number_t bus,
+ /* The return value containing the number of
+ devices present for this media type */
+ uint32_t *count,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ This function information about the number of devices
+ present for a given media type
+
+ Description
+ This function retrieves information about how many
+ devices of a given media type are attached to West Bridge.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Notes
+ While the current implementation of West Bridge only
+ supports one of logical device of each media type, future
+ versions West Bridge may support multiple devices.
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_SUCCESS - the media information was
+ * returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred
+ * communicating with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+ See Also
+ * CyAsStorageQueryMedia
+ * CyAsMediaType
+ * CyAsStorageQueryDevice
+ * CyAsStorageQueryUnit
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_query_media(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The type of media to query */
+ cy_as_media_type type,
+ /* The return value containing the number of
+ devices present for this media type */
+ uint32_t *count,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ This function returns information about a given device
+ of a specific media type
+
+ Description
+ This function retrieves information about a device of a
+ given type of media. The function is called with a given
+ media type and device and a pointer to a media descriptor
+ (CyAsDeviceDesc). This function fills in the data in the
+ media descriptor to provide information about the
+ attributes of the device of the given device.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Notes
+ Currently this API only supports a single logical device
+ of each media type. Therefore the only acceptable value
+ for the parameter device is zero (0).
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_SUCCESS - the media information was
+ * returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_NO_SUCH_MEDIA
+ * CY_AS_ERROR_NO_SUCH_DEVICE
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+ See Also
+ * CyAsMediaType
+ * CyAsStorageQueryMedia
+ * CyAsStorageQueryUnit
+ * CyAsDeviceDesc
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_query_device(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* Parameters and return value for the query call */
+ cy_as_storage_query_device_data *data,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ This function returns information about a given unit on a
+ specific device
+
+ Description
+ This function retrieves information about a device of a
+ given logical unit. The function is called with a given
+ media type, device address, unit address, and a pointer
+ to a unit descriptor (CyAsUnitDesc). This function fills
+ in the data in the unit descriptor to provide information
+ about the attributes of the device of the given logical
+ unit.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_SUCCESS - the media information was returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_NO_SUCH_DEVICE
+ * CY_AS_ERROR_NO_SUCH_UNIT
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+
+ See Also
+ * CyAsMediaType
+ * CyAsStorageQueryMedia
+ * CyAsStorageQueryDevice
+ * CyAsUnitDesc
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_query_unit(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* Parameters and return value for the query call */
+ cy_as_storage_query_unit_data *data_p,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ This function enables/disables the handling of SD/MMC card
+ detection and SD/MMC write protection in West Bridge Firmware.
+
+ Description
+ If the detection of SD/MMC card insertion or removal is being
+ done by the Processor directly, the West Bridge firmware needs
+ to be instructed to disable the card detect feature. Also, if
+ the hardware design does not use the SD_WP GPIO of the West
+ Bridge to handle SD card's write protect notch, the handling
+ of write protection if firmware should be disabled. This API
+ is used to enable/disable the card detect and write protect
+ support in West Bridge firmware.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the feature controls were
+ * set successfully
+ * CY_AS_ERROR_NO_SUCH_BUS - the specified bus is invalid
+ * CY_AS_ERROR_NOT_SUPPORTED - function not supported on
+ * the device in the specified bus
+ * CY_AS_ERROR_IN_SUSPEND - the West Brdige device is in
+ * suspended mode
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_device_control(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The bus to control */
+ cy_as_bus_number_t bus,
+ /* The device to control */
+ uint32_t device,
+ /* Enable/disable control for card detection */
+ cy_bool card_detect_en,
+ /* Enable/disable control for write protect handling */
+ cy_bool write_prot_en,
+ /* Control which pin is used for card detection */
+ cy_as_storage_card_detect config_detect,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ This function reads one or more blocks of data from
+ the storage system.
+
+ Description
+ This function synchronously reads one or more blocks
+ of data from the given media
+ type/device and places the data into the data buffer
+ given. This function does not
+ return until the data is read and placed into the buffer.
+
+ * Valid In Asynchronous Callback: NO
+
+ Notes
+ If the Samsung CEATA drive is the target for a
+ read/write operation, the maximum
+ number of sectors that can be accessed through a
+ single API call is limited to 2047.
+ Longer accesses addressed to a Samsung CEATA drive
+ can result in time-out errors.
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle
+ * was passed in
+ * CY_AS_ERROR_SUCCESS - the media information was
+ * returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred
+ * communicating with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified
+ * does not exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified
+ * media/device pair does not exist
+ * CY_AS_ERROR_NO_SUCH_UNIT - the unit specified
+ * does not exist
+ * CY_AS_ERROR_ASYNC_PENDING - an async operation
+ * is pending
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was
+ * error in reading from the media
+ * CY_AS_ERROR_MEDIA_WRITE_PROTECTED - the media is
+ * write protected
+ * CY_AS_ERROR_INVALID_PARAMETER - Reads/Writes greater
+ * than 4095 logic blocks are not allowed
+
+ See Also
+ * CyAsStorageReadAsync
+ * CyAsStorageWrite
+ * CyAsStorageWriteAsync
+ * CyAsStorageCancelAsync
+ * <LINK Asynchronous Versus Synchronous Operation>
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_read(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The bus to access */
+ cy_as_bus_number_t bus,
+ /* The device to access */
+ uint32_t device,
+ /* The unit to access */
+ uint32_t unit,
+ /* The first block to access */
+ uint32_t block,
+ /* The buffer where data will be placed */
+ void *data_p,
+ /* The number of blocks to be read */
+ uint16_t num_blocks
+ );
+
+/* Summary
+ This function asynchronously reads one or more blocks of data
+ from the storage system.
+
+ Description
+ This function asynchronously reads one or more blocks of
+ data from the given media
+ type/device and places the data into the data buffer given.
+ This function returns
+ as soon as the request is transmitted to the West Bridge
+ device but before the data is
+ available. When the read is complete, the callback function
+ is called to indicate the
+ data has been placed into the data buffer. Note that the
+ data buffer must remain
+ valid from when the read is requested until the callback
+ function is called.
+
+ * Valid In Asynchronous Callback: YES
+
+ Notes
+ If the Samsung CEATA drive is the target for a read/write
+ operation, the maximum
+ number of sectors that can be accessed through a single API
+ call is limited to 2047.
+ Longer accesses addressed to a Samsung CEATA drive can
+ result in time-out errors.
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle
+ * was passed in
+ * CY_AS_ERROR_SUCCESS - the media information was
+ * returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred
+ * communicating with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_ASYNC_PENDING - an async operation
+ * is pending
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error
+ * in reading from the media
+ * CY_AS_ERROR_MEDIA_WRITE_PROTECTED - the media is
+ * write protected
+ * CY_AS_ERROR_QUERY_DEVICE_NEEDED - Before an
+ * asynchronous read can be issue a call to
+ * CyAsStorageQueryDevice must be made
+ * CY_AS_ERROR_INVALID_PARAMETER - Reads/Writes greater
+ * than 4095 logic blocks are not allowed
+
+ See Also
+ * CyAsStorageRead
+ * CyAsStorageWrite
+ * CyAsStorageWriteAsync
+ * CyAsStorageCancelAsync
+ * CyAsStorageQueryDevice
+ * <LINK Asynchronous Versus Synchronous Operation>
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_read_async(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The bus to access */
+ cy_as_bus_number_t bus,
+ /* The device to access */
+ uint32_t device,
+ /* The unit to access */
+ uint32_t unit,
+ /* The first block to access */
+ uint32_t block,
+ /* The buffer where data will be placed */
+ void *data_p,
+ /* The number of blocks to be read */
+ uint16_t num_blocks,
+ /* The function to call when the read is complete
+ or an error occurs */
+ cy_as_storage_callback callback
+ );
+
+/* Summary
+ This function writes one or more blocks of data
+ to the storage system.
+
+ Description
+ This function synchronously writes one or more blocks of
+ data to the given media/device.
+ This function does not return until the data is written
+ into the media.
+
+ * Valid In Asynchronous Callback: NO
+
+ Notes
+ If the Samsung CEATA drive is the target for a read/write
+ operation, the maximum
+ number of sectors that can be accessed through a single
+ API call is limited to 2047.
+ Longer accesses addressed to a Samsung CEATA drive can
+ result in time-out errors.
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_SUCCESS - the media information was
+ * returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred
+ * communicating with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does
+ * not exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified
+ * media/device pair does not exist
+ * CY_AS_ERROR_NO_SUCH_UNIT - the unit specified
+ * does not exist
+ * CY_AS_ERROR_ASYNC_PENDING - an async operation
+ * is pending
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error
+ * in reading from the media
+ * CY_AS_ERROR_MEDIA_WRITE_PROTECTED - the media is
+ * write protected
+ * CY_AS_ERROR_INVALID_PARAMETER - Reads/Writes greater
+ * than 4095 logic blocks are not allowed
+
+ See Also
+ * CyAsStorageRead
+ * CyAsStorageReadAsync
+ * CyAsStorageWriteAsync
+ * CyAsStorageCancelAsync
+ * <LINK Asynchronous Versus Synchronous Operation>
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_write(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The bus to access */
+ cy_as_bus_number_t bus,
+ /* The device to access */
+ uint32_t device,
+ /* The unit to access */
+ uint32_t unit,
+ /* The first block to access */
+ uint32_t block,
+ /* The buffer containing the data to be written */
+ void *data_p,
+ /* The number of blocks to be written */
+ uint16_t num_blocks
+ );
+
+/* Summary
+ This function asynchronously writes one or more blocks
+ of data to the storage system
+
+ Description
+ This function asynchronously writes one or more blocks of
+ data to the given media type/device.
+ This function returns as soon as the request is transmitted
+ to the West Bridge device
+ but before the data is actually written. When the write is
+ complete, the callback
+ function is called to indicate the data has been physically
+ written into the media.
+
+ * Valid In Asynchronous Callback: YES
+
+ Notes
+ If the Samsung CEATA drive is the target for a read/write
+ operation, the maximum
+ number of sectors that can be accessed through a single API
+ call is limited to 2047.
+ Longer accesses addressed to a Samsung CEATA drive can
+ result in time-out errors.
+
+ Notes
+ The data buffer must remain valid from when the write is
+ requested until the callback function is called.
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has
+ * not been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
+ * CY_AS_ERROR_SUCCESS - the media information was returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_ASYNC_PENDING - an async operation is
+ * pending
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
+ * reading from the media
+ * CY_AS_ERROR_MEDIA_WRITE_PROTECTED - the media is write
+ * protected
+ * CY_AS_ERROR_QUERY_DEVICE_NEEDED - A query device call is
+ * required before async writes are allowed
+ * CY_AS_ERROR_INVALID_PARAMETER - Reads/Writes greater
+ * than 4095 logic blocks are not allowed
+
+ See Also
+ * CyAsStorageRead
+ * CyAsStorageWrite
+ * CyAsStorageReadAsync
+ * CyAsStorageCancelAsync
+ * CyAsStorageQueryDevice
+ * <LINK Asynchronous Versus Synchronous Operation>
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_write_async(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The bus to access */
+ cy_as_bus_number_t bus,
+ /* The device to access */
+ uint32_t device,
+ /* The unit to access */
+ uint32_t unit,
+ /* The first block to access */
+ uint32_t block,
+ /* The buffer where the data to be written is stored */
+ void *data_p,
+ /* The number of blocks to be written */
+ uint16_t num_blocks,
+ /* The function to call when the write is complete
+ or an error occurs */
+ cy_as_storage_callback callback
+ );
+
+/* Summary
+ This function aborts any outstanding asynchronous operation
+
+ Description
+ This function aborts any asynchronous block read or block
+ write operation. As only a single asynchronous block read
+ or write operation is possible at one time, this aborts
+ the single operation in progress.
+
+ * Valid In Asynchronous Callback: YES
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
+ * CY_AS_ERROR_SUCCESS - the media information was returned
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_OPERATION_PENDING - no asynchronous
+ * operation is pending
+
+ See Also
+ * CyAsStorageRead
+ * CyAsStorageReadAsync
+ * CyAsStorageWrite
+ * CyAsStorageWriteAsync
+ * <LINK Asynchronous Versus Synchronous Operation>
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_cancel_async(
+ /* Handle to the device with outstanding async request */
+ cy_as_device_handle handle
+ );
+
+/* Summary
+ This function is used to read the content of SD registers
+
+ Description
+ This function is used to read the contents of CSD, CID and
+ CSD registers of the SD Card.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the read operation was successful
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
+ * started
+ * CY_AS_ERROR_IN_SUSPEND - The West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device pair
+ * does not exist
+ * CY_AS_ERROR_INVALID_PARAMETER - The register type is invalid
+ * or the media is not supported on the bus
+ * CY_AS_ERROR_OUT_OF_MEMORY - failed to get memory to process
+ * request
+ * CY_AS_ERROR_INVALID_RESPONSE - communication failure with
+ * West Bridge firmware
+
+ See Also
+ * CyAsStorageSDRegReadData
+ */
+EXTERN cy_as_return_status_t
+cy_as_storage_sd_register_read(
+ /* Handle to the West Bridge device. */
+ cy_as_device_handle handle,
+ /* The bus to query */
+ cy_as_bus_number_t bus,
+ /* The device to query */
+ uint8_t device,
+ /* The type of register to read. */
+ cy_as_sd_card_reg_type reg_type,
+ /* Output data buffer and length. */
+ cy_as_storage_sd_reg_read_data *data_p,
+ /* Callback function to call when done. */
+ cy_as_function_callback cb,
+ /* Call context to send to the cb function. */
+ uint32_t client
+ );
+
+/* Summary
+ Creates a partition starting at the given block and using the
+ remaining blocks on the card.
+
+ Description
+ Storage devices attached to West Bridge can be partitioned
+ into two units.
+ The visibility of these units through the mass storage
+ interface can be
+ individually controlled. This API is used to partition
+ a device into two.
+
+ * Valid in Asynchronous Callback: Yes (if cb supplied)
+ * Nestable: Yes
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the partition was successfully created
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
+ * started
+ * CY_AS_ERROR_IN_SUSPEND - The West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_USB_RUNNING - Partition cannot be created while
+ * USB stack is active
+ * CY_AS_ERROR_OUT_OF_MEMORY - failed to get memory to
+ * process request
+ * CY_AS_ERROR_INVALID_REQUEST - feature not supported by
+ * active device or firmware
+ * CY_AS_ERROR_INVALID_RESPONSE - communication failure with
+ * West Bridge firmware
+ * CY_AS_ERROR_ALREADY_PARTITIONED - the storage device already
+ * has been partitioned
+ * CY_AS_ERROR_INVALID_BLOCK - Size specified for the partition
+ * exceeds the actual device capacity
+
+ See Also
+ * <LINK Partitioning>
+ * CyAsStorageRemovePPartition
+ */
+EXTERN cy_as_return_status_t
+cy_as_storage_create_p_partition(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* Bus on which the device to be partitioned is connected */
+ cy_as_bus_number_t bus,
+ /* Device number to be partitioned */
+ uint32_t device,
+ /* Size of partition number 0 in blocks */
+ uint32_t size,
+ /* Callback in case of async call */
+ cy_as_function_callback cb,
+ /* Client context to pass to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ Removes the partition table on a storage device connected
+ to the West Bridge.
+
+ Description
+ Storage devices attached to West Bridge can be partitioned
+ into two units.This partition information is stored on the
+ device and is non-volatile. This API is used to remove the
+ stored partition information and make the entire device
+ visible as a single partition (unit).
+
+ * Valid in Asynchronous Callback: Yes (if cb supplied)
+ * Nestable: Yes
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the partition was successfully
+ * deleted
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_IN_SUSPEND - The West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_USB_RUNNING - Partition cannot be created
+ * while USB stack is active
+ * CY_AS_ERROR_OUT_OF_MEMORY - failed to get memory to
+ * process request
+ * CY_AS_ERROR_INVALID_REQUEST - operation not supported
+ * by active device/firmware
+ * CY_AS_ERROR_NO_SUCH_UNIT - the addressed device is
+ * not partitioned
+
+ See Also
+ * <LINK Partitioning>
+ * CyAsStorageCreatePPartition
+ */
+EXTERN cy_as_return_status_t
+cy_as_storage_remove_p_partition(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* Bus on which device of interest is connected */
+ cy_as_bus_number_t bus,
+ /* Device number of interest */
+ uint32_t device,
+ /* Callback in case of async call */
+ cy_as_function_callback cb,
+ /* Client context to pass to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ Returns the amount of data read/written to the given
+ device from the USB host.
+
+ Description
+
+ * Valid in Asynchronous Callback: Yes (if cb supplied)
+ * Nestable: Yes
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - API call completed successfully
+ * CY_AS_ERROR_INVALID_HANDLE - Invalid West Bridge device
+ * handle
+ * CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - No firmware image has been
+ * loaded on West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - Storage stack has not been
+ * started
+ * CY_AS_ERROR_NOT_SUPPORTED - This function is not
+ * supported by active firmware version
+ * CY_AS_ERROR_OUT_OF_MEMORY - Failed to get memory to
+ * process the request
+ * CY_AS_ERROR_TIMEOUT - West Bridge firmware did not
+ * respond to request
+ * CY_AS_ERROR_INVALID_RESPONSE - Unexpected reply from
+ * West Bridge firmware
+
+ See Also
+ * CyAsUsbSetMSReportThreshold
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_get_transfer_amount(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* Bus on which device of interest is connected */
+ cy_as_bus_number_t bus,
+ /* Device number of interest */
+ uint32_t device,
+ /* Return value containing read/write sector counts. */
+ cy_as_m_s_c_progress_data *data_p,
+ /* Callback in case of async call */
+ cy_as_function_callback cb,
+ /* Client context to pass to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ Performs a Sector Erase on an attached SD Card
+
+ Description
+ This allows you to erase an attached SD card. The area to erase
+ is specified in terms of a starting Erase Unit and a number of
+ Erase Units. The size of each Erase Unit is defined in the
+ DeviceDesc returned from a StorageQueryDevice call and it can
+ differ between SD cards.
+
+ A large erase can take a while to complete depending on the SD
+ card. In such a case it is reccomended that an async call is made.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - API call completed successfully
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
+ * started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_ASYNC_PENDING - an async operation is pending
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
+ * reading from the media
+ * CY_AS_ERROR_MEDIA_WRITE_PROTECTED - the media is write protected
+ * CY_AS_ERROR_QUERY_DEVICE_NEEDED - A query device call is
+ * required before erase is allowed
+ * CY_AS_ERROR_NO_SUCH_BUS
+ * CY_AS_ERROR_NO_SUCH_DEVICE
+ * CY_AS_ERROR_NOT_SUPPORTED - Erase is currenly only supported
+ * on SD and using SD only firmware
+ * CY_AS_ERROR_OUT_OF_MEMORY
+
+ See Also
+ * CyAsStorageSDRegisterRead
+*/
+EXTERN cy_as_return_status_t
+cy_as_storage_erase(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* Bus on which device of interest is connected */
+ cy_as_bus_number_t bus,
+ /* Device number of interest */
+ uint32_t device,
+ /* Erase Unit to start the erase */
+ uint32_t erase_unit,
+ /* Number of Erase Units to erase */
+ uint16_t num_erase_units,
+ /* Callback in case of async call */
+ cy_as_function_callback cb,
+ /* Client context to pass to the callback */
+ uint32_t client
+ );
+
+/* Summary
+ This function is used to read a Tuple from the SDIO CIS area.
+
+ Description
+ This function is used to read a Tuple from the SDIO CIS area.
+ This function is to be used only for IO to an SDIO card as
+ other media will not respond to the SDIO command set.
+
+ * Valid in Asynchronous Callback: NO
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_SUCCESS - the media information was returned
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device
+ * is in suspend mode
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
+ * exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
+ * pair does not exist
+ * CY_AS_ERROR_ASYNC_PENDING - an async operation is pending
+ * CY_AS_ERROR_INVALID_REQUEST - an invalid IO request
+ * type was made
+ * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was
+ * recieved from the firmware
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
+ * reading from the media
+ * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made to
+ * an invalid function
+ * CY_AS_ERROR_INVALID_ENDPOINT - A DMA request was made to
+ * an invalid endpoint
+ * CY_AS_ERROR_ENDPOINT_DISABLED - A DMA request was made to
+ * a disabled endpoint
+
+*/
+cy_as_return_status_t
+cy_as_sdio_get_c_i_s_info(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* IO function Number */
+ uint8_t n_function_no,
+ /* Id of tuple to be fetched */
+ uint16_t tuple_id,
+ /* Buffer to hold tuple read from card.
+ should be at least 256 bytes in size */
+ uint8_t *data_p
+ );
+
+
+/* Summary
+ This function is used to read properties of the SDIO card.
+
+ Description
+ This function is used to read properties of the SDIO card
+ into a CyAsSDIOCard structure.
+ This function is to be used only for IO to an SDIO card as
+ other media will not respond to the SDIO command set.
+
+ * Valid in Asynchronous Callback: NO
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
+ * started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_SUCCESS - the card information was returned
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
+ * exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
+ * pair does not exist
+ * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was
+ * recieved from the firmware
+
+*/
+cy_as_return_status_t
+cy_as_sdio_query_card(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* Buffer to store card properties */
+ cy_as_sdio_card *data_p
+ );
+
+/* Summary
+ This function is used to reset a SDIO card.
+
+ Description
+ This function is used to reset a SDIO card by writing to
+ the reset bit in the CCCR and reinitializing the card. This
+ function is to be used only for IO to an SDIO card as
+ other media will not respond to the SDIO command set.
+
+ * Valid in Asynchronous Callback: NO
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_SUCCESS - the media information was returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
+ * exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
+ * pair does not exist
+ * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was
+ * recieved from the firmware
+ */
+cy_as_return_status_t
+cy_as_sdio_reset_card(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device
+ );
+
+/* Summary
+ This function performs a Synchronous 1 byte read from the sdio
+ device function.
+
+ Description
+ This function is used to perform a synchronous 1 byte read
+ from an SDIO card function. This function is to be used only
+ for IO to an SDIO card as other media will not respond to the
+ SDIO command set.
+
+ * Valid in Asynchronous Callback: NO
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed
+ * in
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_SUCCESS - the media information was returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device pair
+ * does not exist
+ * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was recieved
+ * from the firmware
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in reading
+ * from the media
+ * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made to an
+ * invalid function
+ * CY_AS_ERROR_FUNCTION_SUSPENDED - The function to which read
+ * was attempted is in suspend
+*/
+cy_as_return_status_t
+cy_as_sdio_direct_read(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* IO function Number */
+ uint8_t n_function_no,
+ /* Address for IO */
+ uint32_t address,
+ /* Set to CY_SDIO_REARM_INT to reinitialize SDIO interrupt */
+ uint8_t misc_buf,
+ /* Buffer to hold byte read from card */
+ uint8_t *data_p
+ );
+
+/* Summary
+ This function performs a Synchronous 1 byte write to the
+ sdio device function.
+
+ Description
+ This function is used to perform a synchronous 1 byte write
+ to an SDIO card function.
+ This function is to be used only for IO to an SDIO card as
+ other media will not respond to the SDIO command set.
+
+ * Valid in Asynchronous Callback: NO
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
+ * started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_SUCCESS - the media information was returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
+ * pair does not exist
+ * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was recieved
+ * from the firmware
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
+ * reading from the media
+ * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made to
+ * an invalid function
+ * CY_AS_ERROR_FUNCTION_SUSPENDED - The function to which
+ * write was attempted is in suspend
+*/
+cy_as_return_status_t
+cy_as_sdio_direct_write(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* IO function Number */
+ uint8_t n_function_no,
+ /* Address for IO */
+ uint32_t address,
+ /* Set to CY_SDIO_REARM_INT to reinitialize SDIO interrupt,
+ set to CY_SDIO_RAW for read after write */
+ uint8_t misc_buf,
+ /* Byte to write */
+ uint16_t argument,
+ /* Buffer to hold byte read from card in Read after write mode */
+ uint8_t *data_p
+ );
+
+/* Summary
+ This function is used to set the blocksize of an SDIO function.
+
+ Description
+ This function is used to set the blocksize of an SDIO function.
+ This function is to be used only for IO to an SDIO card as
+ other media will not respond to the SDIO command set.
+
+ * Valid in Asynchronous Callback: NO
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_SUCCESS - the media information was
+ * returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
+ * exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
+ * pair does not exist
+ * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory
+ * available
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was
+ * recieved from the firmware
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
+ * reading from the media
+ * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
+ * to an invalid function
+ * CY_AS_ERROR_INVALID_BLOCKSIZE - An incorrect blocksize
+ * was passed to the function.
+ * CY_AS_ERROR_FUNCTION_SUSPENDED - The function to which
+ * write was attempted is in suspend
+*/
+cy_as_return_status_t
+cy_as_sdio_set_blocksize(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* IO function Number */
+ uint8_t n_function_no,
+ /* Block size to set. */
+ uint16_t blocksize
+ );
+
+/* Summary
+ This function is used to read Multibyte/Block data from a
+ IO function.
+
+ Description
+ This function is used to read Multibyte/Block data from a
+ IO function. This function is to be used only for IO to an
+ SDIO card as other media will not respond to the SDIO
+ command set.
+
+ * Valid in Asynchronous Callback: YES
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_SUCCESS - the media information was returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
+ * pair does not exist
+ * CY_AS_ERROR_ASYNC_PENDING - an async operation is pending
+ * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was recieved
+ * from the firmware
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
+ * reading from the media
+ * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made to
+ * an invalid function
+ * CY_AS_ERROR_INVALID_BLOCKSIZE - An incorrect blocksize or
+ * block count was passed to the function.
+ * CY_AS_ERROR_FUNCTION_SUSPENDED - The function to which
+ * write was attempted is in suspend
+ * CY_AS_ERROR_IO_ABORTED - The IO operation was aborted
+ * CY_AS_ERROR_IO_SUSPENDED - The IO operation was suspended
+ * CY_AS_ERROR_INVALID_REQUEST - An invalid request was
+ * passed to the card.
+
+*/
+cy_as_return_status_t
+cy_as_sdio_extended_read(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* IO function Number */
+ uint8_t n_function_no,
+ /* Base Address for IO */
+ uint32_t address,
+ /* Set to CY_SDIO_BLOCKMODE for block IO,
+ CY_SDIO_BYTEMODE for multibyte IO,
+ CY_SDIO_OP_FIFO to read multiple bytes from the
+ same address, CY_SDIO_OP_INCR to read bytes from
+ the incrementing addresses */
+ uint8_t misc_buf,
+ /* Block/Byte count to read */
+ uint16_t argument,
+ /* Buffer to hold data read from card */
+ uint8_t *data_p,
+ /* Callback in case of Asyncronous call. 0 if Synchronous */
+ cy_as_sdio_callback callback
+ );
+
+/* Summary
+ This function is used to write Multibyte/Block data
+ to a IO function.
+
+ Description
+ This function is used to write Multibyte/Block data
+ to a IO function. This function is to be used only
+ for IO to an SDIO card as other media will not respond
+ to the SDIO command set.
+
+ * Valid in Asynchronous Callback: YES
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_SUCCESS - the media information was returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
+ * exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
+ * pair does not exist
+ * CY_AS_ERROR_ASYNC_PENDING - an async operation is pending
+ * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was
+ * recieved from the firmware
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
+ * reading from the media
+ * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
+ * to an invalid function
+ * CY_AS_ERROR_INVALID_BLOCKSIZE - An incorrect blocksize or
+ * block count was passed to the function.
+ * CY_AS_ERROR_FUNCTION_SUSPENDED - The function to which
+ * write was attempted is in suspend
+ * CY_AS_ERROR_IO_ABORTED - The IO operation was aborted
+ * CY_AS_ERROR_IO_SUSPENDED - The IO operation was suspended
+ * CY_AS_ERROR_INVALID_REQUEST - An invalid request was
+ * passed to the card.
+*/
+cy_as_return_status_t
+cy_as_sdio_extended_write(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* IO function Number */
+ uint8_t n_function_no,
+ /* Base Address for IO */
+ uint32_t address,
+ /* Set to CY_SDIO_BLOCKMODE for block IO,
+ CY_SDIO_BYTEMODE for multibyte IO,
+ CY_SDIO_OP_FIFO to write multiple bytes to the same address,
+ CY_SDIO_OP_INCR to write multiple bytes to incrementing
+ addresses */
+ uint8_t misc_buf,
+ /* Block/Byte count to write
+ in case of byte mode the count should not exceed the block size
+ or 512, whichever is smaller.
+ in case of block mode, maximum number of blocks is 511. */
+ uint16_t argument,
+ /* Buffer to hold data to be written to card. */
+ uint8_t *data_p,
+ /* Callback in case of Asyncronous call. 0 if Synchronous */
+ cy_as_sdio_callback callback
+ );
+
+/* Summary
+ This function is used to initialize a SDIO card function.
+
+ Description
+ This function is used to initialize a SDIO card function
+ (1 - 7). This function is to be used only for IO to an
+ SDIO card as other media will not respond to the SDIO
+ command set.
+
+ * Valid in Asynchronous Callback: NO
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
+ * started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed
+ * in
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_SUCCESS - the media information was returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
+ * pair does not exist
+ * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was
+ * recieved from the firmware
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
+ * reading from the media
+ * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
+ * to an invalid function
+*/
+cy_as_return_status_t
+cy_as_sdio_init_function(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* IO function Number */
+ uint8_t n_function_no,
+ /* Set to CY_SDIO_FORCE_INIT to reinitialize function */
+ uint8_t misc_buf
+ );
+
+/* Summary
+ This function is used to get properties of a SDIO card function.
+
+ Description
+ This function is used to get properties of a SDIO card functio
+ (1 - 7) into a CyAsSDIOFunc structure. This function is to be
+ used only for IO to an SDIO card as other media will not respond
+ to the SDIO command set.
+
+ * Valid in Asynchronous Callback: NO
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not been
+ * started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed
+ * in
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_SUCCESS - the media information was returned
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the media specified does
+ * not exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device pair
+ * does not exist
+ * CY_AS_ERROR_INVALID_FUNCTION - An IO request was made to
+ * an invalid function
+*/
+cy_as_return_status_t
+cy_as_sdio_query_function(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* IO function Number */
+ uint8_t n_function_no,
+ /* Buffer to store function properties */
+ cy_as_sdio_func *data_p
+ );
+
+/* Summary
+ This function is used to Abort the current IO function.
+
+ Description
+ This function is used to Abort the current IO function.
+ This function is to be used only for IO to an SDIO card as
+ other media will not respond to the SDIO command set.
+
+ * Valid in Asynchronous Callback: NO
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_SUCCESS - the media information was
+ * returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
+ * exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified
+ * media/device pair does not exist
+ * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory
+ * available
+ * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
+ * to an invalid function
+*/
+cy_as_return_status_t
+cy_as_sdio_abort_function(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* IO function Number */
+ uint8_t n_function_no
+ );
+
+/* Summary
+ This function is used to Disable IO to an SDIO function.
+
+ Description
+ This function is used to Disable IO to an SDIO function.
+ This function is to be used only for IO to an SDIO card as
+ other media will not respond to the SDIO command set.
+
+ * Valid in Asynchronous Callback: NO
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is
+ * in suspend mode
+ * CY_AS_ERROR_SUCCESS - the media information was
+ * returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
+ * exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
+ * pair does not exist
+ * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
+ * to an invalid function
+*/
+cy_as_return_status_t
+cy_as_sdio_de_init_function(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* IO function Number */
+ uint8_t n_function_no
+ );
+
+/* Summary
+ This function is used to Suspend the current IO function.
+
+ Description
+ This function is used to Suspend the current IO function.
+ This function is to be used only for IO to an SDIO card as
+ other media will not respond to the SDIO command set.
+
+ * Valid in Asynchronous Callback: NO
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has
+ * not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_SUCCESS - the media information was returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not
+ * exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified
+ * media/device pair does not exist
+ * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory
+ * available
+ * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
+ * to an invalid function
+*/
+cy_as_return_status_t
+cy_as_sdio_suspend(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* IO function Number */
+ uint8_t n_function_no
+ );
+
+/* Summary
+ This function is used to resume a Suspended IO function.
+
+ Description
+ This function is used to resume a Suspended IO function.
+ This function is to be used only for IO to an SDIO card as
+ other media will not respond to the SDIO command set.
+
+ * Valid in Asynchronous Callback: NO
+ * Valid on Antioch device: NO
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
+ * has not been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
+ * loaded into West Bridge
+ * CY_AS_ERROR_NOT_RUNNING - the storage stack has not
+ * been started
+ * CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
+ * passed in
+ * CY_AS_ERROR_IN_SUSPEND - the West Bridge device is
+ * in suspend mode
+ * CY_AS_ERROR_SUCCESS - the media information was
+ * returned
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred
+ * communicating with the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the stack is not running
+ * CY_AS_ERROR_NO_SUCH_BUS - the bus specified
+ * does not exist
+ * CY_AS_ERROR_NO_SUCH_DEVICE - the specified
+ * media/device pair does not exist
+ * CY_AS_ERROR_ASYNC_PENDING - an async operation
+ * is pending
+ * CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory
+ * available
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was
+ * recieved from the firmware
+ * CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error
+ * in reading from the media
+ * CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was
+ * made to an invalid function
+ * CY_AS_ERROR_IO_ABORTED - The IO operation was
+ * aborted
+ * CY_AS_ERROR_IO_SUSPENDED - The IO operation was
+ * suspended
+ * CY_AS_ERROR_INVALID_REQUEST - An invalid request was
+ * passed to the card.
+
+*/
+cy_as_return_status_t
+cy_as_sdio_resume(
+ /* Handle to the Westbridge device */
+ cy_as_device_handle handle,
+ /* Bus to use */
+ cy_as_bus_number_t bus,
+ /* Device number */
+ uint32_t device,
+ /* IO function Number */
+ uint8_t n_function_no,
+ /* Operation to resume (Read or Write) */
+ cy_as_oper_type op,
+ /* Micellaneous buffer same as for Extended read and Write */
+ uint8_t misc_buf,
+ /* Number of pending blocks for IO. Should be less
+ than or equal to the maximum defined for extended
+ read and write */
+ uint16_t pendingblockcount,
+ /* Buffer to continue the Suspended IO operation */
+ uint8_t *data_p
+ );
+
+
+
+/* For supporting deprecated functions */
+#include "cyasstorage_dep.h"
+
+#include "cyas_cplus_end.h"
+
+#endif /* _INCLUDED_CYASSTORAGE_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage_dep.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage_dep.h
new file mode 100644
index 0000000..566b244
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage_dep.h
@@ -0,0 +1,309 @@
+/* Cypress West Bridge API header file (cyanstorage_dep.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+/* This header will contain Antioch specific declaration
+ * of the APIs that are deprecated in Astoria SDK. This is
+ * for maintaining backward compatibility
+ */
+#ifndef __INCLUDED_CYANSTORAGE_DEP_H__
+#define __INCLUDED_CYANSTORAGE_DEP_H__
+
+#ifndef __doxygen__
+
+typedef void (*cy_as_storage_callback_dep)(
+/* Handle to the device completing the storage operation */
+ cy_as_device_handle handle,
+ /* The media type completing the operation */
+ cy_as_media_type type,
+ /* The device completing the operation */
+ uint32_t device,
+ /* The unit completing the operation */
+ uint32_t unit,
+ /* The block number of the completed operation */
+ uint32_t block_number,
+ /* The type of operation */
+ cy_as_oper_type op,
+ /* The error status */
+ cy_as_return_status_t status
+ );
+
+typedef void (*cy_as_storage_event_callback_dep)(
+ /* Handle to the device sending the event notification */
+ cy_as_device_handle handle,
+ /* The media type */
+ cy_as_media_type type,
+ /* The event type */
+ cy_as_storage_event evtype,
+ /* Event related data */
+ void *evdata
+ );
+
+typedef struct cy_as_storage_query_device_data_dep {
+ /* The type of media to query */
+ cy_as_media_type type;
+ /* The logical device number to query */
+ uint32_t device;
+ /* The return value for the device descriptor */
+ cy_as_device_desc desc_p;
+} cy_as_storage_query_device_data_dep;
+
+typedef struct cy_as_storage_query_unit_data_dep {
+ /* The type of media to query */
+ cy_as_media_type type;
+ /* The logical device number to query */
+ uint32_t device;
+ /* The unit to query on the device */
+ uint32_t unit;
+ /* The return value for the unit descriptor */
+ cy_as_unit_desc desc_p;
+} cy_as_storage_query_unit_data_dep;
+
+
+/************ FUNCTIONS *********************/
+
+EXTERN cy_as_return_status_t
+cy_as_storage_register_callback_dep(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The callback function to call for async storage events */
+ cy_as_storage_event_callback_dep callback
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_claim_dep(cy_as_device_handle handle,
+ cy_as_media_type type
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_claim_dep_EX(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The type of media to claim */
+ cy_as_media_type *type,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_release_dep(cy_as_device_handle handle,
+ cy_as_media_type type
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_release_dep_EX(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* Handle to the device of interest */
+ cy_as_media_type *type,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_query_device_dep(
+ cy_as_device_handle handle,
+ cy_as_media_type media,
+ uint32_t device,
+ cy_as_device_desc *desc_p
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_query_device_dep_EX(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* Parameters and return value for the query call */
+ cy_as_storage_query_device_data_dep *data,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_query_unit_dep(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The type of media to query */
+ cy_as_media_type type,
+ /* The logical device number to query */
+ uint32_t device,
+ /* The unit to query on the device */
+ uint32_t unit,
+ /* The return value for the unit descriptor */
+ cy_as_unit_desc *unit_p
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_query_unit_dep_EX(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* Parameters and return value for the query call */
+ cy_as_storage_query_unit_data_dep *data_p,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_device_control_dep(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* Enable/disable control for card detection */
+ cy_bool card_detect_en,
+ /* Enable/disable control for write protect handling */
+ cy_bool write_prot_en,
+ /* Callback to be called when the operation is complete */
+ cy_as_function_callback cb,
+ /* Client data to be passed to the callback */
+ uint32_t client
+ );
+
+
+EXTERN cy_as_return_status_t
+cy_as_storage_read_dep(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The type of media to access */
+ cy_as_media_type type,
+ /* The device to access */
+ uint32_t device,
+ /* The unit to access */
+ uint32_t unit,
+ /* The first block to access */
+ uint32_t block,
+ /* The buffer where data will be placed */
+ void *data_p,
+ /* The number of blocks to be read */
+ uint16_t num_blocks
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_read_async_dep(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The type of media to access */
+ cy_as_media_type type,
+ /* The device to access */
+ uint32_t device,
+ /* The unit to access */
+ uint32_t unit,
+ /* The first block to access */
+ uint32_t block,
+ /* The buffer where data will be placed */
+ void *data_p,
+ /* The number of blocks to be read */
+ uint16_t num_blocks,
+ /* The function to call when the read is complete
+ or an error occurs */
+ cy_as_storage_callback_dep callback
+ );
+EXTERN cy_as_return_status_t
+cy_as_storage_write_dep(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The type of media to access */
+ cy_as_media_type type,
+ /* The device to access */
+ uint32_t device,
+ /* The unit to access */
+ uint32_t unit,
+ /* The first block to access */
+ uint32_t block,
+ /* The buffer containing the data to be written */
+ void *data_p,
+ /* The number of blocks to be written */
+ uint16_t num_blocks
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_write_async_dep(
+ /* Handle to the device of interest */
+ cy_as_device_handle handle,
+ /* The type of media to access */
+ cy_as_media_type type,
+ /* The device to access */
+ uint32_t device,
+ /* The unit to access */
+ uint32_t unit,
+ /* The first block to access */
+ uint32_t block,
+ /* The buffer where the data to be written is stored */
+ void *data_p,
+ /* The number of blocks to be written */
+ uint16_t num_blocks,
+ /* The function to call when the write is complete
+ or an error occurs */
+ cy_as_storage_callback_dep callback
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_sd_register_read_dep(
+ cy_as_device_handle handle,
+ cy_as_media_type type,
+ uint8_t device,
+ cy_as_sd_card_reg_type reg_type,
+ uint8_t read_len,
+ uint8_t *data_p
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_sd_register_read_dep_EX(
+ /* Handle to the West Bridge device. */
+ cy_as_device_handle handle,
+ /* The type of media to query */
+ cy_as_media_type type,
+ /* The device to query */
+ uint8_t device,
+ /* The type of register to read. */
+ cy_as_sd_card_reg_type reg_type,
+ /* Output data buffer and length. */
+ cy_as_storage_sd_reg_read_data *data_p,
+ /* Callback function to call when done. */
+ cy_as_function_callback cb,
+ /* Call context to send to the cb function. */
+ uint32_t client
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_storage_create_p_partition_dep(
+ cy_as_device_handle handle,
+ cy_as_media_type media,
+ uint32_t device,
+ uint32_t size,
+ cy_as_function_callback cb,
+ uint32_t client);
+
+EXTERN cy_as_return_status_t
+cy_as_storage_remove_p_partition_dep(
+ cy_as_device_handle handle,
+ cy_as_media_type media,
+ uint32_t device,
+ cy_as_function_callback cb,
+ uint32_t client);
+
+#endif /*__doxygen*/
+
+#endif /*__INCLUDED_CYANSTORAGE_DEP_H__*/
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastoria.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastoria.h
new file mode 100644
index 0000000..b1b18d0
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastoria.h
@@ -0,0 +1,36 @@
+/* Cypress West Bridge API header file (cyastioch.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASTORIA_H_
+#define _INCLUDED_CYASTORIA_H_
+
+#if !defined(__doxygen__)
+
+#include "cyaserr.h"
+#include "cyasmisc.h"
+#include "cyasstorage.h"
+#include "cyasusb.h"
+#include "cyasmtp.h"
+
+#endif
+
+#endif
+
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastsdkversion.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastsdkversion.h
new file mode 100644
index 0000000..a3c10aa
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastsdkversion.h
@@ -0,0 +1,30 @@
+/* Cypress Astoria Sdk Version file (cyastsdkversion.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor
+## Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASTSDK_VERSION_H_
+#define _INCLUDED_CYASTSDK_VERSION_H_
+
+/* Astoria SDK version 1.2.1 */
+#define CYAS_MAJOR_VERSION (1)
+#define CYAS_MINOR_VERSION (2)
+#define CYAS_BUILD_NUMBER (197)
+
+#endif /*_INCLUDED_CYASTSDK_VERSION_H_*/
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastypes.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastypes.h
new file mode 100644
index 0000000..18043c1
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastypes.h
@@ -0,0 +1,71 @@
+/* Cypress West Bridge API header file (cyastypes.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASTYPES_H_
+#define _INCLUDED_CYASTYPES_H_
+/* moved to staging location, eventual implementation
+ * considered is here
+#include <mach/westbridge/cyashaldef.h>
+*/
+ #include "../../../arch/arm/plat-omap/include/mach/westbridge/cyashaldef.h"
+
+/* Types that are not available on specific platforms.
+ * These are used only in the reference HAL implementations and
+ * are not required for using the API.
+ */
+#ifdef __unix__
+typedef unsigned long DWORD;
+typedef void *LPVOID;
+#define WINAPI
+#define INFINITE (0xFFFFFFFF)
+#define ptr_to_uint(ptr) ((unsigned int)(ptr))
+#endif
+
+/* Basic types used by the entire API */
+
+/* Summary
+ This type represents an endpoint number
+*/
+typedef uint8_t cy_as_end_point_number_t;
+
+/* Summary
+ This type is used to return status information from
+ an API call.
+*/
+typedef uint16_t cy_as_return_status_t;
+
+/* Summary
+ This type represents a bus number
+*/
+typedef uint32_t cy_as_bus_number_t;
+
+/* Summary
+ All APIs provided with this release are marked extern
+ through this definition. This definition can be changed
+ to meet the scope changes required in the user build
+ environment.
+
+ For example, this can be changed to __declspec(exportdll)
+ to enable exporting the API from a DLL.
+ */
+#define EXTERN extern
+
+#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h
new file mode 100644
index 0000000..9049c8d
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h
@@ -0,0 +1,1862 @@
+/* Cypress West Bridge API header file (cyasusb.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+#ifndef _INCLUDED_CYASUSB_H_
+#define _INCLUDED_CYASUSB_H_
+
+#include "cyasmisc.h"
+
+#include "cyas_cplus_start.h"
+
+/*@@Enumeration Model
+ Summary
+ The USB enumeration process is the process of communicating
+ to the USB host information
+ about the capabilities of the connected device. This
+ process is completed by servicing
+ requests for various types of descriptors. In the software
+ APIs described below, this
+ process is controlled in one of two ways.
+
+ Description
+ There are advantages to either type of enumeration
+ and this is why both models are supported.
+ P Port processor based enumeraton gives the P port
+ processor maximum control and flexibility
+ for providing USB configuration information. However,
+ this does require (near) real time data
+ responses from the P port processor during the enumeration
+ process. West Bridge based enumeration
+ requires no real time information from the P port processor,
+ ensuring the fastest possible
+ enumeration times.
+
+ * P Port Based Enumeration *
+ The first method for handling USB enumeration is for the
+ processor client to handle all
+ endpoint zero requests for descriptors. This mode is
+ configured by indicating to the API
+ that the processor wants to handle all endpoint zero
+ requests. This is done by setting
+ bit 0 in the end_point_mask to a 1. The processor uses
+ CyAsUsbReadDataAsync() to read the request and
+ CyAsUsbWriteDataAsync() to write the response.
+
+ * West Bridge Based Enumeration *
+ The second method for handling USB enumeration is the
+ configuration information method.
+ Before enabling a connection from the West Bridge device
+ to the USB connector, the P Port
+ processor sends information about the USB configuration to
+ West Bridge through the configuration
+ APIs. This information is stored within the West Bridge
+ device. When a USB cable is attached,
+ the West Bridge device then handles all descriptor requests
+ based on the stored information.
+ Note that this method of enumeration only supports a single
+ USB configuration.
+
+ In either model of enumeration, the processor client is
+ responsible for ensuring that
+ the system meets USB Chapter 9 compliance requirements. This
+ can be done by providing spec
+ compliant descriptors, and handling any setup packets that
+ are sent to the client
+ appropriately.
+
+ Mass storage class compliance will be ensured by the West
+ Bridge firmware when the mass
+ storage functionality is enabled.
+*/
+
+/*@@Endpoint Configuration
+ Summary
+ The West Bridge device has one 64-byte control endpoint, one
+ 64-byte low bandwidth endpoint, four bulk
+ endpoints dedicated for mass storage usage, and up to ten
+ bulk/interrupt/isochronous
+ endpoints that can be used for USB-to-Processor communication.
+
+ Description
+ The four storage endpoints (Endpoints 2, 4, 6 and 8) are
+ reserved for accessing storage
+ devices attached to West Bridge and are not available for use
+ by the processor. These are
+ used implicitly when using the storage API to read/write to
+ the storage media.
+
+ Endpoint 0 is the standard USB control pipe used for all
+ enumeration activity. Though
+ the endpoint buffer is not directly accessible from the
+ processor, read/write activity
+ can be performed on this endpoint through the API layers.
+ This endpoint is always
+ configured as a bi-directional control endpoint.
+
+ Endpoint 1 is a 64-byte endpoint that can be used for low
+ bandwidth bulk/interrupt
+ activity. The physical buffer is not accessible from the
+ processor, but can be read/written
+ through the API. As the data coming to this endpoint is
+ being handled through the
+ software layers, there can be loss of data if a read call
+ is not waiting when an OUT
+ packet arrives.
+
+ Endpoints 3, 5, 7, 9, 10, 11, 12, 13, 14 and 15 are ten
+ configurable endpoints
+ mapped to parts of a total 4 KB FIFO buffer space on the
+ West Bridge device. This 4 KB
+ physical buffer space is divided into up to four endpoints
+ called PEP1, PEP2, PEP3 and PEP4
+ in this software document. There are multiple configurations
+ in which this buffer space
+ can be used, and the size and number of buffers available to
+ each physical endpoint
+ vary between these configurations. See the West Bridge PDD
+ for details on the buffer
+ orientation corresponding to each configuration.
+
+ * Note *
+ PEPs 1, 2, 3 and 4 are called Physical EP 3, 5, 7 and 9 in the
+ West Bridge PDD. The
+ sequential number scheme is used in the software to disambiguate
+ these from the logical
+ endpoint numbers, and also for convenience of array indexing.
+*/
+
+#if !defined(__doxygen__)
+
+
+#endif
+
+/* Summary
+ This constants defines the maximum size of a USB descriptor
+ when referenced via the CyAsUsbSetDescriptor or
+ CyAsUsbGetDescriptor functions.
+
+ See Also
+ * CyAsUsbSetDescriptor
+ * CyAsUsbGetDescriptor
+*/
+#define CY_AS_MAX_USB_DESCRIPTOR_SIZE (128)
+
+/***************************************
+ * West Bridge Types
+ ***************************************/
+
+
+/* Summary
+ This data structure is the data passed via the evdata paramater
+ on a usb event callback for the inquiry request.
+
+ Description
+ When a SCSI inquiry request arrives via the USB connection and
+ the P Port has asked
+ to receive inquiry requests, this request is forwarded to the
+ client via the USB
+ callback. This callback is called twice, once before the
+ inquiry data is forwarded
+ to the host (CyAsEventUsbInquiryBefore) and once after the
+ inquiry has been sent to the
+ USB host (CyAsEventUsbInquiryAfter). The evdata parameter
+ is a pointer to this data
+ structure.
+
+ *CyAsEventUsbInquiryBefore*
+ If the client just wishes to see the inquiry request and
+ associated data, then a simple
+ return from the callback will forward the inquiry response
+ to the USB host. If the
+ client wishes to change the data returned to the USB host,
+ the updated parameter must
+ be set to CyTrue and the memory area address by the data
+ parameter should be updated.
+ The data pointer can be changed to point to a new memory
+ area and the length field
+ changed to change the amount of data returned from the
+ inquiry request. Note that the
+ data area pointed to by the data parameter must remain
+ valid and the contents must
+ remain consistent until after the CyAsEventUsbInquiryAfter
+ event has occurred. THE LENGTH
+ MUST BE LESS THAN 192 BYTES OR THE CUSTOM INQUIRY RESPONSE
+ WILL NOT BE RETURNED. If the
+ length is too long, the default inquiry response will be
+ returned.
+
+ *CyAsEventUsbInquiryAfter*
+ If the client needs to free any data, this event signals that
+ the data associated with the inquiry is no longer needed.
+
+ See Also
+ * CyAsUsbEventCallback
+ * CyAsUsbRegisterCallback
+*/
+typedef struct cy_as_usb_inquiry_data {
+ /* The bus for the event */
+ cy_as_bus_number_t bus;
+ /* The device the event */
+ uint32_t device;
+ /* The EVPD bit from the SCSI INQUIRY request */
+ uint8_t evpd;
+ /* The codepage in the inquiry request */
+ uint8_t codepage;
+ /* This bool must be set to CyTrue indicate that the inquiry
+ data was changed */
+ cy_bool updated;
+ /* The length of the data */
+ uint16_t length;
+ /* The inquiry data */
+ void *data;
+} cy_as_usb_inquiry_data;
+
+
+/* Summary
+ This data structure is the data passed via the evdata
+ parameter on a usb event
+ callback for the unknown mass storage request.
+
+ Description
+ When a SCSI request is made that the mass storage
+ firmware in West Bridge does not
+ know how to process, this request is passed to the
+ processor for handling via
+ the usb callback. This data structure is used to
+ pass the request and the
+ associated response. The user may set the status
+ to indicate the status of the
+ request. The status value is the bCSWStatus value
+ from the USB mass storage
+ Command Status Wrapper (0 = command passed, 1 =
+ command failed). If the status
+ is set to command failed (1), the sense information
+ should be set as well. For
+ more information about sense information, see the
+ USB mass storage specification
+ as well as the SCSI specifications for block devices.
+ By default the status is
+ initialized to 1 (failure) with a sense information
+ of 05h/20h/00h which
+ indicates INVALID COMMAND.
+*/
+typedef struct cy_as_usb_unknown_command_data {
+ /* The bus for the event */
+ cy_as_bus_number_t bus;
+ /* The device for the event */
+ uint32_t device;
+
+ uint16_t reqlen;
+ /* The request */
+ void *request;
+
+ /* The returned status value for the command */
+ uint8_t status;
+ /* If status is failed, the sense key */
+ uint8_t key;
+ /* If status is failed, the additional sense code */
+ uint8_t asc;
+ /* If status if failed, the additional sense code qualifier */
+ uint8_t ascq;
+} cy_as_usb_unknown_command_data;
+
+
+/* Summary
+ This data structure is the data passed via the evdata
+ paramater on a usb event callback for the start/stop request.
+
+ Description
+ When a SCSI start stop request arrives via the USB connection
+ and the P Port has asked
+
+ See Also
+ * CyAsUsbEventCallback
+ * CyAsUsbRegisterCallback
+*/
+typedef struct cy_as_usb_start_stop_data {
+ /* The bus for the event */
+ cy_as_bus_number_t bus;
+ /* The device for the event */
+ uint32_t device;
+ /* CyTrue means start request, CyFalse means stop request */
+ cy_bool start;
+ /* CyTrue means LoEj bit set, otherwise false */
+ cy_bool loej;
+} cy_as_usb_start_stop_data;
+
+/* Summary
+ This data type is used to indicate which mass storage devices
+ are enumerated.
+
+ Description
+
+ See Also
+ * CyAsUsbEnumControl
+ * CyAsUsbSetEnumConfig
+*/
+typedef enum cy_as_usb_mass_storage_enum {
+ cy_as_usb_nand_enum = 0x01,
+ cy_as_usb_sd_enum = 0x02,
+ cy_as_usb_mmc_enum = 0x04,
+ cy_as_usb_ce_ata_enum = 0x08
+} cy_as_usb_mass_storage_enum;
+
+/* Summary
+ This data type specifies the type of descriptor to transfer
+ to the West Bridge device
+
+ Description
+ During enumeration, if West Bridge is handling enumeration,
+ the West Bridge device needs to USB descriptors
+ to complete the enumeration. The function CyAsUsbSetDescriptor()
+ is used to transfer the descriptors
+ to the West Bridge device. This type is an argument to that
+ function and specifies which descriptor
+ is being transferred.
+
+ See Also
+ * CyAsUsbSetDescriptor
+ * CyAsUsbGetDescriptor
+*/
+typedef enum cy_as_usb_desc_type {
+ /* A device descriptor - See USB 2.0 specification Chapter 9 */
+ cy_as_usb_desc_device = 1,
+ /* A device descriptor qualifier -
+ * See USB 2.0 specification Chapter 9 */
+ cy_as_usb_desc_device_qual = 2,
+ /* A configuration descriptor for FS operation -
+ * See USB 2.0 specification Chapter 9 */
+ cy_as_usb_desc_f_s_configuration = 3,
+ /* A configuration descriptor for HS operation -
+ * See USB 2.0 specification Chapter 9 */
+ cy_as_usb_desc_h_s_configuration = 4,
+ cy_as_usb_desc_string = 5
+} cy_as_usb_desc_type;
+
+/* Summary
+ This type specifies the direction of an endpoint
+
+ Description
+ This type is used when configuring the endpoint hardware
+ to specify the direction
+ of the endpoint.
+
+ See Also
+ * CyAsUsbEndPointConfig
+ * CyAsUsbSetEndPointConfig
+ * CyAsUsbGetEndPointConfig
+*/
+typedef enum cy_as_usb_end_point_dir {
+ /* The endpoint direction is IN (West Bridge -> USB Host) */
+ cy_as_usb_in = 0,
+ /* The endpoint direction is OUT (USB Host -> West Bridge) */
+ cy_as_usb_out = 1,
+ /* The endpoint direction is IN/OUT (valid only for EP 0 & 1) */
+ cy_as_usb_in_out = 2
+} cy_as_usb_end_point_dir;
+
+/* Summary
+ This type specifies the type of an endpoint
+
+ Description
+ This type is used when configuring the endpoint hardware
+ to specify the type of endpoint.
+
+ See Also
+ * CyAsUsbEndPointConfig
+ * CyAsUsbSetEndPointConfig
+ * CyAsUsbGetEndPointConfig
+*/
+typedef enum cy_as_usb_end_point_type {
+ cy_as_usb_control,
+ cy_as_usb_iso,
+ cy_as_usb_bulk,
+ cy_as_usb_int
+} cy_as_usb_end_point_type;
+
+/* Summary
+ This type is a structure used to indicate the top level
+ configuration of the USB stack
+
+ Description
+ In order to configure the USB stack, the CyAsUsbSetEnumConfig()
+ function is called to indicate
+ how mass storage is to be handled, the specific number of
+ interfaces to be supported if
+ West Bridge is handling enumeration, and the end points of
+ specifi interest. This structure
+ contains this information.
+
+ See Also
+ * CyAsUsbSetConfig
+ * CyAsUsbGetConfig
+ * <LINK Enumeration Model>
+*/
+typedef struct cy_as_usb_enum_control {
+ /* Designate which devices on which buses to enumerate */
+ cy_bool devices_to_enumerate[CY_AS_MAX_BUSES]
+ [CY_AS_MAX_STORAGE_DEVICES];
+ /* If true, West Bridge will control enumeration. If this
+ * is false the P port controls enumeration. if the P port
+ * is controlling enumeration, traffic will be received via
+ * endpoint zero. */
+ cy_bool antioch_enumeration;
+ /* This is the interface # to use for the mass storage
+ * interface, if mass storage is enumerated. if mass
+ * storage is not enumerated this value should be zero. */
+ uint8_t mass_storage_interface;
+ /* This is the interface # to use for the MTP interface,
+ * if MTP is enumerated. if MTP is not enumerated
+ * this value should be zero. */
+ uint8_t mtp_interface;
+ /* If true, Inquiry, START/STOP, and unknown mass storage
+ * requests cause a callback to occur for handling by the
+ * baseband processor. */
+ cy_bool mass_storage_callbacks;
+} cy_as_usb_enum_control;
+
+
+/* Summary
+ This structure is used to configure a single endpoint
+
+ Description
+ This data structure contains all of the information required
+ to configure the West Bridge hardware
+ associated with a given endpoint.
+
+ See Also
+ * CyAsUsbSetEndPointConfig
+ * CyAsUsbGetEndPointConfig
+*/
+typedef struct cy_as_usb_end_point_config {
+ /* If true, this endpoint is enabled */
+ cy_bool enabled;
+ /* The direction of this endpoint */
+ cy_as_usb_end_point_dir dir;
+ /* The type of endpoint */
+ cy_as_usb_end_point_type type;
+ /* The physical endpoint #, 1, 2, 3, 4 */
+ cy_as_end_point_number_t physical;
+ /* The size of the endpoint in bytes */
+ uint16_t size;
+} cy_as_usb_end_point_config;
+
+/* Summary
+ List of partition enumeration combinations that can
+ be selected on a partitioned storage device.
+
+ Description
+ West Bridge firmware supports creating upto two
+ partitions on mass storage devices connected to
+ West Bridge. When there are two partitions on a device,
+ the user can choose which of these partitions should be
+ made visible to a USB host through the mass storage
+ interface. This enumeration lists the various enumeration
+ selections that can be made.
+
+ See Also
+ * CyAsStorageCreatePPartition
+ * CyAsStorageRemovePPartition
+ * CyAsUsbSelectMSPartitions
+ */
+typedef enum cy_as_usb_m_s_type_t {
+ /* Enumerate only partition 0 as CD (autorun) device */
+ cy_as_usb_m_s_unit0 = 0,
+ /* Enumerate only partition 1 as MS device (default setting) */
+ cy_as_usb_m_s_unit1,
+ /* Enumerate both units */
+ cy_as_usb_m_s_both
+} cy_as_usb_m_s_type_t;
+
+/* Summary
+ This type specifies the type of USB event that has occurred
+
+ Description
+ This type is used in the USB event callback function to
+ indicate the type of USB event that has occurred. The callback
+ function includes both this reasons for the callback and a data
+ parameter associated with the reason. The data parameter is used
+ in a reason specific way and is documented below with each reason.
+
+ See Also
+ * CyAsUsbIoCallback
+*/
+typedef enum cy_as_usb_event {
+ /* This event is sent when West Bridge is put into the suspend
+ state by the USB host. the data parameter is not used and
+ will be zero. */
+ cy_as_event_usb_suspend,
+ /* This event is sent when West Bridge is taken out of the
+ suspend state by the USB host. the data parameter is not
+ used and will be zero. */
+ cy_as_event_usb_resume,
+ /* This event is sent when a USB reset request is received
+ by the west bridge device. the data parameter is not used and
+ will be zero. */
+ cy_as_event_usb_reset,
+ /* This event is sent when a USB set configuration request is made.
+ the data parameter is a pointer to a uint16_t that contains the
+ configuration number. the configuration number may be zero to
+ indicate an unconfigure operation. */
+ cy_as_event_usb_set_config,
+ /* This event is sent when the USB connection changes speed. This is
+ generally a transition from full speed to high speed. the parameter
+ to this event is a pointer to uint16_t that gives the speed of the
+ USB connection. zero indicates full speed, one indicates high speed */
+ cy_as_event_usb_speed_change,
+ /* This event is sent when a setup packet is received.
+ * The data parameter is a pointer to the eight bytes of setup data. */
+ cy_as_event_usb_setup_packet,
+ /* This event is sent when a status packet is received. The data
+ parameter is not used. */
+ cy_as_event_usb_status_packet,
+ /* This event is sent when mass storage receives an inquiry
+ request and we have asked to see these requests. */
+ cy_as_event_usb_inquiry_before,
+ /* This event is sent when mass storage has finished processing an
+ inquiry request and any data associated with the request is no longer
+ required. */
+ cy_as_event_usb_inquiry_after,
+ /* This event is sent when mass storage receives a start/stop
+ * request and we have asked to see these requests */
+ cy_as_event_usb_start_stop,
+ /* This event is sent when a Clear Feature request is received.
+ * The data parameter is the endpoint number. */
+ cy_as_event_usb_clear_feature,
+ /* This event is sent when mass storage receives a request
+ * that is not known and we have asked to see these requests */
+ cy_as_event_usb_unknown_storage,
+ /* This event is sent when the read/write activity on the USB mass
+ storage has crossed a pre-set level */
+ cy_as_event_usb_m_s_c_progress
+} cy_as_usb_event;
+
+/* Summary
+ This type is the type of a callback function that is
+ called when a USB event occurs
+
+ Description
+ At times West Bridge needs to inform the P port processor
+ of events that have
+ occurred. These events are asynchronous to the thread of
+ control on the P
+ port processor and as such are generally delivered via a
+ callback function that
+ is called as part of an interrupt handler. This type
+ defines the type of function
+ that must be provided as a callback function for USB events.
+
+ See Also
+ * CyAsUsbEvent
+*/
+typedef void (*cy_as_usb_event_callback)(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* The event type being reported */
+ cy_as_usb_event ev,
+ /* The data assocaited with the event being reported */
+ void *evdata
+);
+
+
+/* Summary
+ This type is the callback function called after an
+ asynchronous USB read/write operation
+
+ Description
+ This function type defines a callback function that is
+ called at the completion of any
+ asynchronous read or write operation.
+
+ See Also
+ * CyAsUsbReadDataAsync
+ * CyAsUsbWriteDataAsync
+ * CY_AS_ERROR_CANCELED
+*/
+typedef void (*cy_as_usb_io_callback)(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* The endpoint that has completed an operation */
+ cy_as_end_point_number_t ep,
+ /* THe amount of data transferred to/from USB */
+ uint32_t count,
+ /* The data buffer for the operation */
+ void *buffer,
+ /* The error status of the operation */
+ cy_as_return_status_t status
+);
+
+/* Summary
+ This type is the callback function called after asynchronous
+ API functions have completed.
+
+ Description
+ When calling API functions from callback routines (interrupt
+ handlers usually) the async version of
+ these functions must be used. This callback is called when an
+ asynchronous API function has completed.
+*/
+typedef void (*cy_as_usb_function_callback)(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* The error status of the operation */
+ cy_as_return_status_t status,
+ /* A client supplied 32 bit tag */
+ uint32_t client
+);
+
+
+/********************************************
+ * West Bridge Functions
+ ********************************************/
+
+/* Summary
+ This function starts the USB stack
+
+ Description
+ This function initializes the West Bridge USB software
+ stack if it has not yet been stared.
+ This initializes any required data structures and powers
+ up any USB specific portions of
+ the West Bridge hardware. If the stack had already been
+ started, the USB stack reference count
+ is incremented.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Notes
+ This function cannot be called from any type of West Bridge
+ callback.
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_SUCCESS - the stack initialized and is ready
+ * for use
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
+ * with the West Bridge device
+
+ See Also
+ * CyAsUsbStop
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_start(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ This function stops the USB stack
+
+ Description
+ This function decrements the reference count for
+ the USB stack and if this count
+ is zero, the USB stack is shut down. The shutdown
+ frees all resources associated
+ with the USB stack.
+
+ * Valid In Asynchronous Callback: NO
+
+ Notes
+ While all resources associated with the USB stack will
+ be freed is a shutdown occurs,
+ resources associated with underlying layers of the software
+ will not be freed if they
+ are shared by the storage stack and the storage stack is active.
+ Specifically the DMA manager,
+ the interrupt manager, and the West Bridge communications module
+ are all shared by both the
+ USB stack and the storage stack.
+
+ Returns
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+
+ See Also
+ * CyAsUsbStart
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_stop(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ This function registers a callback function to be called when an
+ asynchronous USB event occurs
+
+ Description
+ When asynchronous USB events occur, a callback function can be
+ called to alert the calling program. This
+ functions allows the calling program to register a callback.
+
+ * Valid In Asynchronous Callback: YES
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_register_callback(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The function to call */
+ cy_as_usb_event_callback callback
+ );
+
+
+/* Summary
+ This function connects the West Bridge device D+ and D- signals
+ physically to the USB host.
+
+ Description
+ The West Bridge device has the ability to programmatically
+ disconnect the USB pins on the device
+ from the USB host. This feature allows for re-enumeration of
+ the West Bridge device as a different
+ device when necessary. This function connects the D+ and D-
+ signal physically to the USB host
+ if they have been previously disconnnected.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+
+ See Also
+ * CyAsUsbDisconnect
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_connect(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ This function disconnects the West Bridge device D+ and D-
+ signals physically from the USB host.
+
+ Description
+ The West Bridge device has the ability to programmatically
+ disconnect the USB pins on the device
+ from the USB host. This feature allows for re-enumeration
+ of the West Bridge device as a different
+ device when necessary. This function disconnects the D+
+ and D- signal physically from the USB host
+ if they have been previously connected.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+
+ See Also
+ * CyAsUsbConnect
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_disconnect(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ This function configures the USB stack
+
+ Description
+ This function is used to configure the USB stack. It is
+ used to indicate which endpoints are going to
+ be used, and how to deal with the mass storage USB device
+ within West Bridge.
+
+ * Valid In Asynchronous Callback: Yes (if cb supplied)
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+
+ See Also
+ * CyAsUsbGetEnumConfig
+ * CyAsUsbEnumControl
+ */
+EXTERN cy_as_return_status_t
+cy_as_usb_set_enum_config(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The USB configuration information */
+ cy_as_usb_enum_control *config_p,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ This function retreives the current configuration of
+ the USB stack
+
+ Description
+ This function sends a request to West Bridge to retreive
+ the current configuration
+
+ * Valid In Asynchronous Callback: Yes (if cb supplied)
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+
+ See Also
+ * CyAsUsbSetConfig
+ * CyAsUsbConfig
+ */
+EXTERN cy_as_return_status_t
+cy_as_usb_get_enum_config(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The return value for USB congifuration information */
+ cy_as_usb_enum_control *config_p,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ This function sets the USB descriptor
+
+ Description
+ This function is used to set the various descriptors
+ assocaited with the USB enumeration
+ process. This function should only be called when the
+ West Bridge enumeration model is selected.
+ Descriptors set using this function can be cleared by
+ stopping the USB stack, or by calling
+ the CyAsUsbClearDescriptors function.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Notes
+ These descriptors are described in the USB 2.0 specification,
+ Chapter 9.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_DESCRIPTOR - the descriptor passed is
+ * not valid
+ * CY_AS_ERROR_BAD_INDEX - a bad index was given for the type
+ * of descriptor given
+ * CY_AS_ERROR_BAD_ENUMERATION_MODE - this function cannot be
+ * called if the P port processor doing enumeration
+
+ See Also
+ * CyAsUsbGetDescriptor
+ * CyAsUsbClearDescriptors
+ * <LINK Enumeration Model>
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_set_descriptor(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The type of descriptor */
+ cy_as_usb_desc_type type,
+ /* Only valid for string descriptors */
+ uint8_t index,
+ /* The descriptor to be transferred */
+ void *desc_p,
+ /* The length of the descriptor in bytes */
+ uint16_t length,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ This function clears all user descriptors stored
+ on the West Bridge.
+
+ Description
+ This function is used to clear all descriptors that
+ were previously
+ stored on the West Bridge through CyAsUsbSetDescriptor
+ calls, and go back
+ to the default descriptor setup in the firmware. This
+ function should
+ only be called when the Antioch enumeration model is
+ selected.
+
+ * Valid In Asynchronous Callback: Yes (if cb supplied)
+ * Nestable: Yes
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - all descriptors cleared successfully
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_BAD_ENUMERATION_MODE - this function cannot be
+ * called if the P port processor is doing enumeration
+
+ See Also
+ * CyAsUsbSetDescriptor
+ * <LINK Enumeration Model>
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_clear_descriptors(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+/* Summary
+ This structure contains the descriptor buffer to be
+ filled by CyAsUsbGetDescriptor API.
+
+ Description
+ This data structure the buffer to hold the descriptor
+ data, and an in/out parameter ti indicate the
+ lenght of the buffer and descriptor data in bytes.
+
+ See Also
+ * CyAsUsbGetDescriptor
+*/
+typedef struct cy_as_get_descriptor_data {
+ /* The buffer to hold the returned descriptor */
+ void *desc_p;
+ /* This is an input and output parameter.
+ * Before the code this pointer points to a uint32_t
+ * that contains the length of the buffer. after
+ * the call, this value contains the amount of data
+ * actually returned. */
+ uint32_t length;
+
+} cy_as_get_descriptor_data;
+
+/* Summary
+ This function retreives a given descriptor from the
+ West Bridge device
+
+ Description
+ This function retreives a USB descriptor from the West
+ Bridge device. This function should only be called when the
+ West Bridge enumeration model is selected.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Notes
+ These descriptors are described in the USB 2.0 specification,
+ Chapter 9.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_BAD_INDEX - a bad index was given for the type of
+ * descriptor given
+ * CY_AS_ERROR_BAD_ENUMERATION_MODE - this function cannot be
+ * called if the P port processor doing enumeration
+
+ See Also
+ * CyAsUsbSetDescriptor
+ * <LINK Enumeration Model>
+*/
+
+EXTERN cy_as_return_status_t
+cy_as_usb_get_descriptor(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The type of descriptor */
+ cy_as_usb_desc_type type,
+ /* Index for string descriptor */
+ uint8_t index,
+ /* Parameters and return value for the get descriptor call */
+ cy_as_get_descriptor_data *data,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ This function sets the configuration of the physical
+ endpoints into one of the twelve supported configuration
+
+ Description
+ USB endpoints are mapped onto one of four physical
+ endpoints in the device. Therefore
+ USB endpoints are known as logical endpoints and these
+ logical endpoints are mapped to
+ one of four physical endpoints. In support of these
+ four physical endpoints there is
+ four kilo-bytes of buffer spaces that can be used as
+ buffers for these physical endpoints.
+ This 4K of buffer space can be configured in one of
+ twelve ways. This function sets the
+ buffer configuration for the physical endpoints.
+
+ * Config 1: PEP1 (2 * 512), PEP2 (2 * 512),
+ * PEP3 (2 * 512), PEP4 (2 * 512)
+ * Config 2: PEP1 (2 * 512), PEP2 (2 * 512),
+ * PEP3 (4 * 512), PEP4 (N/A)
+ * Config 3: PEP1 (2 * 512), PEP2 (2 * 512),
+ * PEP3 (2 * 1024), PEP4(N/A)
+ * Config 4: PEP1 (4 * 512), PEP2 (N/A),
+ * PEP3 (2 * 512), PEP4 (2 * 512)
+ * Config 5: PEP1 (4 * 512), PEP2 (N/A),
+ * PEP3 (4 * 512), PEP4 (N/A)
+ * Config 6: PEP1 (4 * 512), PEP2 (N/A),
+ * PEP3 (2 * 1024), PEP4 (N/A)
+ * Config 7: PEP1 (2 * 1024), PEP2 (N/A),
+ * PEP3 (2 * 512), PEP4 (2 * 512)
+ * Config 8: PEP1 (2 * 1024), PEP2 (N/A),
+ * PEP3 (4 * 512), PEP4 (N/A)
+ * Config 9: PEP1 (2 * 1024), PEP2 (N/A),
+ * PEP3 (2 * 1024), PEP4 (N/A)
+ * Config 10: PEP1 (3 * 512), PEP2 (N/A),
+ * PEP3 (3 * 512), PEP4 (2 * 512)
+ * Config 11: PEP1 (3 * 1024), PEP2 (N/A),
+ * PEP3 (N/A), PEP4 (2 * 512)
+ * Config 12: PEP1 (4 * 1024), PEP2 (N/A),
+ * PEP3 (N/A), PEP4 (N/A)
+
+ * Valid In Asynchronous Callback: NO
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_CONFIGURATION - the configuration given
+ * is not between 1 and 12
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_set_physical_configuration(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The physical endpoint configuration number */
+ uint8_t config
+ );
+
+/* Summary
+ This function sets the hardware configuration for a given endpoint
+
+ Description
+ This function sets the hardware configuration for a given endpoint.
+ This is the method to set the direction of the endpoint, the type
+ of endpoint, the size of the endpoint buffer, and the buffering
+ style for the endpoint.
+
+ * Valid In Asynchronous Callback: NO
+
+ Notes
+ Add documentation about endpoint configuration limitations
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint parameter is invalid
+ * CY_AS_ERROR_INVALID_CONFIGURATION - the endpoint configuration
+ * given is not valid
+ * CY_AS_ERROR_ENDPOINT_CONFIG_NOT_SET - the physical endpoint
+ * configuration is not set
+
+ See Also
+ * CyAsUsbGetEndPointConfig
+ * CyAsUsbEndPointConfig
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_set_end_point_config(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* The configuration information for the endpoint */
+ cy_as_usb_end_point_config *config_p
+ );
+
+/* Summary
+ This function retreives the hardware configuration for
+ a given endpoint
+
+ Description
+ This function gets the hardware configuration for the given
+ endpoint. This include information about the direction of
+ the endpoint, the type of endpoint, the size of the endpoint
+ buffer, and the buffering style for the endpoint.
+
+ * Valid In Asynchronous Callback: NO
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint parameter is
+ * invalid
+
+ See Also
+ * CyAsUsbSetEndPointConfig
+ * CyAsUsbEndPointConfig
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_get_end_point_config(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest*/
+ cy_as_end_point_number_t ep,
+ /* The return value containing the endpoint config
+ * information */
+ cy_as_usb_end_point_config *config_p
+ );
+
+/* Summary
+ This function commits the configuration information that
+ has previously been set.
+
+ Description
+ The initialization process involves calling CyAsUsbSetEnumConfig()
+ and CyAsUsbSetEndPointConfig(). These
+ functions do not actually send the configuration information to
+ the West Bridge device. Instead, these
+ functions store away the configuration information and this
+ CyAsUsbCommitConfig() actually finds the
+ best hardware configuration based on the requested endpoint
+ configuration and sends thsi optimal
+ confiuration down to the West Bridge device.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - a configuration was found and sent
+ * to West Bridge
+ * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
+ * into West Bridge
+ * CY_AS_ERROR_INVALID_CONFIGURATION - the configuration requested
+ * is not possible
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+
+ See Also
+ * CyAsUsbSetEndPointConfig
+ * CyAsUsbSetEnumConfig
+*/
+
+EXTERN cy_as_return_status_t
+cy_as_usb_commit_config(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ This function reads data from a USB endpoint.
+
+ Description
+ This function reads data from an OUT. This function blocks
+ until the read is complete.
+ If this is a packet read, a single received USB packet will
+ complete the read. If this
+ is not a packet read, this function will block until all of
+ the data requested has been
+ recevied.
+
+ * Valid In Asynchronous Callback: NO
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint parameter is
+ * invalid
+
+ See Also
+ * CyAsUsbReadDataAsync
+ * CyAsUsbWriteData
+ * CyAsUsbWriteDataAsync
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_read_data(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* If CyTrue, this is a packet read */
+ cy_bool pktread,
+ /* The amount of data to read */
+ uint32_t dsize,
+ /* The amount of data read */
+ uint32_t *dataread,
+ /* The buffer to hold the data read */
+ void *data
+ );
+
+/* Summary
+ This function reads data from a USB endpoint
+
+ Description
+ This function reads data from an OUT endpoint. This
+ function will return immediately and the callback
+ provided will be called when the read is complete.
+ If this is a packet read, then the callback will be
+ called on the next received packet. If this is not a
+ packet read, the callback will be called when the
+ requested data is received.
+
+ * Valid In Asynchronous Callback: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint parameter is
+ * invalid
+
+ See Also
+ * CyAsUsbReadData
+ * CyAsUsbWriteData
+ * CyAsUsbWriteDataAsync
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_read_data_async(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* If CyTrue, this is a packet read */
+ cy_bool pktread,
+ /* The amount of data to read */
+ uint32_t dsize,
+ /* The buffer for storing the data */
+ void *data,
+ /* The callback function to call when the data is read */
+ cy_as_usb_io_callback callback
+ );
+
+/* Summary
+ This function writes data to a USB endpoint
+
+ Description
+ This function writes data to an IN endpoint data buffer.
+ Multiple USB packets may be sent until all data requeste
+ has been sent. This function blocks until all of the data
+ has been sent.
+
+ * Valid In Asynchronous Callback: NO
+
+ Notes
+ Calling this function with a dsize of zero will result in
+ a zero length packet transmitted to the USB host.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint parameter is
+ * invalid
+
+ See Also
+ * CyAsUsbReadData
+ * CyAsUsbReadDataAsync
+ * CyAsUsbWriteDataAsync
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_write_data(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint to write data to */
+ cy_as_end_point_number_t ep,
+ /* The size of the data to write */
+ uint32_t dsize,
+ /* The data buffer */
+ void *data
+ );
+
+/* Summary
+ This function writes data to a USB endpoint
+
+ Description
+ This function writes data to an IN endpoint data buffer.
+ This function returns immediately and when the write
+ completes, or if an error occurs, the callback function
+ is called to indicate completion of the write operation.
+
+ * Valid In Asynchronous Callback: YES
+
+ Notes
+ Calling this function with a dsize of zero will result
+ in a zero length packet transmitted to the USB host.
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint parameter is
+ * invalid
+
+ See Also
+ * CyAsUsbReadData
+ * CyAsUsbReadDataAsync
+ * CyAsUsbWriteData
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_write_data_async(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint to write data to */
+ cy_as_end_point_number_t ep,
+ /* The size of the data */
+ uint32_t dsize,
+ /* The buffer containing the data */
+ void *data,
+ /* If true, send a short packet to terminate data */
+ cy_bool spacket,
+ /* The callback to call when the data is written */
+ cy_as_usb_io_callback callback
+ );
+
+/* Summary
+ This function aborts an outstanding asynchronous
+ operation on a given endpoint
+
+ Description
+ This function aborts any outstanding operation that is
+ pending on the given endpoint.
+
+ * Valid In Asynchronous Callback: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - this module was shut down
+ * sucessfully
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not
+ * running
+ * CY_AS_ERROR_ASYNC_NOT_PENDING - no asynchronous USB
+ * operation was pending
+
+ See Also
+ * CyAsUsbReadData
+ * CyAsUsbReadDataAsync
+ * CyAsUsbWriteData
+ * CyAsUsbWriteDataAsync
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_cancel_async(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep
+ );
+
+/* Summary
+ This function sets a stall condition on a given endpoint
+
+ Description
+ This function sets a stall condition on the given endpoint.
+ If the callback function is not zero, the function is
+ executed asynchronously and the callback is called when
+ the function is completed. If the callback function is
+ zero, this function executes synchronously and will not
+ return until the function has completed.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the function succeeded
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given was invalid,
+ * or was not configured as an OUT endpoint
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_INVALID_IN_CALLBACK (only if no cb supplied)
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+ See Also
+ * CyAsUsbGetStall
+ * CyAsUsbClearStall
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_set_stall(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+);
+
+/* Summary
+ This function clears a stall condition on a given endpoint
+
+ Description
+ This function clears a stall condition on the given endpoint.
+ If the callback function is not zero, the function is
+ executed asynchronously and the callback is called when the
+ function is completed. If the callback function is zero, this
+ function executes synchronously and will not return until the
+ function has completed.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the function succeeded
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given was invalid,
+ * or was not configured as an OUT endpoint
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_INVALID_IN_CALLBACK (only if no cb supplied)
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+ See Also
+ * CyAsUsbGetStall
+ * CyAsUsbSetStall
+*/
+
+EXTERN cy_as_return_status_t
+cy_as_usb_clear_stall(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+
+/* Summary
+ This function returns the stall status for a given endpoint
+
+ Description
+ This function returns the stall status for a given endpoint
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the function succeeded
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given was invalid,
+ * or was not configured as an OUT endpoint
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_INVALID_IN_CALLBACK
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+ See Also
+ * CyAsUsbGetStall
+ * CyAsUsbSetStall
+ * CyAsUsbClearStall
+*/
+
+EXTERN cy_as_return_status_t
+cy_as_usb_get_stall(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* The return value for the stall state */
+ cy_bool *stall_p,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ This function sets a NAK condition on a given endpoint
+
+ Description
+ This function sets a NAK condition on the given endpoint.
+ If the callback function is not zero, the function is
+ executed asynchronously and the callback is called when
+ the function is completed. If the callback function is
+ zero, this function executes synchronously and will not
+ return until the function has completed.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the function succeeded
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given was
+ * invalid, or was not configured as an OUT endpoint
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_INVALID_IN_CALLBACK (only if no cb supplied)
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+ See Also
+ * CyAsUsbGetNak
+ * CyAsUsbClearNak
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_set_nak(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+);
+
+/* Summary
+ This function clears a NAK condition on a given endpoint
+
+ Description
+ This function clears a NAK condition on the given endpoint.
+ If the callback function is not zero, the function is
+ executed asynchronously and the callback is called when the
+ function is completed. If the callback function is zero,
+ this function executes synchronously and will not return
+ until the function has completed.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the function succeeded
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given was invalid,
+ * or was not configured as an OUT endpoint
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_INVALID_IN_CALLBACK (only if no cb supplied)
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+ See Also
+ * CyAsUsbGetNak
+ * CyAsUsbSetNak
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_clear_nak(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ This function returns the NAK status for a given endpoint
+
+ Description
+ This function returns the NAK status for a given endpoint
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the function succeeded
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given was invalid,
+ * or was not configured as an OUT endpoint
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_INVALID_IN_CALLBACK
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+
+ See Also
+ * CyAsUsbSetNak
+ * CyAsUsbClearNak
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_get_nak(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* The return value for the stall state */
+ cy_bool *nak_p,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+);
+
+/* Summary
+ This function triggers a USB remote wakeup from the Processor
+ API
+
+ Description
+ When there is a Suspend condition on the USB bus, this function
+ programmatically takes the USB bus out of thi suspend state.
+
+ * Valid In Asynchronous Callback: YES (if cb supplied)
+ * Nestable: YES
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the function succeeded
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_INVALID_HANDLE
+ * CY_AS_ERROR_INVALID_IN_CALLBACK
+ * CY_AS_ERROR_OUT_OF_MEMORY
+ * CY_AS_ERROR_INVALID_RESPONSE
+ * CY_AS_ERROR_NOT_IN_SUSPEND
+
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_signal_remote_wakeup(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ This function sets the threshold levels for mass storage progress
+ reports from the West Bridge.
+
+ Description
+ The West Bridge firmware can be configured to track the amount of
+ read/write activity on the mass storage device, and send progress
+ reports when the activity level has crossed a threshold level.
+ This function sets the threshold levels for the progress reports.
+ Set wr_sectors and rd_sectors to 0, if the progress reports are to
+ be turned off.
+
+ * Valid In Asynchronous Callback: Yes (if cb supplied)
+ * Nestable: Yes
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - the function succeeded
+ * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
+ * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
+ * the West Bridge device
+ * CY_AS_ERROR_INVALID_HANDLE - Bad handle
+ * CY_AS_ERROR_INVALID_IN_CALLBACK - Synchronous call made
+ * while in callback
+ * CY_AS_ERROR_OUT_OF_MEMORY - Failed allocating memory for
+ * request processing
+ * CY_AS_ERROR_NOT_SUPPORTED - Firmware version does not support
+ * mass storage progress tracking
+ * CY_AS_ERROR_INVALID_RESPONSE - Unexpected response from
+ * Firmware
+
+ See Also
+ * CyAsUsbMSCProgressData
+ * CyAsEventUsbMSCProgress
+*/
+EXTERN cy_as_return_status_t
+cy_as_usb_set_m_s_report_threshold(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* Number of sectors written before report is sent */
+ uint32_t wr_sectors,
+ /* Number of sectors read before report is sent */
+ uint32_t rd_sectors,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+/* Summary
+ Specify which of the partitions on a partitioned mass storage
+ device should be made visible to USB.
+
+ Description
+ West Bridge firmware supports the creation of upto two
+ partitions on mass storage devices connected to the West Bridge
+ device. When there are two partitions on a device, the user can
+ choose which of these partitions should be made visible to the
+ USB host through the USB mass storage interface. This function
+ allows the user to configure the partitions that should be
+ enumerated. At least one partition should be selected through
+ this API. If neither partition needs to be enumerated, use
+ CyAsUsbSetEnumConfig to control this.
+
+ * Valid in Asynchronous callback: Yes (if cb supplied)
+ * Nestable: Yes
+
+ Returns
+ * CY_AS_ERROR_SUCCESS - operation completed successfully
+ * CY_AS_ERROR_INVALID_HANDLE - invalid handle to the West
+ * Bridge device
+ * CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has not
+ * been configured
+ * CY_AS_ERROR_NO_FIRMWARE - no firmware running on West
+ * Bridge device
+ * CY_AS_ERROR_NOT_RUNNING - USB stack has not been started
+ * CY_AS_ERROR_IN_SUSPEND - West Bridge device is in
+ * suspend mode
+ * CY_AS_ERROR_INVALID_CALL_SEQUENCE - this API has to be
+ * called before CyAsUsbSetEnumConfig
+ * CY_AS_ERROR_OUT_OF_MEMORY - failed to get memory to
+ * process the request
+ * CY_AS_ERROR_NO_SUCH_UNIT - Storage device addressed has
+ * not been partitioned
+ * CY_AS_ERROR_NOT_SUPPORTED - operation is not supported by
+ * active device/firmware.
+
+ See Also
+ * CyAsStorageCreatePPartition
+ * CyAsStorageRemovePPartition
+ * CyAsUsbMsType_t
+ */
+EXTERN cy_as_return_status_t
+cy_as_usb_select_m_s_partitions(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* Bus index of the device being addressed */
+ cy_as_bus_number_t bus,
+ /* Device id of the device being addressed */
+ uint32_t device,
+ /* Selection of partitions to be enumerated */
+ cy_as_usb_m_s_type_t type,
+ /* The callback, if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+extern cy_as_media_type
+cy_as_storage_get_media_from_address(uint16_t v);
+
+extern cy_as_bus_number_t
+cy_as_storage_get_bus_from_address(uint16_t v);
+
+extern uint32_t
+cy_as_storage_get_device_from_address(uint16_t v);
+
+/* For supporting deprecated functions */
+#include "cyasusb_dep.h"
+
+#include "cyas_cplus_end.h"
+
+#endif /* _INCLUDED_CYASUSB_H_ */
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb_dep.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb_dep.h
new file mode 100644
index 0000000..829edde
--- /dev/null
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb_dep.h
@@ -0,0 +1,224 @@
+/* Cypress West Bridge API header file (cyasusb_dep.h)
+## ===========================
+## Copyright (C) 2010 Cypress Semiconductor
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street
+## Fifth Floor, Boston, MA 02110-1301, USA.
+## ===========================
+*/
+
+/*
+ * This header will contain Antioch specific declaration
+ * of the APIs that are deprecated in Astoria SDK. This is
+ * for maintaining backward compatibility.
+ */
+
+#ifndef __INCLUDED_CYASUSB_DEP_H__
+#define __INCLUDED_CYASUSB_DEP_H__
+
+#ifndef __doxygen__
+
+/*
+ This data structure is the data passed via the evdata
+ paramater on a usb event callback for the inquiry request.
+*/
+
+typedef struct cy_as_usb_inquiry_data_dep {
+ /* The media for the event */
+ cy_as_media_type media;
+ /* The EVPD bit from the SCSI INQUIRY request */
+ uint8_t evpd;
+ /* The codepage in the inquiry request */
+ uint8_t codepage;
+ /* This bool must be set to CyTrue indicate
+ * that the inquiry data was changed */
+ cy_bool updated;
+ /* The length of the data */
+ uint16_t length;
+ /* The inquiry data */
+ void *data;
+} cy_as_usb_inquiry_data_dep;
+
+
+typedef struct cy_as_usb_unknown_command_data_dep {
+ /* The media for the event */
+ cy_as_media_type media;
+ /* The length of the requst (should be 16 bytes) */
+ uint16_t reqlen;
+ /* The request */
+ void *request;
+ /* The returned status value for the command */
+ uint8_t status;
+ /* If status is failed, the sense key */
+ uint8_t key;
+ /* If status is failed, the additional sense code */
+ uint8_t asc;
+ /* If status if failed, the additional sense code qualifier */
+ uint8_t ascq;
+} cy_as_usb_unknown_command_data_dep;
+
+
+typedef struct cy_as_usb_start_stop_data_dep {
+ /* The media type for the event */
+ cy_as_media_type media;
+ /* CyTrue means start request, CyFalse means stop request */
+ cy_bool start;
+ /* CyTrue means LoEj bit set, otherwise false */
+ cy_bool loej;
+} cy_as_usb_start_stop_data_dep;
+
+
+typedef struct cy_as_usb_enum_control_dep {
+ /* The bits in this member determine which mass storage devices
+ are enumerated. see cy_as_usb_mass_storage_enum for more details. */
+ uint8_t enum_mass_storage;
+ /* If true, West Bridge will control enumeration. If this is false the
+ pport controls enumeration. if the P port is controlling
+ enumeration, traffic will be received via endpoint zero. */
+ cy_bool antioch_enumeration;
+ /* This is the interface # to use for the mass storage interface,
+ if mass storage is enumerated. if mass storage is not enumerated
+ this value should be zero. */
+ uint8_t mass_storage_interface;
+ /* If true, Inquiry, START/STOP, and unknown mass storage
+ requests cause a callback to occur for handling by the
+ baseband processor. */
+ cy_bool mass_storage_callbacks;
+} cy_as_usb_enum_control_dep;
+
+
+typedef void (*cy_as_usb_event_callback_dep)(
+ /* Handle to the device to configure */
+ cy_as_device_handle handle,
+ /* The event type being reported */
+ cy_as_usb_event ev,
+ /* The data assocaited with the event being reported */
+ void *evdata
+);
+
+
+
+/* Register Callback api */
+EXTERN cy_as_return_status_t
+cy_as_usb_register_callback_dep(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The function to call */
+ cy_as_usb_event_callback_dep callback
+ );
+
+
+extern cy_as_return_status_t
+cy_as_usb_set_enum_config_dep(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The USB configuration information */
+ cy_as_usb_enum_control_dep *config_p,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+
+extern cy_as_return_status_t
+cy_as_usb_get_enum_config_dep(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The return value for USB congifuration information */
+ cy_as_usb_enum_control_dep *config_p,
+ /* The callback if async call */
+ cy_as_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+extern cy_as_return_status_t
+cy_as_usb_get_descriptor_dep(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The type of descriptor */
+ cy_as_usb_desc_type type,
+ /* Index for string descriptor */
+ uint8_t index,
+ /* The buffer to hold the returned descriptor */
+ void *desc_p,
+ /* This is an input and output parameter. Before the code this pointer
+ points to a uint32_t that contains the length of the buffer. after
+ the call, this value contains the amount of data actually returned. */
+ uint32_t *length_p
+ );
+
+extern cy_as_return_status_t
+cy_as_usb_set_stall_dep(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* The callback if async call */
+ cy_as_usb_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+);
+
+EXTERN cy_as_return_status_t
+cy_as_usb_clear_stall_dep(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* The callback if async call */
+ cy_as_usb_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_usb_set_nak_dep(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* The callback if async call */
+ cy_as_usb_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+);
+
+EXTERN cy_as_return_status_t
+cy_as_usb_clear_nak_dep(
+ /* Handle to the West Bridge device */
+ cy_as_device_handle handle,
+ /* The endpoint of interest */
+ cy_as_end_point_number_t ep,
+ /* The callback if async call */
+ cy_as_usb_function_callback cb,
+ /* Client supplied data */
+ uint32_t client
+ );
+
+EXTERN cy_as_return_status_t
+cy_as_usb_select_m_s_partitions_dep(
+ cy_as_device_handle handle,
+ cy_as_media_type media,
+ uint32_t device,
+ cy_as_usb_m_s_type_t type,
+ cy_as_function_callback cb,
+ uint32_t client
+ );
+
+#endif /*__doxygen*/
+
+#endif /*__INCLUDED_CYANSTORAGE_DEP_H__*/
OpenPOWER on IntegriCloud