Merge branch 'fix/fix_csi_bridge_clock_enable_issue_v5.3' into 'release/v5.3'

rcc: change rcc var i to rcc_cnt (v5.3)

See merge request espressif/esp-idf!33536
This commit is contained in:
morris
2024-09-14 16:10:56 +08:00

View File

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