Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove __enable and __disable irq calls from mbed hal common code #1807

Merged
merged 2 commits into from
May 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions hal/common/SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
#include "SPI.h"
#include "critical.h"

#if DEVICE_SPI

Expand Down Expand Up @@ -124,12 +125,12 @@ int SPI::queue_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, i
if (_transaction_buffer.full()) {
return -1; // the buffer is full
} else {
__disable_irq();
core_util_critical_section_enter();
_transaction_buffer.push(transaction);
if (!spi_active(&_spi)) {
dequeue_transaction();
}
__enable_irq();
core_util_critical_section_exit();
return 0;
}
#else
Expand Down
3 changes: 2 additions & 1 deletion hal/common/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
#include "wait_api.h"
#include "toolchain.h"
#include "mbed_interface.h"
#include "critical.h"

WEAK void mbed_die(void) {
#if !defined (NRF51_H) && !defined(TARGET_EFM32)
__disable_irq(); // dont allow interrupts to disturb the flash pattern
core_util_critical_section_enter();
#endif
#if (DEVICE_ERROR_RED == 1)
gpio_t led_red; gpio_init_out(&led_red, LED_RED);
Expand Down
5 changes: 3 additions & 2 deletions libraries/tests/libs/SerialHalfDuplex/SerialHalfDuplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (c) 2010-2011 ARM Limited. All rights reserved.
*/
#include "SerialHalfDuplex.h"
#include "critical.h"

#if DEVICE_SERIAL

Expand Down Expand Up @@ -29,7 +30,7 @@ int SerialHalfDuplex::_putc(int c) {
int retc;

// TODO: We should not disable all interrupts
__disable_irq();
core_util_critical_section_enter();

serial_pinout_tx(gpio.pin);

Expand All @@ -38,7 +39,7 @@ int SerialHalfDuplex::_putc(int c) {

pin_function(gpio.pin, 0);

__enable_irq();
core_util_critical_section_exit();

return retc;
}
Expand Down