Index: firmware/source/sys_main.c =================================================================== diff -u -rb0b3522f2bd0b5b20ecbfd53c8f55b0e646ffa11 -rd6c75118f4e5792b40b744a0b29e44c78368a469 --- firmware/source/sys_main.c (.../sys_main.c) (revision b0b3522f2bd0b5b20ecbfd53c8f55b0e646ffa11) +++ firmware/source/sys_main.c (.../sys_main.c) (revision d6c75118f4e5792b40b744a0b29e44c78368a469) @@ -63,13 +63,15 @@ #include "HDCommon.h" #include "Accel.h" +#include "AirTrap.h" #include "AlarmLamp.h" #include "BloodFlow.h" #include "Buttons.h" #include "CommBuffers.h" #include "CPLD.h" #include "DialInFlow.h" #include "DialOutFlow.h" +#include "FluidLeak.h" #include "FPGA.h" #include "InternalADC.h" #include "Interrupts.h" @@ -79,9 +81,11 @@ #include "PresOccl.h" #include "RTC.h" #include "SafetyShutdown.h" +#include "SyringePump.h" #include "SystemComm.h" #include "TaskBG.h" #include "Timers.h" +#include "Valves.h" #include "WatchdogMgmt.h" static void initProcessor( void ); @@ -105,12 +109,12 @@ { /* USER CODE BEGIN (3) */ - initProcessor(); // configure processor - initSoftware(); // initialize software modules - initHardware(); // configure external hardware - initTasks(); // setup and start the scheduled tasks + initProcessor(); // Configure processor + initSoftware(); // Initialize software modules + initHardware(); // Configure external hardware + initTasks(); // Setup and start the scheduled tasks - // start task background (will not return) + // Start task background (will not return) #ifndef _VECTORCAST_ taskBackground(); #endif @@ -127,18 +131,17 @@ * @brief initProcessor * The initProcessor function initializes and configures the processor \n * peripherals. - * @details - * Inputs : none - * Outputs : Processor peripherals initialized and configured. + * @details Inputs: none + * @details Outputs: Processor peripherals initialized and configured. * @return none *************************************************************************/ static void initProcessor( void ) { - gioInit(); // configure GPIO pins - hetInit(); // configure HET1 - adcInit(); // configure internal ADC channels - mibspiInit(); // re-purposing MIBSPI5 I/O/C pins as GPIO - etpwmInit(); // configure PWMs + gioInit(); // Configure GPIO pins + hetInit(); // Configure HET1 + adcInit(); // Configure internal ADC channels + mibspiInit(); // Re-purposing MIBSPI5 I/O/C pins as GPIO + etpwmInit(); // Configure PWMs etpwmSetCmpA( etpwmREG1, 0 ); etpwmSetCmpA( etpwmREG2, 0 ); etpwmSetCmpA( etpwmREG3, 0 ); @@ -147,58 +150,60 @@ etpwmSetCmpA( etpwmREG7, etpwmREG7->TBPRD / 3 ); etpwmStartTBCLK(); canInit(); // CAN1 = CAN, re-purposing CAN2 and CAN3 Rx and Tx pins as GPIO - //canEnableloopback( canREG1, External_Lbk ); // TODO - debug code sciInit(); // SCI1 used for PC serial interface, SCI2 used for FPGA serial interface - dmaEnable(); // enable DMA + dmaEnable(); // Enable DMA } /************************************************************************* * @brief initSoftware * The initSoftware function calls all software module initialize functions. - * @details - * Inputs : none - * Outputs : All modules initialized. + * @details Inputs: none + * @details Outputs: All modules initialized. * @return none *************************************************************************/ static void initSoftware( void ) { - // initialize ms timer counter + // Initialize ms timer counter initTimers(); - // initialize alarm manager + // Initialize alarm manager initAlarmMgmt(); - // initialize drivers + // Initialize drivers initCPLD(); initSafetyShutdown(); initInternalADC(); initRTC(); - // initialize services + initNVDataMgmt(); + // Initialize services initCommBuffers(); initFPGA(); initMsgQueues(); initNVDataMgmt(); initSystemComm(); initWatchdogMgmt(); - // initialize monitors + // Initialize monitors initAccel(); initButtons(); initPresOccl(); - // initialize controllers + // Initialize controllers + initAirTrap(); initAlarmLamp(); initBloodFlow(); initDialInFlow(); initDialOutFlow(); - // initialize modes + initSyringePump(); + initValves(); + initFluidLeak(); + // Initialize modes initOperationModes(); - // initialize async interrupt handlers + // Initialize async interrupt handlers initInterrupts(); } /************************************************************************* * @brief initHardware * The initHardware function initializes and configures external hardware. - * @details - * Inputs : none - * Outputs : External hardware initialized and configured. + * @details Inputs: none + * @details Outputs: External hardware initialized and configured. * @return none *************************************************************************/ static void initHardware( void ) @@ -208,20 +213,19 @@ /************************************************************************* * @brief initTasks * The initTasks function sets up and starts the scheduled tasks. - * @details - * Inputs : none - * Outputs : Scheduled tasks set up and started. + * @details Inputs: none + * @details Outputs: Scheduled tasks set up and started. * @return none *************************************************************************/ static void initTasks( void ) { - // initialize RTI to setup the 3 tasks + // Initialize RTI to setup the 3 tasks rtiInit(); rtiEnableNotification( rtiNOTIFICATION_COMPARE0 | rtiNOTIFICATION_COMPARE1 | rtiNOTIFICATION_COMPARE3 ); rtiStartCounter( rtiCOUNTER_BLOCK0 ); - // the timer task requires FIQ enabled + // The timer task requires FIQ enabled _enable_FIQ(); - // the general and priority tasks require IRQ enabled + // The general and priority tasks require IRQ enabled _enable_IRQ(); }