| 15 | namespace tt::kernel::critical { |
| 16 | |
| 17 | CriticalInfo enter() { |
| 18 | CriticalInfo info = { |
| 19 | .isrm = 0, |
| 20 | .fromIsr = (xPortInIsrContext() == pdTRUE), |
| 21 | .kernelRunning = (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) |
| 22 | }; |
| 23 | |
| 24 | if (info.fromIsr) { |
| 25 | info.isrm = taskENTER_CRITICAL_FROM_ISR(); |
| 26 | } else if (info.kernelRunning) { |
| 27 | TT_ENTER_CRITICAL(); |
| 28 | } else { |
| 29 | portDISABLE_INTERRUPTS(); |
| 30 | } |
| 31 | |
| 32 | return info; |
| 33 | } |
| 34 | |
| 35 | void exit(CriticalInfo info) { |
| 36 | if (info.fromIsr) { |
nothing calls this directly
no outgoing calls
no test coverage detected