summaryrefslogtreecommitdiff
path: root/drivers/gator/gator_annotate_kernel.c
diff options
context:
space:
mode:
authorPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-24 17:16:17 +0200
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-24 17:16:17 +0200
commit6e1ff8e78958e5ea6871dca4a5ef6076fadcbcc1 (patch)
tree4e17c48118edbe073b49341d95809a8e0b2a8f80 /drivers/gator/gator_annotate_kernel.c
parented6e65a66f3bcf84dff4ff4e680096b7e40076d5 (diff)
parent09f333ed6069575a71fabc999c4dc39b6594d727 (diff)
Merge remote-tracking branch 'armlt/3.3-armlt-gator-5.10' into stable-linux-ux500-3.3ubuntu-release-12-07ubuntu-release-12-06
Conflicts: drivers/Kconfig
Diffstat (limited to 'drivers/gator/gator_annotate_kernel.c')
-rwxr-xr-xdrivers/gator/gator_annotate_kernel.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/drivers/gator/gator_annotate_kernel.c b/drivers/gator/gator_annotate_kernel.c
new file mode 100755
index 00000000000..ffab08795b7
--- /dev/null
+++ b/drivers/gator/gator_annotate_kernel.c
@@ -0,0 +1,90 @@
+/**
+ * Copyright (C) ARM Limited 2012. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+static void kannotate_write(char* ptr, unsigned int size)
+{
+ int retval;
+ int pos = 0;
+ loff_t offset = 0;
+ while (pos < size) {
+ retval = annotate_write(NULL, &ptr[pos], size - pos, &offset);
+ if (retval < 0) {
+ printk(KERN_WARNING "gator: kannotate_write failed with return value %d\n", retval);
+ return;
+ }
+ pos += retval;
+ }
+}
+
+// String annotation
+void gator_annotate(char* string)
+{
+ kannotate_write(string, strlen(string) + 1);
+}
+EXPORT_SYMBOL(gator_annotate);
+
+// String annotation with color
+void gator_annotate_color(int color, char* string)
+{
+ kannotate_write((char*)&color, sizeof(color));
+ kannotate_write(string, strlen(string) + 1);
+}
+EXPORT_SYMBOL(gator_annotate_color);
+
+// Terminate an annotation
+void gator_annotate_end(void)
+{
+ char nul = 0;
+ kannotate_write(&nul, sizeof(nul));
+}
+EXPORT_SYMBOL(gator_annotate_end);
+
+// Image annotation with optional string
+void gator_annotate_visual(char* data, unsigned int length, char* string)
+{
+ long long visual_annotation = 0x011c | (strlen(string) << 16) | ((long long)length << 32);
+ kannotate_write((char*)&visual_annotation, 8);
+ kannotate_write(string, strlen(string));
+ kannotate_write(data, length);
+}
+EXPORT_SYMBOL(gator_annotate_visual);
+
+// Marker annotation
+void gator_annotate_marker(void)
+{
+ int marker_annotation = 0x00021c;
+ kannotate_write((char*)&marker_annotation, 3);
+}
+EXPORT_SYMBOL(gator_annotate_marker);
+
+// Marker annotation with a string
+void gator_annotate_marker_str(char* string)
+{
+ int marker_annotation = 0x021c;
+ kannotate_write((char*)&marker_annotation, 2);
+ kannotate_write(string, strlen(string) + 1);
+}
+EXPORT_SYMBOL(gator_annotate_marker_str);
+
+// Marker annotation with a color
+void gator_annotate_marker_color(int color)
+{
+ long long marker_annotation = (0x021c | ((long long)color << 16)) & 0x0000ffffffffffffLL;
+ kannotate_write((char*)&marker_annotation, 7);
+}
+EXPORT_SYMBOL(gator_annotate_marker_color);
+
+// Marker annotationw ith a string and color
+void gator_annotate_marker_color_str(int color, char* string)
+{
+ long long marker_annotation = 0x021c | ((long long)color << 16);
+ kannotate_write((char*)&marker_annotation, 6);
+ kannotate_write(string, strlen(string) + 1);
+}
+EXPORT_SYMBOL(gator_annotate_marker_color_str);