@@ -686,6 +686,8 @@ uint8_t ucTimer;
686
686
687
687
static void prvTest7_CheckBacklogBehaviour ( void )
688
688
{
689
+ UBaseType_t uxOriginalPriority ;
690
+
689
691
/* Use the first auto-reload timer to test stopping a timer from a
690
692
backlogged callback. */
691
693
@@ -734,6 +736,55 @@ static void prvTest7_CheckBacklogBehaviour( void )
734
736
/* Clear the reload count for the timer used in this test. */
735
737
ucAutoReloadTimerCounters [ 0 ] = ( uint8_t ) 0 ;
736
738
739
+
740
+ /* Verify a one-shot timer is marked as inactive if the timer task processes
741
+ the start or reset request after the expiration time has passed. */
742
+
743
+ /* The timer has not been started yet! */
744
+ if ( xTimerIsTimerActive ( xOneShotTimer ) != pdFALSE )
745
+ {
746
+ xTestStatus = pdFAIL ;
747
+ configASSERT ( xTestStatus );
748
+ }
749
+
750
+ /* Use the timer period specific to backlogged timers because it reduces
751
+ the impact on other tests that might be running when xTaskCatchUpTicks()
752
+ creates the backlog, below. */
753
+ xTimerChangePeriod ( xOneShotTimer , tmrdemoBACKLOG_TIMER_PERIOD , tmrdemoDONT_BLOCK );
754
+
755
+ /* Temporarily give this task maximum priority so it can cause the timer
756
+ task to delay its processing of the reset request below. */
757
+ uxOriginalPriority = uxTaskPriorityGet ( NULL );
758
+ vTaskPrioritySet ( NULL , ( configMAX_PRIORITIES - 1 ) );
759
+
760
+ /* Reset the timer. The timer service won't process this request right
761
+ away as noted above. */
762
+ xTimerReset ( xOneShotTimer , tmrdemoDONT_BLOCK );
763
+
764
+ /* Cause the timer period to elapse without giving an opportunity for the
765
+ timer service task to process the reset request. */
766
+ xTaskCatchUpTicks ( tmrdemoBACKLOG_TIMER_PERIOD );
767
+
768
+ /* Return this task to its original priority. The timer service task will
769
+ process the reset request immediately. The timer task must handle the reset
770
+ request as if it were processed at the time of the request even though in
771
+ this test the processing occurs after the intended expiration time. */
772
+ vTaskPrioritySet ( NULL , uxOriginalPriority );
773
+
774
+ /* The timer should now be inactive. */
775
+ if ( xTimerIsTimerActive ( xOneShotTimer ) != pdFALSE )
776
+ {
777
+ xTestStatus = pdFAIL ;
778
+ configASSERT ( xTestStatus );
779
+ }
780
+
781
+ /* Restore the standard timer period, and leave the timer inactive. */
782
+ xTimerChangePeriod ( xOneShotTimer , tmrdemoONE_SHOT_TIMER_PERIOD , tmrdemoDONT_BLOCK );
783
+ xTimerStop ( xOneShotTimer , tmrdemoDONT_BLOCK );
784
+
785
+ /* Clear the counter for the timer used in this test. */
786
+ ucOneShotTimerCounter = ( uint8_t ) 0 ;
787
+
737
788
if ( xTestStatus == pdPASS )
738
789
{
739
790
/* No errors have been reported so increment the loop counter so the check
0 commit comments