Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

errorCodes.h

00001 /************************************************************************************
00002  * errorCodes.h
00003  *
00004  *   synopsis: Defines return codes, error severity levels and prototypes for
00005  *             error handling routines.
00006  *
00007  *  Damon Fasching, UW Madison                            fasching@wisconsin.cern.ch
00008  *  Douglas Ferguson, UW Madison   (510) 486-5230         dpferguson@lbl.gov
00009  *  
00010  *  modifications    
00011  *   - added error code for an unavailable global address register.  13.03.02 dpsf
00012  *   - added error codes for setMem & memoryTest                     17.03.02 dpsf
00013  *   - added BOC busy errors                                         20.03.02  rcj
00014  *   - removed the two error macros from smSendTxtBuff.c  (ADD_SEVERITY and
00015  *     MERGE_ERROR) and put them inside errorCodes.h so that other routines
00016  *     can use them.                                                 22.03.02  dpsf
00017  *
00018  ************************************************************************************/
00019 #ifndef ERROR_CODES
00020 #define ERROR_CODES
00021 
00022 #include "processor.h"
00023 
00024 /************************
00025  *  return codes
00026  ************************/
00027 
00028 /* Successful completion of routine */
00029 #define SUCCESS                   0x0
00030 
00031 /* Host errors: */
00032 #ifdef I_AM_HOST
00033     //For the primitive list reading machinery:
00034     #define BAD_LIST_IO_VERSION -1
00035     #define BAD_PRIMITIVE_ID    -2
00036     #define LIST_CREATION_ERR   -3
00037     #define PRIM_FILE_ERR       -4
00038 #endif
00039 
00040 /* Boot errors (MDSP only) */
00041 #ifdef I_AM_MASTER_DSP
00042   #define CODE_EXCEEDS_ROM          0x100
00043   #define CODE_LENGTH_MISMATCH      0x101
00044   #define CODE_LOAD_ERROR           0x102
00045   #define FLASH_VERSION_MISMATCH    0x103
00046 #endif
00047 
00048 /* initialization errors */
00049 #define EMIF_INIT_ERROR           0x200
00050 
00051 /* primitive and reply message list handling errors */
00052 #define PRIM_LIST_REV_MISMATCH    0x300
00053 #define MSG_LIST_TOO_LONG         0x301
00054 #define MSG_LIST_LENGTH_MISMATCH  0x302
00055 #define CHECKSUM_ERROR            0x303
00056 #define END_OF_LIST_ADDR_ERR      0x304
00057 #define SLV_REPLY_ERR             0x305
00058 
00059 /* primitive and reply message handling errors */
00060 #define PRIM_REV_NOT_SET          0x400
00061 #define PRIM_REV_MISMATCH         0x401
00062 #define ILLEGAL_PRIM_ID           0x402
00063 #define PRIM_FNCT_PTR_ERROR       0x403
00064 #define MSG_EXCEEDS_LIST_BOUND    0x404
00065 #define DATA_EXCEEDS_BUFFER       0x405
00066 
00067 /* primitive input parameter errors */
00068 #define MEMORY_EXCEEDED           0x500
00069 #define SLAVE_DSP_DNE             0x501
00070 #define SLAVE_DSP_OFF             0x502
00071 #define TRAP_PARAM_ERROR          0x503
00072 #define SLAVE_TXT_BUFF_DNE        0x504
00073 #define ROD_REG_DNE               0x505
00074 #define FIFO_DNE                  0x506
00075 #define FIFO_BANK_DNE             0x507
00076 #define FRAME_SZ_LIMIT_ERR        0x508
00077 #define TRAP_CONFIG_ERROR         0x509
00078 #define BAD_EVENT_TRAP_PARAMS     0x50a
00079 #define BACK_PRESSURE_ILLEGAL     0x50b
00080 #define SERIAL_DATA_ILLEGAL       0x50c
00081 #define HISTOGRAM_SETUP_ERROR     0x50d
00082 #define PRIM_PARAMETER_ERROR      0x50e
00083 #define TASK_INSERTION_ERROR      0x50f
00084 #define TASK_REMOVAL_ERROR        0x510
00085 #define INVALID_CONFIG_SET        0x511
00086 #define INVALID_MODULE_NUM        0x512
00087 #define INVALID_CMD_STREAM_BUF    0x513
00088 #define LIMIT_EXCEEDED            0x514
00089 #define BAD_MODULE_DATA           0x515
00090 #define UNRECOGNIZED_DATA         0x516
00091 #define PRIM_DATA_ERROR           0x517
00092 #define MODULE_MASK_DATA_ERROR    0x518
00093 
00094 /* task manager errors*/
00095 #define TASK_PRIORITY_MAX_ERROR   0x580
00096 #define TASK_DUPLICATE_ERROR      0x581
00097 #define TASK_PRIORITY_ERROR       0x582
00098 #define TASK_NONEXISTANT_ERROR    0x583
00099 #define TASK_REVISION_ERROR       0x584
00100 #define TASK_NOTRUNNING_ERROR     0x585
00101 #define TASK_INCOMPLETE_ERROR     0x586
00102 #define TASK_NOTRUN_ERROR         0x587
00103 #define TASK_CODING_ERROR         0x588
00104 
00105 /* task-related errors */
00106 #define NO_HISTOGRAMS_ERROR       0x5c0
00107 #define HISTOGRAMMING_ERROR_EVT   0x5c1
00108 #define UNEXPECTED_EVENT          0x5c2
00109 #define EVENT_DISCARDED           0x5c3
00110 #define TIMING_ERROR              0x5c4
00111 #define ACCUM_ERROR               0x5c5
00112 #define HEADER_TIME_OUT_ERR       0x5c6
00113 #define HEADER_ERR                0x5c7
00114 #define TRANSMIT_ERR              0x5c8  /* non-fatal */
00115 #define EVENT_ERR                 0x5c9  /* non-fatal */
00116 #define EVENT_RETRANSMIT_ERR      0x5ca
00117 #define TRIGGER_ERR               0x5cb
00118 #define ELECTRONICS_ERROR         0x5cc
00119 
00120 /* data analysis errors (slaves only) */
00121 #ifdef I_AM_SLAVE_DSP
00122   #define MISPLACED_EVFRAG_HDR      0x5d0
00123   #define NOT_PKT_HEADER            0x5d1
00124 #endif
00125 
00126 /* misc errors */
00127 #define TIMEOUT_ERR               0x600
00128 #define NO_TIMER_CHAN_AVAIL       0x601
00129 #define NO_CNT_RLD_REG_AVAIL      0x602
00130 #define NO_GBL_ADDR_REG_AVAIL     0x603
00131 #define ARRAY_INDEX_ERR           0x604
00132 #define BAD_ADDRESS               0x605
00133 #define SET_MEMORY_ERROR          0x606
00134 #define COPY_MEMORY_ERROR         0x607
00135 #define BOC_INITIALLY_BUSY        0x608
00136 #define BOC_CONT_BUSY             0x609
00137 #define SLAVE_NOT_READY           0x60a
00138 #define NON_WORD_BOUNDARY         0x60b
00139 #define WRONG_COMMAND_ID          0x60c
00140 #define CMD_BUFFER_OVERFLOW       0x60d
00141 #define CMD_STREAM_BUF_RSVD       0x60e
00142 #define BUFFER_NOT_READY          0x60f
00143 #define NO_SLAVES_ERROR           0x610
00144 #define PARAM_ERROR               0x611
00145 #define DSP_CMD_LINE_ERROR        0x612
00146 #define ROD_BUSY_ERR              0x613
00147 #define DATA_ERR                  0x614
00148 #define LINKMASK_ERR              0x615
00149 #define CONFIG_ERROR              0x616
00150 #define ASM_FORMAT_ERROR          0x617
00151 #define ASM_BINSIZE_ERROR         0x618
00152 #define ASM_CHIPOCC_ERROR         0x619
00153 #define TEXT_OVERFLOW_ERROR       0x61a
00154 #define COMPILATION_MISMATCH      0x61b
00155 #define PRIM_HEADER_ERR           0x61c
00156 #define PRIMLIST_ERR              0x61d
00157 #define LIST_ABORTED              0x61e
00158 #define BANWIDTH_MISMATCH         0x61f
00159 #define HEADER_NOT_FOUND          0x620
00160 #define REGISTER_COMP_ERR         0x621
00161 
00162 /* memory test errors */
00163 #define MEMORY_TEST_ADDR_ERROR    0x701
00164 #define MEMORY_TEST_CB1_ERROR     0x702
00165 #define MEMORY_TEST_CB2_ERROR     0x704
00166 #define MEMORY_TEST_FLT0_ERROR    0x708
00167 #define MEMORY_TEST_FLT1_ERROR    0x710
00168 #define MEMORY_TEST_RAND_ERROR    0x720
00169 
00170 /* The following are not errors; a primitive can return REPEAT_PRIMITIVE to execPrim()
00171  * to indicate that it needs to be repeated, e.g. because a resource was busy.
00172  * Tasks use REPEAT_TASK to indicate that they are continuing to process data. If a
00173  * task is halted, it exits with TASK_HALTED. */
00174 #define REPEAT_PRIMITIVE          0x1000
00175 #define REPEAT_TASK               0x1001
00176 #define TASK_HALTED               0x1002
00177 #define TASK_QUERIED              0x1003
00178 #define TASK_INITIALIZED          0x1004
00179 
00180 /************************************
00181  * severity codes and related macros
00182  ************************************/
00183 
00184 /* severity codes; sign bit is not an error bit */
00185 #define ERROR_0     28
00186 #define ERROR_1     29
00187 #define FATAL_ERR   30
00188 
00189 /* mask for severity bits */
00190 #define SEVERITY_BITS  ((FATAL_BIT) | (1 << (ERROR_1)) | 1 << (ERROR_0))
00191 
00192 /* mask for fatal error */
00193 #define FATAL_BIT      (1 << (FATAL_ERR))
00194 
00195 /* this macro returns true if the fatal error bit is set in word 'x' */
00196 #define FATAL(x)       (abs(x) & FATAL_BIT)
00197 
00198 /*  Given an error code, 0 < y < 2**28, and a severity level, ERR_0 <= z <= FATAL_ERR,
00199  * this macro adds the severity bit to the error code, negates the result and stores
00200  * it in x, keeping any severity bits which were already present in x.  y = ERROR_n
00201  * for nonfatal errors (execution continues), y = FATAL_ERR for fatal errors (routine
00202  * exits).  This macro should only be used via the function newError (below) which
00203  * should be called from the function in which the error occured.  */
00204 
00205 #define ADD_SEVERITY(x,y,z)  (x = -((abs(x) & SEVERITY_BITS) | (abs(y) | (1 << (z)))))
00206 
00207 /*  Given two error codes, x and y, this macro adds the SEVERITY bits of y to error
00208  * code x.  This allows all errors to have their severity reported up the calling
00209  * stack, with the final error having its full code reported.  This macro should only
00210  * be used via the function addError (below) which should be called from a calling
00211  * function which receives an error return from the function called. */
00212 
00213 #define MERGE_ERROR(x,y)      (x = -((abs(x) & SEVERITY_BITS) | abs(y)))
00214 
00215 #endif  /* Multiple inclusion protection. */

Generated on Fri Dec 16 19:38:09 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5