/** @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 */ }
/** @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. */ void init(){ ATOMIC_START(); /* Disable ALL interrupts while we configure the board ready for use */ initPLL(); /* Set up the PLL and use it */ initGPIO(); initPWM(); initADC(); initAllPagedRAM(); /* Copy table and config blocks of data from flash to the paged RAM blocks for fast data lookup */ 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! */ #ifdef XGATE initXgate(); /* Fred is a legend, for good reason as of now */ #endif 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 */ }