1 /* Cypress West Bridge API header file (cyasusb.h)
2 ## ===========================
3 ## Copyright (C) 2010 Cypress Semiconductor
5 ## This program is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU General Public License
7 ## as published by the Free Software Foundation; either version 2
8 ## of the License, or (at your option) any later version.
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 51 Franklin Street
18 ## Fifth Floor, Boston, MA 02110-1301, USA.
19 ## ===========================
22 #ifndef _INCLUDED_CYASUSB_H_
23 #define _INCLUDED_CYASUSB_H_
27 #include "cyas_cplus_start.h"
31 The USB enumeration process is the process of communicating
32 to the USB host information
33 about the capabilities of the connected device. This
34 process is completed by servicing
35 requests for various types of descriptors. In the software
36 APIs described below, this
37 process is controlled in one of two ways.
40 There are advantages to either type of enumeration
41 and this is why both models are supported.
42 P Port processor based enumeraton gives the P port
43 processor maximum control and flexibility
44 for providing USB configuration information. However,
45 this does require (near) real time data
46 responses from the P port processor during the enumeration
47 process. West Bridge based enumeration
48 requires no real time information from the P port processor,
49 ensuring the fastest possible
52 * P Port Based Enumeration *
53 The first method for handling USB enumeration is for the
54 processor client to handle all
55 endpoint zero requests for descriptors. This mode is
56 configured by indicating to the API
57 that the processor wants to handle all endpoint zero
58 requests. This is done by setting
59 bit 0 in the end_point_mask to a 1. The processor uses
60 CyAsUsbReadDataAsync() to read the request and
61 CyAsUsbWriteDataAsync() to write the response.
63 * West Bridge Based Enumeration *
64 The second method for handling USB enumeration is the
65 configuration information method.
66 Before enabling a connection from the West Bridge device
67 to the USB connector, the P Port
68 processor sends information about the USB configuration to
69 West Bridge through the configuration
70 APIs. This information is stored within the West Bridge
71 device. When a USB cable is attached,
72 the West Bridge device then handles all descriptor requests
73 based on the stored information.
74 Note that this method of enumeration only supports a single
77 In either model of enumeration, the processor client is
78 responsible for ensuring that
79 the system meets USB Chapter 9 compliance requirements. This
80 can be done by providing spec
81 compliant descriptors, and handling any setup packets that
82 are sent to the client
85 Mass storage class compliance will be ensured by the West
86 Bridge firmware when the mass
87 storage functionality is enabled.
90 /*@@Endpoint Configuration
92 The West Bridge device has one 64-byte control endpoint, one
93 64-byte low bandwidth endpoint, four bulk
94 endpoints dedicated for mass storage usage, and up to ten
95 bulk/interrupt/isochronous
96 endpoints that can be used for USB-to-Processor communication.
99 The four storage endpoints (Endpoints 2, 4, 6 and 8) are
100 reserved for accessing storage
101 devices attached to West Bridge and are not available for use
102 by the processor. These are
103 used implicitly when using the storage API to read/write to
106 Endpoint 0 is the standard USB control pipe used for all
107 enumeration activity. Though
108 the endpoint buffer is not directly accessible from the
109 processor, read/write activity
110 can be performed on this endpoint through the API layers.
111 This endpoint is always
112 configured as a bi-directional control endpoint.
114 Endpoint 1 is a 64-byte endpoint that can be used for low
115 bandwidth bulk/interrupt
116 activity. The physical buffer is not accessible from the
117 processor, but can be read/written
118 through the API. As the data coming to this endpoint is
119 being handled through the
120 software layers, there can be loss of data if a read call
121 is not waiting when an OUT
124 Endpoints 3, 5, 7, 9, 10, 11, 12, 13, 14 and 15 are ten
125 configurable endpoints
126 mapped to parts of a total 4 KB FIFO buffer space on the
127 West Bridge device. This 4 KB
128 physical buffer space is divided into up to four endpoints
129 called PEP1, PEP2, PEP3 and PEP4
130 in this software document. There are multiple configurations
131 in which this buffer space
132 can be used, and the size and number of buffers available to
133 each physical endpoint
134 vary between these configurations. See the West Bridge PDD
135 for details on the buffer
136 orientation corresponding to each configuration.
139 PEPs 1, 2, 3 and 4 are called Physical EP 3, 5, 7 and 9 in the
141 sequential number scheme is used in the software to disambiguate
142 these from the logical
143 endpoint numbers, and also for convenience of array indexing.
146 #if !defined(__doxygen__)
152 This constants defines the maximum size of a USB descriptor
153 when referenced via the CyAsUsbSetDescriptor or
154 CyAsUsbGetDescriptor functions.
157 * CyAsUsbSetDescriptor
158 * CyAsUsbGetDescriptor
160 #define CY_AS_MAX_USB_DESCRIPTOR_SIZE (128)
162 /***************************************
164 ***************************************/
168 This data structure is the data passed via the evdata paramater
169 on a usb event callback for the inquiry request.
172 When a SCSI inquiry request arrives via the USB connection and
174 to receive inquiry requests, this request is forwarded to the
176 callback. This callback is called twice, once before the
177 inquiry data is forwarded
178 to the host (CyAsEventUsbInquiryBefore) and once after the
179 inquiry has been sent to the
180 USB host (CyAsEventUsbInquiryAfter). The evdata parameter
181 is a pointer to this data
184 *CyAsEventUsbInquiryBefore*
185 If the client just wishes to see the inquiry request and
186 associated data, then a simple
187 return from the callback will forward the inquiry response
188 to the USB host. If the
189 client wishes to change the data returned to the USB host,
190 the updated parameter must
191 be set to CyTrue and the memory area address by the data
192 parameter should be updated.
193 The data pointer can be changed to point to a new memory
194 area and the length field
195 changed to change the amount of data returned from the
196 inquiry request. Note that the
197 data area pointed to by the data parameter must remain
198 valid and the contents must
199 remain consistent until after the CyAsEventUsbInquiryAfter
200 event has occurred. THE LENGTH
201 MUST BE LESS THAN 192 BYTES OR THE CUSTOM INQUIRY RESPONSE
202 WILL NOT BE RETURNED. If the
203 length is too long, the default inquiry response will be
206 *CyAsEventUsbInquiryAfter*
207 If the client needs to free any data, this event signals that
208 the data associated with the inquiry is no longer needed.
211 * CyAsUsbEventCallback
212 * CyAsUsbRegisterCallback
214 typedef struct cy_as_usb_inquiry_data {
215 /* The bus for the event */
216 cy_as_bus_number_t bus;
217 /* The device the event */
219 /* The EVPD bit from the SCSI INQUIRY request */
221 /* The codepage in the inquiry request */
223 /* This bool must be set to CyTrue indicate that the inquiry
226 /* The length of the data */
228 /* The inquiry data */
230 } cy_as_usb_inquiry_data;
234 This data structure is the data passed via the evdata
235 parameter on a usb event
236 callback for the unknown mass storage request.
239 When a SCSI request is made that the mass storage
240 firmware in West Bridge does not
241 know how to process, this request is passed to the
242 processor for handling via
243 the usb callback. This data structure is used to
244 pass the request and the
245 associated response. The user may set the status
246 to indicate the status of the
247 request. The status value is the bCSWStatus value
248 from the USB mass storage
249 Command Status Wrapper (0 = command passed, 1 =
250 command failed). If the status
251 is set to command failed (1), the sense information
252 should be set as well. For
253 more information about sense information, see the
254 USB mass storage specification
255 as well as the SCSI specifications for block devices.
256 By default the status is
257 initialized to 1 (failure) with a sense information
259 indicates INVALID COMMAND.
261 typedef struct cy_as_usb_unknown_command_data {
262 /* The bus for the event */
263 cy_as_bus_number_t bus;
264 /* The device for the event */
271 /* The returned status value for the command */
273 /* If status is failed, the sense key */
275 /* If status is failed, the additional sense code */
277 /* If status if failed, the additional sense code qualifier */
279 } cy_as_usb_unknown_command_data;
283 This data structure is the data passed via the evdata
284 paramater on a usb event callback for the start/stop request.
287 When a SCSI start stop request arrives via the USB connection
288 and the P Port has asked
291 * CyAsUsbEventCallback
292 * CyAsUsbRegisterCallback
294 typedef struct cy_as_usb_start_stop_data {
295 /* The bus for the event */
296 cy_as_bus_number_t bus;
297 /* The device for the event */
299 /* CyTrue means start request, CyFalse means stop request */
301 /* CyTrue means LoEj bit set, otherwise false */
303 } cy_as_usb_start_stop_data;
306 This data type is used to indicate which mass storage devices
313 * CyAsUsbSetEnumConfig
315 typedef enum cy_as_usb_mass_storage_enum {
316 cy_as_usb_nand_enum = 0x01,
317 cy_as_usb_sd_enum = 0x02,
318 cy_as_usb_mmc_enum = 0x04,
319 cy_as_usb_ce_ata_enum = 0x08
320 } cy_as_usb_mass_storage_enum;
323 This data type specifies the type of descriptor to transfer
324 to the West Bridge device
327 During enumeration, if West Bridge is handling enumeration,
328 the West Bridge device needs to USB descriptors
329 to complete the enumeration. The function CyAsUsbSetDescriptor()
330 is used to transfer the descriptors
331 to the West Bridge device. This type is an argument to that
332 function and specifies which descriptor
333 is being transferred.
336 * CyAsUsbSetDescriptor
337 * CyAsUsbGetDescriptor
339 typedef enum cy_as_usb_desc_type {
340 /* A device descriptor - See USB 2.0 specification Chapter 9 */
341 cy_as_usb_desc_device = 1,
342 /* A device descriptor qualifier -
343 * See USB 2.0 specification Chapter 9 */
344 cy_as_usb_desc_device_qual = 2,
345 /* A configuration descriptor for FS operation -
346 * See USB 2.0 specification Chapter 9 */
347 cy_as_usb_desc_f_s_configuration = 3,
348 /* A configuration descriptor for HS operation -
349 * See USB 2.0 specification Chapter 9 */
350 cy_as_usb_desc_h_s_configuration = 4,
351 cy_as_usb_desc_string = 5
352 } cy_as_usb_desc_type;
355 This type specifies the direction of an endpoint
358 This type is used when configuring the endpoint hardware
359 to specify the direction
363 * CyAsUsbEndPointConfig
364 * CyAsUsbSetEndPointConfig
365 * CyAsUsbGetEndPointConfig
367 typedef enum cy_as_usb_end_point_dir {
368 /* The endpoint direction is IN (West Bridge -> USB Host) */
370 /* The endpoint direction is OUT (USB Host -> West Bridge) */
372 /* The endpoint direction is IN/OUT (valid only for EP 0 & 1) */
374 } cy_as_usb_end_point_dir;
377 This type specifies the type of an endpoint
380 This type is used when configuring the endpoint hardware
381 to specify the type of endpoint.
384 * CyAsUsbEndPointConfig
385 * CyAsUsbSetEndPointConfig
386 * CyAsUsbGetEndPointConfig
388 typedef enum cy_as_usb_end_point_type {
393 } cy_as_usb_end_point_type;
396 This type is a structure used to indicate the top level
397 configuration of the USB stack
400 In order to configure the USB stack, the CyAsUsbSetEnumConfig()
401 function is called to indicate
402 how mass storage is to be handled, the specific number of
403 interfaces to be supported if
404 West Bridge is handling enumeration, and the end points of
405 specifi interest. This structure
406 contains this information.
411 * <LINK Enumeration Model>
413 typedef struct cy_as_usb_enum_control {
414 /* Designate which devices on which buses to enumerate */
415 cy_bool devices_to_enumerate[CY_AS_MAX_BUSES]
416 [CY_AS_MAX_STORAGE_DEVICES];
417 /* If true, West Bridge will control enumeration. If this
418 * is false the P port controls enumeration. if the P port
419 * is controlling enumeration, traffic will be received via
421 cy_bool antioch_enumeration;
422 /* This is the interface # to use for the mass storage
423 * interface, if mass storage is enumerated. if mass
424 * storage is not enumerated this value should be zero. */
425 uint8_t mass_storage_interface;
426 /* This is the interface # to use for the MTP interface,
427 * if MTP is enumerated. if MTP is not enumerated
428 * this value should be zero. */
429 uint8_t mtp_interface;
430 /* If true, Inquiry, START/STOP, and unknown mass storage
431 * requests cause a callback to occur for handling by the
432 * baseband processor. */
433 cy_bool mass_storage_callbacks;
434 } cy_as_usb_enum_control;
438 This structure is used to configure a single endpoint
441 This data structure contains all of the information required
442 to configure the West Bridge hardware
443 associated with a given endpoint.
446 * CyAsUsbSetEndPointConfig
447 * CyAsUsbGetEndPointConfig
449 typedef struct cy_as_usb_end_point_config {
450 /* If true, this endpoint is enabled */
452 /* The direction of this endpoint */
453 cy_as_usb_end_point_dir dir;
454 /* The type of endpoint */
455 cy_as_usb_end_point_type type;
456 /* The physical endpoint #, 1, 2, 3, 4 */
457 cy_as_end_point_number_t physical;
458 /* The size of the endpoint in bytes */
460 } cy_as_usb_end_point_config;
463 List of partition enumeration combinations that can
464 be selected on a partitioned storage device.
467 West Bridge firmware supports creating up to two
468 partitions on mass storage devices connected to
469 West Bridge. When there are two partitions on a device,
470 the user can choose which of these partitions should be
471 made visible to a USB host through the mass storage
472 interface. This enumeration lists the various enumeration
473 selections that can be made.
476 * CyAsStorageCreatePPartition
477 * CyAsStorageRemovePPartition
478 * CyAsUsbSelectMSPartitions
480 typedef enum cy_as_usb_m_s_type_t {
481 /* Enumerate only partition 0 as CD (autorun) device */
482 cy_as_usb_m_s_unit0 = 0,
483 /* Enumerate only partition 1 as MS device (default setting) */
485 /* Enumerate both units */
487 } cy_as_usb_m_s_type_t;
490 This type specifies the type of USB event that has occurred
493 This type is used in the USB event callback function to
494 indicate the type of USB event that has occurred. The callback
495 function includes both this reasons for the callback and a data
496 parameter associated with the reason. The data parameter is used
497 in a reason specific way and is documented below with each reason.
502 typedef enum cy_as_usb_event {
503 /* This event is sent when West Bridge is put into the suspend
504 state by the USB host. the data parameter is not used and
506 cy_as_event_usb_suspend,
507 /* This event is sent when West Bridge is taken out of the
508 suspend state by the USB host. the data parameter is not
509 used and will be zero. */
510 cy_as_event_usb_resume,
511 /* This event is sent when a USB reset request is received
512 by the west bridge device. the data parameter is not used and
514 cy_as_event_usb_reset,
515 /* This event is sent when a USB set configuration request is made.
516 the data parameter is a pointer to a uint16_t that contains the
517 configuration number. the configuration number may be zero to
518 indicate an unconfigure operation. */
519 cy_as_event_usb_set_config,
520 /* This event is sent when the USB connection changes speed. This is
521 generally a transition from full speed to high speed. the parameter
522 to this event is a pointer to uint16_t that gives the speed of the
523 USB connection. zero indicates full speed, one indicates high speed */
524 cy_as_event_usb_speed_change,
525 /* This event is sent when a setup packet is received.
526 * The data parameter is a pointer to the eight bytes of setup data. */
527 cy_as_event_usb_setup_packet,
528 /* This event is sent when a status packet is received. The data
529 parameter is not used. */
530 cy_as_event_usb_status_packet,
531 /* This event is sent when mass storage receives an inquiry
532 request and we have asked to see these requests. */
533 cy_as_event_usb_inquiry_before,
534 /* This event is sent when mass storage has finished processing an
535 inquiry request and any data associated with the request is no longer
537 cy_as_event_usb_inquiry_after,
538 /* This event is sent when mass storage receives a start/stop
539 * request and we have asked to see these requests */
540 cy_as_event_usb_start_stop,
541 /* This event is sent when a Clear Feature request is received.
542 * The data parameter is the endpoint number. */
543 cy_as_event_usb_clear_feature,
544 /* This event is sent when mass storage receives a request
545 * that is not known and we have asked to see these requests */
546 cy_as_event_usb_unknown_storage,
547 /* This event is sent when the read/write activity on the USB mass
548 storage has crossed a pre-set level */
549 cy_as_event_usb_m_s_c_progress
553 This type is the type of a callback function that is
554 called when a USB event occurs
557 At times West Bridge needs to inform the P port processor
559 occurred. These events are asynchronous to the thread of
561 port processor and as such are generally delivered via a
562 callback function that
563 is called as part of an interrupt handler. This type
564 defines the type of function
565 that must be provided as a callback function for USB events.
570 typedef void (*cy_as_usb_event_callback)(
571 /* Handle to the device to configure */
572 cy_as_device_handle handle,
573 /* The event type being reported */
575 /* The data assocaited with the event being reported */
581 This type is the callback function called after an
582 asynchronous USB read/write operation
585 This function type defines a callback function that is
586 called at the completion of any
587 asynchronous read or write operation.
590 * CyAsUsbReadDataAsync
591 * CyAsUsbWriteDataAsync
592 * CY_AS_ERROR_CANCELED
594 typedef void (*cy_as_usb_io_callback)(
595 /* Handle to the device to configure */
596 cy_as_device_handle handle,
597 /* The endpoint that has completed an operation */
598 cy_as_end_point_number_t ep,
599 /* THe amount of data transferred to/from USB */
601 /* The data buffer for the operation */
603 /* The error status of the operation */
604 cy_as_return_status_t status
608 This type is the callback function called after asynchronous
609 API functions have completed.
612 When calling API functions from callback routines (interrupt
613 handlers usually) the async version of
614 these functions must be used. This callback is called when an
615 asynchronous API function has completed.
617 typedef void (*cy_as_usb_function_callback)(
618 /* Handle to the device to configure */
619 cy_as_device_handle handle,
620 /* The error status of the operation */
621 cy_as_return_status_t status,
622 /* A client supplied 32 bit tag */
627 /********************************************
628 * West Bridge Functions
629 ********************************************/
632 This function starts the USB stack
635 This function initializes the West Bridge USB software
636 stack if it has not yet been stared.
637 This initializes any required data structures and powers
638 up any USB specific portions of
639 the West Bridge hardware. If the stack had already been
640 started, the USB stack reference count
643 * Valid In Asynchronous Callback: YES (if cb supplied)
647 This function cannot be called from any type of West Bridge
651 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
653 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
655 * CY_AS_ERROR_SUCCESS - the stack initialized and is ready
657 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
658 * with the West Bridge device
663 EXTERN cy_as_return_status_t
665 /* Handle to the West Bridge device */
666 cy_as_device_handle handle,
667 /* The callback if async call */
668 cy_as_function_callback cb,
669 /* Client supplied data */
674 This function stops the USB stack
677 This function decrements the reference count for
678 the USB stack and if this count
679 is zero, the USB stack is shut down. The shutdown
680 frees all resources associated
683 * Valid In Asynchronous Callback: NO
686 While all resources associated with the USB stack will
687 be freed is a shutdown occurs,
688 resources associated with underlying layers of the software
689 will not be freed if they
690 are shared by the storage stack and the storage stack is active.
691 Specifically the DMA manager,
692 the interrupt manager, and the West Bridge communications module
693 are all shared by both the
694 USB stack and the storage stack.
697 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
699 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
701 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
702 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
703 * the West Bridge device
708 EXTERN cy_as_return_status_t
710 /* Handle to the West Bridge device */
711 cy_as_device_handle handle,
712 /* The callback if async call */
713 cy_as_function_callback cb,
714 /* Client supplied data */
719 This function registers a callback function to be called when an
720 asynchronous USB event occurs
723 When asynchronous USB events occur, a callback function can be
724 called to alert the calling program. This
725 functions allows the calling program to register a callback.
727 * Valid In Asynchronous Callback: YES
729 EXTERN cy_as_return_status_t
730 cy_as_usb_register_callback(
731 /* Handle to the West Bridge device */
732 cy_as_device_handle handle,
733 /* The function to call */
734 cy_as_usb_event_callback callback
739 This function connects the West Bridge device D+ and D- signals
740 physically to the USB host.
743 The West Bridge device has the ability to programmatically
744 disconnect the USB pins on the device
745 from the USB host. This feature allows for re-enumeration of
746 the West Bridge device as a different
747 device when necessary. This function connects the D+ and D-
748 signal physically to the USB host
749 if they have been previously disconnected.
751 * Valid In Asynchronous Callback: YES (if cb supplied)
755 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
756 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
758 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
760 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
761 * the West Bridge device
762 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
767 EXTERN cy_as_return_status_t
769 /* Handle to the West Bridge device */
770 cy_as_device_handle handle,
771 /* The callback if async call */
772 cy_as_function_callback cb,
773 /* Client supplied data */
778 This function disconnects the West Bridge device D+ and D-
779 signals physically from the USB host.
782 The West Bridge device has the ability to programmatically
783 disconnect the USB pins on the device
784 from the USB host. This feature allows for re-enumeration
785 of the West Bridge device as a different
786 device when necessary. This function disconnects the D+
787 and D- signal physically from the USB host
788 if they have been previously connected.
790 * Valid In Asynchronous Callback: YES (if cb supplied)
794 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
795 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
797 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
799 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
800 * the West Bridge device
801 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
806 EXTERN cy_as_return_status_t
807 cy_as_usb_disconnect(
808 /* Handle to the West Bridge device */
809 cy_as_device_handle handle,
810 /* The callback if async call */
811 cy_as_function_callback cb,
812 /* Client supplied data */
817 This function configures the USB stack
820 This function is used to configure the USB stack. It is
821 used to indicate which endpoints are going to
822 be used, and how to deal with the mass storage USB device
825 * Valid In Asynchronous Callback: Yes (if cb supplied)
828 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
829 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
831 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
833 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
834 * the West Bridge device
835 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
838 * CyAsUsbGetEnumConfig
841 EXTERN cy_as_return_status_t
842 cy_as_usb_set_enum_config(
843 /* Handle to the West Bridge device */
844 cy_as_device_handle handle,
845 /* The USB configuration information */
846 cy_as_usb_enum_control *config_p,
847 /* The callback if async call */
848 cy_as_function_callback cb,
849 /* Client supplied data */
854 This function retreives the current configuration of
858 This function sends a request to West Bridge to retrieve
859 the current configuration
861 * Valid In Asynchronous Callback: Yes (if cb supplied)
864 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
865 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
867 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
869 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
870 * the West Bridge device
871 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
877 EXTERN cy_as_return_status_t
878 cy_as_usb_get_enum_config(
879 /* Handle to the West Bridge device */
880 cy_as_device_handle handle,
881 /* The return value for USB congifuration information */
882 cy_as_usb_enum_control *config_p,
883 /* The callback if async call */
884 cy_as_function_callback cb,
885 /* Client supplied data */
890 This function sets the USB descriptor
893 This function is used to set the various descriptors
894 assocaited with the USB enumeration
895 process. This function should only be called when the
896 West Bridge enumeration model is selected.
897 Descriptors set using this function can be cleared by
898 stopping the USB stack, or by calling
899 the CyAsUsbClearDescriptors function.
901 * Valid In Asynchronous Callback: YES (if cb supplied)
905 These descriptors are described in the USB 2.0 specification,
909 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
910 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
912 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
914 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
915 * the West Bridge device
916 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
917 * CY_AS_ERROR_INVALID_DESCRIPTOR - the descriptor passed is
919 * CY_AS_ERROR_BAD_INDEX - a bad index was given for the type
920 * of descriptor given
921 * CY_AS_ERROR_BAD_ENUMERATION_MODE - this function cannot be
922 * called if the P port processor doing enumeration
925 * CyAsUsbGetDescriptor
926 * CyAsUsbClearDescriptors
927 * <LINK Enumeration Model>
929 EXTERN cy_as_return_status_t
930 cy_as_usb_set_descriptor(
931 /* Handle to the West Bridge device */
932 cy_as_device_handle handle,
933 /* The type of descriptor */
934 cy_as_usb_desc_type type,
935 /* Only valid for string descriptors */
937 /* The descriptor to be transferred */
939 /* The length of the descriptor in bytes */
941 /* The callback if async call */
942 cy_as_function_callback cb,
943 /* Client supplied data */
948 This function clears all user descriptors stored
952 This function is used to clear all descriptors that
954 stored on the West Bridge through CyAsUsbSetDescriptor
956 to the default descriptor setup in the firmware. This
958 only be called when the Antioch enumeration model is
961 * Valid In Asynchronous Callback: Yes (if cb supplied)
965 * CY_AS_ERROR_SUCCESS - all descriptors cleared successfully
966 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
968 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
970 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
971 * the West Bridge device
972 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
973 * CY_AS_ERROR_BAD_ENUMERATION_MODE - this function cannot be
974 * called if the P port processor is doing enumeration
977 * CyAsUsbSetDescriptor
978 * <LINK Enumeration Model>
980 EXTERN cy_as_return_status_t
981 cy_as_usb_clear_descriptors(
982 /* Handle to the West Bridge device */
983 cy_as_device_handle handle,
984 /* The callback if async call */
985 cy_as_function_callback cb,
986 /* Client supplied data */
990 This structure contains the descriptor buffer to be
991 filled by CyAsUsbGetDescriptor API.
994 This data structure the buffer to hold the descriptor
995 data, and an in/out parameter ti indicate the
996 length of the buffer and descriptor data in bytes.
999 * CyAsUsbGetDescriptor
1001 typedef struct cy_as_get_descriptor_data {
1002 /* The buffer to hold the returned descriptor */
1004 /* This is an input and output parameter.
1005 * Before the code this pointer points to a uint32_t
1006 * that contains the length of the buffer. after
1007 * the call, this value contains the amount of data
1008 * actually returned. */
1011 } cy_as_get_descriptor_data;
1014 This function retreives a given descriptor from the
1018 This function retreives a USB descriptor from the West
1019 Bridge device. This function should only be called when the
1020 West Bridge enumeration model is selected.
1022 * Valid In Asynchronous Callback: YES (if cb supplied)
1026 These descriptors are described in the USB 2.0 specification,
1030 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
1031 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1033 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1035 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1036 * the West Bridge device
1037 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1038 * CY_AS_ERROR_BAD_INDEX - a bad index was given for the type of
1040 * CY_AS_ERROR_BAD_ENUMERATION_MODE - this function cannot be
1041 * called if the P port processor doing enumeration
1044 * CyAsUsbSetDescriptor
1045 * <LINK Enumeration Model>
1048 EXTERN cy_as_return_status_t
1049 cy_as_usb_get_descriptor(
1050 /* Handle to the West Bridge device */
1051 cy_as_device_handle handle,
1052 /* The type of descriptor */
1053 cy_as_usb_desc_type type,
1054 /* Index for string descriptor */
1056 /* Parameters and return value for the get descriptor call */
1057 cy_as_get_descriptor_data *data,
1058 /* The callback if async call */
1059 cy_as_function_callback cb,
1060 /* Client supplied data */
1065 This function sets the configuration of the physical
1066 endpoints into one of the twelve supported configuration
1069 USB endpoints are mapped onto one of four physical
1070 endpoints in the device. Therefore
1071 USB endpoints are known as logical endpoints and these
1072 logical endpoints are mapped to
1073 one of four physical endpoints. In support of these
1074 four physical endpoints there is
1075 four kilo-bytes of buffer spaces that can be used as
1076 buffers for these physical endpoints.
1077 This 4K of buffer space can be configured in one of
1078 twelve ways. This function sets the
1079 buffer configuration for the physical endpoints.
1081 * Config 1: PEP1 (2 * 512), PEP2 (2 * 512),
1082 * PEP3 (2 * 512), PEP4 (2 * 512)
1083 * Config 2: PEP1 (2 * 512), PEP2 (2 * 512),
1084 * PEP3 (4 * 512), PEP4 (N/A)
1085 * Config 3: PEP1 (2 * 512), PEP2 (2 * 512),
1086 * PEP3 (2 * 1024), PEP4(N/A)
1087 * Config 4: PEP1 (4 * 512), PEP2 (N/A),
1088 * PEP3 (2 * 512), PEP4 (2 * 512)
1089 * Config 5: PEP1 (4 * 512), PEP2 (N/A),
1090 * PEP3 (4 * 512), PEP4 (N/A)
1091 * Config 6: PEP1 (4 * 512), PEP2 (N/A),
1092 * PEP3 (2 * 1024), PEP4 (N/A)
1093 * Config 7: PEP1 (2 * 1024), PEP2 (N/A),
1094 * PEP3 (2 * 512), PEP4 (2 * 512)
1095 * Config 8: PEP1 (2 * 1024), PEP2 (N/A),
1096 * PEP3 (4 * 512), PEP4 (N/A)
1097 * Config 9: PEP1 (2 * 1024), PEP2 (N/A),
1098 * PEP3 (2 * 1024), PEP4 (N/A)
1099 * Config 10: PEP1 (3 * 512), PEP2 (N/A),
1100 * PEP3 (3 * 512), PEP4 (2 * 512)
1101 * Config 11: PEP1 (3 * 1024), PEP2 (N/A),
1102 * PEP3 (N/A), PEP4 (2 * 512)
1103 * Config 12: PEP1 (4 * 1024), PEP2 (N/A),
1104 * PEP3 (N/A), PEP4 (N/A)
1106 * Valid In Asynchronous Callback: NO
1109 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
1110 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1112 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1114 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1115 * the West Bridge device
1116 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1117 * CY_AS_ERROR_INVALID_CONFIGURATION - the configuration given
1118 * is not between 1 and 12
1120 EXTERN cy_as_return_status_t
1121 cy_as_usb_set_physical_configuration(
1122 /* Handle to the West Bridge device */
1123 cy_as_device_handle handle,
1124 /* The physical endpoint configuration number */
1129 This function sets the hardware configuration for a given endpoint
1132 This function sets the hardware configuration for a given endpoint.
1133 This is the method to set the direction of the endpoint, the type
1134 of endpoint, the size of the endpoint buffer, and the buffering
1135 style for the endpoint.
1137 * Valid In Asynchronous Callback: NO
1140 Add documentation about endpoint configuration limitations
1143 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
1144 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1146 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1148 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1149 * the West Bridge device
1150 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1151 * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint parameter is invalid
1152 * CY_AS_ERROR_INVALID_CONFIGURATION - the endpoint configuration
1153 * given is not valid
1154 * CY_AS_ERROR_ENDPOINT_CONFIG_NOT_SET - the physical endpoint
1155 * configuration is not set
1158 * CyAsUsbGetEndPointConfig
1159 * CyAsUsbEndPointConfig
1161 EXTERN cy_as_return_status_t
1162 cy_as_usb_set_end_point_config(
1163 /* Handle to the West Bridge device */
1164 cy_as_device_handle handle,
1165 /* The endpoint of interest */
1166 cy_as_end_point_number_t ep,
1167 /* The configuration information for the endpoint */
1168 cy_as_usb_end_point_config *config_p
1172 This function retreives the hardware configuration for
1176 This function gets the hardware configuration for the given
1177 endpoint. This include information about the direction of
1178 the endpoint, the type of endpoint, the size of the endpoint
1179 buffer, and the buffering style for the endpoint.
1181 * Valid In Asynchronous Callback: NO
1184 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
1185 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1187 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1189 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1190 * the West Bridge device
1191 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1192 * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint parameter is
1196 * CyAsUsbSetEndPointConfig
1197 * CyAsUsbEndPointConfig
1199 EXTERN cy_as_return_status_t
1200 cy_as_usb_get_end_point_config(
1201 /* Handle to the West Bridge device */
1202 cy_as_device_handle handle,
1203 /* The endpoint of interest*/
1204 cy_as_end_point_number_t ep,
1205 /* The return value containing the endpoint config
1207 cy_as_usb_end_point_config *config_p
1211 This function commits the configuration information that
1212 has previously been set.
1215 The initialization process involves calling CyAsUsbSetEnumConfig()
1216 and CyAsUsbSetEndPointConfig(). These
1217 functions do not actually send the configuration information to
1218 the West Bridge device. Instead, these
1219 functions store away the configuration information and this
1220 CyAsUsbCommitConfig() actually finds the
1221 best hardware configuration based on the requested endpoint
1222 configuration and sends this optimal
1223 confiuration down to the West Bridge device.
1225 * Valid In Asynchronous Callback: YES (if cb supplied)
1229 * CY_AS_ERROR_SUCCESS - a configuration was found and sent
1231 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1233 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1235 * CY_AS_ERROR_INVALID_CONFIGURATION - the configuration requested
1237 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1238 * the West Bridge device
1239 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1242 * CyAsUsbSetEndPointConfig
1243 * CyAsUsbSetEnumConfig
1246 EXTERN cy_as_return_status_t
1247 cy_as_usb_commit_config(
1248 /* Handle to the West Bridge device */
1249 cy_as_device_handle handle,
1250 /* The callback if async call */
1251 cy_as_function_callback cb,
1252 /* Client supplied data */
1257 This function reads data from a USB endpoint.
1260 This function reads data from an OUT. This function blocks
1261 until the read is complete.
1262 If this is a packet read, a single received USB packet will
1263 complete the read. If this
1264 is not a packet read, this function will block until all of
1265 the data requested has been
1268 * Valid In Asynchronous Callback: NO
1271 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
1272 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1273 * the West Bridge device
1274 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1275 * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint parameter is
1279 * CyAsUsbReadDataAsync
1281 * CyAsUsbWriteDataAsync
1283 EXTERN cy_as_return_status_t
1284 cy_as_usb_read_data(
1285 /* Handle to the West Bridge device */
1286 cy_as_device_handle handle,
1287 /* The endpoint of interest */
1288 cy_as_end_point_number_t ep,
1289 /* If CyTrue, this is a packet read */
1291 /* The amount of data to read */
1293 /* The amount of data read */
1295 /* The buffer to hold the data read */
1300 This function reads data from a USB endpoint
1303 This function reads data from an OUT endpoint. This
1304 function will return immediately and the callback
1305 provided will be called when the read is complete.
1306 If this is a packet read, then the callback will be
1307 called on the next received packet. If this is not a
1308 packet read, the callback will be called when the
1309 requested data is received.
1311 * Valid In Asynchronous Callback: YES
1314 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
1315 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1316 * the West Bridge device
1317 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1318 * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint parameter is
1324 * CyAsUsbWriteDataAsync
1326 EXTERN cy_as_return_status_t
1327 cy_as_usb_read_data_async(
1328 /* Handle to the West Bridge device */
1329 cy_as_device_handle handle,
1330 /* The endpoint of interest */
1331 cy_as_end_point_number_t ep,
1332 /* If CyTrue, this is a packet read */
1334 /* The amount of data to read */
1336 /* The buffer for storing the data */
1338 /* The callback function to call when the data is read */
1339 cy_as_usb_io_callback callback
1343 This function writes data to a USB endpoint
1346 This function writes data to an IN endpoint data buffer.
1347 Multiple USB packets may be sent until all data requeste
1348 has been sent. This function blocks until all of the data
1351 * Valid In Asynchronous Callback: NO
1354 Calling this function with a dsize of zero will result in
1355 a zero length packet transmitted to the USB host.
1358 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
1359 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1360 * the West Bridge device
1361 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1362 * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint parameter is
1367 * CyAsUsbReadDataAsync
1368 * CyAsUsbWriteDataAsync
1370 EXTERN cy_as_return_status_t
1371 cy_as_usb_write_data(
1372 /* Handle to the West Bridge device */
1373 cy_as_device_handle handle,
1374 /* The endpoint to write data to */
1375 cy_as_end_point_number_t ep,
1376 /* The size of the data to write */
1378 /* The data buffer */
1383 This function writes data to a USB endpoint
1386 This function writes data to an IN endpoint data buffer.
1387 This function returns immediately and when the write
1388 completes, or if an error occurs, the callback function
1389 is called to indicate completion of the write operation.
1391 * Valid In Asynchronous Callback: YES
1394 Calling this function with a dsize of zero will result
1395 in a zero length packet transmitted to the USB host.
1398 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
1399 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1400 * the West Bridge device
1401 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1402 * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint parameter is
1407 * CyAsUsbReadDataAsync
1410 EXTERN cy_as_return_status_t
1411 cy_as_usb_write_data_async(
1412 /* Handle to the West Bridge device */
1413 cy_as_device_handle handle,
1414 /* The endpoint to write data to */
1415 cy_as_end_point_number_t ep,
1416 /* The size of the data */
1418 /* The buffer containing the data */
1420 /* If true, send a short packet to terminate data */
1422 /* The callback to call when the data is written */
1423 cy_as_usb_io_callback callback
1427 This function aborts an outstanding asynchronous
1428 operation on a given endpoint
1431 This function aborts any outstanding operation that is
1432 pending on the given endpoint.
1434 * Valid In Asynchronous Callback: YES
1437 * CY_AS_ERROR_SUCCESS - this module was shut down
1439 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not
1441 * CY_AS_ERROR_ASYNC_NOT_PENDING - no asynchronous USB
1442 * operation was pending
1446 * CyAsUsbReadDataAsync
1448 * CyAsUsbWriteDataAsync
1450 EXTERN cy_as_return_status_t
1451 cy_as_usb_cancel_async(
1452 /* Handle to the West Bridge device */
1453 cy_as_device_handle handle,
1454 /* The endpoint of interest */
1455 cy_as_end_point_number_t ep
1459 This function sets a stall condition on a given endpoint
1462 This function sets a stall condition on the given endpoint.
1463 If the callback function is not zero, the function is
1464 executed asynchronously and the callback is called when
1465 the function is completed. If the callback function is
1466 zero, this function executes synchronously and will not
1467 return until the function has completed.
1469 * Valid In Asynchronous Callback: YES (if cb supplied)
1473 * CY_AS_ERROR_SUCCESS - the function succeeded
1474 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1475 * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given was invalid,
1476 * or was not configured as an OUT endpoint
1477 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1478 * the West Bridge device
1479 * CY_AS_ERROR_INVALID_HANDLE
1480 * CY_AS_ERROR_INVALID_IN_CALLBACK (only if no cb supplied)
1481 * CY_AS_ERROR_OUT_OF_MEMORY
1482 * CY_AS_ERROR_INVALID_RESPONSE
1488 EXTERN cy_as_return_status_t
1489 cy_as_usb_set_stall(
1490 /* Handle to the West Bridge device */
1491 cy_as_device_handle handle,
1492 /* The endpoint of interest */
1493 cy_as_end_point_number_t ep,
1494 /* The callback if async call */
1495 cy_as_function_callback cb,
1496 /* Client supplied data */
1501 This function clears a stall condition on a given endpoint
1504 This function clears a stall condition on the given endpoint.
1505 If the callback function is not zero, the function is
1506 executed asynchronously and the callback is called when the
1507 function is completed. If the callback function is zero, this
1508 function executes synchronously and will not return until the
1509 function has completed.
1511 * Valid In Asynchronous Callback: YES (if cb supplied)
1515 * CY_AS_ERROR_SUCCESS - the function succeeded
1516 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1517 * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given was invalid,
1518 * or was not configured as an OUT endpoint
1519 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1520 * the West Bridge device
1521 * CY_AS_ERROR_INVALID_HANDLE
1522 * CY_AS_ERROR_INVALID_IN_CALLBACK (only if no cb supplied)
1523 * CY_AS_ERROR_OUT_OF_MEMORY
1524 * CY_AS_ERROR_INVALID_RESPONSE
1531 EXTERN cy_as_return_status_t
1532 cy_as_usb_clear_stall(
1533 /* Handle to the West Bridge device */
1534 cy_as_device_handle handle,
1535 /* The endpoint of interest */
1536 cy_as_end_point_number_t ep,
1537 /* The callback if async call */
1538 cy_as_function_callback cb,
1539 /* Client supplied data */
1545 This function returns the stall status for a given endpoint
1548 This function returns the stall status for a given endpoint
1550 * Valid In Asynchronous Callback: YES (if cb supplied)
1554 * CY_AS_ERROR_SUCCESS - the function succeeded
1555 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1556 * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given was invalid,
1557 * or was not configured as an OUT endpoint
1558 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1559 * the West Bridge device
1560 * CY_AS_ERROR_INVALID_HANDLE
1561 * CY_AS_ERROR_INVALID_IN_CALLBACK
1562 * CY_AS_ERROR_OUT_OF_MEMORY
1563 * CY_AS_ERROR_INVALID_RESPONSE
1571 EXTERN cy_as_return_status_t
1572 cy_as_usb_get_stall(
1573 /* Handle to the West Bridge device */
1574 cy_as_device_handle handle,
1575 /* The endpoint of interest */
1576 cy_as_end_point_number_t ep,
1577 /* The return value for the stall state */
1579 /* The callback if async call */
1580 cy_as_function_callback cb,
1581 /* Client supplied data */
1586 This function sets a NAK condition on a given endpoint
1589 This function sets a NAK condition on the given endpoint.
1590 If the callback function is not zero, the function is
1591 executed asynchronously and the callback is called when
1592 the function is completed. If the callback function is
1593 zero, this function executes synchronously and will not
1594 return until the function has completed.
1596 * Valid In Asynchronous Callback: YES (if cb supplied)
1600 * CY_AS_ERROR_SUCCESS - the function succeeded
1601 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1602 * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given was
1603 * invalid, or was not configured as an OUT endpoint
1604 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1605 * the West Bridge device
1606 * CY_AS_ERROR_INVALID_HANDLE
1607 * CY_AS_ERROR_INVALID_IN_CALLBACK (only if no cb supplied)
1608 * CY_AS_ERROR_OUT_OF_MEMORY
1609 * CY_AS_ERROR_INVALID_RESPONSE
1615 EXTERN cy_as_return_status_t
1617 /* Handle to the West Bridge device */
1618 cy_as_device_handle handle,
1619 /* The endpoint of interest */
1620 cy_as_end_point_number_t ep,
1621 /* The callback if async call */
1622 cy_as_function_callback cb,
1623 /* Client supplied data */
1628 This function clears a NAK condition on a given endpoint
1631 This function clears a NAK condition on the given endpoint.
1632 If the callback function is not zero, the function is
1633 executed asynchronously and the callback is called when the
1634 function is completed. If the callback function is zero,
1635 this function executes synchronously and will not return
1636 until the function has completed.
1638 * Valid In Asynchronous Callback: YES (if cb supplied)
1642 * CY_AS_ERROR_SUCCESS - the function succeeded
1643 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1644 * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given was invalid,
1645 * or was not configured as an OUT endpoint
1646 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1647 * the West Bridge device
1648 * CY_AS_ERROR_INVALID_HANDLE
1649 * CY_AS_ERROR_INVALID_IN_CALLBACK (only if no cb supplied)
1650 * CY_AS_ERROR_OUT_OF_MEMORY
1651 * CY_AS_ERROR_INVALID_RESPONSE
1657 EXTERN cy_as_return_status_t
1658 cy_as_usb_clear_nak(
1659 /* Handle to the West Bridge device */
1660 cy_as_device_handle handle,
1661 /* The endpoint of interest */
1662 cy_as_end_point_number_t ep,
1663 /* The callback if async call */
1664 cy_as_function_callback cb,
1665 /* Client supplied data */
1670 This function returns the NAK status for a given endpoint
1673 This function returns the NAK status for a given endpoint
1675 * Valid In Asynchronous Callback: YES (if cb supplied)
1679 * CY_AS_ERROR_SUCCESS - the function succeeded
1680 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1681 * CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given was invalid,
1682 * or was not configured as an OUT endpoint
1683 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1684 * the West Bridge device
1685 * CY_AS_ERROR_INVALID_HANDLE
1686 * CY_AS_ERROR_INVALID_IN_CALLBACK
1687 * CY_AS_ERROR_OUT_OF_MEMORY
1688 * CY_AS_ERROR_INVALID_RESPONSE
1694 EXTERN cy_as_return_status_t
1696 /* Handle to the West Bridge device */
1697 cy_as_device_handle handle,
1698 /* The endpoint of interest */
1699 cy_as_end_point_number_t ep,
1700 /* The return value for the stall state */
1702 /* The callback if async call */
1703 cy_as_function_callback cb,
1704 /* Client supplied data */
1709 This function triggers a USB remote wakeup from the Processor
1713 When there is a Suspend condition on the USB bus, this function
1714 programmatically takes the USB bus out of thi suspend state.
1716 * Valid In Asynchronous Callback: YES (if cb supplied)
1720 * CY_AS_ERROR_SUCCESS - the function succeeded
1721 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1722 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1723 * the West Bridge device
1724 * CY_AS_ERROR_INVALID_HANDLE
1725 * CY_AS_ERROR_INVALID_IN_CALLBACK
1726 * CY_AS_ERROR_OUT_OF_MEMORY
1727 * CY_AS_ERROR_INVALID_RESPONSE
1728 * CY_AS_ERROR_NOT_IN_SUSPEND
1731 EXTERN cy_as_return_status_t
1732 cy_as_usb_signal_remote_wakeup(
1733 /* Handle to the West Bridge device */
1734 cy_as_device_handle handle,
1735 /* The callback if async call */
1736 cy_as_function_callback cb,
1737 /* Client supplied data */
1742 This function sets the threshold levels for mass storage progress
1743 reports from the West Bridge.
1746 The West Bridge firmware can be configured to track the amount of
1747 read/write activity on the mass storage device, and send progress
1748 reports when the activity level has crossed a threshold level.
1749 This function sets the threshold levels for the progress reports.
1750 Set wr_sectors and rd_sectors to 0, if the progress reports are to
1753 * Valid In Asynchronous Callback: Yes (if cb supplied)
1757 * CY_AS_ERROR_SUCCESS - the function succeeded
1758 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
1759 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
1760 * the West Bridge device
1761 * CY_AS_ERROR_INVALID_HANDLE - Bad handle
1762 * CY_AS_ERROR_INVALID_IN_CALLBACK - Synchronous call made
1764 * CY_AS_ERROR_OUT_OF_MEMORY - Failed allocating memory for
1765 * request processing
1766 * CY_AS_ERROR_NOT_SUPPORTED - Firmware version does not support
1767 * mass storage progress tracking
1768 * CY_AS_ERROR_INVALID_RESPONSE - Unexpected response from
1772 * CyAsUsbMSCProgressData
1773 * CyAsEventUsbMSCProgress
1775 EXTERN cy_as_return_status_t
1776 cy_as_usb_set_m_s_report_threshold(
1777 /* Handle to the West Bridge device */
1778 cy_as_device_handle handle,
1779 /* Number of sectors written before report is sent */
1780 uint32_t wr_sectors,
1781 /* Number of sectors read before report is sent */
1782 uint32_t rd_sectors,
1783 /* The callback if async call */
1784 cy_as_function_callback cb,
1785 /* Client supplied data */
1790 Specify which of the partitions on a partitioned mass storage
1791 device should be made visible to USB.
1794 West Bridge firmware supports the creation of up to two
1795 partitions on mass storage devices connected to the West Bridge
1796 device. When there are two partitions on a device, the user can
1797 choose which of these partitions should be made visible to the
1798 USB host through the USB mass storage interface. This function
1799 allows the user to configure the partitions that should be
1800 enumerated. At least one partition should be selected through
1801 this API. If neither partition needs to be enumerated, use
1802 CyAsUsbSetEnumConfig to control this.
1804 * Valid in Asynchronous callback: Yes (if cb supplied)
1808 * CY_AS_ERROR_SUCCESS - operation completed successfully
1809 * CY_AS_ERROR_INVALID_HANDLE - invalid handle to the West
1811 * CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has not
1813 * CY_AS_ERROR_NO_FIRMWARE - no firmware running on West
1815 * CY_AS_ERROR_NOT_RUNNING - USB stack has not been started
1816 * CY_AS_ERROR_IN_SUSPEND - West Bridge device is in
1818 * CY_AS_ERROR_INVALID_CALL_SEQUENCE - this API has to be
1819 * called before CyAsUsbSetEnumConfig
1820 * CY_AS_ERROR_OUT_OF_MEMORY - failed to get memory to
1821 * process the request
1822 * CY_AS_ERROR_NO_SUCH_UNIT - Storage device addressed has
1823 * not been partitioned
1824 * CY_AS_ERROR_NOT_SUPPORTED - operation is not supported by
1825 * active device/firmware.
1828 * CyAsStorageCreatePPartition
1829 * CyAsStorageRemovePPartition
1832 EXTERN cy_as_return_status_t
1833 cy_as_usb_select_m_s_partitions(
1834 /* Handle to the West Bridge device */
1835 cy_as_device_handle handle,
1836 /* Bus index of the device being addressed */
1837 cy_as_bus_number_t bus,
1838 /* Device id of the device being addressed */
1840 /* Selection of partitions to be enumerated */
1841 cy_as_usb_m_s_type_t type,
1842 /* The callback, if async call */
1843 cy_as_function_callback cb,
1844 /* Client supplied data */
1848 extern cy_as_media_type
1849 cy_as_storage_get_media_from_address(uint16_t v);
1851 extern cy_as_bus_number_t
1852 cy_as_storage_get_bus_from_address(uint16_t v);
1855 cy_as_storage_get_device_from_address(uint16_t v);
1857 /* For supporting deprecated functions */
1858 #include "cyasusb_dep.h"
1860 #include "cyas_cplus_end.h"
1862 #endif /* _INCLUDED_CYASUSB_H_ */