Index: HDDefs.h =================================================================== diff -u -r42d796b7a65b8cb96457dd099589ff0dfb1030e1 -r7329c60b42c77046080f213ef7e960f8b2b406d4 --- HDDefs.h (.../HDDefs.h) (revision 42d796b7a65b8cb96457dd099589ff0dfb1030e1) +++ HDDefs.h (.../HDDefs.h) (revision 7329c60b42c77046080f213ef7e960f8b2b406d4) @@ -14,58 +14,58 @@ * @date (original) 29-May-2020 * ***************************************************************************/ - -#ifndef __HD_DEFS_H__ -#define __HD_DEFS_H__ - -// ********** public definitions ********** - -/** - * @addtogroup HDOperationModes - * @{ - */ - -/// Enumeration of operation modes. These are in order of priority (highest to lowest). -enum HD_Op_Modes -{ - MODE_FAUL = 0, ///< Fault mode - MODE_SERV, ///< Service mode - MODE_INIT, ///< Initialization & POST mode - MODE_STAN, ///< Standby mode - MODE_TPAR, ///< Treatment Parameters mode - MODE_PRET, ///< Pre-Treatment mode - MODE_TREA, ///< Treatment mode - MODE_POST, ///< Post-Treatment mode - MODE_NLEG, ///< Not legal - an illegal mode transition occurred - NUM_OF_MODES ///< Number of HD operation modes -}; -typedef enum HD_Op_Modes HD_OP_MODE_T; ///< Type for HD operation modes enumeration - -/**@}*/ - -/** - * @addtogroup HDInitAndPOSTMode - * @{ - */ - -/// Enumeration of init & POST mode states. -enum HD_POST_States -{ + +#ifndef __HD_DEFS_H__ +#define __HD_DEFS_H__ + +// ********** public definitions ********** + +/** + * @addtogroup HDOperationModes + * @{ + */ + +/// Enumeration of operation modes. These are in order of priority (highest to lowest). +enum HD_Op_Modes +{ + MODE_FAUL = 0, ///< Fault mode + MODE_SERV, ///< Service mode + MODE_INIT, ///< Initialization & POST mode + MODE_STAN, ///< Standby mode + MODE_TPAR, ///< Treatment Parameters mode + MODE_PRET, ///< Pre-Treatment mode + MODE_TREA, ///< Treatment mode + MODE_POST, ///< Post-Treatment mode + MODE_NLEG, ///< Not legal - an illegal mode transition occurred + NUM_OF_MODES ///< Number of HD operation modes +}; +typedef enum HD_Op_Modes HD_OP_MODE_T; ///< Type for HD operation modes enumeration + +/**@}*/ + +/** + * @addtogroup HDInitAndPOSTMode + * @{ + */ + +/// Enumeration of init & POST mode states. +enum HD_POST_States +{ POST_STATE_START = 0, ///< Start initialize & POST mode state POST_STATE_FW_INTEGRITY, ///< Run firmware integrity test state POST_STATE_AC, ///< Check HD has AC power - power off if not - POST_STATE_WATCHDOG, ///< Run watchdog test state + POST_STATE_WATCHDOG, ///< Run watchdog test state POST_STATE_SAFETY_SHUTDOWN, ///< Run safety shutdown test state - POST_STATE_RTC, ///< Run RTC test state - POST_STATE_NVDATAMGMT, ///< Run NV Data Mgmt. test state - POST_STATE_BLOOD_FLOW, ///< Run blood flow test state + POST_STATE_RTC, ///< Run RTC test state + POST_STATE_NVDATAMGMT, ///< Run NV Data Mgmt. test state + POST_STATE_BLOOD_FLOW, ///< Run blood flow test state POST_STATE_DIALYSATE_INLET_FLOW, ///< Run dialysate inlet flow test state POST_STATE_DIALYSATE_OUTLET_FLOW, ///< Run dialysate outlet flow test state - POST_STATE_BLOOD_LEAK, ///< Run blood leak sensor test state + POST_STATE_BLOOD_LEAK, ///< Run blood leak sensor test state POST_STATE_VALVES, ///< Run valves test state POST_STATE_SYRINGE_PUMP, ///< Run syringe pump test state POST_STATE_PRES_OCCL, ///< Run pressure occlusion state - POST_STATE_ALARM_AUDIO, ///< Run alarm audio test state + POST_STATE_ALARM_AUDIO, ///< Run alarm audio test state POST_STATE_ALARM_LAMP, ///< Run alarm lamp test state POST_STATE_ACCELEROMETER, ///< Run Accelerometer test state POST_STATE_TEMPERATURES, ///< Run temperatures POST state @@ -74,38 +74,38 @@ POST_STATE_UI_POST, ///< Check whether UI passed its POST tests POST_STATE_FW_COMPATIBILITY, ///< Run firmware compatibility test state POST_STATE_FPGA, ///< Run FPGA test state - POST_STATE_COMPLETED, ///< POST self-tests completed state - POST_STATE_FAILED, ///< POST self-tests failed state - NUM_OF_POST_STATES ///< Number of initialize & POST mode states -}; -typedef enum HD_POST_States HD_POST_STATE_T; ///< Type for HD POST states enumeration - -/**@}*/ - -/** - * @addtogroup HDFaultMode - * @{ - */ - -/// Enumeration of fault mode states. -enum HD_Fault_States -{ - HD_FAULT_STATE_START = 0, ///< Start fault state - NUM_OF_HD_FAULT_STATES ///< Number of fault mode states -}; -typedef enum HD_Fault_States HD_FAULT_STATE_T; ///< Type for HD fault states enumeration - -/**@}*/ - -/** - * @addtogroup HDStandbyMode - * @{ - */ - -/// Sub-mode states while in standby mode -enum HD_Standby_States -{ - STANDBY_START_STATE = 0, ///< Start standby. + POST_STATE_COMPLETED, ///< POST self-tests completed state + POST_STATE_FAILED, ///< POST self-tests failed state + NUM_OF_POST_STATES ///< Number of initialize & POST mode states +}; +typedef enum HD_POST_States HD_POST_STATE_T; ///< Type for HD POST states enumeration + +/**@}*/ + +/** + * @addtogroup HDFaultMode + * @{ + */ + +/// Enumeration of fault mode states. +enum HD_Fault_States +{ + HD_FAULT_STATE_START = 0, ///< Start fault state + NUM_OF_HD_FAULT_STATES ///< Number of fault mode states +}; +typedef enum HD_Fault_States HD_FAULT_STATE_T; ///< Type for HD fault states enumeration + +/**@}*/ + +/** + * @addtogroup HDStandbyMode + * @{ + */ + +/// Sub-mode states while in standby mode +enum HD_Standby_States +{ + STANDBY_START_STATE = 0, ///< Start standby. STANDBY_WAIT_FOR_TREATMENT_STATE, ///< Wait for treatment. STANDBY_WAIT_FOR_DISINFECT_STATE, ///< Wait for UI to send disinfect option. @@ -119,38 +119,38 @@ STANDBY_WAIT_FOR_DG_CHEM_DISINFECT_CMD_RESPONSE_STATE, ///< Wait for DG chemical disinfect command response. STANDBY_WAIT_FOR_DG_CHEM_DISINFECT_TO_START_STATE, ///< Wait for DG chemical disinfect to start. - STANDBY_DG_CHEM_DISINFECT_IN_PROGRESS_STATE, ///< DG chemical disinfect operation is in progress - NUM_OF_STANDBY_STATES ///< Number of standby states (sub-modes) -}; + STANDBY_DG_CHEM_DISINFECT_IN_PROGRESS_STATE, ///< DG chemical disinfect operation is in progress + NUM_OF_STANDBY_STATES ///< Number of standby states (sub-modes) +}; typedef enum HD_Standby_States HD_STANDBY_STATE_T; ///< Type for HD standby states enumeration -/**@}*/ - -/** - * @addtogroup HDTreatmentParamsMode - * @{ - */ - -/// Enumeration of treatment parameters mode states. -enum HD_Treatment_Parameters_Mode_States -{ +/**@}*/ + +/** + * @addtogroup HDTreatmentParamsMode + * @{ + */ + +/// Enumeration of treatment parameters mode states. +enum HD_Treatment_Parameters_Mode_States +{ HD_TREATMENT_PARAMS_MODE_STATE_START = 0, ///< Start treatment params mode state HD_TREATMENT_PARAMS_MODE_STATE_WAIT_4_UI_2_SEND, ///< Wait for UI to send treatment params mode state HD_TREATMENT_PARAMS_MODE_STATE_WAIT_4_UI_2_CONFIRM, ///< Wait for UI to confirm treatment params mode state - NUM_OF_HD_TREATMENT_PARAMS_MODE_STATES ///< Number of treatment params mode states -}; -typedef enum HD_Treatment_Parameters_Mode_States HD_TREATMENT_PARAMS_MODE_STATE_T; ///< Type for HD treatment parameters mode states enumeration - -/**@}*/ - -/** - * @addtogroup HDPreTreatmentMode - * @{ - */ - -/// Enumeration of pre-treatment mode states (sub-mode). -enum HD_Pre_Treatment_Mode_States -{ + NUM_OF_HD_TREATMENT_PARAMS_MODE_STATES ///< Number of treatment params mode states +}; +typedef enum HD_Treatment_Parameters_Mode_States HD_TREATMENT_PARAMS_MODE_STATE_T; ///< Type for HD treatment parameters mode states enumeration + +/**@}*/ + +/** + * @addtogroup HDPreTreatmentMode + * @{ + */ + +/// Enumeration of pre-treatment mode states (sub-mode). +enum HD_Pre_Treatment_Mode_States +{ HD_PRE_TREATMENT_START_STATE = 0, ///< Start pre-treatment mode state HD_PRE_TREATMENT_WATER_SAMPLE_STATE, ///< Water sample state HD_PRE_TREATMENT_SELF_TEST_CONSUMABLE_STATE, ///< Consumable self-tests state @@ -160,8 +160,8 @@ HD_PRE_TREATMENT_PRIME_STATE, ///< Prime blood and dialysate circuits and run wet self-tests state HD_PRE_TREATMENT_RECIRCULATE_STATE, ///< Re-circulate blood and dialysate circuits state HD_PRE_TREATMENT_PATIENT_CONNECTION_STATE, ///< Patient connection state - NUM_OF_HD_PRE_TREATMENT_STATES ///< Number of pre-treatment mode states -}; + NUM_OF_HD_PRE_TREATMENT_STATES ///< Number of pre-treatment mode states +}; typedef enum HD_Pre_Treatment_Mode_States HD_PRE_TREATMENT_MODE_STATE_T; ///< Type for HD pre-treatment mode states enumeration /**@}*/ @@ -276,9 +276,9 @@ }; /// Type for wet self-tests enumeration. typedef enum Wet_Self_Tests_States WET_SELF_TESTS_STATE_T; - -/**@}*/ +/**@}*/ + /** * @addtogroup Prime * @{ @@ -323,84 +323,84 @@ typedef enum HD_Pre_Treatment_Recirc_States HD_PRE_TREATMENT_RECIRC_STATE_T; /**@}*/ - -/** - * @addtogroup HDTreatmentMode - * @{ - */ - -/// Sub-mode states while in treatment mode -enum Treatment_States -{ + +/** + * @addtogroup HDTreatmentMode + * @{ + */ + +/// Sub-mode states while in treatment mode +enum Treatment_States +{ TREATMENT_START_STATE = 0, ///< Start treatment - initialize treatment and go to blood prime state - TREATMENT_BLOOD_PRIME_STATE, ///< Prime blood-side of dialyzer with gradual ramp for 1 min. while dialyzer is bypassed. No dialysis or UF taking place. No treatment time. - TREATMENT_DIALYSIS_STATE, ///< Perform dialysis. Deliver Heparin as prescribed. Deliver UF as prescribed. Handle saline boluses as requested - TREATMENT_STOP_STATE, ///< Treatment stopped. All pumps off. Dializer bypassed - TREATMENT_RINSEBACK_STATE, ///< Perform rinseback with saline. Dialyzer bypassed. Dialysate recirculating - TREATMENT_RECIRC_STATE, ///< Recirculate saline and dialysate while patient disconnected. Blood lines open and shunted. Dialyzer is bypassed - TREATMENT_END_STATE, ///< Dialysis has ended. Blood pump slowed. Dialyzer is bypassed. Dialysate is recirculated. User can rinseback - NUM_OF_TREATMENT_STATES ///< Number of treatment states (sub-modes) -}; -typedef enum Treatment_States TREATMENT_STATE_T; ///< Type for treatment states enumeration - -/**@}*/ - -/** - * @addtogroup HDPostTreatmentMode - * @{ - */ - -/// Enumeration of post-treatment mode states. -enum HD_Post_Treatment_Mode_States + TREATMENT_BLOOD_PRIME_STATE, ///< Prime blood-side of dialyzer with gradual ramp for 1 min. while dialyzer is bypassed. No dialysis or UF taking place. No treatment time. + TREATMENT_DIALYSIS_STATE, ///< Perform dialysis. Deliver Heparin as prescribed. Deliver UF as prescribed. Handle saline boluses as requested + TREATMENT_STOP_STATE, ///< Treatment stopped. All pumps off. Dializer bypassed + TREATMENT_RINSEBACK_STATE, ///< Perform rinseback with saline. Dialyzer bypassed. Dialysate recirculating + TREATMENT_RECIRC_STATE, ///< Recirculate saline and dialysate while patient disconnected. Blood lines open and shunted. Dialyzer is bypassed + TREATMENT_END_STATE, ///< Dialysis has ended. Blood pump slowed. Dialyzer is bypassed. Dialysate is recirculated. User can rinseback + NUM_OF_TREATMENT_STATES ///< Number of treatment states (sub-modes) +}; +typedef enum Treatment_States TREATMENT_STATE_T; ///< Type for treatment states enumeration + +/**@}*/ + +/** + * @addtogroup HDPostTreatmentMode + * @{ + */ + +/// Enumeration of post-treatment mode states. +enum HD_Post_Treatment_Mode_States { HD_POST_TREATMENT_DRAIN_RESERVOIRS_STATE = 0, ///< Drain reservoirs state HD_POST_TREATMENT_PATIENT_DISCONNECTION_STATE, ///< Patient disconnection state HD_POST_TREATMENT_DISPOSABLE_REMOVAL_STATE, ///< Disposable removal state - HD_POST_TREATMENT_VERIFY_STATE, ///< Verify cartridge removed, syringe removed, and reservoirs drained state - NUM_OF_HD_POST_TREATMENT_STATES ///< Number of post-treatment mode states -}; -typedef enum HD_Post_Treatment_Mode_States HD_POST_TREATMENT_STATE_T; ///< Type for HD post treatment mode states enumeration - -/**@}*/ - -/** - * @addtogroup HDServiceMode - * @{ - */ - -/// Enumeration of service mode states. -enum HD_Service_States -{ - HD_SERVICE_STATE_START = 0, ///< Start service mode state - NUM_OF_HD_SERVICE_STATES ///< Number of service mode states -}; -typedef enum HD_Service_States HD_SERVICE_STATE_T; ///< Type for HD services states enumeration - -/**@}*/ - -/** - * @addtogroup Dialysis - * @{ - */ - -/// Enumeration of dialysis sub-mode states. -enum Dialysis_States -{ - DIALYSIS_START_STATE = 0, ///< Start state of the dialysis sub-mode state machine - DIALYSIS_UF_STATE, ///< Ultrafiltration state of the dialysis sub-mode state machine - DIALYSIS_SALINE_BOLUS_STATE, ///< Saline bolus state of the dialysis sub-mode state machine - NUM_OF_DIALYSIS_STATES ///< Number of dialysis sub-mode states -}; -typedef enum Dialysis_States DIALYSIS_STATE_T; ///< Type for dialysis states enumeration - -/// Enumeration of ultrafiltration states. -enum UF_States -{ - UF_START_STATE = 0, ///< Start state of the ultrafiltration state machine - UF_PAUSED_STATE, ///< Paused state of the ultrafiltration state machine - UF_RUNNING_STATE, ///< Running state of the ultrafiltration state machine - NUM_OF_UF_STATES ///< Number of ultrafiltration states -}; + HD_POST_TREATMENT_VERIFY_STATE, ///< Verify cartridge removed, syringe removed, and reservoirs drained state + NUM_OF_HD_POST_TREATMENT_STATES ///< Number of post-treatment mode states +}; +typedef enum HD_Post_Treatment_Mode_States HD_POST_TREATMENT_STATE_T; ///< Type for HD post treatment mode states enumeration + +/**@}*/ + +/** + * @addtogroup HDServiceMode + * @{ + */ + +/// Enumeration of service mode states. +enum HD_Service_States +{ + HD_SERVICE_STATE_START = 0, ///< Start service mode state + NUM_OF_HD_SERVICE_STATES ///< Number of service mode states +}; +typedef enum HD_Service_States HD_SERVICE_STATE_T; ///< Type for HD services states enumeration + +/**@}*/ + +/** + * @addtogroup Dialysis + * @{ + */ + +/// Enumeration of dialysis sub-mode states. +enum Dialysis_States +{ + DIALYSIS_START_STATE = 0, ///< Start state of the dialysis sub-mode state machine + DIALYSIS_UF_STATE, ///< Ultrafiltration state of the dialysis sub-mode state machine + DIALYSIS_SALINE_BOLUS_STATE, ///< Saline bolus state of the dialysis sub-mode state machine + NUM_OF_DIALYSIS_STATES ///< Number of dialysis sub-mode states +}; +typedef enum Dialysis_States DIALYSIS_STATE_T; ///< Type for dialysis states enumeration + +/// Enumeration of ultrafiltration states. +enum UF_States +{ + UF_START_STATE = 0, ///< Start state of the ultrafiltration state machine + UF_PAUSED_STATE, ///< Paused state of the ultrafiltration state machine + UF_RUNNING_STATE, ///< Running state of the ultrafiltration state machine + NUM_OF_UF_STATES ///< Number of ultrafiltration states +}; typedef enum UF_States UF_STATE_T; ///< Type for ultrafiltration states enumeration /// Enumeration of saline bolus states. @@ -412,8 +412,8 @@ SALINE_BOLUS_STATE_MAX_DELIVERED, ///< Maximum saline bolus volume reached - no more saline bolus deliveries allowed NUM_OF_SALINE_BOLUS_STATES ///< Number of saline bolus states }; -typedef enum Saline_Bolus_States SALINE_BOLUS_STATE_T; ///< Type for saline bolus state enumeration - +typedef enum Saline_Bolus_States SALINE_BOLUS_STATE_T; ///< Type for saline bolus state enumeration + /// Enumeration of saline bolus command parameters. enum Saline_Commands { @@ -423,24 +423,24 @@ }; typedef enum Saline_Commands SALINE_CMD_T; ///< Type for saline command enum. -/// Enumeration of ultrafiltration command IDs. -enum UF_Commands -{ - UF_CMD_PAUSE = 0, ///< Pause UF command - UF_CMD_RESUME, ///< Resume UF command - NUM_OF_UF_CMDS ///< Number of UF commands -}; -typedef enum UF_Commands UF_CMD_T; ///< Type for UF command IDs enumeration - -/// Enumeration of ultrafiltration adjustment option IDs. -enum UF_Adjustments -{ - UF_ADJ_TREATMENT_TIME = 0, ///< Adjust treatment time to achieve new ultrafiltration volume - UF_ADJ_UF_RATE, ///< Adjust UF rate to achieve new ultrafiltration volume - NUM_OF_UF_ADJS ///< Number of UF adjustments -}; -typedef enum UF_Adjustments UF_ADJ_T; ///< Type for UF adjustments IDs enumeration - +/// Enumeration of ultrafiltration command IDs. +enum UF_Commands +{ + UF_CMD_PAUSE = 0, ///< Pause UF command + UF_CMD_RESUME, ///< Resume UF command + NUM_OF_UF_CMDS ///< Number of UF commands +}; +typedef enum UF_Commands UF_CMD_T; ///< Type for UF command IDs enumeration + +/// Enumeration of ultrafiltration adjustment option IDs. +enum UF_Adjustments +{ + UF_ADJ_TREATMENT_TIME = 0, ///< Adjust treatment time to achieve new ultrafiltration volume + UF_ADJ_UF_RATE, ///< Adjust UF rate to achieve new ultrafiltration volume + NUM_OF_UF_ADJS ///< Number of UF adjustments +}; +typedef enum UF_Adjustments UF_ADJ_T; ///< Type for UF adjustments IDs enumeration + /**@}*/ /** @@ -676,7 +676,7 @@ HD_PUMP_DIALYSATE_OUTLET_PUMP, ///< HD Dialysate outlet pump HD_PUMP_SYRINGE, ///< HD Syringe pump NUM_OF_HD_PUMPS ///< Number of HD pumps -}; +}; typedef enum HD_Pumps HD_PUMP_T; ///< Type for HD pump enumeration /** @@ -709,7 +709,7 @@ typedef enum Tx_Event_List TX_EVENT_ID_T; ///< Type for treatment event list enumeration /**@}*/ - + /** * @addtogroup CommonHeader * @{ @@ -727,6 +727,11 @@ // **** Common Const **** +// TODO: This breaks the UI build so I added this to exclude from UI build. +// Feel free to rename to what's preferred by FW needs. +// Since UI has to define this is its code when handled by FW let me know by emailing me on bNematiPour@Diality.com, so UI can remove the define. +#if !defined __UI_BUILD__ + #if !defined TASK_GENERAL_INTERVAL #include "TaskGeneral.h" #endif @@ -735,7 +740,8 @@ /// Maximum time in this mode before blood sitting warning given (in general task intervals). static const U32 WARN_TIME_BLOOD_SITTING = ( ( 4 * SEC_PER_MIN * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ); +#endif /**@}*/ -#endif +#endif