forked from espressif/esp-idf
freertos: Restore uxPortCompareSet() in ESP32 unicore & make compatible code for ESP32S2Beta
This macro is used in places which expect it to work even without dual core being on. Still make "mux" functions in FreeRTOS into no-ops as the mux is not needed.
This commit is contained in:
committed by
Angus Gratton
parent
e9901d15a1
commit
c22965b22c
@@ -353,13 +353,29 @@ static inline unsigned portENTER_CRITICAL_NESTED(void) {
|
|||||||
* ESP32 (portMUX assertions would fail).
|
* ESP32 (portMUX assertions would fail).
|
||||||
*/
|
*/
|
||||||
static inline void uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set) {
|
static inline void uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set) {
|
||||||
#ifndef CONFIG_FREERTOS_UNICORE
|
#if XCHAL_HAVE_S32C1I
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"WSR %2,SCOMPARE1 \n"
|
"WSR %2,SCOMPARE1 \n"
|
||||||
"S32C1I %0, %1, 0 \n"
|
"S32C1I %0, %1, 0 \n"
|
||||||
:"=r"(*set)
|
:"=r"(*set)
|
||||||
:"r"(addr), "r"(compare), "0"(*set)
|
:"r"(addr), "r"(compare), "0"(*set)
|
||||||
);
|
);
|
||||||
|
#else
|
||||||
|
// No S32C1I, so do this by disabling and re-enabling interrupts (slower)
|
||||||
|
uint32_t intlevel, old_value;
|
||||||
|
__asm__ __volatile__ ("rsil %0, " XTSTR(XCHAL_EXCM_LEVEL) "\n"
|
||||||
|
: "=r"(intlevel));
|
||||||
|
|
||||||
|
old_value = *addr;
|
||||||
|
if (old_value == compare) {
|
||||||
|
*addr = *set;
|
||||||
|
}
|
||||||
|
|
||||||
|
__asm__ __volatile__ ("memw \n"
|
||||||
|
"wsr %0, ps\n"
|
||||||
|
:: "r"(intlevel));
|
||||||
|
|
||||||
|
*set = old_value;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,16 +91,21 @@
|
|||||||
|
|
||||||
|
|
||||||
static inline bool __attribute__((always_inline)) vPortCPUAcquireMutexIntsDisabled(PORTMUX_AQUIRE_MUX_FN_ARGS) {
|
static inline bool __attribute__((always_inline)) vPortCPUAcquireMutexIntsDisabled(PORTMUX_AQUIRE_MUX_FN_ARGS) {
|
||||||
|
#if !defined(CONFIG_FREERTOS_UNICORE)
|
||||||
#if defined(CONFIG_SPIRAM)
|
#if defined(CONFIG_SPIRAM)
|
||||||
if (esp_ptr_external_ram(mux)) {
|
if (esp_ptr_external_ram(mux)) {
|
||||||
return vPortCPUAcquireMutexIntsDisabledExtram(PORTMUX_AQUIRE_MUX_FN_CALL_ARGS(mux));
|
return vPortCPUAcquireMutexIntsDisabledExtram(PORTMUX_AQUIRE_MUX_FN_CALL_ARGS(mux));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return vPortCPUAcquireMutexIntsDisabledInternal(PORTMUX_AQUIRE_MUX_FN_CALL_ARGS(mux));
|
return vPortCPUAcquireMutexIntsDisabledInternal(PORTMUX_AQUIRE_MUX_FN_CALL_ARGS(mux));
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void vPortCPUReleaseMutexIntsDisabled(PORTMUX_RELEASE_MUX_FN_ARGS) {
|
static inline void vPortCPUReleaseMutexIntsDisabled(PORTMUX_RELEASE_MUX_FN_ARGS) {
|
||||||
|
#if !defined(CONFIG_FREERTOS_UNICORE)
|
||||||
#if defined(CONFIG_SPIRAM)
|
#if defined(CONFIG_SPIRAM)
|
||||||
if (esp_ptr_external_ram(mux)) {
|
if (esp_ptr_external_ram(mux)) {
|
||||||
vPortCPUReleaseMutexIntsDisabledExtram(PORTMUX_RELEASE_MUX_FN_CALL_ARGS(mux));
|
vPortCPUReleaseMutexIntsDisabledExtram(PORTMUX_RELEASE_MUX_FN_CALL_ARGS(mux));
|
||||||
@@ -108,5 +113,6 @@ static inline void vPortCPUReleaseMutexIntsDisabled(PORTMUX_RELEASE_MUX_FN_ARGS)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
vPortCPUReleaseMutexIntsDisabledInternal(PORTMUX_RELEASE_MUX_FN_CALL_ARGS(mux));
|
vPortCPUReleaseMutexIntsDisabledInternal(PORTMUX_RELEASE_MUX_FN_CALL_ARGS(mux));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user