refactor(bitscrambler): don't use Reset Clock Control lock of RC version

This commit is contained in:
morris
2025-05-20 16:52:29 +08:00
parent 7bca1fe76f
commit d46019bf43
4 changed files with 117 additions and 92 deletions

View File

@@ -298,7 +298,7 @@ static inline bool bitscrambler_ll_is_fifo_ready(bitscrambler_dev_t *hw, bitscra
/**
* @brief Enable the bus clock for BitScrambler module
*/
static inline void _bitscrambler_ll_set_bus_clock_sys_enable(bool enable)
static inline void bitscrambler_ll_set_bus_clock_sys_enable(bool enable)
{
PCR.bs_conf.bs_clk_en = enable;
}
@@ -306,7 +306,7 @@ static inline void _bitscrambler_ll_set_bus_clock_sys_enable(bool enable)
/**
* @brief Enable the bus clock for RX BitScrambler module
*/
static inline void _bitscrambler_ll_set_bus_clock_rx_enable(bool enable)
static inline void bitscrambler_ll_set_bus_clock_rx_enable(bool enable)
{
// empty
}
@@ -314,7 +314,7 @@ static inline void _bitscrambler_ll_set_bus_clock_rx_enable(bool enable)
/**
* @brief Enable the bus clock for TX BitScrambler module
*/
static inline void _bitscrambler_ll_set_bus_clock_tx_enable(bool enable)
static inline void bitscrambler_ll_set_bus_clock_tx_enable(bool enable)
{
// empty
}
@@ -349,7 +349,7 @@ static inline void bitscrambler_ll_mem_power_by_pmu(void)
/**
* @brief Reset the BitScrambler module
*/
static inline void _bitscrambler_ll_reset_sys(void)
static inline void bitscrambler_ll_reset_sys(void)
{
PCR.bs_conf.bs_rst_en = 1;
PCR.bs_conf.bs_rst_en = 0;
@@ -358,7 +358,7 @@ static inline void _bitscrambler_ll_reset_sys(void)
/**
* @brief Reset the BitScrambler RX module
*/
static inline void _bitscrambler_ll_reset_rx(void)
static inline void bitscrambler_ll_reset_rx(void)
{
PCR.bs_func_conf.bs_rx_rst_en = 1;
PCR.bs_func_conf.bs_rx_rst_en = 0;
@@ -367,22 +367,12 @@ static inline void _bitscrambler_ll_reset_rx(void)
/**
* @brief Reset the BitScrambler TX module
*/
static inline void _bitscrambler_ll_reset_tx(void)
static inline void bitscrambler_ll_reset_tx(void)
{
PCR.bs_func_conf.bs_tx_rst_en = 1;
PCR.bs_func_conf.bs_tx_rst_en = 0;
}
/// use a macro to wrap the function, force the caller to use it in a critical section
/// the critical section needs to declare the __DECLARE_RCC_RC_ATOMIC_ENV variable in advance
#define bitscrambler_ll_set_bus_clock_sys_enable(...) (void)__DECLARE_RCC_RC_ATOMIC_ENV; _bitscrambler_ll_set_bus_clock_sys_enable(__VA_ARGS__)
#define bitscrambler_ll_set_bus_clock_rx_enable(...) (void)__DECLARE_RCC_RC_ATOMIC_ENV; _bitscrambler_ll_set_bus_clock_rx_enable(__VA_ARGS__)
#define bitscrambler_ll_set_bus_clock_tx_enable(...) (void)__DECLARE_RCC_RC_ATOMIC_ENV; _bitscrambler_ll_set_bus_clock_tx_enable(__VA_ARGS__)
#define bitscrambler_ll_reset_sys(...) (void)__DECLARE_RCC_RC_ATOMIC_ENV; _bitscrambler_ll_reset_sys(__VA_ARGS__)
#define bitscrambler_ll_reset_rx(...) (void)__DECLARE_RCC_RC_ATOMIC_ENV; _bitscrambler_ll_reset_rx(__VA_ARGS__)
#define bitscrambler_ll_reset_tx(...) (void)__DECLARE_RCC_RC_ATOMIC_ENV; _bitscrambler_ll_reset_tx(__VA_ARGS__)
#ifdef __cplusplus
}
#endif