diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2013-11-24 07:14:20 +0400 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2013-11-24 07:14:20 +0400 |
commit | 365ceb1b99c0af86abf12c9830c33e4149fe7f2d (patch) | |
tree | 10441de8326aef8adf61860efc90fa53ced9a3f6 | |
parent | 8c4534b16b144a4ff02a261e5a8ff744e020cc90 (diff) |
Fixing some nop constants in delay.h to make them better
-rw-r--r-- | delay.h | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -9,8 +9,10 @@ #if defined(__arm__) # define NOP __asm__ __volatile__ ("nop\n"); +# define NOP2 __asm__ __volatile__ ("nop\n\tnop"); #else # define NOP __asm__ __volatile__ ("cp r0,r0\n"); +# define NOP2 __asm__ __volatile__ ("rjmp .+0"); #endif // predeclaration to not upset the compiler @@ -54,9 +56,9 @@ template<> __attribute__((always_inline)) inline void delaycycles<-2>() {} template<> __attribute__((always_inline)) inline void delaycycles<-1>() {} template<> __attribute__((always_inline)) inline void delaycycles<0>() {} template<> __attribute__((always_inline)) inline void delaycycles<1>() {NOP;} -template<> __attribute__((always_inline)) inline void delaycycles<2>() {NOP;NOP;} -template<> __attribute__((always_inline)) inline void delaycycles<3>() {NOP;NOP;NOP;} -template<> __attribute__((always_inline)) inline void delaycycles<4>() {NOP;NOP;NOP;NOP;} -template<> __attribute__((always_inline)) inline void delaycycles<5>() {NOP;NOP;NOP;NOP;NOP;} +template<> __attribute__((always_inline)) inline void delaycycles<2>() {NOP2;} +template<> __attribute__((always_inline)) inline void delaycycles<3>() {NOP;NOP2;} +template<> __attribute__((always_inline)) inline void delaycycles<4>() {NOP2;NOP2;} +template<> __attribute__((always_inline)) inline void delaycycles<5>() {NOP2;NOP2;NOP;} #endif
\ No newline at end of file |