⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 messages.c

📁 Intrisyc 公司的PXA255-bootloader,源码易懂
💻 C
字号:
//////////////////////////////////////////////////////////////////////////////////// Copyright(c) 2002-2003 Intrinsyc Software Inc. All rights reserved.//// Module name:////      messages.c//// Description:////      Functions for printing pre-defined messages.//// Author:////      Mike Kirkland//// Created:////      October 2001//////////////////////////////////////////////////////////////////////////////////#include <string.h>#include <util.h>#include <messages.h>// This must match the entries in message.hconst char const *errors[] = {/* PARSE_MIN_ARGS_ERROR */      "Not enough arguments for command.",/* PARSE_NO_COMMAND_ERROR */    "Invalid command.",/* PARSE_INVALID_IP_ERROR */    "Invalid IP address.",/* PARSE_INVALID_ARG_ERROR */   "Invalid arguments.",/* PARSE_RANGE_ERROR */         "Address out of range.",/* DHCP_TIMEOUT_ERROR */        "DHCP timed out.",/* TFTP_TIMEOUT_ERROR */        "TFTP timed out.",/* PARSE_DL_METHOD_ERROR */     "Unknown download method.",/* PARSE_ALIGN_ERROR */         "Address is not aligned.",/* PARSE_KERN_PARAM_ERROR */    "Parameter string incorrectly formatted.",/* PARSE_INVALID_OS_ERROR */    "Invalid OS.",/* NO_OS_ERROR */               "No OS image found.",/* FLASH_VERIFY_ERROR */        "Write verification failed.",/* FLASH_PROGRAMMING_ERROR */   "Flash programming failure.",/* FLASH_PROTECTED_ERROR */     "Flash write-protected.",/* FLASH_VOLTAGE_ERROR */       "Flash voltage incorrect.",/* FLASH_DEAD_ERROR */          "Flash not responding.",/* BOOTP_TIMEOUT_ERROR */       "Bootp timed out.",/* CS_NOTFOUND_ERROR */         "CS89x0 not found.",/* CS_NOTX_ERROR */             "No TX command on CS89x0",/* CS_ISAID_ERROR */            "ISA ID does not match the CS89x0",/* CS_NOTCS_ERROR */            "Chip does not identify itself as a CS89x0",/* CS_NOMAC_ERROR */            "Cannot read MAC address",/* FLASH_FLASHLOADER_ERROR */   "Use flashloader to write below block 3.",/* FLASH_ERASE_ERROR */         "Flash erase failure."};// This must match the entries in message.hconst char const *messages[] ={/* PARSE_DHCP_MESSAGE */        "",/* RAM_CLEAR_MESSAGE */         "Clearing RAM...",/* LOADING_CE_MESSAGE */        "Loading CE...",/* LOADING_LINUX_MESSAGE */     "Loading Linux...",/* PROPER_CEBIN_MESSAGE */      "Proper BIN header",/* IMPROPER_CEBIN_MESSAGE */    "Improper BIN header",/* PARSE_SET_VAR_MESSAGE */     "Settable attributes: ip, gw, mask, server, speed"};////////////////////////////////////////////////////////////////////////////////// error_decode// PURPOSE: Decodes an error number into the string representation.// PARAMS:  (IN) int error - error number to decode// RETURNS: char * - error string.////////////////////////////////////////////////////////////////////////////////static inline char const *error_decode(int error){      return errors[error < countof(errors) ?  error : UNKNOWN_ERROR];}////////////////////////////////////////////////////////////////////////////////// error_print// PURPOSE: Prints an error message from the array errors, based on the index,//          error.// PARAMS:  (IN) int error - index to print from the errors array.// RETURNS: Nothing.////////////////////////////////////////////////////////////////////////////////voiderror_print(int error){   itc_printf("Error: %s\r\n", error_decode(error));}////////////////////////////////////////////////////////////////////////////////// message_decode// PURPOSE: Decodes a message number into the string representation.// PARAMS:  (IN) int message - message number to decode// RETURNS: char * - message string.////////////////////////////////////////////////////////////////////////////////static inline char const *message_decode(int message){      return messages[message < countof(messages) ?  message : UNKNOWN_MESSAGE];}////////////////////////////////////////////////////////////////////////////////// message_print// PURPOSE: Prints a message from the array messages, based on the index,//          messages.// PARAMS:  (IN) int message - index to print from the messages array.// RETURNS: Nothing.////////////////////////////////////////////////////////////////////////////////voidmessage_print(int message){   itc_printf("%s\r\n", message_decode(message));}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -