Rev 4011 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4011 | Rev 4088 | ||
|---|---|---|---|
| Line 45... | Line 45... | ||
| 45 | atomic_t haltstate = {0}; /**< Halt flag */ |
45 | atomic_t haltstate = {0}; /**< Halt flag */ |
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | /** Halt wrapper |
48 | /** Halt wrapper |
| 49 | * |
49 | * |
| 50 | * Set halt flag and halt the cpu. |
50 | * Set halt flag and halt the CPU. |
| 51 | * |
51 | * |
| 52 | */ |
52 | */ |
| 53 | void halt() |
53 | void halt() |
| 54 | { |
54 | { |
| 55 | #ifdef CONFIG_DEBUG |
55 | #ifdef CONFIG_DEBUG |
| 56 | bool rundebugger = false; |
56 | bool rundebugger = false; |
| 57 | 57 | ||
| 58 | if (!atomic_get(&haltstate)) { |
58 | if (!atomic_get(&haltstate)) { |
| 59 | atomic_set(&haltstate, 1); |
59 | atomic_set(&haltstate, 1); |
| 60 | rundebugger = true; |
60 | rundebugger = true; |
| 61 | } |
61 | } |
| 62 | #else |
62 | #else |
| 63 | atomic_set(&haltstate, 1); |
63 | atomic_set(&haltstate, 1); |
| 64 | #endif |
64 | #endif |
| 65 | 65 | ||
| 66 | interrupts_disable(); |
66 | interrupts_disable(); |
| 67 | 67 | ||
| 68 | #if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE)) |
68 | #if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE)) |
| 69 | if (rundebugger) |
69 | if ((rundebugger) && (kconsole_check_poll())) |
| 70 | kconsole("panic", "\nLast resort kernel console ready\n", false); |
70 | kconsole("panic", "\nLast resort kernel console ready.\n", false); |
| 71 | #endif |
71 | #endif |
| 72 | 72 | ||
| 73 | if (CPU) |
73 | if (CPU) |
| 74 | printf("cpu%u: halted\n", CPU->id); |
74 | printf("cpu%u: halted\n", CPU->id); |
| 75 | else |
75 | else |
| 76 | printf("cpu: halted\n"); |
76 | printf("cpu: halted\n"); |
| - | 77 | ||
| 77 | cpu_halt(); |
78 | cpu_halt(); |
| 78 | } |
79 | } |
| 79 | 80 | ||
| 80 | /** Convert ascii representation to unative_t |
81 | /** Convert ascii representation to unative_t |
| 81 | * |
82 | * |