error.c
来自「ADS下的bios工程」· C语言 代码 · 共 70 行
C
70 行
#include <bios/stdio.h>
#include <bios/error.h>
struct BIOS_ERR_STR error_strs[] =
{
{0, "Unknown Error" },
#ifdef BIOS_CMD_ERR_STRS
{0x10000, "Error bad command"},
{0x10001, "Too few argument"},
{0x10002, "Too many argument"},
{0x10003, "Too long command"},
{0x10004, "Illegal argument"},
{0x10005, "negative address size"},
{0x10006, "Missing arguments"},
{0x10007, "No matched command"},
{0x10008, "No previous command to replace"},
{0x10009, "Boot device initialization failed."},
{0x1000a, "Boot device start failed."},
{0x1000b, "Load boot image failed."},
{0x1000c, "Boot failed."},
{0x1000d, "There are no boot devices."},
{0x1000f, "Do not support command."},
#endif /* BIOS_CMD_ERR_STRS */
#ifdef BIOS_DEV_ERR_STRS
#endif /* BIOS_DEV_ERR_STRS */
#ifdef BIOS_FS_ERR_STRS
{0x50000, "File open error"},
#endif /* BIOS_FS_ERR_STRS */
#ifdef BIOS_TFTP_ERR_STRS
{0x60000, "TFTP image download fail"},
#endif /* BIOS_TFTP_ERR_STRS */
#ifdef BIOS_FLASH_ERR_STRS
{0x70000, "FLASH Non-valide manufacture's ID"},
{0x70001, "FLASH Not supported device type"},
{0x70005, "FLASH program fail"},
#endif /* BIOS_FLASH_ERR_STRS */
{(int)NULL, NULL }
};
u8 *
errors(u32 err_code)
{
struct BIOS_ERR_STR *err_str_ptr;
err_str_ptr = &error_strs[0];
while (err_str_ptr -> err_string != NULL) {
/* check for this is the error string we want */
if (err_str_ptr -> err_code == err_code) {
return ((u8 *)err_str_ptr -> err_string);
} /* end error string found */
/* move to the next possible error string */
err_str_ptr ++;
}
return ((u8 *)NULL);
}
void
error_msg(char *s)
{
printf("\nerror : %s\n", s);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?