The official mbed C/C SDK provides the software platform and libraries to build your applications.
Fork of mbed by
TARGET_RBLAB_NRF51822/nrf_delay.h@99:7f6c6de930c0, 2015-05-03 (annotated)
- Committer:
- Mikchel
- Date:
- Sun May 03 16:04:42 2015 +0000
- Revision:
- 99:7f6c6de930c0
- Parent:
- 97:433970e64889
12
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 97:433970e64889 | 1 | #ifndef _NRF_DELAY_H |
Kojto | 97:433970e64889 | 2 | #define _NRF_DELAY_H |
Kojto | 97:433970e64889 | 3 | |
Kojto | 97:433970e64889 | 4 | // #include "nrf.h" |
Kojto | 97:433970e64889 | 5 | |
Kojto | 97:433970e64889 | 6 | /*lint --e{438, 522} "Variable not used" "Function lacks side-effects" */ |
Kojto | 97:433970e64889 | 7 | #if defined ( __CC_ARM ) |
Kojto | 97:433970e64889 | 8 | static __ASM void __INLINE nrf_delay_us(uint32_t volatile number_of_us) |
Kojto | 97:433970e64889 | 9 | { |
Kojto | 97:433970e64889 | 10 | loop |
Kojto | 97:433970e64889 | 11 | SUBS R0, R0, #1 |
Kojto | 97:433970e64889 | 12 | NOP |
Kojto | 97:433970e64889 | 13 | NOP |
Kojto | 97:433970e64889 | 14 | NOP |
Kojto | 97:433970e64889 | 15 | NOP |
Kojto | 97:433970e64889 | 16 | NOP |
Kojto | 97:433970e64889 | 17 | NOP |
Kojto | 97:433970e64889 | 18 | NOP |
Kojto | 97:433970e64889 | 19 | NOP |
Kojto | 97:433970e64889 | 20 | NOP |
Kojto | 97:433970e64889 | 21 | NOP |
Kojto | 97:433970e64889 | 22 | NOP |
Kojto | 97:433970e64889 | 23 | NOP |
Kojto | 97:433970e64889 | 24 | BNE loop |
Kojto | 97:433970e64889 | 25 | BX LR |
Kojto | 97:433970e64889 | 26 | } |
Kojto | 97:433970e64889 | 27 | #elif defined ( __ICCARM__ ) |
Kojto | 97:433970e64889 | 28 | static void __INLINE nrf_delay_us(uint32_t volatile number_of_us) |
Kojto | 97:433970e64889 | 29 | { |
Kojto | 97:433970e64889 | 30 | __ASM ( |
Kojto | 97:433970e64889 | 31 | "loop:\n\t" |
Kojto | 97:433970e64889 | 32 | " SUBS R0, R0, #1\n\t" |
Kojto | 97:433970e64889 | 33 | " NOP\n\t" |
Kojto | 97:433970e64889 | 34 | " NOP\n\t" |
Kojto | 97:433970e64889 | 35 | " NOP\n\t" |
Kojto | 97:433970e64889 | 36 | " NOP\n\t" |
Kojto | 97:433970e64889 | 37 | " NOP\n\t" |
Kojto | 97:433970e64889 | 38 | " NOP\n\t" |
Kojto | 97:433970e64889 | 39 | " NOP\n\t" |
Kojto | 97:433970e64889 | 40 | " NOP\n\t" |
Kojto | 97:433970e64889 | 41 | " NOP\n\t" |
Kojto | 97:433970e64889 | 42 | " NOP\n\t" |
Kojto | 97:433970e64889 | 43 | " NOP\n\t" |
Kojto | 97:433970e64889 | 44 | " NOP\n\t" |
Kojto | 97:433970e64889 | 45 | " BNE loop\n\t"); |
Kojto | 97:433970e64889 | 46 | } |
Kojto | 97:433970e64889 | 47 | #elif defined ( __GNUC__ ) |
Kojto | 97:433970e64889 | 48 | static void __INLINE nrf_delay_us(uint32_t volatile number_of_us) |
Kojto | 97:433970e64889 | 49 | { |
Kojto | 97:433970e64889 | 50 | do |
Kojto | 97:433970e64889 | 51 | { |
Kojto | 97:433970e64889 | 52 | __ASM volatile ( |
Kojto | 97:433970e64889 | 53 | "NOP\n\t" |
Kojto | 97:433970e64889 | 54 | "NOP\n\t" |
Kojto | 97:433970e64889 | 55 | "NOP\n\t" |
Kojto | 97:433970e64889 | 56 | "NOP\n\t" |
Kojto | 97:433970e64889 | 57 | "NOP\n\t" |
Kojto | 97:433970e64889 | 58 | "NOP\n\t" |
Kojto | 97:433970e64889 | 59 | "NOP\n\t" |
Kojto | 97:433970e64889 | 60 | "NOP\n\t" |
Kojto | 97:433970e64889 | 61 | "NOP\n\t" |
Kojto | 97:433970e64889 | 62 | "NOP\n\t" |
Kojto | 97:433970e64889 | 63 | "NOP\n\t" |
Kojto | 97:433970e64889 | 64 | "NOP\n\t" |
Kojto | 97:433970e64889 | 65 | "NOP\n\t" |
Kojto | 97:433970e64889 | 66 | "NOP\n\t" |
Kojto | 97:433970e64889 | 67 | ); |
Kojto | 97:433970e64889 | 68 | } while (--number_of_us); |
Kojto | 97:433970e64889 | 69 | } |
Kojto | 97:433970e64889 | 70 | #endif |
Kojto | 97:433970e64889 | 71 | |
Kojto | 97:433970e64889 | 72 | void nrf_delay_ms(uint32_t volatile number_of_ms); |
Kojto | 97:433970e64889 | 73 | |
Kojto | 97:433970e64889 | 74 | #endif |