diff options
author | Joe Zhao <ztuowen@gmail.com> | 2014-06-07 17:18:26 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2014-06-07 17:18:26 +0800 |
commit | 26d1037502e9a0af56929968f77fe3168dd2b05f (patch) | |
tree | faa314842db556ea49736de21a05eac773b5d627 | |
parent | 07d2ace8b4771e2ad48d4a9e6bf43a2022a25fac (diff) | |
download | rsbus-master.tar.gz rsbus-master.tar.bz2 rsbus-master.zip |
-rw-r--r-- | rs422lib/main.c | 11 | ||||
-rw-r--r-- | rs422lib/sysctl.c | 3 |
2 files changed, 9 insertions, 5 deletions
diff --git a/rs422lib/main.c b/rs422lib/main.c index 34cb03e..0b1b946 100644 --- a/rs422lib/main.c +++ b/rs422lib/main.c @@ -5,6 +5,7 @@ int cnt=0; int cnt2=0; +int cnt3=0; void port_init(void) { @@ -22,6 +23,7 @@ void received(unsigned char* str,unsigned int len) { SWITCH_STATE(ST_RUN); cnt2=0; + cnt3=0; STATE(0)=0; SYSCALL(TEST); } @@ -115,10 +117,13 @@ void init_devices(void) // Clock tick using cycle estimation void basic_running_ex() { - int i; - for (i=950;i>0;--i) - delay_ms(1); + delay_ms(2); ++cnt2; + if (cnt2==250) + { + ++cnt3; + cnt2=0; + } SYSCALL(TEST); } diff --git a/rs422lib/sysctl.c b/rs422lib/sysctl.c index ea05587..11af11b 100644 --- a/rs422lib/sysctl.c +++ b/rs422lib/sysctl.c @@ -19,8 +19,7 @@ void sysctl_void() } void sysroutine() -// << Drawback: interrupt may happen between else and CPUOFF -// Critical section -> unlikely to have a race condition +// Critical section -> unlikely to have a race condition { if (!syscall) _BIS_SR(CPUOFF); |