IRQ disable/enable in usb_lld.c

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
daemon
Posts: 35
Joined: Tue Oct 09, 2012 1:53 pm

IRQ disable/enable in usb_lld.c

Post by daemon »

Hi!
I found an issue in OTGv1 usb_lld.c: in case when CORTEX_SIMPLIFIED_PRIORITY = TRUE a special assumption that OTG FIFO operations must not be interrupted is not satisfied.
New code:

Code: Select all

#if (CORTEX_SIMPLIFIED_PRIORITY == FALSE)
#if (STM32_USB_OTGFIFO_FILL_BASEPRI > 0)
    __set_BASEPRI(CORTEX_PRIO_MASK(STM32_USB_OTGFIFO_FILL_BASEPRI));
#endif
#else
    __disable_irq();
#endif

...

#if (CORTEX_SIMPLIFIED_PRIORITY == FALSE)
#if (STM32_USB_OTGFIFO_FILL_BASEPRI > 0)
  __set_BASEPRI(0);
#endif
#else
    __enable_irq();
#endif


Patch attached.
Attachments
usb_lld.patch.gz
ChibiOS 3.0 rev.7840
(514 Bytes) Downloaded 290 times
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: IRQ disable/enable in usb_lld.c

Post by Giovanni »

Hi,

The problem with this patch is that it introduces a dependency on the RT kernel, drivers in 3.0 are not meant to do that. Priority masking can stay it is not mandatory to use that and would work also in simplified priority mode.

Giovanni
Post Reply