summaryrefslogtreecommitdiff
path: root/rs422lib/sysctl.h
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2014-05-23 15:36:51 +0800
committerJoe Zhao <ztuowen@gmail.com>2014-05-23 15:36:51 +0800
commit07d2ace8b4771e2ad48d4a9e6bf43a2022a25fac (patch)
tree8f76b7e3ce69ceb6d7822ec9aa8977a830d10c8d /rs422lib/sysctl.h
parentd9c0c179fc4636b8927dd2c8b2cb29d573094731 (diff)
downloadrsbus-07d2ace8b4771e2ad48d4a9e6bf43a2022a25fac.tar.gz
rsbus-07d2ace8b4771e2ad48d4a9e6bf43a2022a25fac.tar.bz2
rsbus-07d2ace8b4771e2ad48d4a9e6bf43a2022a25fac.zip
Added SYSSTOP & MSTATE macro
New example main.c
Diffstat (limited to 'rs422lib/sysctl.h')
-rw-r--r--rs422lib/sysctl.h118
1 files changed, 61 insertions, 57 deletions
diff --git a/rs422lib/sysctl.h b/rs422lib/sysctl.h
index b8301fa..83f82d9 100644
--- a/rs422lib/sysctl.h
+++ b/rs422lib/sysctl.h
@@ -1,57 +1,61 @@
-/*
- * sysctl.h
- *
- * Created on: 2014-4-26
- * Author: Tuowen
- */
-
-// Support 8 different syscalls
-// Possible improvement
-// CPUOFF all the time, wakeup after syscall invoked.
-
-#ifndef SYSCTL_H_
-#define SYSCTL_H_
-
-// Sysctl priority bit
-// Lowest first
-#define SYS_BIT7 (0x80)
-#define SYS_BIT6 (0x40)
-#define SYS_BIT5 (0x20)
-#define SYS_BIT4 (0x10)
-#define SYS_BIT3 (0x08)
-#define SYS_BIT2 (0x04)
-#define SYS_BIT1 (0x02)
-#define SYS_BIT0 (0x01)
-
-// SYSCALL invocation routine
-// Used this in IRQ, also wakes up the cpu
-#define SYSCALL_IRQ(X) (syscall|=X,_BIC_SR_IRQ(CPUOFF))
-// Use this in anywhere other than IRQ
-// Continuous invocation ?
-#define SYSCALL(X) (syscall|=X)
-
-// Call handler type
-// Does't have any input
-// Preserve the state in other global variables
-// Usage example -> rsbus_syscall()
-typedef void (*syshdlr)();
-
-// Register call handler
-// Always replace old value
-void sysctl_reghdlr(unsigned int bit,syshdlr rot);
-
-// Remove old call handler
-// Replace with something useless
-void sysctl_rmhdlr(unsigned int bit);
-
-// Insert it into mainloop
-// enabling automatic procedure invocation
-void sysroutine();
-
-// Setting up the proc base
-// Call before usage
-void sysctl_init();
-
-extern volatile unsigned char syscall;
-
-#endif /* SYSCTL_H_ */
+/*
+ * sysctl.h
+ *
+ * Created on: 2014-4-26
+ * Author: Tuowen
+ */
+
+// Support 8 different syscalls
+// Possible improvement
+// CPUOFF all the time, wakeup after syscall invoked.
+
+#ifndef SYSCTL_H_
+#define SYSCTL_H_
+
+// Sysctl priority bit
+// Lowest first
+#define SYS_BIT7 (0x80)
+#define SYS_BIT6 (0x40)
+#define SYS_BIT5 (0x20)
+#define SYS_BIT4 (0x10)
+#define SYS_BIT3 (0x08)
+#define SYS_BIT2 (0x04)
+#define SYS_BIT1 (0x02)
+#define SYS_BIT0 (0x01)
+
+// SYSCALL invocation routine
+// Used this in IRQ, also wakes up the cpu
+#define SYSCALL_IRQ(X) (syscall|=X,_BIC_SR_IRQ(CPUOFF))
+// Use this in anywhere other than IRQ
+// Continuous invocation ?
+#define SYSCALL(X) (syscall|=X)
+
+// Only one stop function
+// For IRQ & Main
+#define SYSSTOP(X) (syscall&=~X)
+
+// Call handler type
+// Does't have any input
+// Preserve the state in other global variables
+// Usage example -> rsbus_syscall()
+typedef void (*syshdlr)();
+
+// Register call handler
+// Always replace old value
+void sysctl_reghdlr(unsigned int bit,syshdlr rot);
+
+// Remove old call handler
+// Replace with something useless
+void sysctl_rmhdlr(unsigned int bit);
+
+// Insert it into mainloop
+// enabling automatic procedure invocation
+void sysroutine();
+
+// Setting up the proc base
+// Call before usage
+void sysctl_init();
+
+extern volatile unsigned char syscall;
+
+#endif /* SYSCTL_H_ */