FreeEMS
0.2.0-SNAPSHOT-282-g9efc524
|
The main function! More...
#include "inc/main.h"
Go to the source code of this file.
Macros | |
#define | NUMBER_OF_OUTPUT_PINS 6 |
Functions | |
int | main () |
The main function! |
The main function!
The function main is traditionally an applications starting point. For us it has two jobs. The first is to call init() which initialises everything before any normal code runs. After that main() is simply an infinite loop from which low priority non-realtime code runs. The most important units of code that runs under the main loop umbrella are the injection, ignition and scheduling calculations.
Definition in file main.c.
#define NUMBER_OF_OUTPUT_PINS 6 |
Referenced by main().
int main | ( | ) |
The main function!
The centre of the application is here. From here all non-ISR code is called directly or indirectly. The two coarse blocks are init and the main loop. Init is called first to set everything up and then the main loop is entered where the flow of control continues until the device is switched off or reset (excluding asynchronous ISR code). Currently the main loop only runs the fuel, ignition and scheduling calculation code, and the communications code and only when actually required. The intention is to maintain a very low latency for calculations such that the behaviour of the device more closely reflects the attached engines rapidly changing requirements. When accessory code is added a new scheduling algorithm will be required to keep the latency low without starving any particular blocks of CPU time.
Store PTIT for now, later make address of byte configurable TODO
Definition at line 57 of file main.c.
References ADCBuffers, ADCBuffers0, ADCBuffers1, ADCBuffersRecord, adjustPWM(), asyncDatalogBasic, asyncDatalogBlockBytes, asyncDatalogBlockLongs, asyncDatalogBlockWords, asyncDatalogOff, asyncDatalogPosition, asyncDatalogScratchPad, asyncDatalogStreamByte, asyncDatalogStreamLong, asyncDatalogStreamWord, asyncDatalogStructs, ATOMIC_END, ATOMIC_START, CALC_FUEL_IGN, calculateFuelAndIgnition(), Counter::calculationsPerformed, CoreVar::CHT, CLEAR_CALC_FUEL_IGN, CLEAR_FORCE_READING, COM_SET_SCI0_INTERFACE_ID, coreStatusA, CoreVars, Counters, decodePacketAndRespond(), DerivedVars, edgeTimeStamp, EVENT_ARRIVAL_TIMEOUT, finaliseAndSend(), fixedConfigs1, FORCE_READING, generateCoreVars(), generateDerivedVars(), HEADER_HAS_LENGTH, DerivedVar::IDT, init(), lastCalcCount, lookupTwoDTableUS(), MAX_NUMBER_OF_OUTPUT_EVENTS, NUMBER_OF_OUTPUT_PINS, schedulingSetting::numberOfConfiguredOutputEvents, outputEventDelayFinalPeriod, schedulingSetting::outputEventPinNumbers, outputEventPulseWidthsMath, performSimpleGPIO(), populateBasicDatalog(), PTIT, resetToNonRunningState(), responseBasicDatalog, responseByteLADatalog, RX_CLEAR_READY_TO_PROCESS, RX_READY_TO_PROCESS, RXStateFlags, safeAdd(), sampleEachADC(), scheduleOutputs(), schedulePortTPin(), schedulingSetting::schedulingConfigurationBits, fixedConfig1::schedulingSettings, SHORTHALF, sleepMicro(), TCNT, TFLGOF, ticksPerDegree, ticksPerDegree0, ticksPerDegree1, ticksPerDegreeRecord, Counter::timeoutADCreadings, timerExtensionClock, LongTime::timeShorts, timeStamp, TRUE, TXBufferCurrentPositionCAN0, TXBufferCurrentPositionHandler, TXBufferCurrentPositionSCI0, and TXBufferInUseFlags.