Skip to content

Commit b16adea

Browse files
committed
Remove sleep lock/unlock from HAL
The sleep locking/unlocking is taken care of by the layer above (driver).
1 parent 46603f8 commit b16adea

File tree

2 files changed

+1
-34
lines changed

2 files changed

+1
-34
lines changed

targets/TARGET_Silicon_Labs/TARGET_EFM32/i2c_api.c

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#if DEVICE_I2C
2929

3030
#include "mbed_assert.h"
31-
#include "mbed_power_mgmt.h"
3231
#include "i2c_api.h"
3332
#include "PeripheralPins.h"
3433
#include "pinmap_function.h"
@@ -466,7 +465,6 @@ void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask)
466465
#include "em_dma.h"
467466
#include "dma_api_HAL.h"
468467
#include "dma_api.h"
469-
#include "sleep_api.h"
470468
#include "buffer.h"
471469

472470
/** Start i2c asynchronous transfer.
@@ -527,18 +525,7 @@ void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, void *rx,
527525
// Kick off the transfer
528526
retval = I2C_TransferInit(obj->i2c.i2c, &(obj->i2c.xfer));
529527

530-
if(retval == i2cTransferInProgress) {
531-
sleep_manager_lock_deep_sleep();
532-
} else {
533-
// something happened, and the transfer did not go through
534-
// So, we need to clean up
535-
536-
// Disable interrupt
537-
i2c_enable_interrupt(obj, 0, false);
538-
539-
// Block until free
540-
while(i2c_active(obj));
541-
}
528+
MBED_ASSERT(retval == i2cTransferInProgress);
542529
}
543530

544531
/** The asynchronous IRQ handler
@@ -561,24 +548,18 @@ uint32_t i2c_irq_handler_asynch(i2c_t *obj)
561548
// Disable interrupt
562549
i2c_enable_interrupt(obj, 0, false);
563550

564-
sleep_manager_unlock_deep_sleep();
565-
566551
return I2C_EVENT_TRANSFER_COMPLETE & obj->i2c.events;
567552
case i2cTransferNack:
568553
// A NACK has been received while an ACK was expected. This is usually because the slave did not respond to the address.
569554
// Disable interrupt
570555
i2c_enable_interrupt(obj, 0, false);
571556

572-
sleep_manager_unlock_deep_sleep();
573-
574557
return I2C_EVENT_ERROR_NO_SLAVE & obj->i2c.events;
575558
default:
576559
// An error situation has arisen.
577560
// Disable interrupt
578561
i2c_enable_interrupt(obj, 0, false);
579562

580-
sleep_manager_unlock_deep_sleep();
581-
582563
// return error
583564
return I2C_EVENT_ERROR & obj->i2c.events;
584565
}
@@ -609,8 +590,6 @@ void i2c_abort_asynch(i2c_t *obj)
609590

610591
// Block until free
611592
while(i2c_active(obj));
612-
613-
sleep_manager_unlock_deep_sleep();
614593
}
615594

616595
#endif //DEVICE_I2C ASYNCH

targets/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#if DEVICE_SPI
2727

2828
#include "mbed_assert.h"
29-
#include "mbed_power_mgmt.h"
3029
#include "PeripheralPins.h"
3130
#include "pinmap.h"
3231
#include "pinmap_function.h"
@@ -39,7 +38,6 @@
3938
#include "em_usart.h"
4039
#include "em_cmu.h"
4140
#include "em_dma.h"
42-
#include "sleep_api.h"
4341

4442
static uint16_t fill_word = SPI_FILL_WORD;
4543

@@ -1185,9 +1183,6 @@ void spi_master_transfer(spi_t *obj, const void *tx, size_t tx_length, void *rx,
11851183
spi_enable_event(obj, SPI_EVENT_ALL, false);
11861184
spi_enable_event(obj, event, true);
11871185

1188-
// Set the sleep mode
1189-
sleep_manager_lock_deep_sleep();
1190-
11911186
/* And kick off the transfer */
11921187
spi_master_transfer_dma(obj, tx, rx, tx_length, rx_length, (void*)handler, hint);
11931188
}
@@ -1242,7 +1237,6 @@ uint32_t spi_irq_handler_asynch(spi_t* obj)
12421237

12431238
/* Wait transmit to complete, before user code is indicated*/
12441239
while(!(obj->spi.spi->STATUS & USART_STATUS_TXC));
1245-
sleep_manager_unlock_deep_sleep();
12461240
/* return to CPP land to say we're finished */
12471241
return SPI_EVENT_COMPLETE;
12481242
} else {
@@ -1260,7 +1254,6 @@ uint32_t spi_irq_handler_asynch(spi_t* obj)
12601254
/* disable interrupts */
12611255
spi_enable_interrupt(obj, (uint32_t)NULL, false);
12621256

1263-
sleep_manager_unlock_deep_sleep();
12641257
/* Return the event back to userland */
12651258
return event;
12661259
}
@@ -1368,7 +1361,6 @@ uint32_t spi_irq_handler_asynch(spi_t* obj)
13681361

13691362
/* Wait for transmit to complete, before user code is indicated */
13701363
while(!(obj->spi.spi->STATUS & USART_STATUS_TXC));
1371-
sleep_manager_unlock_deep_sleep();
13721364

13731365
/* return to CPP land to say we're finished */
13741366
return SPI_EVENT_COMPLETE;
@@ -1389,7 +1381,6 @@ uint32_t spi_irq_handler_asynch(spi_t* obj)
13891381

13901382
/* Wait for transmit to complete, before user code is indicated */
13911383
while(!(obj->spi.spi->STATUS & USART_STATUS_TXC));
1392-
sleep_manager_unlock_deep_sleep();
13931384

13941385
/* Return the event back to userland */
13951386
return event;
@@ -1429,9 +1420,6 @@ void spi_abort_asynch(spi_t *obj)
14291420
// Interrupt implementation: switch off interrupts
14301421
spi_enable_interrupt(obj, (uint32_t)NULL, false);
14311422
}
1432-
1433-
// Release sleep mode block
1434-
sleep_manager_unlock_deep_sleep();
14351423
}
14361424

14371425
const PinMap *spi_master_mosi_pinmap()

0 commit comments

Comments
 (0)