xref: /aosp_15_r20/hardware/libhardware/modules/camera/3_4/common.h (revision e01b6f769022e40d0923dee176e8dc7cd1d52984)
1*e01b6f76SAndroid Build Coastguard Worker /*
2*e01b6f76SAndroid Build Coastguard Worker  * Copyright 2015 The Android Open Source Project
3*e01b6f76SAndroid Build Coastguard Worker  *
4*e01b6f76SAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*e01b6f76SAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*e01b6f76SAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*e01b6f76SAndroid Build Coastguard Worker  *
8*e01b6f76SAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*e01b6f76SAndroid Build Coastguard Worker  *
10*e01b6f76SAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*e01b6f76SAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*e01b6f76SAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*e01b6f76SAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*e01b6f76SAndroid Build Coastguard Worker  * limitations under the License.
15*e01b6f76SAndroid Build Coastguard Worker  */
16*e01b6f76SAndroid Build Coastguard Worker 
17*e01b6f76SAndroid Build Coastguard Worker #ifndef V4L2_CAMERA_HAL_COMMON_H_
18*e01b6f76SAndroid Build Coastguard Worker #define V4L2_CAMERA_HAL_COMMON_H_
19*e01b6f76SAndroid Build Coastguard Worker 
20*e01b6f76SAndroid Build Coastguard Worker #include <cutils/log.h>
21*e01b6f76SAndroid Build Coastguard Worker 
22*e01b6f76SAndroid Build Coastguard Worker // Helpers of logging (showing function name and line number).
23*e01b6f76SAndroid Build Coastguard Worker #define HAL_LOGE(fmt, args...) do { \
24*e01b6f76SAndroid Build Coastguard Worker     ALOGE("%s:%d: " fmt, __func__, __LINE__, ##args);   \
25*e01b6f76SAndroid Build Coastguard Worker   } while(0)
26*e01b6f76SAndroid Build Coastguard Worker 
27*e01b6f76SAndroid Build Coastguard Worker #define HAL_LOGE_IF(cond, fmt, args...) do { \
28*e01b6f76SAndroid Build Coastguard Worker     ALOGE_IF(cond, "%s:%d: " fmt, __func__, __LINE__, ##args);  \
29*e01b6f76SAndroid Build Coastguard Worker   } while(0)
30*e01b6f76SAndroid Build Coastguard Worker 
31*e01b6f76SAndroid Build Coastguard Worker #define HAL_LOGW(fmt, args...) do { \
32*e01b6f76SAndroid Build Coastguard Worker     ALOGW("%s:%d: " fmt, __func__, __LINE__, ##args);   \
33*e01b6f76SAndroid Build Coastguard Worker   } while(0)
34*e01b6f76SAndroid Build Coastguard Worker 
35*e01b6f76SAndroid Build Coastguard Worker #define HAL_LOGW_IF(cond, fmt, args...) do { \
36*e01b6f76SAndroid Build Coastguard Worker     ALOGW_IF(cond, "%s:%d: " fmt, __func__, __LINE__, ##args);  \
37*e01b6f76SAndroid Build Coastguard Worker   } while(0)
38*e01b6f76SAndroid Build Coastguard Worker 
39*e01b6f76SAndroid Build Coastguard Worker #define HAL_LOGI(fmt, args...) do { \
40*e01b6f76SAndroid Build Coastguard Worker     ALOGI("%s:%d: " fmt, __func__, __LINE__, ##args);   \
41*e01b6f76SAndroid Build Coastguard Worker   } while(0)
42*e01b6f76SAndroid Build Coastguard Worker 
43*e01b6f76SAndroid Build Coastguard Worker #define HAL_LOGI_IF(cond, fmt, args...) do { \
44*e01b6f76SAndroid Build Coastguard Worker     ALOGI_IF(cond, "%s:%d: " fmt, __func__, __LINE__, ##args);  \
45*e01b6f76SAndroid Build Coastguard Worker   } while(0)
46*e01b6f76SAndroid Build Coastguard Worker 
47*e01b6f76SAndroid Build Coastguard Worker #define HAL_LOGD(fmt, args...) do { \
48*e01b6f76SAndroid Build Coastguard Worker     ALOGD("%s:%d: " fmt, __func__, __LINE__, ##args);   \
49*e01b6f76SAndroid Build Coastguard Worker   } while(0)
50*e01b6f76SAndroid Build Coastguard Worker 
51*e01b6f76SAndroid Build Coastguard Worker #define HAL_LOGV(fmt, args...) do { \
52*e01b6f76SAndroid Build Coastguard Worker     ALOGV("%s:%d: " fmt, __func__, __LINE__, ##args);   \
53*e01b6f76SAndroid Build Coastguard Worker   } while(0)
54*e01b6f76SAndroid Build Coastguard Worker 
55*e01b6f76SAndroid Build Coastguard Worker // Log enter/exit of methods.
56*e01b6f76SAndroid Build Coastguard Worker #define HAL_LOG_ENTER() HAL_LOGV("enter")
57*e01b6f76SAndroid Build Coastguard Worker #define HAL_LOG_EXIT() HAL_LOGV("exit")
58*e01b6f76SAndroid Build Coastguard Worker 
59*e01b6f76SAndroid Build Coastguard Worker #endif  // V4L2_CAMERA_HAL_COMMON_H_
60