mirror of https://github.com/ARMmbed/mbed-os.git
[LPC15XX] Modified μs_ticker to use critical API
Replaced __disable_irq() and __enable_irq() with core_util_critical_section_enter() and core_util_critical_section_exit().pull/2193/head
parent
d5f09859de
commit
22598341cd
|
@ -16,6 +16,7 @@
|
|||
#include <stddef.h>
|
||||
#include "us_ticker_api.h"
|
||||
#include "PeripheralNames.h"
|
||||
#include "critical.h"
|
||||
|
||||
#define US_TICKER_TIMER_IRQn SCT3_IRQn
|
||||
|
||||
|
@ -61,11 +62,11 @@ uint32_t us_ticker_read() {
|
|||
|
||||
void us_ticker_set_interrupt(timestamp_t timestamp) {
|
||||
// Set SCT3 match register 0 (critical section)
|
||||
__disable_irq();
|
||||
core_util_critical_section_enter();
|
||||
LPC_SCT3->CTRL |= (1 << 2);
|
||||
LPC_SCT3->MATCH0 = (uint32_t)timestamp;
|
||||
LPC_SCT3->CTRL &= ~(1 << 2);
|
||||
__enable_irq();
|
||||
core_util_critical_section_exit();
|
||||
|
||||
// Enable interrupt on SCT3 event 0
|
||||
LPC_SCT3->EVEN = (1 << 0);
|
||||
|
|
Loading…
Reference in New Issue