platform/hal/api/common.git
3 years agohaltest: Add net-config and connmand service for wifi-haltest 00/263900/2 accepted/tizen/6.5/unified/20211028.114854 accepted/tizen/unified/20210915.100031 submit/tizen/20210914.030309 submit/tizen_6.5/20211028.163201 tizen_6.5.m2_release
Chanwoo Choi [Mon, 13 Sep 2021 08:11:21 +0000 (17:11 +0900)]
haltest: Add net-config and connmand service for wifi-haltest

wifi-haltests requires the net-config and connmand daemon.
So that add two network daemon service.

Change-Id: I12f3f155fb14e5aff24e70740a6fba5892f3f426
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohaltest: Remove common-haltests from hal-api-common-haltests.rpm 19/263219/2 accepted/tizen/unified/20210907.121846 submit/tizen/20210830.024306 submit/tizen/20210906.072830
Chanwoo Choi [Thu, 15 Jul 2021 03:11:38 +0000 (12:11 +0900)]
haltest: Remove common-haltests from hal-api-common-haltests.rpm

The automatic haltests get the haltest binary by parsing the binary name
with *haltests*' pattern. Actually, common-haltests doesn't need to be
verified because it cannot verify any HAL backend library for hal.img.

Change-Id: Ibe99e4c51a571931c50768f89e64c94481adc61c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Add ENABLE_DLOG build option 35/262835/1 accepted/tizen/unified/20210827.045711 submit/tizen/20210825.032704 submit/tizen/20210826.082453
Chanwoo Choi [Fri, 20 Aug 2021 03:40:40 +0000 (12:40 +0900)]
halapi: Add ENABLE_DLOG build option

Add ENABLE_DLOG build option to support the case of
when DLOG should be disabled.

Also, if don't require dlog, hal-api-common is not able to use
tizen error value. So that change the error value to make it
minimum package dependency.

Change-Id: I52766750c3b8b547dbc9e2576e0e9a8b3d2b1232
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohal-rpmdb-checker: Add capability for /opt/etc/hal path 49/262749/1 accepted/tizen/unified/20210820.101814 submit/tizen/20210819.080213
Chanwoo Choi [Thu, 19 Aug 2021 06:40:22 +0000 (15:40 +0900)]
hal-rpmdb-checker: Add capability for /opt/etc/hal path

hal-rpmdb-checker.service has used /opt/etc/hal path in order to create
the files for both checking the platform booting is first booting and
hal rpmdb version are matched or not. So that /opt/etc/hal patch
should be set with the proper capability with UID/GID/Smack lable.

Change-Id: I07bec1b2f824d8a0114659346bab09911f863e42
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Delete unused code to make directory 99/261899/1 accepted/tizen/unified/20210803.123918 submit/tizen/20210729.015437
Seungha Son [Wed, 28 Jul 2021 11:31:17 +0000 (20:31 +0900)]
halapi: Delete unused code to make directory

 %{TZ_SYS_RO_ETC}/hal is not used directory then
 delete unused behavior to keep clean code.

Change-Id: Icc7a1085ab42fc2018ab5deb5e29bd5e983a8fea
Signed-off-by: Seungha Son <seungha.son@samsung.com>
3 years agohalapi: Remove build warning due to misused 'const' keyword 11/261511/1 accepted/tizen/unified/20210721.123533 submit/tizen/20210721.013304
Chanwoo Choi [Tue, 20 Jul 2021 09:17:18 +0000 (18:17 +0900)]
halapi: Remove build warning due to misused 'const' keyword

Remove the following build warning due to misused 'const' keyword.

[Build warning message]
[ 11%] Building C object CMakeFiles/hal-api-common.dir/src/hal-api-common.c.o
[ 22%] Building C object CMakeFiles/hal-api-common.dir/src/hal-api-conf.c.o
/home/abuild/rpmbuild/BUILD/hal-api-common-0.0.1/src/hal-api-common.c:
In function '__get_backend_library_data':
/home/abuild/rpmbuild/BUILD/hal-api-common-0.0.1/src/hal-api-common.c:684:9:
warning: passing argument 1 of 'g_free' discards 'const' qualifier
from pointer target type [-Wdiscarded-qualifiers]
  684 |  g_free(backend_module_name);

Change-Id: I8576581f3a40d140293fbbc62433107a25a9998b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Remove libtzplatform-config dependency 10/261510/1
Chanwoo Choi [Tue, 20 Jul 2021 09:15:12 +0000 (18:15 +0900)]
halapi: Remove libtzplatform-config dependency

Change-Id: I7b57ca09374ac2648939ab4fdd415401fe7c00e2
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Add new helper functions to get multiple library names 39/261139/5 accepted/tizen/unified/20210714.014120 submit/tizen/20210713.080137
Chanwoo Choi [Tue, 6 Jul 2021 09:21:49 +0000 (18:21 +0900)]
halapi: Add new helper functions to get multiple library names

In order to get the multiple library namse on device,
add new helper function as following. Firstly, get the number of HAL
backend libraries hal_common_get_backend_count() and the get the library
names by hal_common_get_backend_library_names().

- Get the number of the backend libraries according to the type of HAL module
int hal_common_get_backend_count(enum hal_module module);

- Get the backend library names according to the type of HAL module
int hal_common_get_backend_library_names(enum hal_module module,
                                       char **library_names,
                                       int library_count,
                                       int library_name_size);

Change-Id: If6ecc2f550693768e6e63a572dd99c791984e596
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Add new backend_module_name information 38/261138/3
Chanwoo Choi [Tue, 6 Jul 2021 11:02:12 +0000 (20:02 +0900)]
halapi: Add new backend_module_name information

Change-Id: I186359becfb908d3bd8bb78efc741da3daa87001
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Don't install hal-api.json 55/260155/1 accepted/tizen/unified/20210625.170417 submit/tizen/20210622.012446 submit/tizen/20210624.100841
Chanwoo Choi [Mon, 21 Jun 2021 09:23:14 +0000 (18:23 +0900)]
halapi: Don't install hal-api.json

hal-api.json is not used because of package dependcency issue.
Until fixing the issue, don't install hal-api.json.

Change-Id: Iaafaef11db0ae3a3d5a58812e679b3b1f4716f08
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohal-rpmdb-checker: Remove systemd-tmpfiles-setup.service dependency 49/260149/1
Chanwoo Choi [Mon, 21 Jun 2021 09:18:46 +0000 (18:18 +0900)]
hal-rpmdb-checker: Remove systemd-tmpfiles-setup.service dependency

When checking hal rpmdb dependency, systemd-tmpfiles.setup.service is
not necessary. Also, if add the dependency of systemd-tmpfiles.setup.service
to hal-rpmdb-checker.service, affect the booting time.
So that remove systemd-tmpfiles-setup.service dependency
from systemd-tmpfiles-setup.service

Change-Id: I25bc49c42b6edc81cf072ec133f8123f54b0adf9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalimg: Add hal-rpmdb-checker.service to check rpm version compatibility 95/258895/3
Chanwoo Choi [Thu, 29 Apr 2021 03:14:16 +0000 (12:14 +0900)]
halimg: Add hal-rpmdb-checker.service to check rpm version compatibility

For removing the h/w dependency from Tizen core image, decide to create
Tizen core image (core.img) and hal.img separately. It means that each
image is able to be built on different build time. So that in order to
guarnatee the compatibility between images, must need to check
the version compatiblity of rpm packages of hal backend packages in hal.img.

hal-rpmdb-checker.service will check the  the version compatiblity
between core.img and hal.img on booting time.

If there are no problem between images, hal-rpmdb-checker script
will create /opt/etc/hal/.hal-img-version.ini with hal.img build
information. Also, after writing the core.img, hal-rpmdb-checker
script will create /opt/etc/hal/.first-booting file to distinguish
whether booting is first or not.

Exmaple of /opt/etc/hal/.hal-img-version.ini
$cat /opt/etc/hal/.hal-img-version.ini
tizen-6.5-unified-gbm_20210525.030006;

Change-Id: I06c740d48478eae6671cec555e627e58e06ea119
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Fix svace issue when accessing hal-backend file 48/259948/1 accepted/tizen/unified/20210617.124845 submit/tizen/20210617.022719
Chanwoo Choi [Thu, 17 Jun 2021 02:13:13 +0000 (11:13 +0900)]
halapi: Fix svace issue when accessing hal-backend file

Fix savce TOCTOU[1] issue

[1] https://wiki.sei.cmu.edu/confluence/display/c/FIO45-C.+Avoid+TOCTOU+race+conditions+while+accessing+files

Change-Id: I20e8724afd5d27eb466223315fab11ebc9faf77c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohaltest: Change dmverity command according to the change of dmverity guide 43/259643/1
Chanwoo Choi [Wed, 2 Jun 2021 08:01:13 +0000 (17:01 +0900)]
haltest: Change dmverity command according to the change of dmverity guide

Change-Id: Ibcd023abdddea80bee7323ac841da1fc9809c570
Reported-by: INSUN PYO <insun.pyo@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Add new functions to get information of hal_backend structure 16/257516/4 accepted/tizen/unified/20210429.011907 submit/tizen/20210428.073114
Chanwoo Choi [Mon, 26 Apr 2021 10:06:56 +0000 (19:06 +0900)]
halapi: Add new functions to get information of hal_backend structure

The hal-api-common defines the common hal_backend structure for all hal
backend driver. Add new functions to provide the information of
hal_backend structure because of user request. Add the detailed function
roles as following:

[Newly added functions]
- hal_common_get_backend_abi_version(enum hal_module module);
  : Get the backend HAL ABI version according to the type of HAL module

- hal_common_get_backend_name(enum hal_module module, char *name, int size);
  : Get the backend name according to the type of HAL module

- hal_common_get_backend_vendor(enum hal_module module, char *vendor, int size);
  : Get the backend vendor description according to the type of HAL module

Change-Id: I2060e9047b60c029e161dc18f3981185a0f724a1
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Split the internal functions finely to get flexibility 15/257515/3
Chanwoo Choi [Thu, 22 Apr 2021 10:12:04 +0000 (19:12 +0900)]
halapi: Split the internal functions finely to get flexibility

New functions will use only __open_backend() without __close_backend()
in order to get the data of hal_backend structure. But this code have
been tightly coupled implemented in __get_backend and __put_backend.
In order to make the code more flexibility, split __get_backend/__put_backend
finley to two steps such as open/close and init/exit.

[Simple description for functions]
- __open_backend() : Open backend library and get backend symbol
- __close_backend() : Close backend library
- __init_backend() : After getting backend, initialize HAL backend driver
- __exit_backend() : After getting backend, exit HAL backend driver
- __get_backend()
__open_backend()
__init_backend()
Increase usage_count
- __put_backend()
__exit_backen()
__close_backend()
Decrease usage_count

[Change variable name in struct __hal_module_info]
- library_backend -> backend
- library_handle -> handle

Change-Id: I358e3f4db1991d26c8cf0498b3f37ec543da3e38
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Show process name when using hal-api library 14/257514/1
Chanwoo Choi [Fri, 23 Apr 2021 07:02:45 +0000 (16:02 +0900)]
halapi: Show process name when using hal-api library

The hal-api library are used by the various process.
In order to support the easy debugging, show the process name
who get/put the hal-api library.

Example log with process name,
HAL_MODULE_TBM: Get HAL backend: name(vc4)/vendor(Samsung)/library(/hal/lib64/libhal-backend-tbm.so)/count(1) by /usr/bin/enlightenment
HAL_MODULE_TBM: Get HAL backend: name(vc4)/vendor(Samsung)/library(/hal/lib64/libhal-backend-tbm.so)/count(1) by /usr/bin/boot-animation

Change-Id: I7befe874d17585cfffc79e05e32f90f1edcb284d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: conf: Remove unused local variables 13/257513/1
Chanwoo Choi [Thu, 22 Apr 2021 09:33:36 +0000 (18:33 +0900)]
halapi: conf: Remove unused local variables

Change-Id: Iab9597b3bd4d2bbfc258d62ca1302f8ba64169a4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Encapsulate unused variables by external user 12/257512/1
Chanwoo Choi [Wed, 21 Apr 2021 12:02:43 +0000 (21:02 +0900)]
halapi: Encapsulate unused variables by external user

The following variables are only used in hal-api-common
without exposing for external user. So that move them into internal
header files for encapsulation.
- enum hal_license
- enum hal_group
- char *const hal_group_string[]
- char *const hal_module_string[]

Change-Id: I18643fdbbabcabee7b6aefadff1ba36c8dc3a0fa
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Get backend library name always regardless of usage_count 11/257511/1
Chanwoo Choi [Wed, 21 Apr 2021 11:48:59 +0000 (20:48 +0900)]
halapi: Get backend library name always regardless of usage_count

The backend_library_name value is necessary to show the backend library
name always. So that get backend library name always regardless of usage_count
and then print 'close' message when close the fd of backend library.

Change-Id: I338bf22ac678bc80ceab020c7fd0c1ca1662254b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Replace fPIE gcc option with fPIC 76/257276/2
Chanwoo Choi [Thu, 22 Apr 2021 05:19:35 +0000 (14:19 +0900)]
halapi: Replace fPIE gcc option with fPIC

The fPIE option is for the executable binary.
It is not proper for shared library files.
So that correct the wrong use-case by using fPIC.

Change-Id: Id27d4a31080477415d9bc2bbaa0210039ff27233
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohaltest: Add haltest.target to support HAL TEST mode 43/255743/9 accepted/tizen/unified/20210330.111243 submit/tizen/20210325.061957 submit/tizen/20210330.004535
Chanwoo Choi [Tue, 23 Mar 2021 08:25:16 +0000 (17:25 +0900)]
haltest: Add haltest.target to support HAL TEST mode

In order to support HAL TEST Mode, add haltest.target which requires
the least running processes for only haltest such as sdbd service.
So that haltest.target is based on getty.target to support the console
and then add deviced.service/ac.service for supporting sdbd service.

And reboot-haltest/reboot-normal scripts are for switching between normal
mode and HALTEST mode.

[Essential service list in haltest.target]
- dbus.service for /usr/bin/dbus-daemon
- serial-getty@.service for console
- dlog_logger.service for /usr/bin/dlog_logger
- systemd-udevd.service for /usr/lib/sytemd/sytemd-udevd
- systemd-journald.service for /usr/bin/systemd/systemd-journald
- ac.service for /usr/bin/amd is requied for deviced.service
- deviced.service for /usr/bin/deviced is required for sdbd.service
- sdbd.service for /usr/sbin/sdbd

[Script commands to switch between Normal and HALTEST mode]
- reboot-haltest switches from Normal to HALTEST mode.
- reboot-normal switches from HALTEST to Normal mode.

Change-Id: If8fdd240003cf3509cec5f83bf8aacb3bc1a5ec6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Fix svace warning issue 62/255662/1 accepted/tizen/unified/20210324.124404 submit/tizen/20210323.015555
Chanwoo Choi [Mon, 22 Mar 2021 07:54:53 +0000 (16:54 +0900)]
halapi: Fix svace warning issue

Change-Id: I29f2405f1412a99066ae248c1a98f14cf6b30af9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Remove unneeded function definition from header file 49/255249/2 accepted/tizen/unified/20210317.034405 submit/tizen/20210316.021632 submit/tizen/20210316.040120
Chanwoo Choi [Tue, 16 Mar 2021 00:33:10 +0000 (09:33 +0900)]
halapi: Remove unneeded function definition from header file

_destroy_module_info() function is not used on outside of
hal-api-conf.c. So that remove the unneeded function defintion.

Change-Id: I13b17dcc8592d0a0a1c0d392eda9a9c13dd76155
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Replace hal-api.json with hal-api-list.h 11/255211/4
Chanwoo Choi [Mon, 15 Mar 2021 06:02:54 +0000 (15:02 +0900)]
halapi: Replace hal-api.json with hal-api-list.h

When using hal-api.json, the segmentation falut happen when trying
to use json-c library because of some library including json-c
statically. In order to fix this issue rapily, use the 'hal-api-list.h'
temporarily instead of 'hal-api.json'.

After fixing this issue, revert this patch for using 'hal-api.json'.

Change-Id: I22ba800b536e974879cbfa758f9160b896813c63
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Add new get_backend and put_backend with specific library name 98/254798/6 submit/tizen/20210316.010905
Chanwoo Choi [Tue, 9 Mar 2021 05:01:59 +0000 (14:01 +0900)]
halapi: Add new get_backend and put_backend with specific library name

Basically, hal_common_get_backend has used the promised libray name
for HAL backend like 'libhal-backend-[moodule name].so'. But, there are
some requirements that need to select the one HAL backend among the
multiple HAL backends on same device according to the role of use.

So that add the following two functions with new library_name argument.
- int hal_common_get_backend_with_library_name(enum hal_module module,
void **data, const char *library_name);
- int hal_common_put_backend_with_library_name(enum hal_module module,
void *data, const char *library_name);

[Constraints of library name]
This library_name argument must keep the naming rule as following:
-  'libhal-backend-[moodule name]-[extented name].so

Change-Id: Ia6c69597a718f5a4ae9de2f879f7c4337874b1ee
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Add more information to improve the readability for dlog 99/254799/2
Chanwoo Choi [Tue, 9 Mar 2021 07:44:06 +0000 (16:44 +0900)]
halapi: Add more information to improve the readability for dlog

In order to improve the readability, add more information
with library name and usage_count for multi-thread environment.

Change-Id: I71b3f68789556ccdf77275ba1932b39b1e7378f5
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Fix unlock issue when failed to parse hal-api.json 99/254699/1 accepted/tizen/unified/20210309.140641 submit/tizen/20210308.095802
Chanwoo Choi [Mon, 8 Mar 2021 09:44:47 +0000 (18:44 +0900)]
halapi: Fix unlock issue when failed to parse hal-api.json

There is deadlock issue without unlocking the mutex
when error happen. So that fix the unlock issue.

Change-Id: I4581202808f9b6f9b8b36c452663be1e59c4e7af
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Remove circular dependency between packages 20/254120/4 accepted/tizen/unified/20210225.130533 submit/tizen/20210224.090756 submit/tizen/20210225.073439
Seungha Son [Tue, 23 Feb 2021 14:58:19 +0000 (23:58 +0900)]
halapi: Remove circular dependency between packages

 Change json parsing library from json-glib to json-c
 because when using json-glib, the circular dependency
 problem between dependent rpm is occured.

 By changing the json-parser-lib from json-glib to json-c,
 the circular dependency was removed and the problem was solved.

Change-Id: I694e05649a875ea8a3af8128efc5be7c88282830
Signed-off-by: Seungha Son <seungha.son@samsung.com>
3 years agohalapi: Add macros.hal-api to add new rpm macro for /hal 20/253720/1 accepted/tizen/unified/20210219.040902 submit/tizen/20210217.033413 submit/tizen/20210217.044338 submit/tizen/20210218.022439
Chanwoo Choi [Wed, 17 Feb 2021 02:25:56 +0000 (11:25 +0900)]
halapi: Add macros.hal-api to add new rpm macro for /hal

Change-Id: Iae582e0d2b5912837beb1608bc4f0a8eba91595b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Move all extra files into packaging directory 17/253717/1
Chanwoo Choi [Wed, 17 Feb 2021 01:58:29 +0000 (10:58 +0900)]
halapi: Move all extra files into packaging directory

Change-Id: I5e09bfad0ee0d7f824a28198c2f35ad1727736da
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agosystemd: Add /hal/lib/firmware directory to kernel firmware path 57/253357/6 accepted/tizen/unified/20210217.030900 submit/tizen/20210216.032529 submit/tizen/20210216.094530
INSUN PYO [Tue, 9 Feb 2021 06:29:06 +0000 (15:29 +0900)]
systemd: Add /hal/lib/firmware directory to kernel firmware path

Before systemd starts any services, execute this command to add /hal/lib/firmware path.
 - echo "/hal/lib/firmware" > /sys/module/firmware_class/parameters/path

Change-Id: I972c0add7709975f595220bb6c108d509e005048
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Add new DEVICE_MEMORY module 42/251842/9
Youngjae Cho [Wed, 20 Jan 2021 01:33:41 +0000 (10:33 +0900)]
halapi: Add new DEVICE_MEMORY module

This module fetches memory usage information whose nodepath or format
is dependent to target, such as gpu, gem information.

Change-Id: Ib10f201c91a190226991605771b9025642d4a451
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
3 years agohaltests: Add hal-common-haltests skeleton code 04/252804/5
Seungha Son [Tue, 2 Feb 2021 10:22:20 +0000 (19:22 +0900)]
haltests: Add hal-common-haltests skeleton code

 This is a commit to separate hal-common-haltests
 and uniittests for testing in the target.

 After the commit is applied, unittest is verified
 at gbs build time. The hal-common-haltest verifies
 the function running on the target and is packaged
 in rpm to generate the result.

Change-Id: I6d298e4940370188c8890b4331e7fa952a20fd1b
Signed-off-by: Seungha Son <seungha.son@samsung.com>
3 years agohalapi: Check whether HAL backend library exists or not 94/253194/4 accepted/tizen/unified/20210209.124423 submit/tizen/20210208.080417
Chanwoo Choi [Thu, 4 Feb 2021 09:34:12 +0000 (18:34 +0900)]
halapi: Check whether HAL backend library exists or not

Before loading the library, check wehter HAL backend library
exists or not into /hal/lib/ or /hal/lib64/.

Change-Id: Ibf5c1fd493f785ac8e916eabb285cfad68ea19b0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Replace destructor with reference count method to free memory 93/253193/4
Chanwoo Choi [Thu, 4 Feb 2021 06:53:40 +0000 (15:53 +0900)]
halapi: Replace destructor with reference count method to free memory

Instead of destructor method to free the memory, use the reference count
method to free the memory in order to support multi-thread environment.

So that define the _hal_api_conf_(init|exit)() functions to control
the reference count. These functions either get the resources from hal-api.json
or put the resources according to the reference count.
- _hal_api_conf_init() increments the reference count
- _hal_api_conf_exit() decrements the reference count

hal_common_get_backend() and hal_common_put_backend() functions should
be called pairly in order to free the resources of hal-api.json.

[Detailed use-case of _hal_api_conf_init() and _hal_api_conf_ext()]
hal_common_get_backend()
_hal_api_conf_init()
/* codes */

hal_common_put_backend()
/* codes */
_hal_api_conf_exit()

hal_common_get_backend_library_name()
_hal_api_conf_init()
/* codes */
_hal_api_conf_exit()

hal_common_get_backend_symbol_name()
_hal_api_conf_init()
/* codes */
_hal_api_conf_exit()

hal_common_check_backend_abi_version()
_hal_api_conf_init()
/* codes */
_hal_api_conf_exit()

And change the prototype of hal_common_get_backend_library_name,
hal_common_get_backend_symbol_name as following:
- int hal_common_get_backend_library_name(enum hal_module module, char *name, int size);
- int hal_common_get_backend_symbol_name(enum hal_module module, char *name, int size);

Change-Id: If663b87244cc680d94568818d4358a7b91fb071e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalpai: Add support of reference count for hal_common_(get|put)_backend function 02/252802/4
Chanwoo Choi [Tue, 2 Feb 2021 10:09:58 +0000 (19:09 +0900)]
halpai: Add support of reference count for hal_common_(get|put)_backend function

Some HAL module need to call hal_common_(get|put)_backend() funcions at
multiple points at the same time. So that have to support this
requirement by using the reference count. When touching the reference
count, uses the mutex in order to keep the data integrity.

Change-Id: I2c3a662f21d1c56c7b5b077c7a3f155bf47fd792
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agounittest: Add testcase to check backend abi version 14/252814/6
Seungha Son [Tue, 2 Feb 2021 11:25:34 +0000 (20:25 +0900)]
unittest: Add testcase to check backend abi version

Change-Id: Ic740ea639e738dcbd8514497e0f02bd0e1080bd5
Signed-off-by: Seungha Son <seungha.son@samsung.com>
3 years agohalapi: Delete abi_version value of TELEPHONY 20/253020/1
Seungha Son [Thu, 4 Feb 2021 02:56:46 +0000 (11:56 +0900)]
halapi: Delete abi_version value of TELEPHONY

Change-Id: Ia0a132ac0b5fc29bdb1009c47b0f3de50bc1f649
Signed-off-by: Seungha Son <seungha.son@samsung.com>
3 years agohalapi: Change hal-api.json group format 33/252933/2
Seungha Son [Wed, 3 Feb 2021 07:04:38 +0000 (16:04 +0900)]
halapi: Change hal-api.json group format

 The structure of the json file was changed by adding
 a group value in the json file data. The logic for
 parsing group information according to file change
 has been modified.

Change-Id: I52d67da467ce2630714b4dbd75fcdb58631508c3
Signed-off-by: Seungha Son <seungha.son@samsung.com>
3 years agohalapi: Update error log for providing the more correct debugging info 94/252794/3
Chanwoo Choi [Tue, 2 Feb 2021 08:49:34 +0000 (17:49 +0900)]
halapi: Update error log for providing the more correct debugging info

Update error log for providing the more correct debugging info
without any behavior changes.

Change-Id: Icfc9f72fd971e970457e3dbb2d8bb5eb10a61743
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Add configuration feature 89/252389/7
Seungha Son [Tue, 12 Jan 2021 04:56:35 +0000 (13:56 +0900)]
halapi: Add configuration feature

 The purpose of this patch is to change the way
 hal-related information is managed.

 The information specified in the header file is
 changed to json format and can be changed at runtime.
 so that the information changed at runtime can be
 used without recompiling the library.

 A testcase to verify the saved json data was added and
 this testcase is ran at build time.

Change-Id: Ia9b83dfa18ea370ed4a3ce680c36a9f39317c6ff
Signed-off-by: Seungha Son <seungha.son@samsung.com>
3 years agohalapi: Fix cpp build issue when including hal-common.h 53/252753/2
Chanwoo Choi [Tue, 2 Feb 2021 06:46:54 +0000 (15:46 +0900)]
halapi: Fix cpp build issue when including hal-common.h

If the defined enum value is not sequential, some build error happen as
following. So that fix this issue by making enum hal_module sequential.

And remove the temporary defined HAL_MODULE_FOO.

[Build error message with cpp compiler]
"sorry, unimplemented: non-trivial designated initializers not supported "

Change-Id: I8dcd8c7c11807d8873d8e92413e4137ce84a3c6f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Check enum range for backend_abi_min_version 73/252573/2 accepted/tizen/unified/20210202.143743 submit/tizen/20210201.032626
Seung-Woo Kim [Fri, 29 Jan 2021 10:27:56 +0000 (19:27 +0900)]
halapi: Check enum range for backend_abi_min_version

To avoid out-of-bounds access of version str array, check value
range for data->backend_abi_min_version always.

Change-Id: I3fb05ab9a27394f817937b589ce7751da0467a69
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agohalapi: Ignore already fully put hal backend 60/252560/2 accepted/tizen/unified/20210201.055404 submit/tizen/20210129.082040
Seung-Woo Kim [Fri, 29 Jan 2021 07:52:35 +0000 (16:52 +0900)]
halapi: Ignore already fully put hal backend

In hal_common_put_backend(), requested module backend can be
already put fully. For the case, ignore the hal backend.

Change-Id: I7eef57fa12273760d28b22738ee878ac423da651
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agohalapi: fix wrong module's number about CODEC 25/252325/2 accepted/tizen/unified/20210127.144826 submit/tizen/20210127.011131
Jaehoon Chung [Wed, 27 Jan 2021 00:27:40 +0000 (09:27 +0900)]
halapi: fix wrong module's number about CODEC

Fix wrong module's number about CODEC.
It's not HAL_MODULE_UNKNOWN.

Change-Id: I9cdc3d58ee2feb3bf5137d973972033741c8e352
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agohalapi: Fix pkgconfig .pc file about libdir 28/251928/2 accepted/tizen/unified/20210121.134559 submit/tizen/20210121.041820
Chang Joo Lee [Thu, 21 Jan 2021 04:11:18 +0000 (13:11 +0900)]
halapi: Fix pkgconfig .pc file about libdir

The commit e4c687e484e1 ("packaging: Remove redundant separator") has
missed the update of .pc file. This patch fix the wrong path issue.

Change-Id: I26847c506dcd801030ed616822fccca8595f97ef
Fixes: e4c687e484e1 ("packaging: Remove redundant separator")
Signed-off-by: Chang Joo Lee <changjoo.lee@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopackaging: Remove redundant separator 62/251862/1
Chanwoo Choi [Wed, 20 Jan 2021 04:42:47 +0000 (13:42 +0900)]
packaging: Remove redundant separator

The spec file has passed the redundant separator ('/') with %{_libdir}.
It is not needed. So that remove it.

Change-Id: I531f6a6449e6ab3defec82bb4383ecc22045dc20
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopackaging: create hal directory to use backend packages 40/251840/1 accepted/tizen/unified/20210120.120800 submit/tizen/20210120.012527
Jaehoon Chung [Wed, 20 Jan 2021 00:42:28 +0000 (09:42 +0900)]
packaging: create hal directory to use backend packages

If hal.img will be split from core image, it has to exist hal directory
under root directory before mounting hal.img.
Otherwise, it can't mount anywhere to use hal-backend.
This patch is for preparing to use hal.img.
- The mounting hal.img will be did in ramdisk.

Change-Id: I8ef56c0e383e142269c4164d7cfeba9560fbb039
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agohalapi: Add /etc/ld.so.conf.d/libhal-api.conf 07/251707/5 accepted/tizen/unified/20210119.130216 submit/tizen/20210119.020839
INSUN PYO [Tue, 19 Jan 2021 00:35:10 +0000 (09:35 +0900)]
halapi: Add /etc/ld.so.conf.d/libhal-api.conf

A ldd and ldconfig commands do not work.

Example1) "ldd /usr/bin/deviced | grep libhal-api-common"
Example2) "ldconfig -p | grep libhal-api-common"

Change-Id: I42d0ece00df2ebd4ef36e4f215140a31204397b0
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
3 years agohalapi: Fix fault by using backend instance before dlclose backend library 84/251684/2 submit/tizen/20210119.012202
Chanwoo Choi [Mon, 18 Jan 2021 10:48:06 +0000 (19:48 +0900)]
halapi: Fix fault by using backend instance before dlclose backend library

When try to use backend->name, backend->vendor variables
after dlclose(handle) of HAL backend shared library, segmentation fault happen.
So that move dlclose(hanlde) at the end of hal_common_put_backend() to
fix the segmentation fault.

Change-Id: Icc89e26b0ff11706657f1bfdeff16eba17f255d9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Include stdbool header for common.h 04/251504/3
Seungha Son [Thu, 14 Jan 2021 09:57:06 +0000 (18:57 +0900)]
halapi: Include stdbool header for common.h

 The stdbool.h file is required to use the bool data type.

Change-Id: I0cc08f2a0229bfb64ddbcf46c1cd69da1a183c82
Signed-off-by: Seungha Son <seungha.son@samsung.com>
3 years agoAdd hal-api-common uniitest skeleton 14/251114/6 accepted/tizen/unified/20210113.121021 submit/tizen/20210113.011459
Seungha Son [Fri, 8 Jan 2021 07:52:23 +0000 (16:52 +0900)]
Add hal-api-common uniitest skeleton

 This test will run automatically when building gbs.
 The result can be checked by the developer and
 the side effect of the edited content can be checked.

 it is a test for the currently implemented operation,
 and a test for applying TDD in the future.

Change-Id: I5af141dbb601524ff517b78e7cc970323ed138fc
Signed-off-by: Seungha Son <linuxias@gmail.com>
3 years agoFix wrong spelling 02/251302/1
Seungha Son [Tue, 12 Jan 2021 08:52:23 +0000 (17:52 +0900)]
Fix wrong spelling

 HAL_MODULE_TELPEPHONY -> HAL_MODULE_TELEPHONY

Change-Id: Ie3b77e9b3839de8306e2c49e10bdeb4b3fe91744
Signed-off-by: Seungha Son <linuxias@gmail.com>
3 years agohalapi: common: Change variable name for improving the readability 85/251185/3 accepted/tizen/unified/20210111.125423 submit/tizen/20210111.072925
Chanwoo Choi [Mon, 11 Jan 2021 06:00:55 +0000 (15:00 +0900)]
halapi: common: Change variable name for improving the readability

Change the variable name for improving the readability
because prior defined variable name is vague to pass
the correct meaning of version. So that change the name as following
in order to improve the readability and understanding.

[Chagned variable names]
- g_curr_hal_abi_version -> g_platform_curr_abi_version
- current_version -> platform_abi_version
- compat_version -> backend_min_abi_version

Change-Id: I733b203a6c0fe058dedb6e9e26f832a0629ccc15
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: common: Add hal_api_version_str array and an error message 64/251164/3
Jaehoon Chung [Sun, 10 Jan 2021 23:03:47 +0000 (08:03 +0900)]
halapi: common: Add hal_api_version_str array and an error message

Add hal_api_version_str array to display as string after converting each
enum value.
It's easier to understand than using enum value.
If abi version doesn't support about current version and compatible version,
then it needs to notice about not supporting abi_version.

Change-Id: I67f31423a4b9d911b269d8c7560c9907a6bafc8b
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agohalapi: common: Change the parameter name of helper functions for readability 91/251091/2 accepted/tizen/unified/20210108.125849 submit/tizen/20210108.044006
Chanwoo Choi [Fri, 8 Jan 2021 03:46:15 +0000 (12:46 +0900)]
halapi: common: Change the parameter name of helper functions for readability

hal-api-common's helper functions have the 'enum hal_module' as first
parameter. In order to improve the readability, replace parameter name
from 'handle' to 'module'.

Change-Id: I3baa384885d9e5225987f143d4b1951c4b6aedd6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: common: Fix bug by using the module parameter 89/251089/1
Chanwoo Choi [Fri, 8 Jan 2021 03:30:03 +0000 (12:30 +0900)]
halapi: common: Fix bug by using the module parameter

hal-api-common helper functions have been used the fixed hal module id
such as HAL_MODULE_FOO. It is wrong usage. hal-api-common helper
functions have to use the 'module' parameter.

Change-Id: Ifa27e0e4df3c5b89ce96511802ef5a008cf2a279
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: common: Change return type of hal_common_put_backend and backend->exit 34/251034/1 accepted/tizen/unified/20210107.123346 submit/tizen/20210107.062142
Chanwoo Choi [Thu, 7 Jan 2021 05:35:40 +0000 (14:35 +0900)]
halapi: common: Change return type of hal_common_put_backend and backend->exit

Change the return type of hal_common_put_backend() and backend->exit()
from void to int in order to pass the error value.

Change-Id: I155a33e469511319303bd56d3866d3bbfbec786c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: common: Add hal_common_(get|put)_backend() function to handle backend data 61/250461/4 accepted/tizen/unified/20210104.130218 submit/tizen/20210104.043912
Chanwoo Choi [Mon, 28 Dec 2020 04:43:47 +0000 (13:43 +0900)]
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>
3 years agohalapi: common: Divide hal-common.h into two header files 62/250462/4
Chanwoo Choi [Mon, 28 Dec 2020 04:50:34 +0000 (13:50 +0900)]
halapi: common: Divide hal-common.h into two header files

Divide hal-common.h into two header files as following:
- hal-common.h is used for HAL API packages (/platform/hal/api/)
- hal-common-interface.h is used for HAL backend packages (/platform/hal/device/)

Change-Id: Ida3192ed4dbb29d9b718b2b90f3a61f8ed380e2e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: common: Add library and symbol name for hal-api-device 85/250485/2
Chanwoo Choi [Mon, 28 Dec 2020 07:21:36 +0000 (16:21 +0900)]
halapi: common: Add library and symbol name for hal-api-device

Change-Id: I83f661c30b1e2dcb763c9956804d03db57e3aa46
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agoAdd support hal-api-common library to check HAL ABI and support of haltest 65/250165/14
Chanwoo Choi [Fri, 18 Dec 2020 04:20:37 +0000 (13:20 +0900)]
Add support hal-api-common library to check HAL ABI and support of haltest

Need to provide the helper function of HAL ABI version check
in order to support HAL API layer on Tizen 6.5. By supporing
the ABI check method, Tizen can separate the hal.img from core image
and then we can remove the h/w dependency from Tizen core image.

hal-api-common-*.rpm contains the shared library providing the helper
function of the HAL ABI version check and the HAL ABI data of all
modules. If some module changes the their owr HAL ABI interface,
they must update the ABI information to /platform/hal/api/common.
It contains the following files:
- /usr/lib/hal/libhal-api-common.so
- /usr/share/licenses/hal-api-common/LICENSE

hal-api-common-devel-*.rpm contains the header file for including
the helper function of HAL ABI version check.
It contains the following files:
- /usr/include/hal/hal-common.h
- /usr/lib/pkgconfig/hal-api-common.pc

But, this patch is not enough. Usually, the configuraiton data
like HAL ABI version information should get the file like xml, json
style format file and so on. But, it just specify the HAL ABI versin
information of all modules in the src/common.h as workardound style.
It must need to be fixed on later. And this version doesn't include
the any haltest code even if it is necessary. Also on later,
The role of common-haltest make the pre-considition environment
for all haltests and then execute the haltest file to verify
the hal.img and the implementation of HAL backend pacakges.

For example, show the relationship among hal-api-foo, hal-backend-foo
and hal-api-common as following:

-----------------------------------
| 'User of hal-api-foo'           |
|   executes C HAl API.           |
-----------------------------------
    |
    | (Call HAL API)
    |
-----------------------------------
| /usr/include/hal-foo.h          |
|                                 |
|                                 |       ----------------------------------
| hal-api-foo.rpm                 | <---> | (Check HAL ABI Version)        |
| (/usr/lib/libhal-api-foo.so)    |       |                                |
|                                 |       | hal-api-common.rpm             |
|                                 |       | (/usr/lib/libhal-api-common.so)|
| /usr/include/hal-foo-interface.h|       ----------------------------------
----------------------------------|
    |
    | dlopen ("/hal/lib/libhal-backend-foo.so")
    | dlsym ("hal_backend_foo_daa")
    |
-----------------------------------
| hal-backend-foo-rpi4.rpm        |
| (/hal/lib/libhal-backend-foo.so)|
-----------------------------------

Change-Id: Ifb4b10e94c419517882794cc101bfcd598570335
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agoInitial empty repository master
Tizen Infrastructure [Fri, 18 Dec 2020 00:45:59 +0000 (00:45 +0000)]
Initial empty repository