summaryrefslogtreecommitdiff
path: root/drivers/media/sprd_sensor/csi2/csi_log.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/sprd_sensor/csi2/csi_log.c')
-rw-r--r--drivers/media/sprd_sensor/csi2/csi_log.c177
1 files changed, 177 insertions, 0 deletions
diff --git a/drivers/media/sprd_sensor/csi2/csi_log.c b/drivers/media/sprd_sensor/csi2/csi_log.c
new file mode 100644
index 00000000..38dd0589
--- /dev/null
+++ b/drivers/media/sprd_sensor/csi2/csi_log.c
@@ -0,0 +1,177 @@
+/*
+ * log.c
+ *
+ * Created on: Jun 25, 2010
+ * Author: klabadi & dlopo
+ */
+#include <linux/kernel.h>
+#include "csi_log.h"
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+static log_verbose_t log_verbose = VERBOSE_NOTICE;
+static log_numeric_t log_numeric = NUMERIC_HEX;
+static unsigned log_verbose_write = 0;
+
+void log_set_verbose(log_verbose_t verbose)
+{
+ log_verbose = verbose;
+}
+
+void log_set_numeric(log_numeric_t numeric)
+{
+ log_numeric = numeric;
+}
+
+void log_set_verbose_write(unsigned state)
+{
+ log_verbose_write = state;
+}
+
+void log_print_write(unsigned a, unsigned b)
+{
+ if (log_verbose_write == 1)
+ {
+ if (log_numeric == NUMERIC_DEC)
+ {
+ printk("%d, %d\n", a, b);
+ }
+ else
+ {
+ printk("0x%x, 0x%x\n", a, b);
+ }
+ }
+}
+
+void log_print0(log_verbose_t verbose, const char* function_name)
+{
+ if (verbose == VERBOSE_ERROR)
+ {
+ printk("ERROR: ");
+ }
+ if (verbose == VERBOSE_WARN)
+ {
+ printk("WARNING: ");
+ }
+ if (verbose <= log_verbose)
+ {
+ printk("%s\n", function_name);
+ }
+}
+
+void log_print1(log_verbose_t verbose, const char* function_name, const char* a)
+{
+ if (verbose == VERBOSE_ERROR)
+ {
+ printk("ERROR: ");
+ }
+ if (verbose == VERBOSE_WARN)
+ {
+ printk("WARNING: ");
+ }
+ if (verbose <= log_verbose)
+ {
+ printk("%s: %s\n", function_name, a);
+ }
+}
+
+void log_print2(log_verbose_t verbose, const char* function_name, const char* a,
+ unsigned b)
+{
+ if (verbose == VERBOSE_ERROR)
+ {
+ printk("ERROR: ");
+ }
+ if (verbose == VERBOSE_WARN)
+ {
+ printk("WARNING: ");
+ }
+ if (verbose <= log_verbose)
+ {
+ if (log_numeric == NUMERIC_DEC)
+ {
+ printk("%s: %s, %d\n", function_name, a, b);
+ }
+ else
+ {
+ printk("%s: %s, 0x%x\n", function_name, a, b);
+ }
+ }
+}
+
+void log_print3(log_verbose_t verbose, const char* function_name, const char* a,
+ unsigned b, unsigned c)
+{
+ if (verbose == VERBOSE_ERROR)
+ {
+ printk("ERROR: ");
+ }
+ if (verbose == VERBOSE_WARN)
+ {
+ printk("WARNING: ");
+ }
+ if (verbose <= log_verbose)
+ {
+ if (log_numeric == NUMERIC_DEC)
+ {
+ printk("%s: %s, %d, %d\n", function_name, a, b, c);
+ }
+ else
+ {
+ printk("%s: %s, 0x%x, 0x%x\n", function_name, a, b, c);
+ }
+ }
+}
+
+void log_print_int(log_verbose_t verbose, const char* a, unsigned b)
+{
+ if (verbose <= log_verbose)
+ {
+ if (log_numeric == NUMERIC_DEC)
+ {
+ printk("%s: %d\n", a, b);
+ }
+ else
+ {
+ printk("%s: 0x%x\n", a, b);
+ }
+ }
+}
+
+void log_print_int2(log_verbose_t verbose, const char* a, unsigned b,
+ unsigned c)
+{
+ if (verbose <= log_verbose)
+ {
+ if (log_numeric == NUMERIC_DEC)
+ {
+ printk("%s: %d, %d\n", a, b, c);
+ }
+ else
+ {
+ printk("%s: 0x%x, 0x%x\n", a, b, c);
+ }
+ }
+}
+
+void log_print_int3(log_verbose_t verbose, const char* a, unsigned b,
+ unsigned c, unsigned d)
+{
+ if (verbose <= log_verbose)
+ {
+ if (log_numeric == NUMERIC_DEC)
+ {
+ printk("%s: %d, %d, %d\n", a, b, c, d);
+ }
+ else
+ {
+ printk("%s: 0x%x, 0x%x, 0x%x\n", a, b, c, d);
+ }
+ }
+}
+
+#ifdef __cplusplus
+}
+#endif