summaryrefslogtreecommitdiff
path: root/rs422lib/sysctl.c
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2014-05-16 22:36:52 +0800
committerJoe Zhao <ztuowen@gmail.com>2014-05-16 22:36:52 +0800
commitd9c0c179fc4636b8927dd2c8b2cb29d573094731 (patch)
tree09001c14dd2d3d06ab1b4fe57a0676be9909972a /rs422lib/sysctl.c
parent80469b4bfaf49a407d8d6b5bf3c2eb0d1c9870e6 (diff)
downloadrsbus-d9c0c179fc4636b8927dd2c8b2cb29d573094731.tar.gz
rsbus-d9c0c179fc4636b8927dd2c8b2cb29d573094731.tar.bz2
rsbus-d9c0c179fc4636b8927dd2c8b2cb29d573094731.zip
remove main & cmd
Diffstat (limited to 'rs422lib/sysctl.c')
-rw-r--r--rs422lib/sysctl.c174
1 files changed, 87 insertions, 87 deletions
diff --git a/rs422lib/sysctl.c b/rs422lib/sysctl.c
index 4562702..cafcb62 100644
--- a/rs422lib/sysctl.c
+++ b/rs422lib/sysctl.c
@@ -1,87 +1,87 @@
-/*
- * sysctl.c
- *
- * Created on: 2014-4-26
- * Author: Tuowen
- */
-
-#include<msp430g2553.h>
-#include"sysctl.h"
-
-syshdlr sysarr[8];
-
-volatile unsigned char syscall=0;
-
-void sysctl_void()
-{
- // This is the default routine
- // I don't want some monkey just come and call some random places in the text!!!!!
-}
-
-void sysroutine()
-{
- if (syscall>0)
- switch ((syscall & (-syscall))) // This is used to get the lowest bit
- {
- case SYS_BIT7:
- syscall=syscall&(~SYS_BIT7);
- sysarr[7]();
- break;
- case SYS_BIT6:
- syscall=syscall&(~SYS_BIT6);
- sysarr[6]();
- break;
- case SYS_BIT5:
- syscall=syscall&(~SYS_BIT5);
- sysarr[5]();
- break;
- case SYS_BIT4:
- syscall=syscall&(~SYS_BIT4);
- sysarr[4]();
- break;
- case SYS_BIT3:
- syscall=syscall&(~SYS_BIT3);
- sysarr[3]();
- break;
- case SYS_BIT2:
- syscall=syscall&(~SYS_BIT2);
- sysarr[2]();
- break;
- case SYS_BIT1:
- syscall=syscall&(~SYS_BIT1);
- sysarr[1]();
- break;
- case SYS_BIT0:
- syscall=syscall&(~SYS_BIT0);
- sysarr[0]();
- break;
- }
- else
- _BIS_SR(CPUOFF);
-}
-
-inline int sys_b2i(int bit)
-{
- int i=0;
- while (bit>1){bit>>=1;++i;}
- return i;
-}
-
-void sysctl_reghdlr(unsigned int bit,syshdlr rot)
-{
- bit=sys_b2i(bit);
- sysarr[bit]=rot;
-}
-
-void sysctl_rmhdlr(unsigned int bit)
-{
- bit=sys_b2i(bit);
- sysarr[bit]=&sysctl_void;
-}
-
-void sysctl_init()
-{
- unsigned int i;
- for (i=0;i<8;++i)
- sysarr[i]=&sysctl_void;
-}
+/*
+ * sysctl.c
+ *
+ * Created on: 2014-4-26
+ * Author: Tuowen
+ */
+
+#include<msp430g2553.h>
+#include"sysctl.h"
+
+syshdlr sysarr[8];
+
+volatile unsigned char syscall=0;
+
+void sysctl_void()
+{
+ // This is the default routine
+ // I don't want some monkey just come and call some random places in the text!!!!!
+}
+
+void sysroutine()
+{
+ if (syscall>0)
+ switch ((syscall & (-syscall))) // This is used to get the lowest bit
+ {
+ case SYS_BIT7:
+ syscall=syscall&(~SYS_BIT7);
+ sysarr[7]();
+ break;
+ case SYS_BIT6:
+ syscall=syscall&(~SYS_BIT6);
+ sysarr[6]();
+ break;
+ case SYS_BIT5:
+ syscall=syscall&(~SYS_BIT5);
+ sysarr[5]();
+ break;
+ case SYS_BIT4:
+ syscall=syscall&(~SYS_BIT4);
+ sysarr[4]();
+ break;
+ case SYS_BIT3:
+ syscall=syscall&(~SYS_BIT3);
+ sysarr[3]();
+ break;
+ case SYS_BIT2:
+ syscall=syscall&(~SYS_BIT2);
+ sysarr[2]();
+ break;
+ case SYS_BIT1:
+ syscall=syscall&(~SYS_BIT1);
+ sysarr[1]();
+ break;
+ case SYS_BIT0:
+ syscall=syscall&(~SYS_BIT0);
+ sysarr[0]();
+ break;
+ }
+ else
+ _BIS_SR(CPUOFF);
+}
+
+inline int sys_b2i(int bit)
+{
+ int i=0;
+ while (bit>1){bit>>=1;++i;}
+ return i;
+}
+
+void sysctl_reghdlr(unsigned int bit,syshdlr rot)
+{
+ bit=sys_b2i(bit);
+ sysarr[bit]=rot;
+}
+
+void sysctl_rmhdlr(unsigned int bit)
+{
+ bit=sys_b2i(bit);
+ sysarr[bit]=&sysctl_void;
+}
+
+void sysctl_init()
+{
+ unsigned int i;
+ for (i=0;i<8;++i)
+ sysarr[i]=&sysctl_void;
+}