completion_codes.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2011 Jan Vesely
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00034 #ifndef DRV_OHCI_HW_STRUCT_COMPLETION_CODES_H
00035 #define DRV_OHCI_HW_STRUCT_COMPLETION_CODES_H
00036 
00037 #include <errno.h>
00038 
00039 #define CC_NOERROR (0x0)
00040 #define CC_CRC (0x1)
00041 #define CC_BITSTUFF (0x2)
00042 #define CC_TOGGLE (0x3)
00043 #define CC_STALL (0x4)
00044 #define CC_NORESPONSE (0x5)
00045 #define CC_PIDFAIL (0x6)
00046 #define CC_PIDUNEXPECTED (0x7)
00047 #define CC_DATAOVERRRUN (0x8)
00048 #define CC_DATAUNDERRRUN (0x9)
00049 #define CC_BUFFEROVERRRUN (0xc)
00050 #define CC_BUFFERUNDERRUN (0xd)
00051 #define CC_NOACCESS1 (0xe)
00052 #define CC_NOACCESS2 (0xf)
00053 
00054 inline static int cc_to_rc(int cc)
00055 {
00056         switch (cc) {
00057         case CC_NOERROR:
00058                 return EOK;
00059 
00060         case CC_CRC:
00061                 return EBADCHECKSUM;
00062 
00063         case CC_PIDUNEXPECTED:
00064         case CC_PIDFAIL:
00065         case CC_BITSTUFF:
00066                 return EIO;
00067 
00068         case CC_TOGGLE:
00069         case CC_STALL:
00070                 return ESTALL;
00071 
00072         case CC_NORESPONSE:
00073                 return ETIMEOUT;
00074 
00075         case CC_DATAOVERRRUN:
00076         case CC_DATAUNDERRRUN:
00077         case CC_BUFFEROVERRRUN:
00078         case CC_BUFFERUNDERRUN:
00079                 return EOVERFLOW;
00080 
00081         case CC_NOACCESS1:
00082         case CC_NOACCESS2:
00083         default:
00084                 return ENOTSUP;
00085         }
00086 }
00087 
00088 #endif
00089 

Generated on Thu Jun 2 07:45:44 2011 for HelenOS/USB by  doxygen 1.4.7