rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
global_shared.h
Go to the documentation of this file.
1/*
2 * @file global_shared.h
3 *
4 * part of global.h which is shared between firmware and simulator
5 * See also common_headers.h
6 *
7 * Dec 25, 2018
8 * @author Andrey Belomutskiy, (c) 2012-2020
9 */
10
11#pragma once
12
13/**
14 * Of note is that interrupts are NOT serviced on the stack of the thread that was running when the
15 * interrupt occurred. The only thing that happens on that thread's stack is that its registers are
16 * pushed (by hardware) when an interrupt occurs, just before swapping the stack pointer out for the
17 * main stack (currently 0x400=1024 bytes), where the ISR actually runs.
18 * see also __main_stack_size__
19 * see also __process_stack_size__
20 *
21 * see also http://www.chibios.org/dokuwiki/doku.php?id=chibios:kb:stacks
22 *
23 * In the firmware we are using 'extern *Engine' - in the firmware Engine is a singleton
24 *
25 * On the other hand, in order to have a meaningful unit test we are passing Engine * engine as a parameter
26 */
27
28#include "global.h"
29
30/*
31 * Stack debugging
32 */
33int getRemainingStack(thread_t *otp);
34int CountFreeStackSpace(const void* wabase);
35
36#define assertStackVoid(message, code, desiredAvailableStack) { if (getCurrentRemainingStack() < desiredAvailableStack) { firmwareError(code, "stack: %s", message); return; } }
37#define assertStack(message, code, desiredAvailableStack, result) { if (getCurrentRemainingStack() < desiredAvailableStack) { firmwareError(code, "stack: %s", message); return result; } }
int getRemainingStack(thread_t *otp)
int CountFreeStackSpace(const void *wabase)