Index: Utilities.h =================================================================== diff -u -r5846ff450c26de04b388c2636964a9116ccb6e9d -rdeccca7f64383d627e700a8bb929742eb33d947a --- Utilities.h (.../Utilities.h) (revision 5846ff450c26de04b388c2636964a9116ccb6e9d) +++ Utilities.h (.../Utilities.h) (revision deccca7f64383d627e700a8bb929742eb33d947a) @@ -7,8 +7,8 @@ * * @file Utilities.h * -* @author (last) Michael Garthwaite -* @date (last) 22-Feb-2022 +* @author (last) Dara Navaei +* @date (last) 09-Aug-2022 * * @author (original) Sean * @date (original) 17-Feb-2020 @@ -39,7 +39,8 @@ TIME_WINDOWED_COUNT_CAN_OFF, ///< CAN off TIME_WINDOWED_COUNT_CAN_PARITY, ///< CAN parity error TIME_WINDOWED_COUNT_FPGA_UART_FRAME_ERROR, ///< FPGA UART frame error - TIME_WINDOWED_COUNT_FPGA_UART_OVERRUN, ///< FPGA UART overrun error + TIME_WINDOWED_COUNT_FPGA_UART_OVERRUN, ///< FPGA UART overrun error + TIME_WINDOWED_COUNT_FPGA_CLOCK_SPEED_ERROR, ///< FPGA clock speed error #ifdef _HD_ TIME_WINDOWED_COUNT_BP_COMMUTATION_ERROR, ///< Blood pump commutation error TIME_WINDOWED_COUNT_DIP_COMMUTATION_ERROR, ///< Dialysate inlet pump commutation error @@ -62,6 +63,13 @@ NUM_OF_CRITICAL_DATA_TYPES ///< Total number of critical data types } CRITICAL_DATA_TYPES_T; +/// Semaphore items +typedef enum Semaphores +{ + SEMAPHORE_RTC = 0, ///< Semaphore RTC + NUM_OF_SEMAPHORES, ///< Number of semaphores +} SEMAPHORE_T; + /// Record structure for alarm data of any supported type. typedef union { @@ -87,7 +95,7 @@ U32 crc32( U32 const initialValue, const U08 *address, U32 len ); U16 crc16( const U08 *address, U32 len ); U08 crc8( const U08 *address, U32 len ); -U08 crc4( U08* buffer ); +U08 crc4( U16* buffer, U32 byteCount ); U32 u32DiffWithWrap( U32 start, U32 end ); S32 u32BiDiffWithWrap( U32 start, U32 end ); U16 u16DiffWithWrap( U16 start, U16 end ); @@ -99,7 +107,12 @@ BOOL isCriticalDataInRange( CRITICAL_DATA_T *data ); void resetCriticalData( CRITICAL_DATA_T *data ); U32 hexStrToDec( U08 const * const valuePtr, U08 size ); -BOOL isCriticalDataSet( CRITICAL_DATA_T *data ); ///< Determines if critcal data has been set. +BOOL isCriticalDataSet( CRITICAL_DATA_T *data ); ///< Determines if critical data has been set. + +void initSemaphores( void ); +BOOL getSemaphore( SEMAPHORE_T s ); +void releaseSemaphore( SEMAPHORE_T s ); +BOOL isSemaphoreReleased( SEMAPHORE_T s ); /**@}*/