Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MAXREFDES131_Qt_Demo MAX32630FTHR_iButton_uSD_Logger MAX32630FTHR_DS18B20_uSD_Logger MAXREFDES130_131_Demo ... more
OneWire_Masters/GPIO/owlink.s@40:590791ecac1c, 2016-04-05 (annotated)
- Committer:
- IanBenzMaxim
- Date:
- Tue Apr 05 17:28:35 2016 -0500
- Revision:
- 40:590791ecac1c
- Parent:
- 31:7c684e49fa8f
- Child:
- 46:afe466c96069
Added check to make ow_usdelay(0) work correctly which increases function overhead by 2 clock cycles.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
IanBenzMaxim | 40:590791ecac1c | 1 | #define PROC_CLOCK_MHZ (__SYSTEM_HFX / 1000000) // Processor clock in MHz |
IanBenzMaxim | 31:7c684e49fa8f | 2 | #define OVERHEAD_TUNING 21 // Fraction where OverheadTime(us) = OVERHEAD_TUNING / PROC_CLOCK_MHZ |
IanBenzMaxim | 31:7c684e49fa8f | 3 | // Make PROC_CLOCK_MHZ and OVERHEAD_TUNING divisible by PROC_CYCLES_PER_LOOP for best results |
IanBenzMaxim | 28:057bb14d3cee | 4 | |
IanBenzMaxim | 31:7c684e49fa8f | 5 | #define PIPELINE_REFILL_PROC_CYCLES 1 // ARM specifies 1-3 cycles for pipeline refill following a branch |
IanBenzMaxim | 31:7c684e49fa8f | 6 | #define PROC_CYCLES_PER_LOOP (2 + PIPELINE_REFILL_PROC_CYCLES) |
IanBenzMaxim | 31:7c684e49fa8f | 7 | #define LOOPS_PER_US (PROC_CLOCK_MHZ / PROC_CYCLES_PER_LOOP) // Number of loop passes for a 1 us delay |
IanBenzMaxim | 31:7c684e49fa8f | 8 | #define LOOPS_REMOVED_TUNING (OVERHEAD_TUNING / PROC_CYCLES_PER_LOOP) |
IanBenzMaxim | 30:fdd7a0f82f2f | 9 | |
IanBenzMaxim | 31:7c684e49fa8f | 10 | #if defined TOOLCHAIN_IAR |
IanBenzMaxim | 30:fdd7a0f82f2f | 11 | SECTION owlink : CODE |
IanBenzMaxim | 31:7c684e49fa8f | 12 | #elif defined TOOLCHAIN_ARM_STD |
IanBenzMaxim | 29:5c51a17cfbf5 | 13 | AREA owlink, CODE |
IanBenzMaxim | 31:7c684e49fa8f | 14 | #else // TOOLCHAIN_GCC_ARM |
IanBenzMaxim | 31:7c684e49fa8f | 15 | .syntax unified |
IanBenzMaxim | 31:7c684e49fa8f | 16 | .section .text |
IanBenzMaxim | 30:fdd7a0f82f2f | 17 | #endif |
IanBenzMaxim | 28:057bb14d3cee | 18 | |
IanBenzMaxim | 31:7c684e49fa8f | 19 | // void ow_usdelay(unsigned int time_us) |
IanBenzMaxim | 31:7c684e49fa8f | 20 | #ifdef TOOLCHAIN_GCC_ARM |
IanBenzMaxim | 31:7c684e49fa8f | 21 | .thumb_func |
IanBenzMaxim | 31:7c684e49fa8f | 22 | .global ow_usdelay |
IanBenzMaxim | 31:7c684e49fa8f | 23 | ow_usdelay: |
IanBenzMaxim | 31:7c684e49fa8f | 24 | #else // TOOLCHAIN_IAR or TOOLCHAIN_ARM_STD |
IanBenzMaxim | 29:5c51a17cfbf5 | 25 | EXPORT ow_usdelay |
IanBenzMaxim | 29:5c51a17cfbf5 | 26 | ow_usdelay |
IanBenzMaxim | 31:7c684e49fa8f | 27 | #endif |
IanBenzMaxim | 40:590791ecac1c | 28 | cmp R0, #0 // Return if time_us equals zero |
IanBenzMaxim | 40:590791ecac1c | 29 | beq return |
IanBenzMaxim | 28:057bb14d3cee | 30 | mov R1, #LOOPS_PER_US |
IanBenzMaxim | 28:057bb14d3cee | 31 | mul R0, R0, R1 |
IanBenzMaxim | 28:057bb14d3cee | 32 | sub R0, R0, #LOOPS_REMOVED_TUNING |
IanBenzMaxim | 31:7c684e49fa8f | 33 | #ifdef TOOLCHAIN_GCC_ARM |
IanBenzMaxim | 31:7c684e49fa8f | 34 | loop: |
IanBenzMaxim | 31:7c684e49fa8f | 35 | #else // TOOLCHAIN_IAR or TOOLCHAIN_ARM_STD |
IanBenzMaxim | 29:5c51a17cfbf5 | 36 | loop |
IanBenzMaxim | 31:7c684e49fa8f | 37 | #endif |
IanBenzMaxim | 28:057bb14d3cee | 38 | subs R0, R0, #1 |
IanBenzMaxim | 28:057bb14d3cee | 39 | bne loop |
IanBenzMaxim | 40:590791ecac1c | 40 | #ifdef TOOLCHAIN_GCC_ARM |
IanBenzMaxim | 40:590791ecac1c | 41 | return: |
IanBenzMaxim | 40:590791ecac1c | 42 | #else // TOOLCHAIN_IAR or TOOLCHAIN_ARM_STD |
IanBenzMaxim | 40:590791ecac1c | 43 | return |
IanBenzMaxim | 40:590791ecac1c | 44 | #endif |
IanBenzMaxim | 28:057bb14d3cee | 45 | bx R14 |
IanBenzMaxim | 28:057bb14d3cee | 46 | |
IanBenzMaxim | 31:7c684e49fa8f | 47 | #ifdef TOOLCHAIN_GCC_ARM |
IanBenzMaxim | 31:7c684e49fa8f | 48 | .end |
IanBenzMaxim | 31:7c684e49fa8f | 49 | #else // TOOLCHAIN_IAR or TOOLCHAIN_ARM_STD |
IanBenzMaxim | 31:7c684e49fa8f | 50 | END |
IanBenzMaxim | 40:590791ecac1c | 51 | #endif |