-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsahpi_struct_utils.i
179 lines (135 loc) · 7.33 KB
/
sahpi_struct_utils.i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/* -*- linux-c -*-
*
* (C) Copyright IBM Corp. 2004
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
* file and program are licensed under a BSD style license. See
* the Copying file included with the OpenHPI distribution for
* full licensing terms.
*
* Author(s):
* Steve Sherman <[email protected]>
*/
#ifndef __SAHPI_STRUCT_UTILS_H
#define __SAHPI_STRUCT_UTILS_H
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
/***********************
* Text buffer utilities
***********************/
SaErrorT oh_init_textbuffer(SaHpiTextBufferT *buffer);
SaErrorT oh_append_textbuffer(SaHpiTextBufferT *buffer, const char *from);
SaErrorT oh_copy_textbuffer(SaHpiTextBufferT *dest, const SaHpiTextBufferT *from);
/* Print just the Data portions of the text structures */
SaErrorT oh_fprint_text(FILE *stream, const SaHpiTextBufferT *buffer);
/* Same as SaHpiTextBufferT, only more Data */
#define OH_MAX_TEXT_BUFFER_LENGTH 2048
typedef struct {
SaHpiTextTypeT DataType;
SaHpiLanguageT Language;
SaHpiUint16T DataLength;
SaHpiUint8T Data[OH_MAX_TEXT_BUFFER_LENGTH];
} oh_big_textbuffer;
SaErrorT oh_init_bigtext(oh_big_textbuffer *big_buffer);
SaErrorT oh_append_bigtext(oh_big_textbuffer *big_buffer, const char *from);
SaErrorT oh_copy_bigtext(oh_big_textbuffer *dest, const oh_big_textbuffer *from);
/* Print just the Data portions of the text structures */
SaErrorT oh_fprint_bigtext(FILE *stream, const oh_big_textbuffer *big_buffer);
/************************************
* HPI structure to string conversion
************************************/
SaErrorT oh_decode_manufacturerid(SaHpiManufacturerIdT value,
SaHpiTextBufferT *buffer);
SaErrorT oh_decode_sensorreading(SaHpiSensorReadingT reading,
SaHpiSensorDataFormatT format,
SaHpiTextBufferT *buffer);
SaErrorT oh_encode_sensorreading(SaHpiTextBufferT *buffer,
SaHpiSensorReadingTypeT type,
SaHpiSensorReadingT *reading);
SaErrorT oh_decode_capabilities(SaHpiCapabilitiesT ResourceCapabilities,
SaHpiTextBufferT *buffer);
SaErrorT oh_decode_hscapabilities(SaHpiHsCapabilitiesT HsCapabilities,
SaHpiTextBufferT *buffer);
SaErrorT oh_decode_sensoroptionaldata(SaHpiSensorOptionalDataT sensor_opt_data,
SaHpiTextBufferT *buffer);
SaErrorT oh_decode_sensorenableoptdata(SaHpiSensorEnableOptDataT sensor_enable_opt_data,
SaHpiTextBufferT *buffer);
SaErrorT oh_decode_dimitestcapabilities(SaHpiDimiTestCapabilityT capabilities,
SaHpiTextBufferT *buffer);
SaErrorT oh_decode_fumiprotocols(SaHpiFumiProtocolT protocols,
SaHpiTextBufferT *buffer);
SaErrorT oh_decode_fumicapabilities(SaHpiFumiCapabilityT capabilities,
SaHpiTextBufferT *buffer);
/*************************
* Validate HPI structures
*************************/
SaHpiBoolT oh_valid_textbuffer(SaHpiTextBufferT *buffer);
SaErrorT oh_valid_thresholds(SaHpiSensorThresholdsT *thds,
SaHpiRdrT *rdr);
SaErrorT oh_valid_ctrl_state_mode(SaHpiCtrlRecT *ctrl_rdr,
SaHpiCtrlModeT mode,
SaHpiCtrlStateT *state);
/************************
* Compare HPI structures
************************/
int oh_compare_sensorreading(SaHpiSensorReadingTypeT type,
SaHpiSensorReadingT *reading1,
SaHpiSensorReadingT *reading2);
/***************************
* Print HPI data structures
***************************/
#define OH_PRINT_OFFSET " " /* Offset string */
SaErrorT oh_append_offset(oh_big_textbuffer *buffer, int offsets);
SaErrorT oh_fprint_event(FILE *stream,
const SaHpiEventT *event,
const SaHpiEntityPathT *entitypath,
int offsets);
SaErrorT oh_fprint_idrfield(FILE *stream, const SaHpiIdrFieldT *thisfield, int offsets);
SaErrorT oh_fprint_idrinfo(FILE *stream, const SaHpiIdrInfoT *idrInfo, int offsets);
SaErrorT oh_fprint_idrareaheader(FILE *stream, const SaHpiIdrAreaHeaderT *areaHeader, int offsets);
SaErrorT oh_fprint_rptentry(FILE *stream, const SaHpiRptEntryT *rptEntry, int offsets);
SaErrorT oh_fprint_sensorrec(FILE *stream, const SaHpiSensorRecT *sensor, int offsets);
SaErrorT oh_fprint_rdr(FILE *stream, const SaHpiRdrT *rdrEntry, int offsets);
SaErrorT oh_fprint_textbuffer(FILE *stream, const SaHpiTextBufferT *textbuffer, int offsets);
SaErrorT oh_fprint_ctrlrec(FILE *stream, const SaHpiCtrlRecT *control, int offsets);
SaErrorT oh_fprint_watchdogrec(FILE *stream, const SaHpiWatchdogRecT *watchdog, int offsets);
SaErrorT oh_fprint_eventloginfo(FILE *stream, const SaHpiEventLogInfoT *thiselinfo, int offsets);
SaErrorT oh_fprint_eventlogentry(FILE *stream,
const SaHpiEventLogEntryT *thiseventlog,
const SaHpiEntityPathT *entitypath,
int offsets);
SaErrorT oh_fprint_ctrlstate(FILE *stream, const SaHpiCtrlStateT *thisctrlstate, int offsets);
SaErrorT oh_fprint_thresholds(FILE *stream,
const SaHpiSensorThresholdsT *thresholds,
const SaHpiSensorDataFormatT *format,
int offsets);
SaErrorT oh_print_text(const SaHpiTextBufferT *buffer);
SaErrorT oh_print_bigtext(const oh_big_textbuffer *big_buffer);
SaErrorT oh_print_event(const SaHpiEventT *event, const SaHpiEntityPathT *entitypath, int offsets);
SaErrorT oh_print_idrfield(const SaHpiIdrFieldT *thisfield, int offsets);
SaErrorT oh_print_idrinfo(const SaHpiIdrInfoT *idrInfo, int offsets);
SaErrorT oh_print_idrareaheader(const SaHpiIdrAreaHeaderT *areaHeader, int offsets);
SaErrorT oh_print_rptentry(const SaHpiRptEntryT *rptEntry, int offsets);
SaErrorT oh_print_sensorrec(const SaHpiSensorRecT *sensor, int offsets);
SaErrorT oh_print_rdr(const SaHpiRdrT *rdrEntry, int offsets);
SaErrorT oh_print_textbuffer(const SaHpiTextBufferT *textbuffer, int offsets);
SaErrorT oh_print_ctrlrec(const SaHpiCtrlRecT *control, int offsets);
SaErrorT oh_print_watchdogrec(const SaHpiWatchdogRecT *watchdog, int offsets);
SaErrorT oh_print_eventloginfo(const SaHpiEventLogInfoT *thiselinfo, int offsets);
SaErrorT oh_print_eventlogentry(const SaHpiEventLogEntryT *thiseventlog, const SaHpiEntityPathT *entitypath, int offsets);
SaErrorT oh_print_ctrlstate(const SaHpiCtrlStateT *thisctrlstate, int offsets);
SaErrorT oh_print_thresholds(const SaHpiSensorThresholdsT *thresholds,
const SaHpiSensorDataFormatT *format,
int offsets);
SaErrorT oh_build_event(oh_big_textbuffer *buffer, const SaHpiEventT *event, const SaHpiEntityPathT *entitypath, int offsets);
SaErrorT oh_build_threshold_mask(oh_big_textbuffer *buffer, const SaHpiSensorThdMaskT tmask, int offsets);
extern FILE *fopen(const char *path, const char *mode);
extern int fclose(FILE *fp);
#ifdef __cplusplus
}
#endif
#endif