diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-08-07 16:03:00 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-08-07 16:03:00 +0300 |
commit | f71f37e4269b43222d6b1b812e7109e946345b53 (patch) | |
tree | f73d4d3dbfb639f5c4c97fe04d88d0f739149239 /esp8266/esp_mphal.h | |
parent | c2070d771a70df6ebe19d6ca97b363b2b38d69fa (diff) | |
download | micropython-f71f37e4269b43222d6b1b812e7109e946345b53.tar.gz micropython-f71f37e4269b43222d6b1b812e7109e946345b53.zip |
esp8266/esp_mphal.h: Add mp_hal_ticks_cpu() for reuse.
Diffstat (limited to 'esp8266/esp_mphal.h')
-rw-r--r-- | esp8266/esp_mphal.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/esp8266/esp_mphal.h b/esp8266/esp_mphal.h index 91fee21198..fa52ae53a2 100644 --- a/esp8266/esp_mphal.h +++ b/esp8266/esp_mphal.h @@ -47,6 +47,12 @@ void mp_hal_init(void); void mp_hal_rtc_init(void); uint32_t mp_hal_ticks_us(void); +__attribute__((always_inline)) static inline uint32_t mp_hal_ticks_cpu(void) { + uint32_t ccount; + __asm__ __volatile__("rsr %0,ccount":"=a" (ccount)); + return ccount; +} + void mp_hal_delay_us(uint32_t); void mp_hal_set_interrupt_char(int c); uint32_t mp_hal_get_cpu_freq(void); |