usb_error.c revision 184610
122205Sjoerg/* $FreeBSD: head/sys/dev/usb2/core/usb2_error.c 184610 2008-11-04 02:31:03Z alfred $ */ 222205Sjoerg/*- 322205Sjoerg * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 422205Sjoerg * 522205Sjoerg * Redistribution and use in source and binary forms, with or without 622205Sjoerg * modification, are permitted provided that the following conditions 722205Sjoerg * are met: 822205Sjoerg * 1. Redistributions of source code must retain the above copyright 922205Sjoerg * notice, this list of conditions and the following disclaimer. 1022205Sjoerg * 2. Redistributions in binary form must reproduce the above copyright 1122205Sjoerg * notice, this list of conditions and the following disclaimer in the 1222205Sjoerg * documentation and/or other materials provided with the distribution. 1322205Sjoerg * 1422205Sjoerg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1522205Sjoerg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1622205Sjoerg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1722205Sjoerg * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1822205Sjoerg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1922205Sjoerg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2022205Sjoerg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2122205Sjoerg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2222205Sjoerg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2322205Sjoerg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2422205Sjoerg * SUCH DAMAGE. 2522205Sjoerg */ 2622205Sjoerg 2750477Speter#include <dev/usb2/include/usb2_mfunc.h> 2822205Sjoerg#include <dev/usb2/include/usb2_error.h> 2922205Sjoerg 3022205Sjoerg#include <dev/usb2/core/usb2_core.h> 3122205Sjoerg 3222205SjoergUSB_MAKE_DEBUG_TABLE(USB_ERR); 3322205Sjoerg 3422205Sjoerg/*------------------------------------------------------------------------* 3522205Sjoerg * usb2_errstr 3622205Sjoerg * 3722205Sjoerg * This function converts an USB error code into a string. 3822205Sjoerg *------------------------------------------------------------------------*/ 3922205Sjoergconst char * 4022205Sjoergusb2_errstr(usb2_error_t err) 4122205Sjoerg{ 4222205Sjoerg return ((err < USB_ERR_MAX) ? 4322205Sjoerg USB_ERR[err] : "USB_ERR_UNKNOWN"); 4422205Sjoerg} 4522205Sjoerg