Ari Hausman-Cohen | 7344215 | 2016-06-08 15:50:49 -0700 | [diff] [blame] | 1 | /* |
| 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-Cohen | 3841a7f | 2016-07-19 17:27:52 -0700 | [diff] [blame] | 17 | #ifndef V4L2_CAMERA_HAL_COMMON_H_ |
| 18 | #define V4L2_CAMERA_HAL_COMMON_H_ |
Ari Hausman-Cohen | 7344215 | 2016-06-08 15:50:49 -0700 | [diff] [blame] | 19 | |
| 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 | |
Ari Hausman-Cohen | ad6fe2b | 2016-11-16 10:48:07 -0800 | [diff] [blame^] | 42 | #define HAL_LOGI(fmt, args...) do { \ |
| 43 | ALOGI("%s:%d: " fmt, __func__, __LINE__, ##args); \ |
| 44 | } while(0) |
| 45 | |
| 46 | #define HAL_LOGI_IF(cond, fmt, args...) do { \ |
| 47 | ALOGI_IF(cond, "%s:%d: " fmt, __func__, __LINE__, ##args); \ |
| 48 | } while(0) |
| 49 | |
Ari Hausman-Cohen | 7344215 | 2016-06-08 15:50:49 -0700 | [diff] [blame] | 50 | #define HAL_LOGD(fmt, args...) do { \ |
| 51 | ALOGD("%s:%d: " fmt, __func__, __LINE__, ##args); \ |
| 52 | } while(0) |
| 53 | |
| 54 | #define HAL_LOGV(fmt, args...) do { \ |
| 55 | ALOGV("%s:%d: " fmt, __func__, __LINE__, ##args); \ |
| 56 | } while(0) |
| 57 | |
| 58 | // Log enter/exit of methods. |
| 59 | #define HAL_LOG_ENTER() HAL_LOGV("enter") |
| 60 | #define HAL_LOG_EXIT() HAL_LOGV("exit") |
| 61 | |
| 62 | // Fix confliction in case it's defined elsewhere. |
| 63 | #ifndef DISALLOW_COPY_AND_ASSIGN |
| 64 | #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
| 65 | TypeName(const TypeName&); \ |
| 66 | void operator=(const TypeName&); |
| 67 | #endif |
| 68 | |
Ari Hausman-Cohen | 3841a7f | 2016-07-19 17:27:52 -0700 | [diff] [blame] | 69 | #endif // V4L2_CAMERA_HAL_COMMON_H_ |