source: fact/drsdaq/VME/atlas/include/rcc_error/rcc_error.h@ 9833

Last change on this file since 9833 was 22, checked in by ogrimm, 16 years ago
First commit of drsdaq program
  • Property svn:executable set to *
File size: 4.3 KB
Line 
1/*
2 * rcc_error.h (originally iom_error)
3 *
4 * ref : ATLAS Technical Note 51
5 * "Error reporting in the I/O module libraries"
6 *
7 * HP Beck 26-01-1998
8 * HP Beck 21-04-1998 revised
9 * HP Beck 04-05-1998 Package IDs and Package ID strings added
10 * JOP 27-05-1998 LS package added
11 * MAJO 06-11-2001 Adapted to RCC environment
12 */
13
14#ifndef _RCC_ERROR_H_
15#define _RCC_ERROR_H_
16
17#include <stdio.h>
18
19/* Package Identifers */
20
21typedef enum
22{
23 P_ID_RCC_ERROR = 1,
24 P_ID_VMERCC = 2, //Do not change
25 P_ID_UIO,
26 P_ID_SMEM,
27 P_ID_TS,
28 P_ID_CORBO,
29 P_ID_CMEM_RCC,
30 P_ID_IO_RCC, // = 8; Do not change
31 P_ID_FILAR, // = 9; Do not change
32 P_ID_SOLAR, // = 10; Do not change
33 P_ID_QUEST, // = 11; Do not change
34 P_ID_EM_RCC,
35 P_ID_LL_RCC,
36 P_ID_SLINK,
37 P_ID_S5933,
38 P_ID_RODBUSY,
39 P_ID_ROBIN, // = 17; Do not change
40 P_ID_RF2TTC
41} err_pid; // Package ID Type
42
43/* Definitions for error types */
44
45typedef unsigned int err_type ; /* full error information */
46typedef unsigned int err_pack ; /* only major or only minor error */
47typedef unsigned int err_field; /* error number */
48typedef char err_str[256] ; /* textual representation of errors */
49
50/* Textual representations for Package Identifiers */
51
52#define P_ID_RCC_ERROR_STR "RCC Error"
53#define P_ID_UIO_STR "UIO library"
54#define P_ID_SMEM_STR "Smem library in iom_utils"
55#define P_ID_TS_STR "Time stamping library"
56#define P_ID_LL_RCC_STR "Linked List Library"
57#define P_ID_EM_RCC_STR "FILAR EM library"
58#define P_ID_CORBO_STR "Corbo library"
59#define P_ID_RODBUSY_STR "ROD-BUSY library"
60#define P_ID_VMERCC_STR "VMEbus driver/library for the RCC"
61#define P_ID_CMEM_RCC_STR "CMEM RCC library"
62#define P_ID_IO_RCC_STR "IO RCC library"
63#define P_ID_FILAR_STR "FILAR library"
64#define P_ID_SOLAR_STR "SOLAR library"
65#define P_ID_SLINK_STR "AMCC based S-Link library"
66#define P_ID_S5933_STR "S5933 library"
67#define P_ID_ROBIN_STR "ROBIN library"
68#define P_ID_RF2TTC_STR "Library for RF2TTC and RFRX"
69
70/* Errors from the RCC_error package */
71
72enum {ERCC_OK = 0 ,
73 ERCC_NOTOPEN = (P_ID_RCC_ERROR<<8) + 1 ,
74 ERCC_NOINIT ,
75 ERCC_STREAM ,
76 ERCC_NOCODE
77} ;
78
79/* ... and their textual representation */
80
81#define ERCC_OK_STR "all OK"
82#define ERCC_NOTOPEN_STR "no open performed"
83#define ERCC_NOINIT_STR "packX_err_get is NULL pointer"
84#define ERCC_STREAM_STR "stream not writeable"
85#define ERCC_NOCODE_STR "no such error code"
86
87
88/* MACRO definitions */
89
90#define RCC_ERROR_RETURN(maj, min) \
91 ( !(min) ? 0 : \
92 ( ( (maj) & 0xffff0000 ) ? \
93 ( ((maj) & 0xffff0000) + ((min) & 0xffff) ) : \
94 ( ((maj)<<16) + ((min) & 0xffff) ) ) )
95
96
97#define RCC_ERROR_MAJOR(error_code) \
98 ( ((error_code) & 0xffff0000) ? \
99 ((error_code) & 0xffff0000)>>16 : \
100 ((error_code) & 0x0000ffff) )
101
102#define RCC_ERROR_MINOR(error_code) \
103 ( (error_code) & 0x0000ffff )
104
105#define RCC_ERROR_MINOR_PID(error_code) \
106 ( ((error_code) & 0x0000ff00)>>8 )
107
108#define RCC_ERROR_MINOR_ERRNO(error_code) \
109 ( (error_code) & 0x000000ff )
110
111#define RCC_ERROR_MAJOR_PID(error_code) \
112 ( ((error_code) & 0xffff0000) ? \
113 ((error_code) & 0xff000000)>>24 : \
114 ((error_code) & 0x0000ff00)>>8 )
115
116#define RCC_ERROR_MAJOR_ERRNO(error_code) \
117 ( ((error_code) & 0xffff0000) ? \
118 ((error_code) & 0x00ff0000)>>16 : \
119 ((error_code) & 0x000000ff) )
120
121/* The rcc_error API prototyping */
122
123#ifdef __cplusplus
124extern "C" {
125#endif
126
127err_type rcc_error_open( void ) ;
128err_type rcc_error_close( void ) ;
129err_type rcc_error_init(err_pid, err_type (*)(err_pack, err_str, err_str) );
130err_type iom_error_init(err_pid, err_type (*)(err_pack, err_str, err_str) );
131err_type rcc_error_print(FILE* stream, err_type) ;
132err_type rcc_error_get(err_type, err_str, err_str, err_str, err_str);
133err_type rcc_error_string(char *text, err_type err);
134
135#ifdef __cplusplus
136}
137#endif
138
139#endif
Note: See TracBrowser for help on using the repository browser.