@@ -321,75 +321,10 @@ static void rf_if_ack_timer_signal(void)
321
321
}
322
322
#endif
323
323
324
- // *INDENT-OFF*
325
- /* Delay functions for RF Chip SPI access */
326
- #ifdef __CC_ARM
327
- __asm static void delay_loop (uint32_t count)
328
- {
329
- 1
330
- SUBS a1, a1, #1
331
- BCS %BT1
332
- BX lr
333
- }
334
- #elif defined (__ARMCC_VERSION) /* ARMC6 */
335
- void delay_loop (uint32_t count)
336
- {
337
- // TODO: This needs implementation
338
- while (count--)
339
- ;;
340
- }
341
- #elif defined (__ICCARM__)
342
- static void delay_loop (uint32_t count)
343
- {
344
- __asm volatile (
345
- " loop: \n "
346
- " SUBS %0, %0, #1 \n "
347
- " BCS.n loop\n "
348
- : " +r" (count)
349
- :
350
- : " cc"
351
- );
352
- }
353
- #else // GCC
354
- static void delay_loop (uint32_t count)
355
- {
356
- __asm__ volatile (
357
- " %=:\n\t "
358
- #if defined(__thumb__) && !defined(__thumb2__)
359
- " SUB %0, #1\n\t "
360
- #else
361
- " SUBS %0, %0, #1\n\t "
362
- #endif
363
- " BCS %=b\n\t "
364
- : " +l" (count)
365
- :
366
- : " cc"
367
- );
368
- }
369
- #endif
370
- // *INDENT-ON*
371
-
372
- static void delay_ns (uint32_t ns)
373
- {
374
- uint32_t cycles_per_us = SystemCoreClock / 1000000 ;
375
- // Cortex-M0 takes 4 cycles per loop (SUB=1, BCS=3)
376
- // Cortex-M3 and M4 takes 3 cycles per loop (SUB=1, BCS=2)
377
- // Cortex-M7 - who knows?
378
- // Cortex M3-M7 have "CYCCNT" - would be better than a software loop, but M0 doesn't
379
- // Assume 3 cycles per loop for now - will be 33% slow on M0. No biggie,
380
- // as original version of code was 300% slow on M4.
381
- // [Note that this very calculation, plus call overhead, will take multiple
382
- // cycles. Could well be 100ns on its own... So round down here, startup is
383
- // worth at least one loop iteration.]
384
- uint32_t count = (cycles_per_us * ns) / 3000 ;
385
-
386
- delay_loop (count);
387
- }
388
-
389
324
// t1 = 180ns, SEL falling edge to MISO active [SPI setup assumed slow enough to not need manual delay]
390
325
#define CS_SELECT () {rf->CS = 0 ; /* delay_ns(180); */ }
391
326
// t9 = 250ns, last clock to SEL rising edge, t8 = 250ns, SPI idle time between consecutive access
392
- #define CS_RELEASE () {delay_ns (250 ); rf->CS = 1 ; delay_ns (250 );}
327
+ #define CS_RELEASE () {wait_ns (250 ); rf->CS = 1 ; wait_ns (250 );}
393
328
394
329
/*
395
330
* \brief Read connected radio part.
0 commit comments