RM0461
The procedure to get an interrupt when a semaphore becomes free is described hereafter.
Try to lock semaphore x
•
If the semaphore lock is obtained, no interrupt is needed.
•
If the semaphore lock fails:
•
Clear pending semaphore x interrupt status for the interrupt line in HSEM_ICR.
Re-try to lock the semaphore x again:
–
–
On semaphore x free interrupt, try to lock semaphore x
•
If the semaphore lock is obtained:
Disable the semaphore x interrupt in HSEM_IER.
Clear pending semaphore x interrupt status in HSEM_ICR.
•
If the semaphore x lock fails:
Clear pending semaphore x interrupt status in HSEM_ICR.
Try again to lock the semaphore x:
–
Figure 29. Interrupt state diagram
No
MaskedStatus = 1 & Interrupt x generated
If the semaphore lock is obtained, no interrupt is needed (semaphore has been
freed between first try to lock and clear semaphore interrupt status).
If the semaphore lock fails, enable the semaphore x interrupt in HSEM_IER.
If the semaphore lock is obtained (semaphore has been freed between first try to
lock and semaphore Interrupt status clear), disable the semaphore interrupt in
HSEM_IER.
Semaphore x
locked
WRITE
(MASTERID & PROCID & LOCK = 0)
Interrupt
Semaphore x
Status = 1
Interrupt
Semaphore x
Enabled
Yes
Interrupt
Semaphore x
Semaphore x free
RM0461 Rev 5
Hardware semaphore (HSEM)
MSv41951V3
301/1306
308
Need help?
Do you have a question about the STM32WLEx and is the answer not in the manual?