mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Fri Jul 17 09:15:10 2015 +0100
Revision:
592:a274ee790e56
Parent:
579:53297373a894
Synchronized with git revision e7144f83a8d75df80c4877936b6ffe552b0be9e6

Full URL: https://github.com/mbedmicro/mbed/commit/e7144f83a8d75df80c4877936b6ffe552b0be9e6/

More API implementation for SAMR21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 579:53297373a894 1 #include "interrupt_sam_nvic.h"
mbed_official 579:53297373a894 2
mbed_official 579:53297373a894 3 #if !defined(__DOXYGEN__)
mbed_official 579:53297373a894 4 /* Deprecated - global flag to determine the global interrupt state. Required by
mbed_official 579:53297373a894 5 * QTouch library, however new applications should use cpu_irq_is_enabled()
mbed_official 579:53297373a894 6 * which probes the true global interrupt state from the CPU special registers.
mbed_official 579:53297373a894 7 */
mbed_official 579:53297373a894 8 volatile bool g_interrupt_enabled = true;
mbed_official 579:53297373a894 9 #endif
mbed_official 579:53297373a894 10
mbed_official 579:53297373a894 11 void cpu_irq_enter_critical(void)
mbed_official 579:53297373a894 12 {
mbed_official 579:53297373a894 13 if (cpu_irq_critical_section_counter == 0) {
mbed_official 579:53297373a894 14 if (cpu_irq_is_enabled()) {
mbed_official 579:53297373a894 15 cpu_irq_disable();
mbed_official 579:53297373a894 16 cpu_irq_prev_interrupt_state = true;
mbed_official 579:53297373a894 17 } else {
mbed_official 579:53297373a894 18 /* Make sure the to save the prev state as false */
mbed_official 579:53297373a894 19 cpu_irq_prev_interrupt_state = false;
mbed_official 579:53297373a894 20 }
mbed_official 579:53297373a894 21
mbed_official 579:53297373a894 22 }
mbed_official 579:53297373a894 23
mbed_official 579:53297373a894 24 cpu_irq_critical_section_counter++;
mbed_official 579:53297373a894 25 }
mbed_official 579:53297373a894 26
mbed_official 579:53297373a894 27 void cpu_irq_leave_critical(void)
mbed_official 579:53297373a894 28 {
mbed_official 579:53297373a894 29 /* Check if the user is trying to leave a critical section when not in a critical section */
mbed_official 579:53297373a894 30 Assert(cpu_irq_critical_section_counter > 0);
mbed_official 579:53297373a894 31
mbed_official 579:53297373a894 32 cpu_irq_critical_section_counter--;
mbed_official 579:53297373a894 33
mbed_official 579:53297373a894 34 /* Only enable global interrupts when the counter reaches 0 and the state of the global interrupt flag
mbed_official 579:53297373a894 35 was enabled when entering critical state */
mbed_official 579:53297373a894 36 if ((cpu_irq_critical_section_counter == 0) && (cpu_irq_prev_interrupt_state)) {
mbed_official 579:53297373a894 37 cpu_irq_enable();
mbed_official 579:53297373a894 38 }
mbed_official 579:53297373a894 39 }
mbed_official 579:53297373a894 40