Commit 9153bd43 authored by Thomas Guillem's avatar Thomas Guillem Committed by Martin Storsjö

Add missing hardware headers for gingerbread

This allows building most of the iomx hwbuffer code for gingerbread
as well, even though it's not hooked up completely yet.
Signed-off-by: Martin Storsjö's avatarMartin Storsjö <martin@martin.st>
parent ffb923c9
/*
* Copyright (C) 2008 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_COPYBIT_INTERFACE_H
#define ANDROID_COPYBIT_INTERFACE_H
#include <hardware/hardware.h>
#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS
/**
* The id of this module
*/
#define COPYBIT_HARDWARE_MODULE_ID "copybit"
/**
* Name of the graphics device to open
*/
#define COPYBIT_HARDWARE_COPYBIT0 "copybit0"
/* supported pixel-formats. these must be compatible with
* graphics/PixelFormat.java, ui/PixelFormat.h, pixelflinger/format.h
*/
enum {
COPYBIT_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888,
COPYBIT_FORMAT_RGBX_8888 = HAL_PIXEL_FORMAT_RGBX_8888,
COPYBIT_FORMAT_RGB_888 = HAL_PIXEL_FORMAT_RGB_888,
COPYBIT_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565,
COPYBIT_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888,
COPYBIT_FORMAT_RGBA_5551 = HAL_PIXEL_FORMAT_RGBA_5551,
COPYBIT_FORMAT_RGBA_4444 = HAL_PIXEL_FORMAT_RGBA_4444,
COPYBIT_FORMAT_YCbCr_422_SP = 0x10,
COPYBIT_FORMAT_YCrCb_420_SP = 0x11,
};
/* name for copybit_set_parameter */
enum {
/* rotation of the source image in degrees (0 to 359) */
COPYBIT_ROTATION_DEG = 1,
/* plane alpha value */
COPYBIT_PLANE_ALPHA = 2,
/* enable or disable dithering */
COPYBIT_DITHER = 3,
/* transformation applied (this is a superset of COPYBIT_ROTATION_DEG) */
COPYBIT_TRANSFORM = 4,
/* blurs the copied bitmap. The amount of blurring cannot be changed
* at this time. */
COPYBIT_BLUR = 5
};
/* values for copybit_set_parameter(COPYBIT_TRANSFORM) */
enum {
/* flip source image horizontally */
COPYBIT_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H,
/* flip source image vertically */
COPYBIT_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,
/* rotate source image 90 degres */
COPYBIT_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,
/* rotate source image 180 degres */
COPYBIT_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,
/* rotate source image 270 degres */
COPYBIT_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
};
/* enable/disable value copybit_set_parameter */
enum {
COPYBIT_DISABLE = 0,
COPYBIT_ENABLE = 1
};
/* use get_static_info() to query static informations about the hardware */
enum {
/* Maximum amount of minification supported by the hardware*/
COPYBIT_MINIFICATION_LIMIT = 1,
/* Maximum amount of magnification supported by the hardware */
COPYBIT_MAGNIFICATION_LIMIT = 2,
/* Number of fractional bits support by the scaling engine */
COPYBIT_SCALING_FRAC_BITS = 3,
/* Supported rotation step in degres. */
COPYBIT_ROTATION_STEP_DEG = 4,
};
/* Image structure */
struct copybit_image_t {
/* width */
uint32_t w;
/* height */
uint32_t h;
/* format COPYBIT_FORMAT_xxx */
int32_t format;
/* base of buffer with image */
void *base;
/* handle to the image */
native_handle_t* handle;
};
/* Rectangle */
struct copybit_rect_t {
/* left */
int l;
/* top */
int t;
/* right */
int r;
/* bottom */
int b;
};
/* Region */
struct copybit_region_t {
int (*next)(struct copybit_region_t const *region, struct copybit_rect_t *rect);
};
/**
* Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
* and the fields of this data structure must begin with hw_module_t
* followed by module specific information.
*/
struct copybit_module_t {
struct hw_module_t common;
};
/**
* Every device data structure must begin with hw_device_t
* followed by module specific public methods and attributes.
*/
struct copybit_device_t {
struct hw_device_t common;
/**
* Set a copybit parameter.
*
* @param dev from open
* @param name one for the COPYBIT_NAME_xxx
* @param value one of the COPYBIT_VALUE_xxx
*
* @return 0 if successful
*/
int (*set_parameter)(struct copybit_device_t *dev, int name, int value);
/**
* Get a static copybit information.
*
* @param dev from open
* @param name one of the COPYBIT_STATIC_xxx
*
* @return value or -EINVAL if error
*/
int (*get)(struct copybit_device_t *dev, int name);
/**
* Execute the bit blit copy operation
*
* @param dev from open
* @param dst is the destination image
* @param src is the source image
* @param region the clip region
*
* @return 0 if successful
*/
int (*blit)(struct copybit_device_t *dev,
struct copybit_image_t const *dst,
struct copybit_image_t const *src,
struct copybit_region_t const *region);
/**
* Execute the stretch bit blit copy operation
*
* @param dev from open
* @param dst is the destination image
* @param src is the source image
* @param dst_rect is the destination rectangle
* @param src_rect is the source rectangle
* @param region the clip region
*
* @return 0 if successful
*/
int (*stretch)(struct copybit_device_t *dev,
struct copybit_image_t const *dst,
struct copybit_image_t const *src,
struct copybit_rect_t const *dst_rect,
struct copybit_rect_t const *src_rect,
struct copybit_region_t const *region);
};
/** convenience API for opening and closing a device */
static inline int copybit_open(const struct hw_module_t* module,
struct copybit_device_t** device) {
return module->methods->open(module,
COPYBIT_HARDWARE_COPYBIT0, (struct hw_device_t**)device);
}
static inline int copybit_close(struct copybit_device_t* device) {
return device->common.close(&device->common);
}
__END_DECLS
#endif // ANDROID_COPYBIT_INTERFACE_H
/*
* Copyright (C) 2010 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_INCLUDE_HARDWARE_GPS_H
#define ANDROID_INCLUDE_HARDWARE_GPS_H
#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <pthread.h>
#include <hardware/hardware.h>
__BEGIN_DECLS
/**
* The id of this module
*/
#define GPS_HARDWARE_MODULE_ID "gps"
/** Milliseconds since January 1, 1970 */
typedef int64_t GpsUtcTime;
/** Maximum number of SVs for gps_sv_status_callback(). */
#define GPS_MAX_SVS 32
/** Requested operational mode for GPS operation. */
typedef uint32_t GpsPositionMode;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
/** Mode for running GPS standalone (no assistance). */
#define GPS_POSITION_MODE_STANDALONE 0
/** AGPS MS-Based mode. */
#define GPS_POSITION_MODE_MS_BASED 1
/** AGPS MS-Assisted mode. */
#define GPS_POSITION_MODE_MS_ASSISTED 2
/** Requested recurrence mode for GPS operation. */
typedef uint32_t GpsPositionRecurrence;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
/** Receive GPS fixes on a recurring basis at a specified period. */
#define GPS_POSITION_RECURRENCE_PERIODIC 0
/** Request a single shot GPS fix. */
#define GPS_POSITION_RECURRENCE_SINGLE 1
/** GPS status event values. */
typedef uint16_t GpsStatusValue;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
/** GPS status unknown. */
#define GPS_STATUS_NONE 0
/** GPS has begun navigating. */
#define GPS_STATUS_SESSION_BEGIN 1
/** GPS has stopped navigating. */
#define GPS_STATUS_SESSION_END 2
/** GPS has powered on but is not navigating. */
#define GPS_STATUS_ENGINE_ON 3
/** GPS is powered off. */
#define GPS_STATUS_ENGINE_OFF 4
/** Flags to indicate which values are valid in a GpsLocation. */
typedef uint16_t GpsLocationFlags;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
/** GpsLocation has valid latitude and longitude. */
#define GPS_LOCATION_HAS_LAT_LONG 0x0001
/** GpsLocation has valid altitude. */
#define GPS_LOCATION_HAS_ALTITUDE 0x0002
/** GpsLocation has valid speed. */
#define GPS_LOCATION_HAS_SPEED 0x0004
/** GpsLocation has valid bearing. */
#define GPS_LOCATION_HAS_BEARING 0x0008
/** GpsLocation has valid accuracy. */
#define GPS_LOCATION_HAS_ACCURACY 0x0010
/** Flags for the gps_set_capabilities callback. */
/** GPS HAL schedules fixes for GPS_POSITION_RECURRENCE_PERIODIC mode.
If this is not set, then the framework will use 1000ms for min_interval
and will start and call start() and stop() to schedule the GPS.
*/
#define GPS_CAPABILITY_SCHEDULING 0x0000001
/** GPS supports MS-Based AGPS mode */
#define GPS_CAPABILITY_MSB 0x0000002
/** GPS supports MS-Assisted AGPS mode */
#define GPS_CAPABILITY_MSA 0x0000004
/** GPS supports single-shot fixes */
#define GPS_CAPABILITY_SINGLE_SHOT 0x0000008
/** Flags used to specify which aiding data to delete
when calling delete_aiding_data(). */
typedef uint16_t GpsAidingData;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
#define GPS_DELETE_EPHEMERIS 0x0001
#define GPS_DELETE_ALMANAC 0x0002
#define GPS_DELETE_POSITION 0x0004
#define GPS_DELETE_TIME 0x0008
#define GPS_DELETE_IONO 0x0010
#define GPS_DELETE_UTC 0x0020
#define GPS_DELETE_HEALTH 0x0040
#define GPS_DELETE_SVDIR 0x0080
#define GPS_DELETE_SVSTEER 0x0100
#define GPS_DELETE_SADATA 0x0200
#define GPS_DELETE_RTI 0x0400
#define GPS_DELETE_CELLDB_INFO 0x8000
#define GPS_DELETE_ALL 0xFFFF
/** AGPS type */
typedef uint16_t AGpsType;
#define AGPS_TYPE_SUPL 1
#define AGPS_TYPE_C2K 2
typedef uint16_t AGpsSetIDType;
#define AGPS_SETID_TYPE_NONE 0
#define AGPS_SETID_TYPE_IMSI 1
#define AGPS_SETID_TYPE_MSISDN 2
/**
* String length constants
*/
#define GPS_NI_SHORT_STRING_MAXLEN 256
#define GPS_NI_LONG_STRING_MAXLEN 2048
/**
* GpsNiType constants
*/
typedef uint32_t GpsNiType;
#define GPS_NI_TYPE_VOICE 1
#define GPS_NI_TYPE_UMTS_SUPL 2
#define GPS_NI_TYPE_UMTS_CTRL_PLANE 3
/**
* GpsNiNotifyFlags constants
*/
typedef uint32_t GpsNiNotifyFlags;
/** NI requires notification */
#define GPS_NI_NEED_NOTIFY 0x0001
/** NI requires verification */
#define GPS_NI_NEED_VERIFY 0x0002
/** NI requires privacy override, no notification/minimal trace */
#define GPS_NI_PRIVACY_OVERRIDE 0x0004
/**
* GPS NI responses, used to define the response in
* NI structures
*/
typedef int GpsUserResponseType;
#define GPS_NI_RESPONSE_ACCEPT 1
#define GPS_NI_RESPONSE_DENY 2
#define GPS_NI_RESPONSE_NORESP 3
/**
* NI data encoding scheme
*/
typedef int GpsNiEncodingType;
#define GPS_ENC_NONE 0
#define GPS_ENC_SUPL_GSM_DEFAULT 1
#define GPS_ENC_SUPL_UTF8 2
#define GPS_ENC_SUPL_UCS2 3
#define GPS_ENC_UNKNOWN -1
/** AGPS status event values. */
typedef uint16_t AGpsStatusValue;
/** GPS requests data connection for AGPS. */
#define GPS_REQUEST_AGPS_DATA_CONN 1
/** GPS releases the AGPS data connection. */
#define GPS_RELEASE_AGPS_DATA_CONN 2
/** AGPS data connection initiated */
#define GPS_AGPS_DATA_CONNECTED 3
/** AGPS data connection completed */
#define GPS_AGPS_DATA_CONN_DONE 4
/** AGPS data connection failed */
#define GPS_AGPS_DATA_CONN_FAILED 5
#define AGPS_REF_LOCATION_TYPE_GSM_CELLID 1
#define AGPS_REF_LOCATION_TYPE_UMTS_CELLID 2
#define AGPS_REG_LOCATION_TYPE_MAC 3
/** Network types for update_network_state "type" parameter */
#define AGPS_RIL_NETWORK_TYPE_MOBILE 0
#define AGPS_RIL_NETWORK_TYPE_WIFI 1
#define AGPS_RIL_NETWORK_TYPE_MOBILE_MMS 2
#define AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL 3
#define AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN 4
#define AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI 5
#define AGPS_RIL_NETWORK_TTYPE_WIMAX 6
/**
* Name for the GPS XTRA interface.
*/
#define GPS_XTRA_INTERFACE "gps-xtra"
/**
* Name for the GPS DEBUG interface.
*/
#define GPS_DEBUG_INTERFACE "gps-debug"
/**
* Name for the AGPS interface.
*/
#define AGPS_INTERFACE "agps"
/**
* Name for NI interface
*/
#define GPS_NI_INTERFACE "gps-ni"
/**
* Name for the AGPS-RIL interface.
*/
#define AGPS_RIL_INTERFACE "agps_ril"
/** Represents a location. */
typedef struct {
/** set to sizeof(GpsLocation) */
size_t size;
/** Contains GpsLocationFlags bits. */
uint16_t flags;
/** Represents latitude in degrees. */
double latitude;
/** Represents longitude in degrees. */
double longitude;
/** Represents altitude in meters above the WGS 84 reference
* ellipsoid. */
double altitude;
/** Represents speed in meters per second. */
float speed;
/** Represents heading in degrees. */
float bearing;
/** Represents expected accuracy in meters. */
float accuracy;
/** Timestamp for the location fix. */
GpsUtcTime timestamp;
} GpsLocation;
/** Represents the status. */
typedef struct {
/** set to sizeof(GpsStatus) */
size_t size;
GpsStatusValue status;
} GpsStatus;
/** Represents SV information. */
typedef struct {
/** set to sizeof(GpsSvInfo) */
size_t size;
/** Pseudo-random number for the SV. */
int prn;
/** Signal to noise ratio. */
float snr;
/** Elevation of SV in degrees. */
float elevation;
/** Azimuth of SV in degrees. */
float azimuth;
} GpsSvInfo;
/** Represents SV status. */
typedef struct {
/** set to sizeof(GpsSvStatus) */
size_t size;
/** Number of SVs currently visible. */
int num_svs;
/** Contains an array of SV information. */
GpsSvInfo sv_list[GPS_MAX_SVS];
/** Represents a bit mask indicating which SVs
* have ephemeris data.
*/
uint32_t ephemeris_mask;
/** Represents a bit mask indicating which SVs
* have almanac data.
*/
uint32_t almanac_mask;
/**
* Represents a bit mask indicating which SVs
* were used for computing the most recent position fix.
*/
uint32_t used_in_fix_mask;
} GpsSvStatus;
/* 2G and 3G */
/* In 3G lac is discarded */
typedef struct {
uint16_t type;
uint16_t mcc;
uint16_t mnc;
uint16_t lac;
uint32_t cid;
} AGpsRefLocationCellID;
typedef struct {
uint8_t mac[6];
} AGpsRefLocationMac;
/** Represents ref locations */
typedef struct {
uint16_t type;
union {
AGpsRefLocationCellID cellID;
AGpsRefLocationMac mac;
} u;
} AGpsRefLocation;
/** Callback with location information.
* Can only be called from a thread created by create_thread_cb.
*/
typedef void (* gps_location_callback)(GpsLocation* location);
/** Callback with status information.
* Can only be called from a thread created by create_thread_cb.
*/
typedef void (* gps_status_callback)(GpsStatus* status);
/** Callback with SV status information.
* Can only be called from a thread created by create_thread_cb.
*/
typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info);
/** Callback for reporting NMEA sentences.
* Can only be called from a thread created by create_thread_cb.
*/
typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length);
/** Callback to inform framework of the GPS engine's capabilities.
* Capability parameter is a bit field of GPS_CAPABILITY_* flags.
*/
typedef void (* gps_set_capabilities)(uint32_t capabilities);
/** Callback utility for acquiring the GPS wakelock.
* This can be used to prevent the CPU from suspending while handling GPS events.
*/
typedef void (* gps_acquire_wakelock)();
/** Callback utility for releasing the GPS wakelock. */
typedef void (* gps_release_wakelock)();
/** Callback for creating a thread that can call into the Java framework code.
* This must be used to create any threads that report events up to the framework.
*/
typedef pthread_t (* gps_create_thread)(const char* name, void (*start)(void *), void* arg);
/** GPS callback structure. */
typedef struct {
/** set to sizeof(GpsCallbacks) */
size_t size;
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;
} GpsCallbacks;
/** Represents the standard GPS interface. */
typedef struct {
/** set to sizeof(GpsInterface) */
size_t size;
/**
* Opens the interface and provides the callback routines