WEB开发网
开发学院手机开发Android 开发 Android HAL 阅读

Android HAL

 2010-04-21 06:36:00 来源:WEB开发网   
核心提示:struct led_module_t {struct hw_module_t common;/* support API for LEDServices constructor */};struct led_control_device_t {struct hw_device_t common;/* supporti

struct led_module_t {

struct hw_module_t common;

/* support API for LEDServices constructor */

};

struct led_control_device_t {

struct hw_device_t common;

/* supporting control APIs go here */

int (*getcount_led)(struct led_control_device_t *dev);

int (*set_on)(struct led_control_device_t *dev);

int (*set_off)(struct led_control_device_t *dev);

};

struct led_control_context_t {

struct led_control_device_t device;

};

led.c 文件:

#define LOG_TAG "LedStub"

#include

#include

#include

#include

#include

#include "../include/led.h"

static int led_device_close(struct hw_device_t* device)

{

struct led_control_context_t* ctx = (struct led_control_context_t*)device;

if (ctx) {

free(ctx);

}

return 0;

}

static int led_getcount(struct led_control_device_t *dev)

{

LOGI("led_getcount");

return 4;

}

static int led_set_on(struct led_control_device_t *dev)

{

//FIXME: do system call to control gpio led

LOGI("led_set_on");

return 0;

}

static int led_set_off(struct led_control_device_t *dev)

{

//FIXME: do system call to control gpio led

LOGI("led_set_off");

return 0;

}

static int led_device_open(const struct hw_module_t* module, const char* name,

struct hw_device_t** device)

{

struct led_control_context_t *context;

LOGD("led_device_open");

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:Android HAL

编辑录入:coldstar [复制链接] [打 印]
赞助商链接