mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
28 lines
590 B
C
28 lines
590 B
C
/*
|
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#include "ulp_riscv_lock.h"
|
|
#include "ulp_riscv_lock_shared.h"
|
|
|
|
#include <assert.h>
|
|
|
|
void ulp_riscv_lock_acquire(ulp_riscv_lock_t *lock)
|
|
{
|
|
assert(lock);
|
|
|
|
lock->critical_section_flag_main_cpu = true;
|
|
lock->turn = ULP_RISCV_LOCK_TURN_ULP;
|
|
|
|
while (lock->critical_section_flag_ulp && (lock->turn == ULP_RISCV_LOCK_TURN_ULP)) {
|
|
}
|
|
}
|
|
|
|
void ulp_riscv_lock_release(ulp_riscv_lock_t *lock)
|
|
{
|
|
assert(lock);
|
|
|
|
lock->critical_section_flag_main_cpu = false;
|
|
}
|