Ticket #460 (Open)Thu Nov 15 07:30:07 UTC 2018
HAL_IICTransfer and HAL_IICMonitorTransfer; IICStatus_Busy test is not safe
Reported by: | Simon Willcocks (1499) | Severity: | Minor |
Part: | RISC OS: General | Release: | |
Milestone: | RISC OS ROM build complete | Status | Open |
Details by Simon Willcocks (1499):
Very low priority, but for future developments, the entry to the two routines need to use ldrex/strex or swap instructions.
HAL_IICTransfer
; Check for bus 0 – any other is an error
CMP a1, #0
MOVNE a1, #IICStatus_Error ; Return this code if not bus 0
MOVNE pc, lr
; It’s bus 0. Look if we’re busy.
LDR a1, IIC_Status ; 0 > not busy, !0 -> busy interrupt or alternate core access here may allow two threads access to the rest of the routine.
CMP a1, #0
MOVNE a1, #IICStatus_Busy
MOVNE pc,lr
[…] -
MVN a1, #0 ; Flag us as busy before we go further
STR a1, IIC_Status