| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "faults_declarations.h" | ||
| 2 | |||
| 3 | uint8_t fault_status = FAULT_STATUS_NONE; | ||
| 4 | uint32_t faults = 0U; | ||
| 5 | |||
| 6 | 120 | void fault_occurred(uint32_t fault) { | |
| 7 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 40 times.
|
120 | if ((faults & fault) == 0U) { |
| 8 | if ((PERMANENT_FAULTS & fault) != 0U) { | ||
| 9 | print("Permanent fault occurred: 0x"); puth(fault); print("\n"); | ||
| 10 | fault_status = FAULT_STATUS_PERMANENT; | ||
| 11 | } else { | ||
| 12 | 80 | print("Temporary fault occurred: 0x"); puth(fault); print("\n"); | |
| 13 | 80 | fault_status = FAULT_STATUS_TEMPORARY; | |
| 14 | } | ||
| 15 | } | ||
| 16 | 120 | faults |= fault; | |
| 17 | 120 | } | |
| 18 | |||
| 19 | 10344 | void fault_recovered(uint32_t fault) { | |
| 20 | if ((PERMANENT_FAULTS & fault) == 0U) { | ||
| 21 | 10344 | faults &= ~fault; | |
| 22 | } else { | ||
| 23 | print("Cannot recover from a permanent fault!\n"); | ||
| 24 | } | ||
| 25 | 10344 | } | |
| 26 |