Fix ep_ctrl_mask() corrupting opposite direction's ENDPTCTRL bits

This commit is contained in:
gab-k
2026-03-07 21:53:01 +01:00
parent da307fa85b
commit 11a3c3b712

View File

@ -388,7 +388,7 @@ TU_ATTR_ALWAYS_INLINE static inline void ep_ctrl_mask(volatile uint32_t *epctrl,
uint32_t or_mask) {
uint32_t value = *epctrl;
if (and_mask != 0) {
value &= (dir == TUSB_DIR_OUT) ? and_mask : (and_mask << 16u);
value &= (dir == TUSB_DIR_OUT) ? (and_mask | 0xFFFF0000u) : ((and_mask << 16u) | 0x0000FFFFu);
}
if (or_mask != 0) {
value |= (dir == TUSB_DIR_OUT) ? or_mask : (or_mask << 16u);