halapi: common: Add hal_common_(get|put)_backend() function to handle backend data 61/250461/4 accepted/tizen/unified/20210104.130218 submit/tizen/20210104.043912
authorChanwoo Choi <cw00.choi@samsung.com>
Mon, 28 Dec 2020 04:43:47 +0000 (13:43 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 28 Dec 2020 08:59:04 +0000 (17:59 +0900)
commit5d2b552a3dea8299299fd153c2ea7f51d928ed1a
tree5f245423cf27c304fe4bf760e2a17e4bb117567e
parentee9bfb651823262cdade3229eeeaf429efd3f389
halapi: common: Add hal_common_(get|put)_backend() function to handle backend data

Following step is for getting the backend data which contains the
function pointers for each HAL module.
1. get library name of HAL backend
2. dlopen with library name
3. get symbol name of HAL backend
4. dlsym with symbol name
5. Get the backend data via backend->init()

In order to reduce the duplicate code on each HAL API packages,
add hal_common_get_backend() helper function which contains
the above steps to get the backend data.

And add hal_common_put_backend() helper function to free
the hal_backend instance and dlclose the shared library.

Change-Id: Ic603d3e4f0ba1ff2aed9699b1eaf925cbd97c60c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
CMakeLists.txt
include/hal-common-interface.h
include/hal-common.h
src/common.h
src/hal-api-common.c