scpi_errs.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #include "core/config.h" // CONFIG_REBOOT_FEATURE
  2. #include "app/scpi/scpi_errs.h"
  3. // Refer to: [1], p 520
  4. int scpi_error_class( int errCode )
  5. {
  6. if( errCode <= 0 )
  7. return (((int)((errCode) / 100))*100);
  8. return SCPI_ERROR_CLASS_EXECUTION; // treat all positive error codes as EXECUTION errors (device dependent)
  9. }
  10. const int SCPI_ERROR_SUCCESS = 0; // Success code
  11. const char SCPI_ERROR_NO[] = "0, No Error";
  12. const int SCPI_ERROR_COMMAND_ERROR = -100l;
  13. const char SCPI_ERROR_COMMAND_ERROR_MSG[] = "Command Error";
  14. const int SCPI_ERROR_INVALID_CHARACTER = -101l;
  15. const char SCPI_ERROR_INVALID_CHARACTER_MSG[] = "Invalid character";
  16. const int SCPI_ERROR_SYNTAX_ERROR = -102l;
  17. const char SCPI_ERROR_SYNTAX_ERROR_MSG[] = "Syntax Error";
  18. const char SCPI_ERROR_SYNTAX_ERROR_PARAM_MSG[] = "Parameter Syntax Error";
  19. const int SCPI_ERROR_INVSEP_ERROR = -103l;
  20. const char SCPI_ERROR_INVSEP_ERROR_MSG[] = "Invalid separator";
  21. const int SCPI_ERROR_PARAMETER_NOTALLOWED = -108l;
  22. const char SCPI_ERROR_PARAMETER_NOTALLOWED_MSG[] = "Parameter not allowed";
  23. const int SCPI_ERROR_MISSING_PARAMETER = -109l;
  24. const char SCPI_ERROR_MISSING_PARAMETER_MSG[] = "Missing parameter";
  25. const int SCPI_ERROR_COMMAND_HEADER = -110l;
  26. const char SCPI_ERROR_COMMAND_HEADER_MSG[] = "Command header error (parse error)";
  27. const int SCPI_ERROR_COMMAND_HEADER_SEP = -111l;
  28. const char SCPI_ERROR_COMMAND_HEADER_SEP_MSG[] = "Header separator error";
  29. const int SCPI_ERROR_MNEMONIC_TOOLONG = -112l;
  30. const char SCPI_ERROR_MNEMONIC_TOOLONG_MSG[] = "Program mnemonic too long";
  31. const int SCPI_ERROR_UNDEFHEADER_ERROR = -113l;
  32. const char SCPI_ERROR_UNDEFHEADER_ERROR_MSG[] = "Undefined header";
  33. const int SCPI_ERROR_NUMERIC_DATAERROR = -120l;
  34. const char SCPI_ERROR_NUMERIC_DATAERROR_MSG[] = "Numeric data error";
  35. const int SCPI_ERROR_INVALID_NUMERIC_CHAR = -121l;
  36. const char SCPI_ERROR_INVALID_NUMERIC_CHAR_MSG[] = "Invalid character in number";
  37. const int SCPI_ERROR_INVALID_STRINGDATA = -151;
  38. const char SCPI_ERROR_INVALID_STRINGDATA_MSG[] = "Invalid string data";
  39. const int SCPI_ERROR_INVALID_BLOCKDATA = -161;
  40. const char SCPI_ERROR_INVALID_BLOCKDATA_MSG[] = "Invalid block data";
  41. const int SCPI_ERROR_EXECUTION_ERROR = -200l;
  42. const char SCPI_ERROR_EXECUTION_ERROR_MSG[] = "Execution error";
  43. const int SCPI_ERROR_TRIGGER_IGNORED = -211l;
  44. const char SCPI_ERROR_TRIGGER_IGNORED_MSG[] = "Trigger ignored";
  45. const int SCPI_ERROR_PARAMETER_ERROR = -220l;
  46. const char SCPI_ERROR_PARAMETER_ERROR_MSG[] = "Parameter error";
  47. const int SCPI_ERROR_DATA_RANGE = -222l;
  48. const char SCPI_ERROR_DATA_RANGE_MSG[] = "Data out of range";
  49. const int SCPI_ERROR_ILLEGAL_PARAM = -224l;
  50. const char SCPI_ERROR_ILLEGAL_PARAM_MSG[] = "Illegal parameter value";
  51. const int SCPI_ERROR_DEVICE_SPECIFIC = -300;
  52. const char SCPI_ERROR_DEVICE_SPECIFIC_MSG[] = "Device-specific error";
  53. const int SCPI_ERROR_QUEUE_OVERFLOW = -350l;
  54. const char SCPI_ERROR_QUEUE_OVERFLOW_MSG[] = "Queue overflow";
  55. const int SCPI_ERROR_OUTOF_MEMORY = -361l;
  56. const char SCPI_ERROR_OUTOF_MEMORY_MSG[] = "Out of memory";
  57. const int SCPI_ERROR_INBUF_OVERFLOW = -363l;
  58. const char SCPI_ERROR_INBUF_OVERFLOW_MSG[] = "Input buffer overrun";
  59. const int SCPI_ERROR_QUERY_ERROR = -400l;
  60. const char SCPI_ERROR_QUERY_ERROR_MSG[] = "Query error";
  61. const int SCPI_ERROR_POWERON = -500l;
  62. const char SCPI_ERROR_POWERON_MSG[] = "Power on";
  63. const int SCPI_ERROR_CHRZ_DATA_NOTFOUND = 1; // Execution Error, see @scpi_error_class
  64. const char SCPI_ERROR_CHRZ_DATA_NOTFOUND_MSG[] = "Characterization data not found";
  65. const int SCPI_ERROR_THERM_DATA_NOTFOUND = 2; // Execution Error, see @scpi_error_class
  66. const char SCPI_ERROR_THERM_DATA_NOTFOUND_MSG[] = "Thermocompensation data not found or corrupted";
  67. const int SCPI_ERROR_DATA_CORRUPTED = 3; // Execution Error, see @scpi_error_class
  68. const char SCPI_ERROR_DATA_CORRUPTED_MSG[] = "Data array corrupted or not found";
  69. const int SCPI_ERROR_TOO_MANY_REQUESTS = 4; // Execution Error, see @scpi_error_class
  70. const char SCPI_ERROR_TOO_MANY_REQUESTS_MSG[] = "Too many requests in line";
  71. const int SCPI_ERROR_INTERNAL_DEVICE = 5; // Execution Error, see @scpi_error_class
  72. const char SCPI_ERROR_INTERNAL_DEVICE_MSG[] = "Internal device error";
  73. const char SCPI_ERROR_INTERNAL_INT_SWITCH_MSG[] = "# An unexpected error has occurred! The interface will not be switched!";
  74. #if CONFIG_REBOOT_FEATURE
  75. const char SCPI_MESSAGE_INTERNAL_INT_SWITCH_MSG[] = "! The interface will be switched automatically.";
  76. #else
  77. const char SCPI_MESSAGE_INTERNAL_INT_SWITCH_MSG[] = "! The interface will be switched the next time the USB cable is connected!";
  78. #endif