esp_hw_support: Remove compare_set.h API

This function removes the following legacy atomic CAS functions:

From compare_set.h (file removed):
- compare_and_set_native()
- compare_and_set_extram()

From portmacro.h
- uxPortCompareSet()
- uxPortCompareSetExtram()

Users should call esp_cpu_compare_and_set() instead as this function hides the details
of atomic CAS on internal and external RAM addresses.

Due to the removal of compare_set.h, some missing header includes are also fixed in this commit.
This commit is contained in:
Darian Leung
2022-07-21 19:14:41 +08:00
parent d37fa7e244
commit 781d06af73
35 changed files with 36 additions and 225 deletions

View File

@@ -32,6 +32,7 @@
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "esp_cpu.h"
#include "hal/sha_hal.h"
#include "hal/sha_types.h"
@@ -106,7 +107,6 @@ static SemaphoreHandle_t sha_get_engine_state(esp_sha_type sha_type)
unsigned idx = sha_engine_index(sha_type);
volatile SemaphoreHandle_t *engine = &engine_states[idx];
SemaphoreHandle_t result = *engine;
uint32_t set_engine = 0;
if (result == NULL) {
// Create a new semaphore for 'in use' flag
@@ -115,10 +115,8 @@ static SemaphoreHandle_t sha_get_engine_state(esp_sha_type sha_type)
xSemaphoreGive(new_engine); // start available
// try to atomically set the previously NULL *engine to new_engine
set_engine = (uint32_t)new_engine;
uxPortCompareSet((volatile uint32_t *)engine, 0, &set_engine);
if (set_engine != 0) { // we lost a race setting *engine
if (!esp_cpu_compare_and_set((volatile uint32_t *)engine, 0, (uint32_t)new_engine)) {
// we lost a race setting *engine
vSemaphoreDelete(new_engine);
}
result = *engine;