change(rcc): change rcc var i to rcc_cnt

This commit is contained in:
Armando 2024-09-13 10:05:34 +08:00
parent 45b7b7dc1c
commit 9e9225dbc2

View File

@ -25,10 +25,10 @@ extern "C" {
* @note This macro will increase the reference lock of that peripheral.
* You can get the value before the increment from the `rc_name` local variable
*/
#define PERIPH_RCC_ACQUIRE_ATOMIC(periph, rc_name) \
for (uint8_t rc_name, i = 1, __DECLARE_RCC_RC_ATOMIC_ENV; \
i ? (rc_name = periph_rcc_acquire_enter(periph), 1) : 0; \
periph_rcc_acquire_exit(periph, rc_name), i--)
#define PERIPH_RCC_ACQUIRE_ATOMIC(rc_periph, rc_name) \
for (uint8_t rc_name, _rc_cnt = 1, __DECLARE_RCC_RC_ATOMIC_ENV; \
_rc_cnt ? (rc_name = periph_rcc_acquire_enter(rc_periph), 1) : 0; \
periph_rcc_acquire_exit(rc_periph, rc_name), _rc_cnt--)
/**
* @brief Release the RCC lock for a peripheral module
@ -37,10 +37,10 @@ extern "C" {
* @note This macro will decrease the reference lock of that peripheral.
* You can get the value after the decrease from the `rc_name` local variable
*/
#define PERIPH_RCC_RELEASE_ATOMIC(periph, rc_name) \
for (uint8_t rc_name, i = 1, __DECLARE_RCC_RC_ATOMIC_ENV; \
i ? (rc_name = periph_rcc_release_enter(periph), 1) : 0; \
periph_rcc_release_exit(periph, rc_name), i--)
#define PERIPH_RCC_RELEASE_ATOMIC(rc_periph, rc_name) \
for (uint8_t rc_name, _rc_cnt = 1, __DECLARE_RCC_RC_ATOMIC_ENV; \
_rc_cnt ? (rc_name = periph_rcc_release_enter(rc_periph), 1) : 0; \
periph_rcc_release_exit(rc_periph, rc_name), _rc_cnt--)
/**
* @brief A simplified version of `PERIPH_RCC_ACQUIRE/RELEASE_ATOMIC`, without a reference count
@ -48,9 +48,9 @@ extern "C" {
* @note User code protected by this macro should be as short as possible, because it's a critical section
*/
#define PERIPH_RCC_ATOMIC() \
for (int i = 1, __DECLARE_RCC_ATOMIC_ENV; \
i ? (periph_rcc_enter(), 1) : 0; \
periph_rcc_exit(), i--)
for (int _rc_cnt = 1, __DECLARE_RCC_ATOMIC_ENV; \
_rc_cnt ? (periph_rcc_enter(), 1) : 0; \
periph_rcc_exit(), _rc_cnt--)
/** @cond */
// The following functions are not intended to be used directly by the developers