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

errorCodes.h

Go to the documentation of this file.
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 /* Boot errors (master DSP only) */
00032 #ifdef I_AM_MASTER_DSP
00033   #define CODE_EXCEEDS_ROM          0x100
00034   #define CODE_LENGTH_MISMATCH      0x101
00035   #define CODE_LOAD_ERROR           0x102
00036 #endif
00037 
00038 /* initialization errors */
00039 #define EMIF_INIT_ERROR           0x200
00040 
00041 /* primitive and reply message list handling errors */
00042 #define PRIM_LIST_REV_MISMATCH    0x300
00043 #define MSG_LIST_TOO_LONG         0x301
00044 #define MSG_LIST_LENGTH_MISMATCH  0x302
00045 #define CHECKSUM_ERROR            0x303
00046 #define END_OF_LIST_ADDR_ERR      0x304
00047 #define SLV_REPLY_ERR             0x305
00048 
00049 /* primitive and reply message handling errors */
00050 #define PRIM_REV_NOT_SET          0x400
00051 #define PRIM_REV_MISMATCH         0x401
00052 #define ILLEGAL_PRIM_ID           0x402
00053 #define PRIM_FNCT_PTR_ERROR       0x403
00054 #define MSG_EXCEEDS_LIST_BOUND    0x404
00055 
00056 /* primitive input parameter errors */
00057 #define MEMORY_EXCEEDED           0x500
00058 #define SLAVE_DSP_DNE             0x501
00059 #define SLAVE_DSP_OFF             0x502
00060 #define TRAP_PARAM_ERROR          0x503
00061 #define SLAVE_TXT_BUFF_DNE        0x504
00062 #define ROD_REG_DNE               0x505
00063 #define FIFO_DNE                  0x506
00064 #define FIFO_BANK_DNE             0x507
00065 #define FRAME_SZ_LIMIT_ERR        0x508
00066 #define TRAP_CONFIG_ERROR         0x509
00067 #define BAD_EVENT_TRAP_PARAMS     0x50a
00068 #define BACK_PRESSURE_ILLEGAL     0x50b
00069 #define SERIAL_DATA_ILLEGAL       0x50c
00070 #define HISTOGRAM_SETUP_ERROR     0x50d
00071 #define PRIM_PARAMETER_ERROR      0x50e
00072 #define TASK_INSERTION_ERROR      0x50f
00073 #define TASK_REMOVAL_ERROR        0x510
00074 #define INVALID_CONFIG_SET        0x511
00075 #define INVALID_MODULE_NUM        0x512
00076 #define INVALID_CMD_STREAM_BUF    0x513
00077 #define LIMIT_EXCEEDED            0x514
00078 
00079 /* task manager errors*/
00080 #define TASK_PRIORITY_MAX_ERROR   0x580
00081 #define TASK_DUPLICATE_ERROR      0x581
00082 #define TASK_PRIORITY_ERROR       0x582
00083 #define TASK_NONEXISTANT_ERROR    0x583
00084 #define TASK_REVISION_ERROR       0x584
00085 #define TASK_NOTRUNNING_ERROR     0x585
00086 #define TASK_INCOMPLETE_ERROR     0x586
00087 #define TASK_NOTRUN_ERROR         0x587
00088 #define TASK_CODING_ERROR         0x588
00089 
00090 /* task-related errors */
00091 #define NO_HISTOGRAMS_ERROR       0x5c0
00092 #define HISTOGRAMMING_ERROR_EVT   0x5c1
00093 #define UNEXPECTED_EVENT          0x5c2
00094 #define EVENT_DISCARDED           0x5c3
00095 #define TIMING_ERROR              0x5c4
00096 #define ACCUM_ERROR               0x5c5
00097 #define HEADER_TIME_OUT_ERR       0x5c6
00098 #define HEADER_ERR                0x5c7
00099 #define TRANSMIT_ERR              0x5c8  /* non-fatal */
00100 #define EVENT_ERR                 0x5c9  /* non-fatal */
00101 #define EVENT_RETRANSMIT_ERR      0x5ca
00102 #define TRIGGER_ERR               0x5cb
00103 
00104 /* data analysis errors (slaves only) */
00105 #ifdef I_AM_SLAVE_DSP
00106   #define MISPLACED_EVFRAG_HDR      0x5d0
00107   #define NOT_PKT_HEADER            0x5d1
00108 #endif
00109 
00110 /* misc errors */
00111 #define TIME_OUT_ERR              0x600
00112 #define NO_TIMER_CHAN_AVAIL       0x601
00113 #define NO_CNT_RLD_REG_AVAIL      0x602
00114 #define NO_GBL_ADDR_REG_AVAIL     0x603
00115 #define ARRAY_INDEX_ERR           0x604
00116 #define BAD_ADDRESS               0x605
00117 #define SET_MEMORY_ERROR          0x606
00118 #define COPY_MEMORY_ERROR         0x607
00119 #define BOC_INITIALLY_BUSY        0x608
00120 #define BOC_CONT_BUSY             0x609
00121 #define SLAVE_NOT_READY           0x60a
00122 #define NON_WORD_BOUNDARY         0x60b
00123 #define WRONG_COMMAND_ID          0x60c
00124 #define CMD_BUFFER_OVERFLOW       0x60d
00125 #define CMD_STREAM_BUF_RSVD       0x60e
00126 #define BUFFER_NOT_READY          0x60f
00127 #define NO_SLAVES_ERROR           0x610
00128 #define PARAM_ERROR               0x611
00129 #define DSP_CMD_LINE_ERROR        0x612
00130 #define ROD_BUSY_ERR              0x613
00131 #define DATA_ERR                  0x614
00132 #define LINKMASK_ERR              0x615
00133 #define CONFIG_ERROR              0x616
00134 
00135 /* memory test errors */
00136 #define MEMORY_TEST_ADDR_ERROR   0x701
00137 #define MEMORY_TEST_CB1_ERROR    0x702
00138 #define MEMORY_TEST_CB2_ERROR    0x704
00139 #define MEMORY_TEST_FLT0_ERROR   0x708
00140 #define MEMORY_TEST_FLT1_ERROR   0x710
00141 #define MEMORY_TEST_RAND_ERROR   0x720
00142 
00143 /* The following are not errors; a primitive can return REPEAT_PRIMITIVE to execPrim()
00144  * to indicate that it needs to be repeated, e.g. because a resource was busy.
00145  * Tasks use REPEAT_TASK to indicate that they are continuing to process data. If a
00146  * task is halted, it exits with TASK_HALTED. */
00147 #define REPEAT_PRIMITIVE          0x1000
00148 #define REPEAT_TASK               0x1001
00149 #define TASK_HALTED               0x1002
00150 #define TASK_QUERIED              0x1003
00151 #define TASK_INITIALIZED          0x1004
00152 
00153 /************************************
00154  * severity codes and related macros
00155  ************************************/
00156 
00157 /* severity codes; sign bit is not an error bit */
00158 #define ERROR_0     28
00159 #define ERROR_1     29
00160 #define FATAL_ERR   30
00161 
00162 /* mask for severity bits */
00163 #define SEVERITY_BITS  ((FATAL_BIT) | (1 << (ERROR_1)) | 1 << (ERROR_0))
00164 
00165 /* mask for fatal error */
00166 #define FATAL_BIT      (1 << (FATAL_ERR))
00167 
00168 /* this macro returns true if the fatal error bit is set in word 'x' */
00169 #define FATAL(x)       (abs(x) & FATAL_BIT)
00170 
00171 /*  Given an error code, 0 < y < 2**28, and a severity level, ERR_0 <= z <= FATAL_ERR,
00172  * this macro adds the severity bit to the error code, negates the result and stores
00173  * it in x, keeping any severity bits which were already present in x.  y = ERROR_n
00174  * for nonfatal errors (execution continues), y = FATAL_ERR for fatal errors (routine
00175  * exits).  This macro should only be used via the function newError (below) which
00176  * should be called from the function in which the error occured.  */
00177 
00178 #define ADD_SEVERITY(x,y,z)  (x = -((abs(x) & SEVERITY_BITS) | (abs(y) | (1 << (z)))))
00179 
00180 /*  Given two error codes, x and y, this macro adds the SEVERITY bits of y to error
00181  * code x.  This allows all errors to have their severity reported up the calling
00182  * stack, with the final error having its full code reported.  This macro should only
00183  * be used via the function addError (below) which should be called from a calling
00184  * function which receives an error return from the function called. */
00185 
00186 #define MERGE_ERROR(x,y)      (x = -((abs(x) & SEVERITY_BITS) | abs(y)))
00187 
00188 #endif

Generated on Mon Dec 15 19:36:00 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3