Dependents:   BLE_MIDI

Fork of nRF51822 by Nordic Semiconductor

Committer:
mistery
Date:
Thu Aug 10 14:20:09 2017 +0000
Revision:
639:3d9350cc3295
Parent:
47:db25ca6ed092

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rohit Grover 47:db25ca6ed092 1 #ifndef _NRF_DELAY_H
Rohit Grover 47:db25ca6ed092 2 #define _NRF_DELAY_H
Rohit Grover 47:db25ca6ed092 3
Rohit Grover 47:db25ca6ed092 4 // #include "nrf.h"
Rohit Grover 47:db25ca6ed092 5
Rohit Grover 47:db25ca6ed092 6 /*lint --e{438, 522} "Variable not used" "Function lacks side-effects" */
Rohit Grover 47:db25ca6ed092 7 #if defined ( __CC_ARM )
Rohit Grover 47:db25ca6ed092 8 static __ASM void __INLINE nrf_delay_us(uint32_t volatile number_of_us)
Rohit Grover 47:db25ca6ed092 9 {
Rohit Grover 47:db25ca6ed092 10 loop
Rohit Grover 47:db25ca6ed092 11 SUBS R0, R0, #1
Rohit Grover 47:db25ca6ed092 12 NOP
Rohit Grover 47:db25ca6ed092 13 NOP
Rohit Grover 47:db25ca6ed092 14 NOP
Rohit Grover 47:db25ca6ed092 15 NOP
Rohit Grover 47:db25ca6ed092 16 NOP
Rohit Grover 47:db25ca6ed092 17 NOP
Rohit Grover 47:db25ca6ed092 18 NOP
Rohit Grover 47:db25ca6ed092 19 NOP
Rohit Grover 47:db25ca6ed092 20 NOP
Rohit Grover 47:db25ca6ed092 21 NOP
Rohit Grover 47:db25ca6ed092 22 NOP
Rohit Grover 47:db25ca6ed092 23 NOP
Rohit Grover 47:db25ca6ed092 24 BNE loop
Rohit Grover 47:db25ca6ed092 25 BX LR
Rohit Grover 47:db25ca6ed092 26 }
Rohit Grover 47:db25ca6ed092 27 #elif defined ( __ICCARM__ )
Rohit Grover 47:db25ca6ed092 28 static void __INLINE nrf_delay_us(uint32_t volatile number_of_us)
Rohit Grover 47:db25ca6ed092 29 {
Rohit Grover 47:db25ca6ed092 30 __ASM (
Rohit Grover 47:db25ca6ed092 31 "loop:\n\t"
Rohit Grover 47:db25ca6ed092 32 " SUBS R0, R0, #1\n\t"
Rohit Grover 47:db25ca6ed092 33 " NOP\n\t"
Rohit Grover 47:db25ca6ed092 34 " NOP\n\t"
Rohit Grover 47:db25ca6ed092 35 " NOP\n\t"
Rohit Grover 47:db25ca6ed092 36 " NOP\n\t"
Rohit Grover 47:db25ca6ed092 37 " NOP\n\t"
Rohit Grover 47:db25ca6ed092 38 " NOP\n\t"
Rohit Grover 47:db25ca6ed092 39 " NOP\n\t"
Rohit Grover 47:db25ca6ed092 40 " NOP\n\t"
Rohit Grover 47:db25ca6ed092 41 " NOP\n\t"
Rohit Grover 47:db25ca6ed092 42 " NOP\n\t"
Rohit Grover 47:db25ca6ed092 43 " NOP\n\t"
Rohit Grover 47:db25ca6ed092 44 " NOP\n\t"
Rohit Grover 47:db25ca6ed092 45 " BNE loop\n\t");
Rohit Grover 47:db25ca6ed092 46 }
Rohit Grover 47:db25ca6ed092 47 #elif defined ( __GNUC__ )
Rohit Grover 47:db25ca6ed092 48 static void __INLINE nrf_delay_us(uint32_t volatile number_of_us)
Rohit Grover 47:db25ca6ed092 49 {
Rohit Grover 47:db25ca6ed092 50 do
Rohit Grover 47:db25ca6ed092 51 {
Rohit Grover 47:db25ca6ed092 52 __ASM volatile (
Rohit Grover 47:db25ca6ed092 53 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 54 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 55 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 56 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 57 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 58 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 59 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 60 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 61 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 62 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 63 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 64 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 65 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 66 "NOP\n\t"
Rohit Grover 47:db25ca6ed092 67 );
Rohit Grover 47:db25ca6ed092 68 } while (--number_of_us);
Rohit Grover 47:db25ca6ed092 69 }
Rohit Grover 47:db25ca6ed092 70 #endif
Rohit Grover 47:db25ca6ed092 71
Rohit Grover 47:db25ca6ed092 72 void nrf_delay_ms(uint32_t volatile number_of_ms);
Rohit Grover 47:db25ca6ed092 73
Rohit Grover 47:db25ca6ed092 74 #endif