📄 err.c
字号:
/*
ERR.C: Error message
(C) Copyright TransDimension, Inc. All rights reserved.
Modification history
====================
3May2000 Original Release
*/
#include "types.h"
#include "err.h"
/* enumeration table errors */
static U8 *err_enr[] = {
"Enr error", /* ERR_ENR */
"try to reg/del DEV0", /* ERR_DEV0 */
"No such <dev, ep>", /* ENR_NONE */
"Invalid ep buffer size", /* ENR_BSIZE */
"Enr table full", /* ENR_FULL */
"Old ENR replaced", /* ENR_REPLACE */
"Invalid xfer for <dev, ep>", /* ENR_TYPE */
"No enr found for <dev>" /* ENR_ENRNONE */
};
/* Level 1 (xact level) errors */
static U8 *err_xact[] = {
"Xact level errors", /* ERR_XACT */
"Invalid operation under the HCFS", /* ERR_STATE */
"Failed to dispatch batch" /* ERR_BATCH */
};
/* Level 2 (xfer level) errors */
static U8 *err_xfer[] = {
"Xfer level errors", /* ERR_XFER */
"No such <dev, ep>", /* ERR_DEVEP */
"Wrong ep type for the xfer", /* ERR_EPTYPE */
"No buf for non-null xact", /* ERR_NOBUF */
"Endpoint stall", /* ERR_STL */
"Xfer aborted - too many Naks", /* ERR_NAK */
"Out xact no err nor ack", /* ERR_ACK */
"In Data overflowed", /* ERR_OVFL */
"Timeout/error (3 strikes)" /* ERR_TOERR */
};
/* Level 4 (high level usb function) errors */
static U8 *err_usb[] = {
"High level usb function error", /* ERR_USB */
"Err while turning on/off port pwr", /* ERR_PORTPWR */
"Err while getting port status", /* ERR_PORTSTS */
"Err while getting hub descriptor", /* ERR_HUBDESC */
"Prob to reset the port", /* ERR_PORTRST */
"Prob to ack port change", /* ERR_PORTACK */
"Prob to assign dev addr", /* ERR_DEVADDR */
"Prob to set dev conf", /* ERR_SETCONF */
"Prob to get dev conf", /* ERR_GETCONF */
"Invalid port num", /* ERR_PORTNUM */
"No dev addr available", /* ERR_DEVFULL */
"Prob to register the ep", /* ERR_EPREG */
"Prob to get dev desc", /* ERR_DEVDESC */
"Prob to get dev desc via DEV0", /* ERR_DEV0DESC */
"Failed to find the conf num", /* ERR_NOCONF */
"Inconsistency in num of eps", /* ERR_NUMEPS */
"prob to get intf", /* ERR_GETINTF */
"prob to set intf", /* ERR_SETINTF */
"Failed to find/set conf for dev", /* ERR_DEVCONF */
"Root hub enu failed", /* ERR_HUBENU */
"Dev enu failed", /* ERR_DEVENU */
"Invalid hub specification", /* ERR_HOSTHUB */
"Prob in device connection", /* ERR_PORTCONN */
"Prob while getting conf desc", /* ERR_CONFDESC */
"Failed to find the given intf", /* ERR_NOINTF */
"Failed to find EP0 in enr table" /* ERR_ENREP0 */
};
static U8 *err_sys[] = {
"System error", /* ERR_SYS */
"Sys error 1", /* ERR_SYS1 */
"sys error 2", /* ERR_SYS2 */
"Sys error 3", /* ERR_SYS3 */
"Sys error 4", /* ERR_SYS4 */
"Sys error 5", /* ERR_SYS5 */
"Sys error 6", /* ERR_SYS6 */
"Sys error 7", /* ERR_SYS7 */
"Sys error 8", /* ERR_SYS8 */
"Sys error 9" /* ERR_SYS9 */
};
typedef struct _eclass {
U8 **msg;
U8 size;
} ECLASS;
static ECLASS eclass[] = {
{ NULL, 0 }, /* reserved */
{ err_xact, 3 }, /* Level 1 errors (100s) */
{ err_xfer, 9 }, /* Level 2 errors (200s) */
{ NULL, 0 }, /* reserved */
{ err_usb, 27 }, /* Level 4 errors (400s) */
{ NULL, 0 }, /* reserved */
{ err_enr, 8 }, /* enr errors (600s) */
{ NULL, 0 }, /* reserved */
{ NULL, 0 }, /* reserved */
{ err_sys, 10 } /* system errors */
};
void err_print(I16 r)
{
I16 c, d, e;
ECLASS *p;
if (r >= 0) return;
r = -r; c = r / 100;
if (c != 1 && c != 2 && c != 4 && c != 6 && c != 9)
return;
d = r % 100;
p = eclass + c;
if (d >= p->size) d = 0;
send_msg((p->msg)[d]);
send_msg("\r\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -