author | Don Dominic <a0486429@ti.com> | |
Tue, 18 Jan 2022 16:09:18 +0000 (21:39 +0530) | ||
committer | Rishabh Garg <rishabh@ti.com> | |
Thu, 20 Jan 2022 09:10:03 +0000 (03:10 -0600) | ||
commit | 836ba3a3c67b6a13ba170a91a63b07329531f37d | |
tree | b51378046f9d350fde09a6c82cbb06839dec3eaf | tree | snapshot (tar.xz tar.gz zip) |
parent | f286c2d81383f42ae63e6927bfdccf01810e8e18 | commit | diff |
[PDK-11014] osal_freertos: fix issues in critical sections with freertos
- osal_freertos used HwiP_nonos.c implementation for which
HwiP_disable and HwiP_restore uses CSL implementation to
disable/enable interrupts.
The same also returns cookie/key to restore interrupt to old state
- FreeRTOS portable layer handles critical sections using
vPortEnterCritical & vPortExitCritical and keeps track of
critical nesting count
- Hence usage of both OSAL APIs and FreeRTOS portable layer functions together
will result in wrong behavior related to critical nesting count
- Fix this by adding proper HwiP_freertos.c,
in which HwiP_disable / HwiP_restore redirect to vPortEnterCritical / vPortExitCritical
- In case when invoked from ISR or before starting the Scheduler,
CSL implementations are used due to following reasons:-
1. vPortEnterCritical is not thread safe and will result in assert condition if invoked from ISR
2. Before starting the scheduler the ulCriticalNesting won't be set to 0
- This global variable gets set to 0( or gets updated) by popping from corresponding task stack
- Validated FreeRTOS Unit Test and OSAL Unit Test on R5F/C66x
Signed-off-by: Don Dominic <a0486429@ti.com>
- osal_freertos used HwiP_nonos.c implementation for which
HwiP_disable and HwiP_restore uses CSL implementation to
disable/enable interrupts.
The same also returns cookie/key to restore interrupt to old state
- FreeRTOS portable layer handles critical sections using
vPortEnterCritical & vPortExitCritical and keeps track of
critical nesting count
- Hence usage of both OSAL APIs and FreeRTOS portable layer functions together
will result in wrong behavior related to critical nesting count
- Fix this by adding proper HwiP_freertos.c,
in which HwiP_disable / HwiP_restore redirect to vPortEnterCritical / vPortExitCritical
- In case when invoked from ISR or before starting the Scheduler,
CSL implementations are used due to following reasons:-
1. vPortEnterCritical is not thread safe and will result in assert condition if invoked from ISR
2. Before starting the scheduler the ulCriticalNesting won't be set to 0
- This global variable gets set to 0( or gets updated) by popping from corresponding task stack
- Validated FreeRTOS Unit Test and OSAL Unit Test on R5F/C66x
Signed-off-by: Don Dominic <a0486429@ti.com>