mirror of https://github.com/ARMmbed/mbed-os.git
Nuvoton: Remove dead code nu_delay_cycle_x4(...)
Originally, nu_delay_cycle_x4(...) is borrowed from mbed test code for delay cycle. Currently, it is not used on Nuvoton targets. If delay cycle is needed, use wait_ns(...) instead which has strict implementation and has passed tests.pull/11195/head
parent
0fabceea00
commit
d8dff83fcb
|
@ -65,65 +65,3 @@ void nu_busy_wait_us(uint32_t us)
|
||||||
prev = cur;
|
prev = cur;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delay 4 cycles per round by hand-counting instruction cycles
|
|
||||||
*
|
|
||||||
* The delay function here is implemented by just hand-counting instruction cycles rather than preferred
|
|
||||||
* H/W timer since it is to use in cases where H/W timer is not available. Usually, it can delay at least
|
|
||||||
* 4-cycles per round.
|
|
||||||
*
|
|
||||||
* In modern pipeline core, plus flash performance and other factors, we cannot rely accurately on hand-
|
|
||||||
* counting instruction cycles for expected delay cycles.
|
|
||||||
*/
|
|
||||||
#if defined(__CC_ARM)
|
|
||||||
MBED_NOINLINE
|
|
||||||
__asm void nu_delay_cycle_x4(uint32_t rounds)
|
|
||||||
{
|
|
||||||
// AStyle should not format inline assembly
|
|
||||||
// *INDENT-OFF*
|
|
||||||
1
|
|
||||||
#if !defined(__CORTEX_M0)
|
|
||||||
NOP // 1 cycle
|
|
||||||
#endif
|
|
||||||
SUBS a1, a1, #1 // 1 cycle
|
|
||||||
BCS %BT1 // 3 cycles(M0)/2 cycles(non-M0)
|
|
||||||
BX lr
|
|
||||||
// *INDENT-ON*
|
|
||||||
}
|
|
||||||
#elif defined (__ICCARM__)
|
|
||||||
MBED_NOINLINE
|
|
||||||
void nu_delay_cycle_x4(uint32_t rounds)
|
|
||||||
{
|
|
||||||
__asm volatile(
|
|
||||||
"loop: \n"
|
|
||||||
#if !defined(__CORTEX_M0)
|
|
||||||
" NOP \n" // 1 cycle
|
|
||||||
#endif
|
|
||||||
" SUBS %0, %0, #1 \n" // 1 cycle
|
|
||||||
" BCS.n loop\n" // 3 cycles(M0)/2 cycles(non-M0)
|
|
||||||
: "+r"(rounds)
|
|
||||||
:
|
|
||||||
: "cc"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
#elif defined ( __GNUC__ ) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
|
|
||||||
MBED_NOINLINE
|
|
||||||
void nu_delay_cycle_x4(uint32_t rounds)
|
|
||||||
{
|
|
||||||
__asm__ volatile(
|
|
||||||
"%=:\n\t"
|
|
||||||
#if !defined(__CORTEX_M0)
|
|
||||||
"NOP\n\t" // 1 cycle
|
|
||||||
#endif
|
|
||||||
#if defined(__thumb__) && !defined(__thumb2__) && !defined(__ARMCC_VERSION)
|
|
||||||
"SUB %0, #1\n\t" // 1 cycle
|
|
||||||
#else
|
|
||||||
"SUBS %0, %0, #1\n\t" // 1 cycle
|
|
||||||
#endif
|
|
||||||
"BCS %=b\n\t" // 3 cycles(M0)/2 cycles(non-M0)
|
|
||||||
: "+l"(rounds)
|
|
||||||
:
|
|
||||||
: "cc"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -74,9 +74,6 @@ void nu_countdown_free(struct nu_countdown_ctx_s *ctx);
|
||||||
*/
|
*/
|
||||||
void nu_busy_wait_us(uint32_t us);
|
void nu_busy_wait_us(uint32_t us);
|
||||||
|
|
||||||
/* Delay 4 cycles per round by hand-counting instruction cycles */
|
|
||||||
void nu_delay_cycle_x4(uint32_t rounds);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue