Fix common misspellings
[deliverable/linux.git] / drivers / staging / westbridge / astoria / include / linux / westbridge / cyasusb.h
1 /* Cypress West Bridge API header file (cyasusb.h)
2 ## ===========================
3 ## Copyright (C) 2010 Cypress Semiconductor
4 ##
5 ## This program is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU General Public License
7 ## as published by the Free Software Foundation; either version 2
8 ## of the License, or (at your option) any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 51 Franklin Street
18 ## Fifth Floor, Boston, MA 02110-1301, USA.
19 ## ===========================
20 */
21
22 #ifndef _INCLUDED_CYASUSB_H_
23 #define _INCLUDED_CYASUSB_H_
24
25 #include "cyasmisc.h"
26
27 #include "cyas_cplus_start.h"
28
29 /*@@Enumeration Model
30 Summary
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.
38
39 Description
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
50 enumeration times.
51
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.
62
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
75 USB configuration.
76
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
83 appropriately.
84
85 Mass storage class compliance will be ensured by the West
86 Bridge firmware when the mass
87 storage functionality is enabled.
88 */
89
90 /*@@Endpoint Configuration
91 Summary
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.
97
98 Description
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
104 the storage media.
105
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.
113
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
122 packet arrives.
123
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.
137
138 * Note *
139 PEPs 1, 2, 3 and 4 are called Physical EP 3, 5, 7 and 9 in the
140 West Bridge PDD. 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.
144 */
145
146 #if !defined(__doxygen__)
147
148
149 #endif
150
151 /* Summary
152 This constants defines the maximum size of a USB descriptor
153 when referenced via the CyAsUsbSetDescriptor or
154 CyAsUsbGetDescriptor functions.
155
156 See Also
157 * CyAsUsbSetDescriptor
158 * CyAsUsbGetDescriptor
159 */
160 #define CY_AS_MAX_USB_DESCRIPTOR_SIZE (128)
161
162 /***************************************
163 * West Bridge Types
164 ***************************************/
165
166
167 /* Summary
168 This data structure is the data passed via the evdata paramater
169 on a usb event callback for the inquiry request.
170
171 Description
172 When a SCSI inquiry request arrives via the USB connection and
173 the P Port has asked
174 to receive inquiry requests, this request is forwarded to the
175 client via the USB
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
182 structure.
183
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
204 returned.
205
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.
209
210 See Also
211 * CyAsUsbEventCallback
212 * CyAsUsbRegisterCallback
213 */
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 */
218 uint32_t device;
219 /* The EVPD bit from the SCSI INQUIRY request */
220 uint8_t evpd;
221 /* The codepage in the inquiry request */
222 uint8_t codepage;
223 /* This bool must be set to CyTrue indicate that the inquiry
224 data was changed */
225 cy_bool updated;
226 /* The length of the data */
227 uint16_t length;
228 /* The inquiry data */
229 void *data;
230 } cy_as_usb_inquiry_data;
231
232
233 /* Summary
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.
237
238 Description
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
258 of 05h/20h/00h which
259 indicates INVALID COMMAND.
260 */
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 */
265 uint32_t device;
266
267 uint16_t reqlen;
268 /* The request */
269 void *request;
270
271 /* The returned status value for the command */
272 uint8_t status;
273 /* If status is failed, the sense key */
274 uint8_t key;
275 /* If status is failed, the additional sense code */
276 uint8_t asc;
277 /* If status if failed, the additional sense code qualifier */
278 uint8_t ascq;
279 } cy_as_usb_unknown_command_data;
280
281
282 /* Summary
283 This data structure is the data passed via the evdata
284 paramater on a usb event callback for the start/stop request.
285
286 Description
287 When a SCSI start stop request arrives via the USB connection
288 and the P Port has asked
289
290 See Also
291 * CyAsUsbEventCallback
292 * CyAsUsbRegisterCallback
293 */
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 */
298 uint32_t device;
299 /* CyTrue means start request, CyFalse means stop request */
300 cy_bool start;
301 /* CyTrue means LoEj bit set, otherwise false */
302 cy_bool loej;
303 } cy_as_usb_start_stop_data;
304
305 /* Summary
306 This data type is used to indicate which mass storage devices
307 are enumerated.
308
309 Description
310
311 See Also
312 * CyAsUsbEnumControl
313 * CyAsUsbSetEnumConfig
314 */
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;
321
322 /* Summary
323 This data type specifies the type of descriptor to transfer
324 to the West Bridge device
325
326 Description
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.
334
335 See Also
336 * CyAsUsbSetDescriptor
337 * CyAsUsbGetDescriptor
338 */
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;
353
354 /* Summary
355 This type specifies the direction of an endpoint
356
357 Description
358 This type is used when configuring the endpoint hardware
359 to specify the direction
360 of the endpoint.
361
362 See Also
363 * CyAsUsbEndPointConfig
364 * CyAsUsbSetEndPointConfig
365 * CyAsUsbGetEndPointConfig
366 */
367 typedef enum cy_as_usb_end_point_dir {
368 /* The endpoint direction is IN (West Bridge -> USB Host) */
369 cy_as_usb_in = 0,
370 /* The endpoint direction is OUT (USB Host -> West Bridge) */
371 cy_as_usb_out = 1,
372 /* The endpoint direction is IN/OUT (valid only for EP 0 & 1) */
373 cy_as_usb_in_out = 2
374 } cy_as_usb_end_point_dir;
375
376 /* Summary
377 This type specifies the type of an endpoint
378
379 Description
380 This type is used when configuring the endpoint hardware
381 to specify the type of endpoint.
382
383 See Also
384 * CyAsUsbEndPointConfig
385 * CyAsUsbSetEndPointConfig
386 * CyAsUsbGetEndPointConfig
387 */
388 typedef enum cy_as_usb_end_point_type {
389 cy_as_usb_control,
390 cy_as_usb_iso,
391 cy_as_usb_bulk,
392 cy_as_usb_int
393 } cy_as_usb_end_point_type;
394
395 /* Summary
396 This type is a structure used to indicate the top level
397 configuration of the USB stack
398
399 Description
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.
407
408 See Also
409 * CyAsUsbSetConfig
410 * CyAsUsbGetConfig
411 * <LINK Enumeration Model>
412 */
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
420 * endpoint zero. */
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;
435
436
437 /* Summary
438 This structure is used to configure a single endpoint
439
440 Description
441 This data structure contains all of the information required
442 to configure the West Bridge hardware
443 associated with a given endpoint.
444
445 See Also
446 * CyAsUsbSetEndPointConfig
447 * CyAsUsbGetEndPointConfig
448 */
449 typedef struct cy_as_usb_end_point_config {
450 /* If true, this endpoint is enabled */
451 cy_bool 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 */
459 uint16_t size;
460 } cy_as_usb_end_point_config;
461
462 /* Summary
463 List of partition enumeration combinations that can
464 be selected on a partitioned storage device.
465
466 Description
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.
474
475 See Also
476 * CyAsStorageCreatePPartition
477 * CyAsStorageRemovePPartition
478 * CyAsUsbSelectMSPartitions
479 */
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) */
484 cy_as_usb_m_s_unit1,
485 /* Enumerate both units */
486 cy_as_usb_m_s_both
487 } cy_as_usb_m_s_type_t;
488
489 /* Summary
490 This type specifies the type of USB event that has occurred
491
492 Description
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.
498
499 See Also
500 * CyAsUsbIoCallback
501 */
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
505 will be zero. */
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
513 will be zero. */
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
536 required. */
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
550 } cy_as_usb_event;
551
552 /* Summary
553 This type is the type of a callback function that is
554 called when a USB event occurs
555
556 Description
557 At times West Bridge needs to inform the P port processor
558 of events that have
559 occurred. These events are asynchronous to the thread of
560 control on the P
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.
566
567 See Also
568 * CyAsUsbEvent
569 */
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 */
574 cy_as_usb_event ev,
575 /* The data assocaited with the event being reported */
576 void *evdata
577 );
578
579
580 /* Summary
581 This type is the callback function called after an
582 asynchronous USB read/write operation
583
584 Description
585 This function type defines a callback function that is
586 called at the completion of any
587 asynchronous read or write operation.
588
589 See Also
590 * CyAsUsbReadDataAsync
591 * CyAsUsbWriteDataAsync
592 * CY_AS_ERROR_CANCELED
593 */
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 */
600 uint32_t count,
601 /* The data buffer for the operation */
602 void *buffer,
603 /* The error status of the operation */
604 cy_as_return_status_t status
605 );
606
607 /* Summary
608 This type is the callback function called after asynchronous
609 API functions have completed.
610
611 Description
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.
616 */
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 */
623 uint32_t client
624 );
625
626
627 /********************************************
628 * West Bridge Functions
629 ********************************************/
630
631 /* Summary
632 This function starts the USB stack
633
634 Description
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
641 is incremented.
642
643 * Valid In Asynchronous Callback: YES (if cb supplied)
644 * Nestable: YES
645
646 Notes
647 This function cannot be called from any type of West Bridge
648 callback.
649
650 Returns
651 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
652 * been configured
653 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
654 * into West Bridge
655 * CY_AS_ERROR_SUCCESS - the stack initialized and is ready
656 * for use
657 * CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
658 * with the West Bridge device
659
660 See Also
661 * CyAsUsbStop
662 */
663 EXTERN cy_as_return_status_t
664 cy_as_usb_start(
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 */
670 uint32_t client
671 );
672
673 /* Summary
674 This function stops the USB stack
675
676 Description
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
681 with the USB stack.
682
683 * Valid In Asynchronous Callback: NO
684
685 Notes
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.
695
696 Returns
697 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
698 * been configured
699 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
700 * into West Bridge
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
704
705 See Also
706 * CyAsUsbStart
707 */
708 EXTERN cy_as_return_status_t
709 cy_as_usb_stop(
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 */
715 uint32_t client
716 );
717
718 /* Summary
719 This function registers a callback function to be called when an
720 asynchronous USB event occurs
721
722 Description
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.
726
727 * Valid In Asynchronous Callback: YES
728 */
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
735 );
736
737
738 /* Summary
739 This function connects the West Bridge device D+ and D- signals
740 physically to the USB host.
741
742 Description
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.
750
751 * Valid In Asynchronous Callback: YES (if cb supplied)
752 * Nestable: YES
753
754 Returns
755 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
756 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
757 * been configured
758 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
759 * into West Bridge
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
763
764 See Also
765 * CyAsUsbDisconnect
766 */
767 EXTERN cy_as_return_status_t
768 cy_as_usb_connect(
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 */
774 uint32_t client
775 );
776
777 /* Summary
778 This function disconnects the West Bridge device D+ and D-
779 signals physically from the USB host.
780
781 Description
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.
789
790 * Valid In Asynchronous Callback: YES (if cb supplied)
791 * Nestable: YES
792
793 Returns
794 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
795 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
796 * been configured
797 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
798 * into West Bridge
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
802
803 See Also
804 * CyAsUsbConnect
805 */
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 */
813 uint32_t client
814 );
815
816 /* Summary
817 This function configures the USB stack
818
819 Description
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
823 within West Bridge.
824
825 * Valid In Asynchronous Callback: Yes (if cb supplied)
826
827 Returns
828 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
829 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
830 * been configured
831 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
832 * into West Bridge
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
836
837 See Also
838 * CyAsUsbGetEnumConfig
839 * CyAsUsbEnumControl
840 */
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 */
850 uint32_t client
851 );
852
853 /* Summary
854 This function retreives the current configuration of
855 the USB stack
856
857 Description
858 This function sends a request to West Bridge to retrieve
859 the current configuration
860
861 * Valid In Asynchronous Callback: Yes (if cb supplied)
862
863 Returns
864 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
865 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
866 * been configured
867 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
868 * into West Bridge
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
872
873 See Also
874 * CyAsUsbSetConfig
875 * CyAsUsbConfig
876 */
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 */
886 uint32_t client
887 );
888
889 /* Summary
890 This function sets the USB descriptor
891
892 Description
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.
900
901 * Valid In Asynchronous Callback: YES (if cb supplied)
902 * Nestable: YES
903
904 Notes
905 These descriptors are described in the USB 2.0 specification,
906 Chapter 9.
907
908 Returns
909 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
910 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
911 * been configured
912 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
913 * into West Bridge
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
918 * not valid
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
923
924 See Also
925 * CyAsUsbGetDescriptor
926 * CyAsUsbClearDescriptors
927 * <LINK Enumeration Model>
928 */
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 */
936 uint8_t index,
937 /* The descriptor to be transferred */
938 void *desc_p,
939 /* The length of the descriptor in bytes */
940 uint16_t length,
941 /* The callback if async call */
942 cy_as_function_callback cb,
943 /* Client supplied data */
944 uint32_t client
945 );
946
947 /* Summary
948 This function clears all user descriptors stored
949 on the West Bridge.
950
951 Description
952 This function is used to clear all descriptors that
953 were previously
954 stored on the West Bridge through CyAsUsbSetDescriptor
955 calls, and go back
956 to the default descriptor setup in the firmware. This
957 function should
958 only be called when the Antioch enumeration model is
959 selected.
960
961 * Valid In Asynchronous Callback: Yes (if cb supplied)
962 * Nestable: Yes
963
964 Returns
965 * CY_AS_ERROR_SUCCESS - all descriptors cleared successfully
966 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
967 * been configured
968 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
969 * into West Bridge
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
975
976 See Also
977 * CyAsUsbSetDescriptor
978 * <LINK Enumeration Model>
979 */
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 */
987 uint32_t client
988 );
989 /* Summary
990 This structure contains the descriptor buffer to be
991 filled by CyAsUsbGetDescriptor API.
992
993 Description
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.
997
998 See Also
999 * CyAsUsbGetDescriptor
1000 */
1001 typedef struct cy_as_get_descriptor_data {
1002 /* The buffer to hold the returned descriptor */
1003 void *desc_p;
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. */
1009 uint32_t length;
1010
1011 } cy_as_get_descriptor_data;
1012
1013 /* Summary
1014 This function retreives a given descriptor from the
1015 West Bridge device
1016
1017 Description
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.
1021
1022 * Valid In Asynchronous Callback: YES (if cb supplied)
1023 * Nestable: YES
1024
1025 Notes
1026 These descriptors are described in the USB 2.0 specification,
1027 Chapter 9.
1028
1029 Returns
1030 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
1031 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1032 * been configured
1033 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1034 * into West Bridge
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
1039 * descriptor given
1040 * CY_AS_ERROR_BAD_ENUMERATION_MODE - this function cannot be
1041 * called if the P port processor doing enumeration
1042
1043 See Also
1044 * CyAsUsbSetDescriptor
1045 * <LINK Enumeration Model>
1046 */
1047
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 */
1055 uint8_t index,
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 */
1061 uint32_t client
1062 );
1063
1064 /* Summary
1065 This function sets the configuration of the physical
1066 endpoints into one of the twelve supported configuration
1067
1068 Description
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.
1080
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)
1105
1106 * Valid In Asynchronous Callback: NO
1107
1108 Returns
1109 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
1110 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1111 * been configured
1112 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1113 * into West Bridge
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
1119 */
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 */
1125 uint8_t config
1126 );
1127
1128 /* Summary
1129 This function sets the hardware configuration for a given endpoint
1130
1131 Description
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.
1136
1137 * Valid In Asynchronous Callback: NO
1138
1139 Notes
1140 Add documentation about endpoint configuration limitations
1141
1142 Returns
1143 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
1144 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1145 * been configured
1146 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1147 * into West Bridge
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
1156
1157 See Also
1158 * CyAsUsbGetEndPointConfig
1159 * CyAsUsbEndPointConfig
1160 */
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
1169 );
1170
1171 /* Summary
1172 This function retreives the hardware configuration for
1173 a given endpoint
1174
1175 Description
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.
1180
1181 * Valid In Asynchronous Callback: NO
1182
1183 Returns
1184 * CY_AS_ERROR_SUCCESS - this module was shut down successfully
1185 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1186 * been configured
1187 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1188 * into West Bridge
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
1193 * invalid
1194
1195 See Also
1196 * CyAsUsbSetEndPointConfig
1197 * CyAsUsbEndPointConfig
1198 */
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
1206 * information */
1207 cy_as_usb_end_point_config *config_p
1208 );
1209
1210 /* Summary
1211 This function commits the configuration information that
1212 has previously been set.
1213
1214 Description
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.
1224
1225 * Valid In Asynchronous Callback: YES (if cb supplied)
1226 * Nestable: YES
1227
1228 Returns
1229 * CY_AS_ERROR_SUCCESS - a configuration was found and sent
1230 * to West Bridge
1231 * CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
1232 * been configured
1233 * CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
1234 * into West Bridge
1235 * CY_AS_ERROR_INVALID_CONFIGURATION - the configuration requested
1236 * is not possible
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
1240
1241 See Also
1242 * CyAsUsbSetEndPointConfig
1243 * CyAsUsbSetEnumConfig
1244 */
1245
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 */
1253 uint32_t client
1254 );
1255
1256 /* Summary
1257 This function reads data from a USB endpoint.
1258
1259 Description
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
1266 recevied.
1267
1268 * Valid In Asynchronous Callback: NO
1269
1270 Returns
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
1276 * invalid
1277
1278 See Also
1279 * CyAsUsbReadDataAsync
1280 * CyAsUsbWriteData
1281 * CyAsUsbWriteDataAsync
1282 */
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 */
1290 cy_bool pktread,
1291 /* The amount of data to read */
1292 uint32_t dsize,
1293 /* The amount of data read */
1294 uint32_t *dataread,
1295 /* The buffer to hold the data read */
1296 void *data
1297 );
1298
1299 /* Summary
1300 This function reads data from a USB endpoint
1301
1302 Description
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.
1310
1311 * Valid In Asynchronous Callback: YES
1312
1313 Returns
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
1319 * invalid
1320
1321 See Also
1322 * CyAsUsbReadData
1323 * CyAsUsbWriteData
1324 * CyAsUsbWriteDataAsync
1325 */
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 */
1333 cy_bool pktread,
1334 /* The amount of data to read */
1335 uint32_t dsize,
1336 /* The buffer for storing the data */
1337 void *data,
1338 /* The callback function to call when the data is read */
1339 cy_as_usb_io_callback callback
1340 );
1341
1342 /* Summary
1343 This function writes data to a USB endpoint
1344
1345 Description
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
1349 has been sent.
1350
1351 * Valid In Asynchronous Callback: NO
1352
1353 Notes
1354 Calling this function with a dsize of zero will result in
1355 a zero length packet transmitted to the USB host.
1356
1357 Returns
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
1363 * invalid
1364
1365 See Also
1366 * CyAsUsbReadData
1367 * CyAsUsbReadDataAsync
1368 * CyAsUsbWriteDataAsync
1369 */
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 */
1377 uint32_t dsize,
1378 /* The data buffer */
1379 void *data
1380 );
1381
1382 /* Summary
1383 This function writes data to a USB endpoint
1384
1385 Description
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.
1390
1391 * Valid In Asynchronous Callback: YES
1392
1393 Notes
1394 Calling this function with a dsize of zero will result
1395 in a zero length packet transmitted to the USB host.
1396
1397 Returns
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
1403 * invalid
1404
1405 See Also
1406 * CyAsUsbReadData
1407 * CyAsUsbReadDataAsync
1408 * CyAsUsbWriteData
1409 */
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 */
1417 uint32_t dsize,
1418 /* The buffer containing the data */
1419 void *data,
1420 /* If true, send a short packet to terminate data */
1421 cy_bool spacket,
1422 /* The callback to call when the data is written */
1423 cy_as_usb_io_callback callback
1424 );
1425
1426 /* Summary
1427 This function aborts an outstanding asynchronous
1428 operation on a given endpoint
1429
1430 Description
1431 This function aborts any outstanding operation that is
1432 pending on the given endpoint.
1433
1434 * Valid In Asynchronous Callback: YES
1435
1436 Returns
1437 * CY_AS_ERROR_SUCCESS - this module was shut down
1438 * successfully
1439 * CY_AS_ERROR_NOT_RUNNING - the USB stack is not
1440 * running
1441 * CY_AS_ERROR_ASYNC_NOT_PENDING - no asynchronous USB
1442 * operation was pending
1443
1444 See Also
1445 * CyAsUsbReadData
1446 * CyAsUsbReadDataAsync
1447 * CyAsUsbWriteData
1448 * CyAsUsbWriteDataAsync
1449 */
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
1456 );
1457
1458 /* Summary
1459 This function sets a stall condition on a given endpoint
1460
1461 Description
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.
1468
1469 * Valid In Asynchronous Callback: YES (if cb supplied)
1470 * Nestable: YES
1471
1472 Returns
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
1483
1484 See Also
1485 * CyAsUsbGetStall
1486 * CyAsUsbClearStall
1487 */
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 */
1497 uint32_t client
1498 );
1499
1500 /* Summary
1501 This function clears a stall condition on a given endpoint
1502
1503 Description
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.
1510
1511 * Valid In Asynchronous Callback: YES (if cb supplied)
1512 * Nestable: YES
1513
1514 Returns
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
1525
1526 See Also
1527 * CyAsUsbGetStall
1528 * CyAsUsbSetStall
1529 */
1530
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 */
1540 uint32_t client
1541 );
1542
1543
1544 /* Summary
1545 This function returns the stall status for a given endpoint
1546
1547 Description
1548 This function returns the stall status for a given endpoint
1549
1550 * Valid In Asynchronous Callback: YES (if cb supplied)
1551 * Nestable: YES
1552
1553 Returns
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
1564
1565 See Also
1566 * CyAsUsbGetStall
1567 * CyAsUsbSetStall
1568 * CyAsUsbClearStall
1569 */
1570
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 */
1578 cy_bool *stall_p,
1579 /* The callback if async call */
1580 cy_as_function_callback cb,
1581 /* Client supplied data */
1582 uint32_t client
1583 );
1584
1585 /* Summary
1586 This function sets a NAK condition on a given endpoint
1587
1588 Description
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.
1595
1596 * Valid In Asynchronous Callback: YES (if cb supplied)
1597 * Nestable: YES
1598
1599 Returns
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
1610
1611 See Also
1612 * CyAsUsbGetNak
1613 * CyAsUsbClearNak
1614 */
1615 EXTERN cy_as_return_status_t
1616 cy_as_usb_set_nak(
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 */
1624 uint32_t client
1625 );
1626
1627 /* Summary
1628 This function clears a NAK condition on a given endpoint
1629
1630 Description
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.
1637
1638 * Valid In Asynchronous Callback: YES (if cb supplied)
1639 * Nestable: YES
1640
1641 Returns
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
1652
1653 See Also
1654 * CyAsUsbGetNak
1655 * CyAsUsbSetNak
1656 */
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 */
1666 uint32_t client
1667 );
1668
1669 /* Summary
1670 This function returns the NAK status for a given endpoint
1671
1672 Description
1673 This function returns the NAK status for a given endpoint
1674
1675 * Valid In Asynchronous Callback: YES (if cb supplied)
1676 * Nestable: YES
1677
1678 Returns
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
1689
1690 See Also
1691 * CyAsUsbSetNak
1692 * CyAsUsbClearNak
1693 */
1694 EXTERN cy_as_return_status_t
1695 cy_as_usb_get_nak(
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 */
1701 cy_bool *nak_p,
1702 /* The callback if async call */
1703 cy_as_function_callback cb,
1704 /* Client supplied data */
1705 uint32_t client
1706 );
1707
1708 /* Summary
1709 This function triggers a USB remote wakeup from the Processor
1710 API
1711
1712 Description
1713 When there is a Suspend condition on the USB bus, this function
1714 programmatically takes the USB bus out of thi suspend state.
1715
1716 * Valid In Asynchronous Callback: YES (if cb supplied)
1717 * Nestable: YES
1718
1719 Returns
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
1729
1730 */
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 */
1738 uint32_t client
1739 );
1740
1741 /* Summary
1742 This function sets the threshold levels for mass storage progress
1743 reports from the West Bridge.
1744
1745 Description
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
1751 be turned off.
1752
1753 * Valid In Asynchronous Callback: Yes (if cb supplied)
1754 * Nestable: Yes
1755
1756 Returns
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
1763 * while in callback
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
1769 * Firmware
1770
1771 See Also
1772 * CyAsUsbMSCProgressData
1773 * CyAsEventUsbMSCProgress
1774 */
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 */
1786 uint32_t client
1787 );
1788
1789 /* Summary
1790 Specify which of the partitions on a partitioned mass storage
1791 device should be made visible to USB.
1792
1793 Description
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.
1803
1804 * Valid in Asynchronous callback: Yes (if cb supplied)
1805 * Nestable: Yes
1806
1807 Returns
1808 * CY_AS_ERROR_SUCCESS - operation completed successfully
1809 * CY_AS_ERROR_INVALID_HANDLE - invalid handle to the West
1810 * Bridge device
1811 * CY_AS_ERROR_NOT_CONFIGURED - West Bridge device has not
1812 * been configured
1813 * CY_AS_ERROR_NO_FIRMWARE - no firmware running on West
1814 * Bridge device
1815 * CY_AS_ERROR_NOT_RUNNING - USB stack has not been started
1816 * CY_AS_ERROR_IN_SUSPEND - West Bridge device is in
1817 * suspend mode
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.
1826
1827 See Also
1828 * CyAsStorageCreatePPartition
1829 * CyAsStorageRemovePPartition
1830 * CyAsUsbMsType_t
1831 */
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 */
1839 uint32_t device,
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 */
1845 uint32_t client
1846 );
1847
1848 extern cy_as_media_type
1849 cy_as_storage_get_media_from_address(uint16_t v);
1850
1851 extern cy_as_bus_number_t
1852 cy_as_storage_get_bus_from_address(uint16_t v);
1853
1854 extern uint32_t
1855 cy_as_storage_get_device_from_address(uint16_t v);
1856
1857 /* For supporting deprecated functions */
1858 #include "cyasusb_dep.h"
1859
1860 #include "cyas_cplus_end.h"
1861
1862 #endif /* _INCLUDED_CYASUSB_H_ */
This page took 0.070281 seconds and 5 git commands to generate.