Пример #1
0
/** @brief Copies paged flash to RAM
 *
 * Take the tables and config from flash up to RAM to allow live tuning.
 *
 * For the main tables and other paged config we need to adjust
 * the RPAGE value to the appropriate one before copying up.
 *
 * This function is simply a delegator to the ones for each flash page. Each
 * one lives in the same paged space as the data it is copying up.
 */
void initAllPagedRAM(){
	/* Setup the flash block pointers before copying flash to RAM using them */
	initAllPagedAddresses();

	/* Copy the tables up to their paged RAM blocks through the window from flash */
	initPagedRAMFuel();
	initPagedRAMTime();
	initPagedRAMTune();

	/* Default to page one for now, perhaps read the configured port straight out of reset in future? TODO */
	setupPagedRAM(TRUE); // probably something like (PORTA & TableSwitchingMask)
}
Пример #2
0
/** @brief The main top level init
 *
 * The main init function to be called from main.c before entering the main
 * loop. This function is simply a delegator to the finer grained special
 * purpose init functions.
 *
 * @author Fred Cooke
 */
void init(){
	ATOMIC_START();			/* Disable ALL interrupts while we configure the board ready for use */
	initPLL();				/* Set up the PLL and use it */
	initIO();				/* TODO make this config dependent. Set up all the pins and modules to be in low power harmless states */
	initAllPagedRAM();			/* Copy table and config blocks of data from flash to the paged ram blocks for fast data lookup */
	initAllPagedAddresses();	/* Save the paged memory addresses to variables such that we can access them from another paged block with no warnings */
	initVariables();		/* Initialise the rest of the running variables etc */
	initFlash();			/* TODO, finalise this */
	initECTTimer();			/* TODO move this to inside config in an organised way. Set up the timer module and its various aspects */
	initPITTimer();			/* TODO ditto... */
	initSCIStuff();			/* Setup the sci module(s) that we will use. */
	initConfiguration();	/* TODO Set user/feature/config up here! */
	initInterrupts();		/* still last, reset timers, enable interrupts here TODO move this to inside config in an organised way. Set up the rest of the individual interrupts */
	ATOMIC_END(); /* Re-enable any configured interrupts */
}