/************************************************************************** * * Copyright (c) 2024-2025 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file TaskPriority.c * * @author (last) Michael Garthwaite * @date (last) 09-Sep-2025 * * @author (original) Vinayakam Mani * @date (original) 07-Aug-2024 * ***************************************************************************/ #include "gio.h" #include "BloodLeak.h" #include "Conductivity.h" #include "DialysatePumps.h" #include "FPGA.h" #include "Flow.h" #include "Heaters.h" #include "InternalADC.h" #include "Level.h" #include "ModeGenDialysate.h" #include "Pressure.h" #include "TaskPriority.h" #include "Temperature.h" #include "Valves.h" #include "WatchdogMgmt.h" /** * @addtogroup TaskPriority * @{ */ #ifdef TASK_TIMING_OUTPUT_ENABLED #include "mibspi.h" #define TASK_TIMING_TEST_PIN_SPI1_PORT_MASK 0x00000020 // (CS5 - re-purposed as output GPIO) #define SET_TASK_ON() { mibspiREG3->PC3 |= TASK_TIMING_TEST_PIN_SPI1_PORT_MASK; } #define SET_TASK_OFF() { mibspiREG3->PC3 &= ~TASK_TIMING_TEST_PIN_SPI1_PORT_MASK; } #endif /*********************************************************************//** * @brief * The taskPriority function handles the scheduled priority task interrupt. * Calls the executive functions for FPGA, pumps, valves, and buttons. * @details \b Inputs: none * @details \b Outputs: Executive for the FPGA, pumps, valves, and buttons called. * @note This task runs every 10 ms interval. *************************************************************************/ void taskPriority( void ) { #ifdef TASK_TIMING_OUTPUT_ENABLED // SET_TASK_ON(); // TODO - uncomment and define TASK_TIMING_OUTPUT_ENABLED to monitor this tasks timing #endif #ifndef BOARD_WITH_NO_HARDWARE // First pass for FPGA execFPGA( TRUE ); //TODO : Enable later Temperature, Conductivity, Heaters, Internal ADC and FPGA clock speed // Monitor internal ADC channels //execInternalADC(); //Monitor Level sensor execLevels(); // Monitor pressures execPressureSensor(); // Monitor temperatures execTemperatureSensors(); // Verify the processor clock speed against the FPGA clock //execFPGAClockSpeedTest(); // Read/write Conductivity sensors execConductivity(); // Control valves execValves(); // Monitor dialysate pump execDialysatePumpMonitor(); // Heaters monitor execHeatersMonitor(); // Dialysate generation monitor execGenDialysateMonitor(); // Exec blood leak embedded mode execBloodLeakEmbModeCommand(); // Blood leak sensor execBloodLeak(); // Flow Sensor execFlowMonitor(); // Second pass for FPGA execFPGA( FALSE ); #endif // Check in with watchdog manager checkInWithWatchdogMgmt( TASK_PRIORITY ); #ifdef TASK_TIMING_OUTPUT_ENABLED // SET_TASK_OFF(); // TODO - uncomment and define TASK_TIMING_OUTPUT_ENABLED to monitor this tasks timing #endif } /**@}*/