/* usb/sys/errors.h
 *
 * (c) 2002 Simtec Electronics
 *
 * Ben Dooks
 *
 * Error codes for usb system calls
 *
 * $Id: errors.h,v 1.12 2003/10/16 10:05:15 ben Exp $
 *
 * This Library file is part of the Simtec Electronics USB stack development
 *   suite.
 * Specific licence is granted to use this file by third parties for the
 *   development of USB device drivers.
 *
 */

#ifndef usb_error_h
#define usb_error_h

/** USB Error OK.
No error occoured.
@memo USB Error OK.
*/
#define USB_RESULT_OK                        0x00000000
/** USB Error alias not found. */
#define USB_RESULT_ALIAS_FILE_NOT_FOUND      0x00819B00
/** USB Error structure dropped. */
#define USB_RESULT_STRUCTUR_DROPPED          0x00819B01
/** USB Error invalid parameter. */
#define USB_RESULT_INVALID_PARAMETER         0x00819B02
/** USB Error controller already exists. */
#define USB_RESULT_CONTROLLER_ALREADY_EXISTS 0x00819B03
/** USB Error bus invalid internal 2. */
#define USB_RESULT_BUS_INVALID_INTERNAL_2    0x00819B04
/** USB Error illegal speed*/
#define USB_RESULT_ILLEGAL_SPEED             0x00819B05
/** USB Error all devices used */
#define USB_RESULT_ALL_DEVICES_USED          0x00819B06
/** USB Error device address used */
#define USB_RESULT_DEVICE_ADDRESS_USED       0x00819B07
/** USB Error endpoint address used */
#define USB_RESULT_ENDPOINT_ADDRESS_USED     0x00819B08
/** USB Error invalid pipe state */
#define USB_RESULT_INVALID_PIPE_STATE        0x00819B09
/** USB Error no transaction pending */
#define USB_RESULT_NO_TRANSACTION_PENDING    0x00819B0A
/** USB Error error generated */
#define USB_RESULT_ERROR_GENERATED           0x00819B0B
/** USB Error no object found */
#define USB_RESULT_NO_OBJECT_FOUND           0x00819B0C
/** USB Error bus capacity too small */
#define USB_RESULT_BUS_CAPACITY_TO_SMALL     0x00819B0D
/** USB Error bus invalid payload size */
#define USB_RESULT_BUS_INVALID_PAYLOAD_SIZE  0x00819B0E
/** USB Error invalid transfer type */
#define USB_RESULT_BUS_INVALID_TRANSFER_TYPE 0x00819B0F
/** USB Error invalid internal 1 */
#define USB_RESULT_BUS_INVALID_INTERNAL_1    0x00819B10
/** USB Error out of memory */
#define USB_RESULT_NOT_ENOUGH_MEMORY         0x00819B11
/** USB Error temporary failiure.
 The USB stack had a transient faliure in processing the request,
   retrying the request may suceed.</para>
 <para>This is similar to the UNIX idea of "interupted system call" and will
   most commonly be seen when an application is performing usb transactions
   in some "non user mode" i.e. from callbacks.
@memo Temporary failiure
*/
#define USB_RESULT_TEMPORARY_FAILURE         0x00819B12

/** USB Error - resource not available */
#define USB_RESULT_NOT_AVAILABLE             0x00819B13

/** USB Result - in progress */
#define USB_RESULT_IN_PROGRESS               0x00819B14

/** USB Result - a generic failure */
#define USB_RESULT_FAILED                    0x00819B15

/** USB Result - no resources */
#define USB_RESULT_NO_RESOURCES              0x00819B16 

/** USB Result - device not found */
#define USB_RESULT_DEVICE_NOT_FOUND          0x00819B17

/** USB Result - lock's parent is busy */
#define USB_RESULT_LOCK_PARENT_BUSY          0x00819B18

/** USB Result - lock busy */
#define USB_RESULT_LOCK_BUSY                 0x00819B19

/** USB Result - sublock busy */
#define USB_RESULT_LOCK_SUB_BUSY             0x00819B1A

/** USB Result - undefined lock access */
#define USB_RESULT_LOCK_UNDEFINED_ACCESS     0x00819B1B

/** USB Result - pipe in use */
#define USB_RESULT_PIPE_INUSE                0x00819B1C

/* library error block starts at 0x819b80 */

/** USB Error block - library errors (and errors that where not originally in
 * the core) */
#define USB_ERR_LIBRARY  (0x819b80)

/** USB Error - endpoint is not known / corrupted */
#define USB_RESULT_INVALID_ENDPOINT          (0x00819B86)

/** USB Error - device is not known / corrupted */
#define USB_RESULT_INVALID_DEVICE            (0x00819B87)

/** USB Error - host controller is not known / corrupted */
#define USB_RESULT_INVALID_HC                (0x00819B88)

/** USB Error - argument (generic) is not known / corrupted / bad */
#define USB_RESULT_INVALID_ARGUMENT          (USB_RESULT_INVALID_PARAMETER)

/** USB Error - waiting is not known / corrupted */
#define USB_RESULT_INVALID_WAITING           (0x00819B8A)

/** USB Error - URB is not known / corrupted */
#define USB_RESULT_INVALID_URB               (0x00819B8B)

/** USB Error - Pipe is not known / corrupted */
#define USB_RESULT_INVALID_PIPE              (0x00819B8C)

/** USB Error - call is not supported on this version */
#define USB_RESULT_NOT_SUPPORTED             (0x00819B8D)

/* transaction errors are mapped to 0x819bb0 */

#define USB_ERR_TRANSACTION (0x819bb0)

/* device manager errors sit up here */

/** USB Error - device manager did not respond (is not available) */
#define USB_RESULT_DEVMGR_NORESPONSE   (0x819BF0)

/** USB Error - device manager operation failed */
#define USB_RESULT_DEVMGR_FAILED       (0x819BF1)

/** USB Error - device manager: device is already claimed */     
#define USB_RESULT_DEVMGR_ALREADYCLAIMED (0x819BF2)

/** USB Error - device manager: unknown error */
#define USB_RESULT_DEVMGR_UNKNOWN        (0x819BF3)

/** USB Error - device manager: device not found */
#define USB_RESULT_DEVMGR_NODEV          (0x819BF4)

#endif
