aboutsummaryrefslogtreecommitdiff
path: root/gdb/rdi-share/params.h
blob: 5b0757bc92d7a27af0160a4649d264ee355474a3 (plain)
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
179
180
181
/* 
 * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
 * 
 * This software may be freely used, copied, modified, and distributed
 * provided that the above copyright notice is preserved in all copies of the
 * software.
 */

/* -*-C-*-
 *
 * $Revision$
 *     $Date$
 *
 *
 *   Project: ANGEL
 *
 *     Title: Parameter negotiation structures and utilities
 */

#ifndef angel_params_h
#define angel_params_h

#include "angel.h"
#include "adp.h"

#ifndef TARGET
# include "host.h"
#endif

/* A single parameter, with tag */
typedef struct Parameter {
      ADP_Parameter     type;
      unsigned int      value;
} Parameter;

/* A list of parameter values, with tag */
typedef struct ParameterList {
      ADP_Parameter     type;
      unsigned int      num_options;
      unsigned int     *option; /* points to array of values */
} ParameterList;

/* A configuration of one or more parameters */
typedef struct ParameterConfig {
      unsigned int      num_parameters;
      Parameter        *param;  /* pointer to array of Parameters */
} ParameterConfig;

/* A set of parameter options */
typedef struct ParameterOptions {
      unsigned int      num_param_lists;
      ParameterList    *param_list; /* pointer to array of ParamLists */
} ParameterOptions;

/*
 * Function: Angel_MatchParams
 *  Purpose: find a configuration from the requested options which is
 *           the best match from the supported options.
 *
 *   Params:
 *              Input: requested      The offered set of parameters.
 *                     supported      The supported set of parameters.
 *
 *            Returns: ptr to config  A match has been made, ptr to result
 *                                      will remain valid until next call to
 *                                      this function.
 *                     NULL           Match not possible
 */
const ParameterConfig *Angel_MatchParams( const ParameterOptions *requested,
                                          const ParameterOptions *supported );

/*
 * Function: Angel_FindParam
 *  Purpose: find the value of a given parameter from a config.
 *
 *   Params:
 *              Input: type     parameter type to find
 *                     config   config to search
 *             Output: value    parameter value if found
 *
 *            Returns: TRUE     parameter found
 *                     FALSE    parameter not found
 */
bool Angel_FindParam( ADP_Parameter          type,
                      const ParameterConfig *config,
                      unsigned int          *value );

/*
 * Function: Angel_StoreParam
 *  Purpose: store the value of a given parameter in a config.
 *
 *   Params:
 *             In/Out: config   config to store in
 *              Input: type     parameter type to store
 *                     value    parameter value if found
 *
 *            Returns: TRUE     parameter found and new value stored
 *                     FALSE    parameter not found
 */
bool Angel_StoreParam( ParameterConfig *config,
                       ADP_Parameter    type,
                       unsigned int     value );

/*
 * Function: Angel_FindParamList
 *  Purpose: find the parameter list of a given parameter from an options.
 *
 *   Params:
 *              Input: type     parameter type to find
 *                     options  options block to search
 *
 *            Returns: pointer to list
 *                     NULL     parameter not found
 */
ParameterList *Angel_FindParamList( const ParameterOptions *options,
                                    ADP_Parameter           type );

/*
 * Function: Angel_BuildParamConfigMessage
 *  Purpose: write a parameter config to a buffer in ADP format.
 *
 *   Params:
 *              Input: buffer   where to write to
 *                     config   the parameter config to write
 *
 *            Returns: number of characters written to buffer
 */
unsigned int Angel_BuildParamConfigMessage( unsigned char         *buffer,
                                            const ParameterConfig *config );

/*
 * Function: Angel_BuildParamOptionsMessage
 *  Purpose: write a parameter Options to a buffer in ADP format.
 *
 *   Params:
 *              Input: buffer   where to write to
 *                     options  the options block to write
 *
 *            Returns: number of characters written to buffer
 */
unsigned int Angel_BuildParamOptionsMessage( unsigned char          *buffer,
                                             const ParameterOptions *options );

/*
 * Function: Angel_ReadParamConfigMessage
 *  Purpose: read a parameter config from a buffer where it is in ADP format.
 *
 *   Params:
 *              Input: buffer   where to read from
 *             In/Out: config   the parameter config to read to, which must
 *                              be set up on entry with a valid array, and
 *                              the size of the array in num_parameters.
 *
 *            Returns: TRUE     okay
 *                     FALSE    not enough space in config
 */
bool Angel_ReadParamConfigMessage( const unsigned char *buffer,
                                   ParameterConfig     *config );

/*
 * Function: Angel_ReadParamOptionsMessage
 *  Purpose: read a parameter options from a buffer
 *             where it is in ADP format.
 *
 *   Params:
 *              Input: buffer   where to read from
 *             In/Out: options  the parameter options block to read to, 
 *                                which must be set up on entry with a valid
 *                                array, and the size of the array in
 *                                num_parameters.  Each param_list must
 *                                also be set up in the same way.
 *
 *            Returns: TRUE     okay
 *                     FALSE    not enough space in options
 */
bool Angel_ReadParamOptionsMessage( const unsigned char *buffer,
                                    ParameterOptions    *options );

#endif /* ndef angel_params_h */

/* EOF params.h */