blob: e53e296eff1ed2cdd803ef0b9ef2a96a593195e7 [file] [log] [blame]
/*
* 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 //// ***** 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)(bt_bdaddr_t* 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