blob: e77c0b2b7c7c3e4a2e94e12a3f9c0b6667e051f0 [file] [log] [blame]
Ari Hausman-Cohen73442152016-06-08 15:50:49 -07001/*
2 * Copyright 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Ari Hausman-Cohen3841a7f2016-07-19 17:27:52 -070017#ifndef V4L2_CAMERA_HAL_COMMON_H_
18#define V4L2_CAMERA_HAL_COMMON_H_
Ari Hausman-Cohen73442152016-06-08 15:50:49 -070019
20// #define LOG_NDEBUG 0
21#include <cutils/log.h>
22
23#define LOG_TAG "V4L2CameraHAL"
24
25// Helpers of logging (showing function name and line number).
26#define HAL_LOGE(fmt, args...) do { \
27 ALOGE("%s:%d: " fmt, __func__, __LINE__, ##args); \
28 } while(0)
29
30#define HAL_LOGE_IF(cond, fmt, args...) do { \
31 ALOGE_IF(cond, "%s:%d: " fmt, __func__, __LINE__, ##args); \
32 } while(0)
33
34#define HAL_LOGW(fmt, args...) do { \
35 ALOGW("%s:%d: " fmt, __func__, __LINE__, ##args); \
36 } while(0)
37
38#define HAL_LOGW_IF(cond, fmt, args...) do { \
39 ALOGW_IF(cond, "%s:%d: " fmt, __func__, __LINE__, ##args); \
40 } while(0)
41
42#define HAL_LOGD(fmt, args...) do { \
43 ALOGD("%s:%d: " fmt, __func__, __LINE__, ##args); \
44 } while(0)
45
46#define HAL_LOGV(fmt, args...) do { \
47 ALOGV("%s:%d: " fmt, __func__, __LINE__, ##args); \
48 } while(0)
49
50// Log enter/exit of methods.
51#define HAL_LOG_ENTER() HAL_LOGV("enter")
52#define HAL_LOG_EXIT() HAL_LOGV("exit")
53
54// Fix confliction in case it's defined elsewhere.
55#ifndef DISALLOW_COPY_AND_ASSIGN
56#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
57 TypeName(const TypeName&); \
58 void operator=(const TypeName&);
59#endif
60
Ari Hausman-Cohen3841a7f2016-07-19 17:27:52 -070061#endif // V4L2_CAMERA_HAL_COMMON_H_