drivers: dp: use atomic APIs for pin set/reset
Use LL_GPIO_SetOutputPin and LL_GPIO_ResetOutputPin for the STM32 optimized DP functions. This yelds a speedup of the bit-banged interface from about 585kHz to 640kHz on an STM32C0. Suggested-by: Mathieu Choplain <mathieu.choplain@st.com> Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
parent
fd44146ad2
commit
a361c45af6
1 changed files with 2 additions and 16 deletions
|
@ -35,29 +35,15 @@ static ALWAYS_INLINE void swdp_ll_pin_output(void *const base, uint8_t pin)
|
|||
static ALWAYS_INLINE void swdp_ll_pin_set(void *const base, uint8_t pin)
|
||||
{
|
||||
GPIO_TypeDef *gpio = base;
|
||||
uint32_t val;
|
||||
|
||||
z_stm32_hsem_lock(CFG_HW_GPIO_SEMID, HSEM_LOCK_DEFAULT_RETRY);
|
||||
|
||||
val = LL_GPIO_ReadOutputPort(gpio);
|
||||
val |= BIT(pin);
|
||||
LL_GPIO_WriteOutputPort(gpio, val);
|
||||
|
||||
z_stm32_hsem_unlock(CFG_HW_GPIO_SEMID);
|
||||
LL_GPIO_SetOutputPin(gpio, BIT(pin));
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void swdp_ll_pin_clr(void *const base, uint8_t pin)
|
||||
{
|
||||
GPIO_TypeDef *gpio = base;
|
||||
uint32_t val;
|
||||
|
||||
z_stm32_hsem_lock(CFG_HW_GPIO_SEMID, HSEM_LOCK_DEFAULT_RETRY);
|
||||
|
||||
val = LL_GPIO_ReadOutputPort(gpio);
|
||||
val &= ~BIT(pin);
|
||||
LL_GPIO_WriteOutputPort(gpio, val);
|
||||
|
||||
z_stm32_hsem_unlock(CFG_HW_GPIO_SEMID);
|
||||
LL_GPIO_ResetOutputPin(gpio, BIT(pin));
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE uint32_t swdp_ll_pin_get(void *const base, uint8_t pin)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue