summaryrefslogtreecommitdiffstats
path: root/FFT_Test/debug.hcc
diff options
context:
space:
mode:
Diffstat (limited to 'FFT_Test/debug.hcc')
-rw-r--r--FFT_Test/debug.hcc92
1 files changed, 92 insertions, 0 deletions
diff --git a/FFT_Test/debug.hcc b/FFT_Test/debug.hcc
new file mode 100644
index 0000000..44736e3
--- /dev/null
+++ b/FFT_Test/debug.hcc
@@ -0,0 +1,92 @@
+#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);
+ }
+}
+
+
+void print_signed_hex_value(signed value, unsigned 6 size)
+{
+ unsigned 8 ch;
+ unsigned 4 i;
+ signed 32 stempvalue;
+ unsigned 32 utempvalue;
+ unsigned 6 bit;
+ unsigned 1 inverse;
+
+ if(value & (1<<size))
+ stempvalue = adjs(value,32);
+ else
+ stempvalue = 0@value;
+ utempvalue = 0;
+
+ if(stempvalue<0)
+ {
+ for(bit = 0;bit < size; bit++)
+ {
+ if (stempvalue & (1<<bit))
+ {
+ utempvalue = 1<<bit;
+ utempvalue += (unsigned)~(stempvalue >> bit);
+ bit = size;
+ }
+ }
+ PalDataPortWrite(PalRS232PortCT(0), '-');
+ }
+ else
+ {
+ utempvalue = (unsigned)stempvalue;
+ }
+
+/* if(stempvalue[size]==1)
+ {
+ PalDataPortWrite(PalRS232PortCT(0), '-');
+ mask = ~(0 @ (1<<size));
+ utempvalue = ((unsigned)stempvalue) & mask;
+ }
+ else
+ {
+ utempvalue = (unsigned)stempvalue;
+ }
+*/
+ for(i = 0;i < 8;i++)
+ {
+ ch = 0 @ (utempvalue\\28);
+ utempvalue <<= 4;
+ ch += (ch > 9) ? 0x37 : 0x30;
+ PalDataPortWrite(PalRS232PortCT(0), ch);
+ }
+}
+
+void print_string(unsigned char *s) {
+ unsigned 10 i;
+ i = 0;
+ for(i = 0;'\0' != s[i];i++)
+ {
+ PalDataPortWrite(PalRS232PortCT(0), s[i]);
+ }
+
+}
+
+void print_eol(void)
+{
+ PalDataPortWrite(PalRS232PortCT(0), 0x0A);
+// PalDataPortWrite(PalRS232PortCT(0), 0x0D);
+} \ No newline at end of file