Index: TestSupport.c =================================================================== diff -u -r60942b3154c83220da99a31718872afbb0ae6dca -r2cee3073ca8ba8d7023bc15dc42bd4959ff91e12 --- TestSupport.c (.../TestSupport.c) (revision 60942b3154c83220da99a31718872afbb0ae6dca) +++ TestSupport.c (.../TestSupport.c) (revision 2cee3073ca8ba8d7023bc15dc42bd4959ff91e12) @@ -196,6 +196,226 @@ return reset; } +/*********************************************************************//** + * @brief + * The u32BroadcastIntervalOverride function sets the override for a given + * U32 broadcast interval override record. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message Override message from Dialin which includes the U32 override + * value (in ms). + * @param override Pointer to the override record to set + * @param taskIntvlMS Task interval (in ms) + * @return TRUE if override is successful, FALSE if not + *************************************************************************/ +BOOL u32BroadcastIntervalOverride( MESSAGE_T *message, OVERRIDE_U32_T *override, U32 taskIntvlMS ) +{ + BOOL result = FALSE; + TEST_OVERRIDE_PAYLOAD_T payload; + OVERRIDE_TYPE_T ovType = getOverridePayloadFromMessage( message, &payload ); + + // Verify tester has logged in with TD and override type is valid + if ( ( TRUE == isTestingActivated() ) && ( ovType != OVERRIDE_INVALID ) && ( ovType < NUM_OF_OVERRIDE_TYPES ) ) + { + result = TRUE; + if ( OVERRIDE_OVERRIDE == ovType ) + { + U32 value = payload.state.u32; + U32 intvl = value / taskIntvlMS; + + override->ovData = intvl; + override->override = OVERRIDE_KEY; + } + else + { + override->override = OVERRIDE_RESET; + override->ovData = override->ovInitData; + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The u32Override function sets the override for a given U32 override record. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message Override message from Dialin which includes the U32 override + * value. + * @param override Pointer to the override record to set + * @param min Minimum value that should be allowed + * @param max Maximum value that should be allowed + * @return TRUE if override is successful, FALSE if not + *************************************************************************/ +BOOL u32Override( MESSAGE_T *message, OVERRIDE_U32_T *override, U32 min, U32 max ) +{ + BOOL result = FALSE; + TEST_OVERRIDE_PAYLOAD_T payload; + OVERRIDE_TYPE_T ovType = getOverridePayloadFromMessage( message, &payload ); + + // Verify tester has logged in with TD and override type is valid + if ( ( TRUE == isTestingActivated() ) && ( ovType != OVERRIDE_INVALID ) && ( ovType < NUM_OF_OVERRIDE_TYPES ) ) + { + if ( OVERRIDE_OVERRIDE == ovType ) + { + U32 value = payload.state.u32; + + if ( ( value >= min ) && ( value <= max ) ) + { + result = TRUE; + override->ovData = value; + override->override = OVERRIDE_KEY; + } + } + else + { + result = TRUE; + override->override = OVERRIDE_RESET; + override->ovData = override->ovInitData; + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The f32Override function sets the override for a given F32 override record. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message Override message from Dialin which includes the F32 override + * value. + * @param override Pointer to the override record to set + * @param min Minimum value that should be allowed + * @param max Maximum value that should be allowed + * @return TRUE if override is successful, FALSE if not + *************************************************************************/ +BOOL f32Override( MESSAGE_T *message, OVERRIDE_F32_T *override ) +{ + BOOL result = FALSE; + TEST_OVERRIDE_PAYLOAD_T payload; + OVERRIDE_TYPE_T ovType = getOverridePayloadFromMessage( message, &payload ); + + // Verify tester has logged in with TD and override type is valid + if ( ( TRUE == isTestingActivated() ) && ( ovType != OVERRIDE_INVALID ) && ( ovType < NUM_OF_OVERRIDE_TYPES ) ) + { + result = TRUE; + if ( OVERRIDE_OVERRIDE == ovType ) + { + F32 value = payload.state.f32; + + override->ovData = value; + override->override = OVERRIDE_KEY; + } + else + { + override->override = OVERRIDE_RESET; + override->ovData = override->ovInitData; + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The u32ArrayOverride function sets the override for a given array of U32 + * override records. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message Override message from Dialin which includes the U32 override + * value and the array index. + * @param override Pointer to the array of override records + * @param maxIndex Maximum array index to allow + * @param min Minimum value that should be allowed + * @param max Maximum value that should be allowed + * @return TRUE if override is successful, FALSE if not + *************************************************************************/ +BOOL u32ArrayOverride( MESSAGE_T *message, OVERRIDE_U32_T *override, U32 maxIndex, U32 min, U32 max ) +{ + BOOL result = FALSE; + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + OVERRIDE_TYPE_T ovType = getOverrideArrayPayloadFromMessage( message, &payload ); + + // Verify tester has logged in with TD and override type is valid + if ( ( TRUE == isTestingActivated() ) && ( ovType != OVERRIDE_INVALID ) && ( ovType < NUM_OF_OVERRIDE_TYPES ) ) + { + U32 index = payload.index; + + // Verify voltage index of override + if ( index <= maxIndex ) + { + if ( OVERRIDE_OVERRIDE == ovType ) + { + U32 value = payload.state.u32; + + if ( ( value >= min ) && ( value <= max ) ) + { + result = TRUE; + override[ index ].ovData = value; + override[ index ].override = OVERRIDE_KEY; + } + } + else + { + result = TRUE; + override[ index ].override = OVERRIDE_RESET; + override[ index ].ovData = override[ index ].ovInitData; + } + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The u32ArrayOverride function sets the override for a given array of U32 + * override records. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message Override message from Dialin which includes the U32 override + * value and the array index. + * @param override Pointer to the array of override records + * @param maxIndex Maximum array index to allow + * @param min Minimum value that should be allowed + * @param max Maximum value that should be allowed + * @return TRUE if override is successful, FALSE if not + *************************************************************************/ +BOOL f32ArrayOverride( MESSAGE_T *message, OVERRIDE_F32_T *override, U32 maxIndex ) +{ + BOOL result = FALSE; + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + OVERRIDE_TYPE_T ovType = getOverrideArrayPayloadFromMessage( message, &payload ); + + // Verify tester has logged in with TD and override type is valid + if ( ( TRUE == isTestingActivated() ) && ( ovType != OVERRIDE_INVALID ) && ( ovType < NUM_OF_OVERRIDE_TYPES ) ) + { + U32 index = payload.index; + + // Verify voltage index of override + if ( index <= maxIndex ) + { + result = TRUE; + if ( OVERRIDE_OVERRIDE == ovType ) + { + F32 value = payload.state.f32; + + override[ index ].ovData = value; + override[ index ].override = OVERRIDE_KEY; + } + else + { + override[ index ].override = OVERRIDE_RESET; + override[ index ].ovData = override[ index ].ovInitData; + } + } + } + + return result; +} + // ********** Release software configurations functions ********** /*********************************************************************//**