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: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/us_ticker.c
- Revision:
- 180:96ed750bd169
- Parent:
- 174:b96e65c34a4d
--- a/targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/us_ticker.c Thu Dec 07 14:01:42 2017 +0000 +++ b/targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/us_ticker.c Wed Jan 17 15:23:54 2018 +0000 @@ -20,6 +20,7 @@ #include "RZ_A1_Init.h" #include "VKRZA1H.h" +#include "mbed_critical.h" #define US_TICKER_TIMER_IRQn (OSTMI1TINT_IRQn) #define CPG_STBCR5_BIT_MSTP50 (0x01u) /* OSTM1 */ @@ -83,22 +84,14 @@ uint32_t us_ticker_read() { uint64_t cnt_val64; uint64_t us_val64; - int check_irq_masked; -#if defined ( __ICCARM__) - check_irq_masked = __disable_irq_iar(); -#else - check_irq_masked = __disable_irq(); -#endif /* __ICCARM__ */ + core_util_critical_section_enter(); cnt_val64 = ticker_read_counter64(); us_val64 = (cnt_val64 / count_clock); ticker_us_last64 = us_val64; - if (!check_irq_masked) { - __enable_irq(); - } - + core_util_critical_section_exit(); /* clock to us */ return (uint32_t)us_val64; }