File: test.h

package info (click to toggle)
android-platform-system-tools-hidl 10.0.0%2Br36-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,936 kB
  • sloc: cpp: 21,933; yacc: 1,416; java: 1,239; lex: 496; sh: 360; python: 44; xml: 20; makefile: 12
file content (382 lines) | stat: -rw-r--r-- 10,923 bytes parent folder | download | duplicates (3)
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ANDROID_FB_INTERFACE_H
#define ANDROID_FB_INTERFACE_H


#include <onelib>
#include <there/somelib.h>
#include "mylib.h"

__BEGIN_DECLS

// comments

#define MY_DEFINE 1 \
                  + 1
#define META(thing1, thing2) thing1 + thing2
#define VERSION HARDWARE_MODULE_API_VERSION(0, 1)
#define ONE 1 /* got to
                 get rid of magic numbers */

/* test */
/* test **/
/* test / ** ** / test */
/* test //// ***** test /****/

#define a 1l
#define b 1l + 2ll
#define c 1ul + 1l
#define d 2 + 1l
#define e 3 + 1ll
#define f 4 + 3ul
#define g 1l + 3
#define h 32u
#define i 64ull
#define j 2 + a
#define k 1u
#define l k + 1l

/*****************************************************************************/
typedef enum {
    A = 47,
    /* B is a very important value */
    B,
#ifdef UNHAPPY
    C = 1 + test(19) + test2[21],
#endif
    D = 1 ? 1 : 2
} onehere;

inline std::string to_string(T value) { return to_string(static_cast<E>(value)); }

const res_t RESULT_ACCESS_DENIED = ~2 | -1;
const res_t RESULT_INVALID_PARAMETER = 54;

#ifdef __cplusplus
extern "C" {
#endif

static void fun1() { }

typedef int my_int_type;
typedef my_int_type my_type_two;

namespace MyNamespace {
    static void fun1() { }
    static void fun2() { }
}

#ifdef __cplusplus
}
#endif

static void fun3() { test; }
static void fun4() { test; }

#undef ONE

typedef void (*no_arg_fun)(void);

typedef int (*other_fun)(int j);

typedef void (*alarm_cb)(void *data);

typedef void (*special_types)(const native_handle_t* a, int b);

typedef foo_t bar_t;

struct baz_t;

typedef pthread_t (* fun_with_funs)(void (*my_fun)(void *), void* arg);

int (*global_fun_1)(struct framebuffer_device_t* dev, int enable);
int (*global_fun_2)(struct framebuffer_device_t* dev, int enable);

typedef struct framebuffer_device_t {
    /*
     * Common methods of the framebuffer device.
     */
    struct hw_device_t common;

    typedef enum another_here {
        A = 3 | 4,
        B,
        C = 4
    } another_here;

    /* anon struct */
    struct {
        float b;
    };

    struct not_type_defd {
        double latitude[];
        double halfLongitude;
    };

    char here;

    /* flags describing some attributes of the framebuffer */
    const uint32_t  flags;

    /* dimensions of the framebuffer in pixels */
    const uint32_t  width;
    const uint32_t  height;

    /* frambuffer stride in pixels */
    const int       stride;

    /* framebuffer pixel format */
    const int       format_type;

    /* resolution of the framebuffer's display panel in pixel per inch*/
    const float     xdpi;
    const float     ydpi;

    /* framebuffer's display panel refresh rate in frames per second */
    const float     fps;

    /* min swap interval supported by this framebuffer */
    const int       minSwapInterval;

    /* max swap interval supported by this framebuffer */
    const int       maxSwapInterval;

    /* Number of framebuffers supported*/
    const int       numFramebuffers;

    int reserved[7];

    /*
     * requests a specific swap-interval (same definition than EGL)
     *
     * Returns 0 on success or -errno on error.
     */
    int (*setSwapInterval)(struct framebuffer_device_t* window,
            int interval);

    /*
     * This hook is OPTIONAL.
     *
     * It is non NULL If the framebuffer driver supports "update-on-demand"
     * and the given rectangle is the area of the screen that gets
     * updated during (*post)().
     *
     * This is useful on devices that are able to DMA only a portion of
     * the screen to the display panel, upon demand -- as opposed to
     * constantly refreshing the panel 60 times per second, for instance.
     *
     * Only the area defined by this rectangle is guaranteed to be valid, that
     * is, the driver is not allowed to post anything outside of this
     * rectangle.
     *
     * The rectangle evaluated during (*post)() and specifies which area
     * of the buffer passed in (*post)() shall to be posted.
     *
     * return -EINVAL if width or height <=0, or if left or top < 0
     */
    int (*setUpdateRect)(struct framebuffer_device_t* window,
            int left, int top, int width, int height);

    /*
     * Post <buffer> to the display (display it on the screen)
     * The buffer must have been allocated with the
     *   GRALLOC_USAGE_HW_FB usage flag.
     * buffer must be the same width and height as the display and must NOT
     * be locked.
     *
     * The buffer is shown during the next VSYNC.
     *
     * If the same buffer is posted again (possibly after some other buffer),
     * post() will block until the the first post is completed.
     *
     * Internally, post() is expected to lock the buffer so that a
     * subsequent call to gralloc_module_t::(*lock)() with USAGE_RENDER or
     * USAGE_*_WRITE will block until it is safe; that is typically once this
     * buffer is shown and another buffer has been posted.
     *
     * Returns 0 on success or -errno on error.
     */
    int (*post)(struct framebuffer_device_t* dev, buffer_handle_t buffer);


    /*
     * The (*compositionComplete)() method must be called after the
     * compositor has finished issuing GL commands for client buffers.
     */

    int (*compositionComplete)(struct framebuffer_device_t* dev);

    /*
     * This hook is OPTIONAL.
     *
     * If non NULL it will be caused by SurfaceFlinger on dumpsys
     */
    void (*dump)(struct framebuffer_device_t* dev, char *buff, int buff_len);

    /*
     * (*enableScreen)() is used to either blank (enable=0) or
     * unblank (enable=1) the screen this framebuffer is attached to.
     *
     * Returns 0 on success or -errno on error.
     */
    int (*enableScreen)(struct framebuffer_device_t* dev, int enable);

    void* reserved_proc[6];

} framebuffer_device_t;

typedef int context_hub_callback(uint32_t hub_id, const struct hub_message_t *rxed_msg, void *cookie);

typedef struct my_other_t {

    int a;
    int b[];
    int c[3];
    int d[][];
    int e[3][];
    int f[3][5];
    int g[4+4][6 * 6][];
    int h[1][2][][3][4][5][6][7][8];

    unsigned int i;
    unsigned int8_t j;
    unsigned int16_t k;
    unsigned int32_t l;
    unsigned int64_t m;
    unsigned int32_t * n;
    const unsigned int32_t *** o;
    unsigned p;
    short q;
    long r;
    unsigned short s;
    unsigned long t;
    unsigned char u;
    char v;

    int (*store_meta_data_in_buffers)(struct camera_device *, int enable);

    typedef void (*scan_result_callback)(FooFooBarFoo* bda, int rssi, vector<uint8_t> adv_data);

    pthread_t (* gps_create_thread)(const char* name, void (*start)(void *), void* arg);

    int (*p1)(struct framebuffer_device_t* dev);

    void (*p2)(struct framebuffer_device_t* dev, char *buff, int buff_len);

    int (*p3)(struct framebuffer_device_t* dev, int enable[3][4][5]);


    int (*get_supported_activities_list)(struct activity_recognition_module* module,
            char const* const* *activity_list);

    int (*read_energy_info)();
    void (*reserved_procs[16 - 4])(void);

} my_other_t;

#define another 4

typedef struct {
    /** set to sizeof(GpsCallbacks_v1) */
    size_t      size;
    myWierdSize mySize;
    wchar_t     MyWideChar;

    gps_location_callback location_cb;
    gps_status_callback status_cb;
    gps_sv_status_callback sv_status_cb;
    gps_nmea_callback nmea_cb;
    gps_set_capabilities set_capabilities_cb;
    gps_acquire_wakelock acquire_wakelock_cb;
    gps_release_wakelock release_wakelock_cb;
    gps_create_thread create_thread_cb;
    gps_request_utc_time request_utc_time_cb;
} __attribute__((packed)) GpsCallbacks_v1;

typedef struct one_name {
    float a;
} another_name;

typedef struct this_t {
    int hello;
} this_t;

typedef union that_t {
    float a;
    float c;
} that_t;

/*
 * return the frame size (number of bytes per sample) of an output stream.
 */
static inline size_t audio_stream_out_frame_size(const struct audio_stream_out *s)
{
    size_t chan_samp_sz;
    audio_format_t format = s->common.get_format(&s->common);

    if (audio_has_proportional_frames(format)) {
        chan_samp_sz = audio_bytes_per_sample(format);
        return audio_channel_count_from_out_mask(s->common.get_channels(&s->common)) * chan_samp_sz;
    }

    return sizeof(int8_t);
}

/* effective and commanding */
enum effect_command_e {
   EFFECT_CMD_INIT,                 // initialize effect engine
   EFFECT_CMD_SET_CONFIG,           // configure effect engine (see effect_config_t)
   EFFECT_CMD_RESET,                // reset effect engine
   EFFECT_CMD_ENABLE,               // enable effect process
   EFFECT_CMD_DISABLE,              // disable effect process
   EFFECT_CMD_SET_PARAM,            // set parameter immediately (see effect_param_t)
   EFFECT_CMD_SET_PARAM_DEFERRED,   // set parameter deferred
   EFFECT_CMD_SET_PARAM_COMMIT,     // commit previous set parameter deferred
   EFFECT_CMD_GET_PARAM,            // get parameter
   EFFECT_CMD_SET_DEVICE,           // set audio device (see audio.h, audio_devices_t)
   EFFECT_CMD_SET_VOLUME,           // set volume
   EFFECT_CMD_SET_AUDIO_MODE,       // set the audio mode (normal, ring, ...)
   EFFECT_CMD_SET_CONFIG_REVERSE,   // configure effect engine reverse stream(see effect_config_t)
   EFFECT_CMD_SET_INPUT_DEVICE,     // set capture device (see audio.h, audio_devices_t)
   EFFECT_CMD_GET_CONFIG,           // read effect engine configuration
   EFFECT_CMD_GET_CONFIG_REVERSE,   // read configure effect engine reverse stream configuration
   EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS,// get all supported configurations for a feature.
   EFFECT_CMD_GET_FEATURE_CONFIG,   // get current feature configuration
   EFFECT_CMD_SET_FEATURE_CONFIG,   // set current feature configuration
   EFFECT_CMD_SET_AUDIO_SOURCE,     // set the audio source (see audio.h, audio_source_t)
   EFFECT_CMD_OFFLOAD,              // set if effect thread is an offload one,
                                    // send the ioHandle of the effect thread
   EFFECT_CMD_FIRST_PROPRIETARY = 0x10000 // first proprietary command code
};


namespace myspace {
enum class enum_class : int32_t {
    great,
};
} // namespace myspace

enum struct enum_struct {
    great,
};


__END_DECLS

#endif