1/* ********************************************************************* 2 * Broadcom Common Firmware Environment (CFE) 3 * 4 * Error strings File: cfe_error.h 5 * 6 * This file contains a mapping from error codes to strings 7 * 8 * Author: Mitch Lichtenberg (mpl@broadcom.com) 9 * 10 ********************************************************************* 11 * 12 * Copyright 2000,2001,2002,2003 13 * Broadcom Corporation. All rights reserved. 14 * 15 * This software is furnished under license and may be used and 16 * copied only in accordance with the following terms and 17 * conditions. Subject to these conditions, you may download, 18 * copy, install, use, modify and distribute modified or unmodified 19 * copies of this software in source and/or binary form. No title 20 * or ownership is transferred hereby. 21 * 22 * 1) Any source code used, modified or distributed must reproduce 23 * and retain this copyright notice and list of conditions 24 * as they appear in the source file. 25 * 26 * 2) No right is granted to use any trade name, trademark, or 27 * logo of Broadcom Corporation. The "Broadcom Corporation" 28 * name may not be used to endorse or promote products derived 29 * from this software without the prior written permission of 30 * Broadcom Corporation. 31 * 32 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR 33 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED 34 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 35 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT 36 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN 37 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, 38 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 39 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 40 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 41 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 42 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 43 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF 44 * THE POSSIBILITY OF SUCH DAMAGE. 45 ********************************************************************* */ 46 47 48#include "lib_types.h" 49#include "cfe.h" 50#include "cfe_error.h" 51 52/* ********************************************************************* 53 * Types 54 ********************************************************************* */ 55 56 57typedef struct errmap_s { 58 int errcode; 59 const char *string; 60} errmap_t; 61 62/* ********************************************************************* 63 * Error code list 64 ********************************************************************* */ 65 66errmap_t cfe_errorstrings[] = { 67 {CFE_OK ,"No error"}, 68 {CFE_ERR ,"Error"}, 69 {CFE_ERR_INV_COMMAND ,"Invalid command"}, 70 {CFE_ERR_EOF ,"End of file reached"}, 71 {CFE_ERR_IOERR ,"I/O error"}, 72 {CFE_ERR_NOMEM ,"Insufficient memory"}, 73 {CFE_ERR_DEVNOTFOUND ,"Device not found"}, 74 {CFE_ERR_DEVOPEN ,"Device is open"}, 75 {CFE_ERR_INV_PARAM ,"Invalid parameter"}, 76 {CFE_ERR_ENVNOTFOUND ,"Environment variable not found"}, 77 {CFE_ERR_ENVREADONLY ,"Environment variable is read-only"}, 78 {CFE_ERR_NOTELF ,"Not an ELF-format executable"}, 79 {CFE_ERR_NOT32BIT ,"Not a 32-bit executable"}, 80 {CFE_ERR_WRONGENDIAN ,"Executable is wrong-endian"}, 81 {CFE_ERR_BADELFVERS ,"Invalid ELF file version"}, 82 {CFE_ERR_NOTMIPS ,"Not a MIPS ELF file"}, 83 {CFE_ERR_BADELFFMT ,"Invalid ELF file"}, 84 {CFE_ERR_BADADDR ,"Section would load outside available DRAM"}, 85 {CFE_ERR_FILENOTFOUND ,"File not found"}, 86 {CFE_ERR_UNSUPPORTED ,"Unsupported function"}, 87 {CFE_ERR_HOSTUNKNOWN ,"Host name unknown"}, 88 {CFE_ERR_TIMEOUT ,"Timeout occured"}, 89 {CFE_ERR_PROTOCOLERR ,"Network protocol error"}, 90 {CFE_ERR_NETDOWN ,"Network is down"}, 91 {CFE_ERR_NONAMESERVER ,"No name server configured"}, 92 {CFE_ERR_NOHANDLES ,"No more handles"}, 93 {CFE_ERR_ALREADYBOUND ,"Already bound"}, 94 {CFE_ERR_CANNOTSET ,"Cannot set network parameter"}, 95 {CFE_ERR_NOMORE ,"No more enumerated items"}, 96 {CFE_ERR_BADFILESYS ,"File system not recognized"}, 97 {CFE_ERR_FSNOTAVAIL ,"File system not available"}, 98 {CFE_ERR_INVBOOTBLOCK ,"Invalid boot block on disk"}, 99 {CFE_ERR_WRONGDEVTYPE ,"Device type is incorrect for boot method"}, 100 {CFE_ERR_BBCHECKSUM ,"Boot block checksum is invalid"}, 101 {CFE_ERR_BOOTPROGCHKSUM ,"Boot program checksum is invalid"}, 102 {CFE_ERR_LDRNOTAVAIL, "Loader is not available"}, 103 {CFE_ERR_NOTREADY, "Device is not ready"}, 104 {CFE_ERR_GETMEM, "Cannot get memory at specified address"}, 105 {CFE_ERR_SETMEM, "Cannot set memory at specified address"}, 106 {CFE_ERR_NOTCONN, "Socket is not connected"}, 107 {CFE_ERR_ADDRINUSE, "Address is in use"}, 108 {CFE_ERR_INTR, "Interrupted"}, 109 {0,NULL}}; 110 111 112/* ********************************************************************* 113 * cfe_errortext(err) 114 * 115 * Returns the text corresponding to a CFE error code 116 * 117 * Input parameters: 118 * err - error code 119 * 120 * Return value: 121 * string description of error 122 ********************************************************************* */ 123 124const char *cfe_errortext(int err) 125{ 126 errmap_t *e = cfe_errorstrings; 127 128 while (e->string) { 129 if (e->errcode == err) return e->string; 130 e++; 131 } 132 133 return (const char *) "Unknown error"; 134} 135 136