File indexing completed on 2025-05-11 08:24:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 #ifdef HAVE_CONFIG_H
0052 #include "config.h"
0053 #endif
0054
0055 #include <rtems.h>
0056 #include <rtems/timecounter.h>
0057 #include <rtems/score/atomic.h>
0058 #include <rtems/score/threaddispatch.h>
0059
0060 #include "tx-support.h"
0061
0062 #include <rtems/test.h>
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282 typedef struct {
0283 struct timecounter base;
0284 Atomic_Ulong counter;
0285 } Timecounter;
0286
0287 static Timecounter high_quality_low_frequency;
0288
0289 static Timecounter high_quality_normal_frequency;
0290
0291 static Timecounter high_quality_high_frequency;
0292
0293 static Timecounter low_quality;
0294
0295 static Timecounter very_high_quality;
0296
0297 static uint32_t ntp_counter;
0298
0299 static uint32_t GetTimecount( struct timecounter *base )
0300 {
0301 Timecounter *tc;
0302
0303 tc = (Timecounter *) base;
0304
0305 return (uint32_t) _Atomic_Fetch_add_ulong(
0306 &tc->counter,
0307 1,
0308 ATOMIC_ORDER_RELAXED
0309 );
0310 }
0311
0312 static uint32_t GetCounter( const Timecounter *tc )
0313 {
0314 return (uint32_t) _Atomic_Load_ulong(
0315 &tc->counter,
0316 ATOMIC_ORDER_RELAXED
0317 );
0318 }
0319
0320 static void SetCounter( Timecounter *tc, uint32_t counter )
0321 {
0322 _Atomic_Store_ulong(
0323 &tc->counter,
0324 counter,
0325 ATOMIC_ORDER_RELAXED
0326 );
0327 }
0328
0329 static void NtpUpdateCounter( int64_t *adjustment, time_t *newsec )
0330 {
0331 (void) newsec;
0332 T_eq_i64( *adjustment, 0 );
0333 ++ntp_counter;
0334 }
0335
0336 static void NtpUpdateSecondIncrement( int64_t *adjustment, time_t *newsec )
0337 {
0338 (void) adjustment;
0339 ++(*newsec);
0340 }
0341
0342 static void NtpUpdateSecondDecrement( int64_t *adjustment, time_t *newsec )
0343 {
0344 (void) adjustment;
0345 --(*newsec);
0346 }
0347
0348 static void NtpUpdateAdjustmentFaster( int64_t *adjustment, time_t *newsec )
0349 {
0350 *adjustment = ( (int64_t) 5000 ) << 32;
0351 (void) newsec;
0352 }
0353
0354 static void NtpUpdateAdjustmentSlower( int64_t *adjustment, time_t *newsec )
0355 {
0356 *adjustment = -( (int64_t) 5000 ) << 32;
0357 (void) newsec;
0358 }
0359
0360 static void CallTimecounterTick( void )
0361 {
0362 Per_CPU_Control *cpu_self;
0363
0364 cpu_self = _Thread_Dispatch_disable();
0365 rtems_timecounter_tick();
0366 _Thread_Dispatch_enable( cpu_self );
0367 }
0368
0369
0370
0371
0372
0373
0374 static void ScoreTimecounterValInstall_Action_0( void )
0375 {
0376 ISR_lock_Context lock_context;
0377
0378 _Timecounter_Acquire( &lock_context );
0379 _Timecounter_Tick_simple( 0, 0, &lock_context );
0380 }
0381
0382
0383
0384
0385
0386 static void ScoreTimecounterValInstall_Action_1( void )
0387 {
0388 struct bintime bt;
0389 struct timespec ts;
0390 struct timeval tv;
0391
0392
0393
0394
0395 rtems_clock_get_realtime( &ts );
0396 T_eq_i64( ts.tv_sec, 567993600 );
0397 T_eq_u64( ts.tv_nsec, 0 );
0398
0399
0400
0401
0402 rtems_clock_get_realtime( &ts );
0403 T_eq_i64( ts.tv_sec, 567993600 );
0404 T_eq_u64( ts.tv_nsec, 0 );
0405
0406
0407
0408
0409
0410 rtems_clock_get_realtime_coarse( &ts );
0411 T_eq_i64( ts.tv_sec, 567993600 );
0412 T_eq_u64( ts.tv_nsec, 0 );
0413
0414
0415
0416
0417
0418 rtems_clock_get_realtime_coarse( &ts );
0419 T_eq_i64( ts.tv_sec, 567993600 );
0420 T_eq_u64( ts.tv_nsec, 0 );
0421
0422
0423
0424
0425 rtems_clock_get_realtime_bintime( &bt );
0426 T_eq_i64( bt.sec, 567993600 );
0427 T_eq_u64( bt.frac, 0 );
0428
0429
0430
0431
0432 rtems_clock_get_realtime_bintime( &bt );
0433 T_eq_i64( bt.sec, 567993600 );
0434 T_eq_u64( bt.frac, 0 );
0435
0436
0437
0438
0439
0440 rtems_clock_get_realtime_coarse_bintime( &bt );
0441 T_eq_i64( bt.sec, 567993600 );
0442 T_eq_u64( bt.frac, 0 );
0443
0444
0445
0446
0447
0448 rtems_clock_get_realtime_coarse_bintime( &bt );
0449 T_eq_i64( bt.sec, 567993600 );
0450 T_eq_u64( bt.frac, 0 );
0451
0452
0453
0454
0455 rtems_clock_get_realtime_timeval( &tv );
0456 T_eq_i64( tv.tv_sec, 567993600 );
0457 T_eq_long( tv.tv_usec, 0 );
0458
0459
0460
0461
0462 rtems_clock_get_realtime_timeval( &tv );
0463 T_eq_i64( tv.tv_sec, 567993600 );
0464 T_eq_long( tv.tv_usec, 0 );
0465
0466
0467
0468
0469
0470 rtems_clock_get_realtime_coarse_timeval( &tv );
0471 T_eq_i64( tv.tv_sec, 567993600 );
0472 T_eq_long( tv.tv_usec, 0 );
0473
0474
0475
0476
0477
0478 rtems_clock_get_realtime_coarse_timeval( &tv );
0479 T_eq_i64( tv.tv_sec, 567993600 );
0480 T_eq_long( tv.tv_usec, 0 );
0481
0482
0483
0484
0485 rtems_clock_get_boot_time( &ts );
0486 T_eq_i64( ts.tv_sec, 567993599 );
0487 T_eq_u64( ts.tv_nsec, 0 );
0488
0489
0490
0491
0492 rtems_clock_get_boot_time_bintime( &bt );
0493 T_eq_i64( bt.sec, 567993599 );
0494 T_eq_u64( bt.frac, 0 );
0495
0496
0497
0498
0499 rtems_clock_get_boot_time_timeval( &tv );
0500 T_eq_i64( tv.tv_sec, 567993599 );
0501 T_eq_long( tv.tv_usec, 0 );
0502 }
0503
0504
0505
0506
0507
0508 static void ScoreTimecounterValInstall_Action_2( void )
0509 {
0510 struct bintime bt;
0511 sbintime_t sb;
0512 struct timespec ts;
0513 struct timeval tv;
0514
0515
0516
0517
0518 rtems_clock_get_monotonic( &ts );
0519 T_eq_i64( ts.tv_sec, 1 );
0520 T_eq_u64( ts.tv_nsec, 0 );
0521
0522
0523
0524
0525 rtems_clock_get_monotonic( &ts );
0526 T_eq_i64( ts.tv_sec, 1 );
0527 T_eq_u64( ts.tv_nsec, 0 );
0528
0529
0530
0531
0532
0533 rtems_clock_get_monotonic_coarse( &ts );
0534 T_eq_i64( ts.tv_sec, 1 );
0535 T_eq_u64( ts.tv_nsec, 0 );
0536
0537
0538
0539
0540
0541 rtems_clock_get_monotonic_coarse( &ts );
0542 T_eq_i64( ts.tv_sec, 1 );
0543 T_eq_u64( ts.tv_nsec, 0 );
0544
0545
0546
0547
0548 rtems_clock_get_monotonic_bintime( &bt );
0549 T_eq_i64( bt.sec, 1 );
0550 T_eq_u64( bt.frac, 0 );
0551
0552
0553
0554
0555 rtems_clock_get_monotonic_bintime( &bt );
0556 T_eq_i64( bt.sec, 1 );
0557 T_eq_u64( bt.frac, 0 );
0558
0559
0560
0561
0562
0563 rtems_clock_get_monotonic_coarse_bintime( &bt );
0564 T_eq_i64( bt.sec, 1 );
0565 T_eq_u64( bt.frac, 0 );
0566
0567
0568
0569
0570
0571 rtems_clock_get_monotonic_coarse_bintime( &bt );
0572 T_eq_i64( bt.sec, 1 );
0573 T_eq_u64( bt.frac, 0 );
0574
0575
0576
0577
0578 sb = rtems_clock_get_monotonic_sbintime();
0579 T_eq_i64( sb, SBT_1S );
0580
0581
0582
0583
0584 sb = rtems_clock_get_monotonic_sbintime();
0585 T_eq_i64( sb, SBT_1S );
0586
0587
0588
0589
0590 rtems_clock_get_monotonic_timeval( &tv );
0591 T_eq_i64( tv.tv_sec, 1 );
0592 T_eq_long( tv.tv_usec, 0 );
0593
0594
0595
0596
0597 rtems_clock_get_monotonic_timeval( &tv );
0598 T_eq_i64( tv.tv_sec, 1 );
0599 T_eq_long( tv.tv_usec, 0 );
0600
0601
0602
0603
0604
0605 rtems_clock_get_monotonic_coarse_timeval( &tv );
0606 T_eq_i64( tv.tv_sec, 1 );
0607 T_eq_long( tv.tv_usec, 0 );
0608
0609
0610
0611
0612
0613 rtems_clock_get_monotonic_coarse_timeval( &tv );
0614 T_eq_i64( tv.tv_sec, 1 );
0615 T_eq_long( tv.tv_usec, 0 );
0616 }
0617
0618
0619
0620
0621 static void ScoreTimecounterValInstall_Action_3( void )
0622 {
0623 Timecounter *hqlf;
0624 Timecounter *hqnf;
0625 Timecounter *hqhf;
0626 Timecounter *lq;
0627 sbintime_t sb;
0628
0629 hqlf = &high_quality_low_frequency;
0630 hqnf = &high_quality_normal_frequency;
0631 hqhf = &high_quality_high_frequency;
0632 lq = &low_quality;
0633
0634
0635
0636
0637
0638 hqnf->base.tc_get_timecount = GetTimecount;
0639 hqnf->base.tc_counter_mask = 0xffffffff;
0640 hqnf->base.tc_frequency = 0x20000000;
0641 hqnf->base.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER + 1;
0642 rtems_timecounter_install( &hqnf->base );
0643
0644 T_eq_u32( GetCounter( hqnf ), 1 );
0645
0646 sb = rtems_clock_get_monotonic_sbintime();
0647 T_eq_u32( GetCounter( hqnf ), 2 );
0648 T_eq_i64( sb, SBT_1S + 8 );
0649
0650
0651
0652
0653
0654 hqlf->base.tc_get_timecount = GetTimecount;
0655 hqlf->base.tc_counter_mask = 0xffffffff;
0656 hqlf->base.tc_frequency = 0x10000000;
0657 hqlf->base.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER + 1;
0658 rtems_timecounter_install( &hqlf->base );
0659
0660 T_eq_u32( GetCounter( hqlf ), 0 );
0661 T_eq_u32( GetCounter( hqnf ), 2 );
0662
0663 sb = rtems_clock_get_monotonic_sbintime();
0664 T_eq_u32( GetCounter( hqlf ), 0 );
0665 T_eq_u32( GetCounter( hqnf ), 3 );
0666 T_eq_i64( sb, SBT_1S + 16 );
0667
0668
0669
0670
0671
0672 hqhf->base.tc_get_timecount = GetTimecount;
0673 hqhf->base.tc_counter_mask = 0xffffffff;
0674 hqhf->base.tc_frequency = 0x40000000;
0675 hqhf->base.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER + 1;
0676 rtems_timecounter_install( &hqhf->base );
0677
0678 T_eq_u32( GetCounter( hqlf ), 0 );
0679 T_eq_u32( GetCounter( hqnf ), 4 );
0680 T_eq_u32( GetCounter( hqhf ), 1 );
0681
0682 sb = rtems_clock_get_monotonic_sbintime();
0683 T_eq_u32( GetCounter( hqlf ), 0 );
0684 T_eq_u32( GetCounter( hqnf ), 4 );
0685 T_eq_u32( GetCounter( hqhf ), 2 );
0686 T_eq_i64( sb, SBT_1S + 28 );
0687
0688
0689
0690
0691
0692 lq->base.tc_get_timecount = GetTimecount;
0693 lq->base.tc_counter_mask = 0xffffffff;
0694 lq->base.tc_frequency = 0x80000000;
0695 lq->base.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
0696 rtems_timecounter_install( &lq->base );
0697
0698 T_eq_u32( GetCounter( hqlf ), 0 );
0699 T_eq_u32( GetCounter( hqnf ), 4 );
0700 T_eq_u32( GetCounter( hqhf ), 2 );
0701 T_eq_u32( GetCounter( lq ), 0 );
0702
0703 sb = rtems_clock_get_monotonic_sbintime();
0704 T_eq_u32( GetCounter( hqlf ), 0 );
0705 T_eq_u32( GetCounter( hqnf ), 4 );
0706 T_eq_u32( GetCounter( hqhf ), 3 );
0707 T_eq_u32( GetCounter( lq ), 0 );
0708 T_eq_i64( sb, SBT_1S + 32 );
0709 }
0710
0711
0712
0713
0714
0715 static void ScoreTimecounterValInstall_Action_4( void )
0716 {
0717 Timecounter *tc;
0718 uint32_t counter;
0719 struct bintime bt;
0720 struct timespec ts;
0721 struct timeval tv;
0722
0723 tc = &high_quality_high_frequency;
0724 counter = GetCounter( tc );
0725
0726
0727
0728
0729 rtems_clock_get_realtime( &ts );
0730 T_eq_u32( GetCounter( tc ), counter + 1 );
0731
0732
0733
0734
0735 rtems_clock_get_realtime_bintime( &bt );
0736 T_eq_u32( GetCounter( tc ), counter + 2 );
0737
0738
0739
0740
0741 rtems_clock_get_realtime_timeval( &tv );
0742 T_eq_u32( GetCounter( tc ), counter + 3 );
0743
0744
0745
0746
0747 rtems_clock_get_monotonic( &ts );
0748 T_eq_u32( GetCounter( tc ), counter + 4 );
0749
0750
0751
0752
0753
0754 rtems_clock_get_monotonic_bintime( &bt );
0755 T_eq_u32( GetCounter( tc ), counter + 5 );
0756
0757
0758
0759
0760
0761 (void) rtems_clock_get_monotonic_sbintime();
0762 T_eq_u32( GetCounter( tc ), counter + 6 );
0763
0764
0765
0766
0767
0768 rtems_clock_get_monotonic_timeval( &tv );
0769 T_eq_u32( GetCounter( tc ), counter + 7 );
0770 }
0771
0772
0773
0774
0775 static void ScoreTimecounterValInstall_Action_5( void )
0776 {
0777 Timecounter *tc;
0778 uint32_t counter;
0779 struct bintime bt;
0780 struct timespec ts;
0781 struct timeval tv;
0782
0783 tc = &high_quality_high_frequency;
0784 counter = GetCounter( tc );
0785
0786
0787
0788
0789
0790 rtems_clock_get_realtime_coarse( &ts );
0791 T_eq_u32( GetCounter( tc ), counter );
0792
0793
0794
0795
0796
0797 rtems_clock_get_realtime_coarse_bintime( &bt );
0798 T_eq_u32( GetCounter( tc ), counter );
0799
0800
0801
0802
0803
0804 rtems_clock_get_realtime_coarse_timeval( &tv );
0805 T_eq_u32( GetCounter( tc ), counter );
0806
0807
0808
0809
0810
0811 rtems_clock_get_monotonic_coarse( &ts );
0812 T_eq_u32( GetCounter( tc ), counter );
0813
0814
0815
0816
0817
0818 rtems_clock_get_monotonic_coarse_bintime( &bt );
0819 T_eq_u32( GetCounter( tc ), counter );
0820
0821
0822
0823
0824
0825 rtems_clock_get_monotonic_coarse_timeval( &tv );
0826 T_eq_u32( GetCounter( tc ), counter );
0827
0828
0829
0830
0831 rtems_clock_get_boot_time( &ts );
0832 T_eq_u32( GetCounter( tc ), counter );
0833
0834
0835
0836
0837
0838 rtems_clock_get_boot_time_bintime( &bt );
0839 T_eq_u32( GetCounter( tc ), counter );
0840
0841
0842
0843
0844
0845 rtems_clock_get_boot_time_timeval( &tv );
0846 T_eq_u32( GetCounter( tc ), counter );
0847 }
0848
0849
0850
0851
0852
0853 static void ScoreTimecounterValInstall_Action_6( void )
0854 {
0855 Timecounter *tc;
0856 uint32_t counter;
0857 struct bintime bt;
0858 sbintime_t sb;
0859 struct timespec ts;
0860 struct timeval tv;
0861
0862 tc = &high_quality_high_frequency;
0863 counter = 3 * tc->base.tc_frequency + 123456789;
0864
0865
0866
0867
0868
0869 SetCounter( tc, counter );
0870 rtems_clock_get_realtime( &ts );
0871 T_eq_i64( ts.tv_sec, 567993603 );
0872 T_eq_u64( ts.tv_nsec, 114978100 );
0873
0874
0875
0876
0877
0878 SetCounter( tc, counter );
0879 rtems_clock_get_realtime_bintime( &bt );
0880 T_eq_i64( bt.sec, 567993603 );
0881 T_eq_u64( bt.frac, 2120971587975905280 );
0882
0883
0884
0885
0886
0887 SetCounter( tc, counter );
0888 rtems_clock_get_realtime_timeval( &tv );
0889 T_eq_i64( tv.tv_sec, 567993603 );
0890 T_eq_long( tv.tv_usec, 114978 );
0891
0892
0893
0894
0895
0896 SetCounter( tc, counter );
0897 rtems_clock_get_monotonic( &ts );
0898 T_eq_i64( ts.tv_sec, 4 );
0899 T_eq_u64( ts.tv_nsec, 114978100 );
0900
0901
0902
0903
0904
0905 SetCounter( tc, counter );
0906 rtems_clock_get_monotonic_bintime( &bt );
0907 T_eq_i64( bt.sec, 4 );
0908 T_eq_u64( bt.frac, 2120971587975905280 );
0909
0910
0911
0912
0913
0914 SetCounter( tc, counter );
0915 sb = rtems_clock_get_monotonic_sbintime();
0916 T_eq_i64( sb, 17673696364 );
0917
0918
0919
0920
0921
0922 SetCounter( tc, counter );
0923 rtems_clock_get_monotonic_timeval( &tv );
0924 T_eq_i64( tv.tv_sec, 4 );
0925 T_eq_long( tv.tv_usec, 114978 );
0926 }
0927
0928
0929
0930
0931 static void ScoreTimecounterValInstall_Action_7( void )
0932 {
0933 Timecounter *tc;
0934 struct bintime bt;
0935
0936 tc = &high_quality_high_frequency;
0937
0938 SetCounter( tc, 0 );
0939 rtems_clock_get_realtime_bintime( &bt );
0940 T_eq_i64( bt.sec, 567993600 );
0941 T_eq_u64( bt.frac, 103079215104 );
0942
0943 SetCounter( tc, 2 * tc->base.tc_frequency );
0944 CallTimecounterTick();
0945
0946 SetCounter( tc, 2 * tc->base.tc_frequency );
0947 rtems_clock_get_realtime_bintime( &bt );
0948 T_eq_i64( bt.sec, 567993602 );
0949 T_eq_u64( bt.frac, 103079215104 );
0950 }
0951
0952
0953
0954
0955
0956 static void ScoreTimecounterValInstall_Action_8( void )
0957 {
0958 ISR_lock_Context lock_context;
0959 Timecounter *tc;
0960 struct bintime bt;
0961
0962 tc = &high_quality_high_frequency;
0963
0964 _Timecounter_Acquire( &lock_context );
0965 _Timecounter_Tick_simple(
0966 tc->base.tc_frequency / 2,
0967 GetCounter( tc ) - tc->base.tc_frequency / 2,
0968 &lock_context
0969 );
0970
0971
0972
0973
0974 rtems_clock_get_realtime_bintime( &bt );
0975 T_eq_i64( bt.sec, 567993603 );
0976 T_eq_u64( bt.frac, 103079215104 );
0977 }
0978
0979
0980
0981
0982
0983 static void ScoreTimecounterValInstall_Action_9( void )
0984 {
0985 Timecounter *tc;
0986 struct bintime bt;
0987
0988 tc = &very_high_quality;
0989 tc->base.tc_get_timecount = GetTimecount;
0990 tc->base.tc_counter_mask = 0xffffffff;
0991 tc->base.tc_frequency = 0x01000000;
0992 tc->base.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER + 2;
0993 rtems_timecounter_install( &tc->base );
0994
0995 T_eq_u32( GetCounter( tc ), 1 );
0996
0997 rtems_clock_get_realtime_bintime( &bt );
0998 T_eq_i64( bt.sec, 567993603 );
0999 T_eq_u64( bt.frac, 1219770712064 );
1000
1001
1002
1003
1004
1005 _Timecounter_Set_NTP_update_second( NtpUpdateCounter );
1006 SetCounter( tc, tc->base.tc_frequency / 2 );
1007 CallTimecounterTick();
1008 _Timecounter_Set_NTP_update_second( NULL );
1009
1010 T_eq_u32( ntp_counter, 0 );
1011
1012 rtems_clock_get_realtime_bintime( &bt );
1013 T_eq_i64( bt.sec, 567993603 );
1014 T_eq_u64( bt.frac, UINT64_C( 9223373256625487872 ) );
1015
1016
1017
1018
1019
1020 _Timecounter_Set_NTP_update_second( NtpUpdateCounter );
1021 SetCounter( tc, tc->base.tc_frequency );
1022 CallTimecounterTick();
1023 _Timecounter_Set_NTP_update_second( NULL );
1024
1025 T_eq_u32( ntp_counter, 1 );
1026
1027 rtems_clock_get_realtime_bintime( &bt );
1028 T_eq_i64( bt.sec, 567993604 );
1029 T_eq_u64( bt.frac, 1219770712064 );
1030
1031
1032
1033
1034
1035 _Timecounter_Set_NTP_update_second( NtpUpdateCounter );
1036 SetCounter( tc, 201 * tc->base.tc_frequency );
1037 CallTimecounterTick();
1038 _Timecounter_Set_NTP_update_second( NULL );
1039
1040 T_eq_u32( ntp_counter, 201 );
1041
1042 rtems_clock_get_realtime_bintime( &bt );
1043 T_eq_i64( bt.sec, 567993804 );
1044 T_eq_u64( bt.frac, 1219770712064 );
1045
1046
1047
1048
1049
1050 _Timecounter_Set_NTP_update_second( NtpUpdateCounter );
1051 SetCounter( tc, 402 * tc->base.tc_frequency );
1052 CallTimecounterTick();
1053 _Timecounter_Set_NTP_update_second( NULL );
1054
1055 T_eq_u32( ntp_counter, 203 );
1056
1057 rtems_clock_get_realtime_bintime( &bt );
1058 T_eq_i64( bt.sec, 567994005 );
1059 T_eq_u64( bt.frac, 1219770712064 );
1060
1061
1062
1063
1064
1065 _Timecounter_Set_NTP_update_second( NtpUpdateSecondIncrement );
1066 SetCounter( tc, 403 * tc->base.tc_frequency );
1067 CallTimecounterTick();
1068 _Timecounter_Set_NTP_update_second( NULL );
1069
1070 rtems_clock_get_realtime_bintime( &bt );
1071 T_eq_i64( bt.sec, 567994007 );
1072 T_eq_u64( bt.frac, 1219770712064 );
1073
1074
1075
1076
1077
1078 _Timecounter_Set_NTP_update_second( NtpUpdateSecondDecrement );
1079 SetCounter( tc, 404 * tc->base.tc_frequency );
1080 CallTimecounterTick();
1081 _Timecounter_Set_NTP_update_second( NULL );
1082
1083 rtems_clock_get_realtime_bintime( &bt );
1084 T_eq_i64( bt.sec, 567994007 );
1085 T_eq_u64( bt.frac, 1219770712064 );
1086
1087
1088
1089
1090
1091 _Timecounter_Set_NTP_update_second( NtpUpdateAdjustmentFaster );
1092 SetCounter( tc, 405 * tc->base.tc_frequency );
1093 CallTimecounterTick();
1094 _Timecounter_Set_NTP_update_second( NULL );
1095
1096 SetCounter( tc, 406 * tc->base.tc_frequency );
1097 rtems_clock_get_realtime_bintime( &bt );
1098 T_eq_i64( bt.sec, 567994009 );
1099 T_eq_u64( bt.frac, 92353004044288 );
1100
1101
1102
1103
1104
1105 _Timecounter_Set_NTP_update_second( NtpUpdateAdjustmentSlower );
1106 SetCounter( tc, 407 * tc->base.tc_frequency );
1107 CallTimecounterTick();
1108 _Timecounter_Set_NTP_update_second( NULL );
1109
1110 SetCounter( tc, 408 * tc->base.tc_frequency );
1111 rtems_clock_get_realtime_bintime( &bt );
1112 T_eq_i64( bt.sec, 567994011 );
1113 T_eq_u64( bt.frac, 92353004044288 );
1114 }
1115
1116
1117
1118
1119 T_TEST_CASE( ScoreTimecounterValInstall )
1120 {
1121 ScoreTimecounterValInstall_Action_0();
1122 ScoreTimecounterValInstall_Action_1();
1123 ScoreTimecounterValInstall_Action_2();
1124 ScoreTimecounterValInstall_Action_3();
1125 ScoreTimecounterValInstall_Action_4();
1126 ScoreTimecounterValInstall_Action_5();
1127 ScoreTimecounterValInstall_Action_6();
1128 ScoreTimecounterValInstall_Action_7();
1129 ScoreTimecounterValInstall_Action_8();
1130 ScoreTimecounterValInstall_Action_9();
1131 }
1132
1133