summaryrefslogtreecommitdiffstats
path: root/Support_Libs
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2004-09-30 08:31:42 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2004-09-30 08:31:42 (GMT)
commit6d8771fb182d835850111a3284148f1fdc37c52d (patch)
tree8bab67d90a09ac3b591c7756fa4163457b2c494b /Support_Libs
parent25733e98aa4f4c0e6fe360b5410de75b808d0f2a (diff)
downloadTASS-6d8771fb182d835850111a3284148f1fdc37c52d.zip
TASS-6d8771fb182d835850111a3284148f1fdc37c52d.tar.gz
TASS-6d8771fb182d835850111a3284148f1fdc37c52d.tar.bz2
Initial Checkin of support libs.
We can now print strings and integers to the RS232 port
Diffstat (limited to 'Support_Libs')
-rw-r--r--Support_Libs/debug/debug.hcc33
-rw-r--r--Support_Libs/debug/debug.hch33
2 files changed, 66 insertions, 0 deletions
diff --git a/Support_Libs/debug/debug.hcc b/Support_Libs/debug/debug.hcc
new file mode 100644
index 0000000..2cc6bef
--- /dev/null
+++ b/Support_Libs/debug/debug.hcc
@@ -0,0 +1,33 @@
+#include <stdlib.hch>
+
+#include "pal_master.hch"
+
+#include "debug.hch"
+
+void print_hex_value(unsigned value)
+{
+ unsigned 8 ch;
+ unsigned 4 i;
+ unsigned 32 tempvalue;
+
+ tempvalue = 0 @ value;
+
+ for(i = 0;i < 8;i++)
+ {
+ ch = 0 @ (tempvalue\\28);
+ tempvalue <<= 4;
+ ch += (ch > 9) ? 0x37 : 0x30;
+ PalDataPortWrite(PalRS232PortCT(0), ch);
+ }
+
+ PalDataPortWrite(PalRS232PortCT(0), 0x0A);
+ PalDataPortWrite(PalRS232PortCT(0), 0x0D);
+}
+
+void print_string(unsigned 8 s[16]) {
+ unsigned 4 i;
+
+ for(i = 0;('\0' != s[i]) || (0 < i);i++) {
+ PalDataPortWrite(PalRS232PortCT(0), s[i] +0x30);
+ }
+}
diff --git a/Support_Libs/debug/debug.hch b/Support_Libs/debug/debug.hch
new file mode 100644
index 0000000..abd8bea
--- /dev/null
+++ b/Support_Libs/debug/debug.hch
@@ -0,0 +1,33 @@
+/****************************************************************************
+ *
+ * print_hex_value (unsigned value)
+ *
+ * Arguments: (typical)
+ * value: The integer which will be printed
+ *
+ * Description: (typical)
+ * This function will print the integer through the RS232 interface in a
+ * 32-bit hexadecimal representation.
+ * Pre: Value must be smaller or equal to 32-bits.
+ * RS232 must be available.
+ * Post: A hex representation of value is printed.
+ *
+ ****************************************************************************/
+void print_hex_value(unsigned value);
+
+/****************************************************************************
+ *
+ * print_string (unsigned 8 value[16])
+ *
+ * Arguments: (typical)
+ * value: An array of characters.
+ *
+ * Description: (typical)
+ * This function will print a string through the RS232 interface.
+ * Pre: Value must not be 16 characters in length. If less char's
+ * are used, termination with \0 is recommended.
+ * RS232 must be available.
+ * Post: The string is printed as is.
+ *
+ ****************************************************************************/
+void print_string(unsigned 8 s[16]);