GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_include / print_support.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14
15 #ifndef __PRINT_SUPPORT_H_INCLUDED__
16 #define __PRINT_SUPPORT_H_INCLUDED__
17
18 #include "storage_class.h"
19
20 #include <stdarg.h>
21 #if !defined(__KERNEL__)
22 #include <stdio.h>
23 #endif
24
25 extern int (*sh_css_printf) (const char *fmt, va_list args);
26 /* depends on host supplied print function in ia_css_init() */
27 STORAGE_CLASS_INLINE void ia_css_print(const char *fmt, ...)
28 {
29         va_list ap;
30         if (sh_css_printf) {
31                 va_start(ap, fmt);
32                 sh_css_printf(fmt, ap);
33                 va_end(ap);
34         }
35 }
36
37 /* Start adding support for bxt tracing functions for poc. From
38  * bxt_sandbox/support/print_support.h. */
39 /* TODO: support these macros in userspace. */
40 #define PWARN(format, ...) ia_css_print("warning: ", ##__VA_ARGS__)
41 #define PRINT(format, ...) ia_css_print(format, ##__VA_ARGS__)
42 #define PERROR(format, ...) ia_css_print("error: " format, ##__VA_ARGS__)
43 #define PDEBUG(format, ...) ia_css_print("debug: " format, ##__VA_ARGS__)
44
45 #endif /* __PRINT_SUPPORT_H_INCLUDED__ */