기존 이솝 임베디드 포럼의 지식인 서비스가 게시판 형태로 변경되었습니다.

안녕하세요...

 

제가 지금 AudioFlinger에서 Har 단 연결 부분을 보고 있는데요....

이 부분에  

 int err = hw_get_module(ALSA_HARDWARE_MODULE_ID,
            (hw_module_t const**)&module);

 

라는 구문이 있더라구요....구글링을 해보니...

 

hw_get_module()함수를 사용하여 "alsa"라는 이름을 가진  module을 가져온다.

err = module->methods->open(module, ALSA_HARDWARE_NAME, &device);
==> module의 open함수를 실행하면 driver의 구조체를 획득할 수 있다.

 

뭐 이렇게 말하는데...도무지 제 실력으로는 감이 안 옵니다..

 

여기서 말하는 hw_module_t 구조체의 맵버들의 의미를 알게 되면 어느 정도 궁금증이 해소 될 듯한데요...

특히, audio Flinger와 har 연결 부분에 왜 이 구문이 등장하는지.... 원....

 

다음,,,hw_module_t 구조체 입니다... 각 맵버들의 의미를  아시는 분 설명 좀 부탁 드려요..

typedef struct hw_module_t {
    /** tag must be initialized to HARDWARE_MODULE_TAG */
    uint32_t tag;

    /** major version number for the module */
    uint16_t version_major;

    /** minor version number of the module */
    uint16_t version_minor;

    /** Identifier of module */
    const char *id;

    /** Name of this module */
    const char *name;

    /** Author/owner/implementor of the module */
    const char *author;

    /** Modules methods */
    struct hw_module_methods_t* methods;

    /** module's dso */
    void* dso;

    /** padding to 128 bytes, reserved for future use */
    uint32_t reserved[32-7];

} hw_module_t;

typedef struct hw_module_methods_t {
    /** Open a specific device */
    int (*open)(const struct hw_module_t* module, const char* id,
            struct hw_device_t** device);

} hw_module_methods_t;


고도리

2011.05.19 09:40:06
*.200.239.234

워낙 다양하게 적용되도록 구성이 된 structure입니다.


소스를 그냥 분석하시는게 가장 빠를 듯 하고요.

간단하게 말씀드리면.....


case by case입니다.


관련 소스는


hardware/libhardware/hardware.c와

hardware/libhardware/modules/overlay/overlay.cpp


를 참고하시면 될겁니다.

List of Articles
번호 제목 글쓴이 날짜 조회 수sort

사용자 로그인