1 | /*
|
---|
2 | * TOPPERS Software
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
4 | *
|
---|
5 | * Copyright (C) 2014-2015 by Embedded and Real-Time Systems Laboratory
|
---|
6 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
7 | *
|
---|
8 | * ä¸è¨èä½æ¨©è
|
---|
9 | ã¯ï¼ä»¥ä¸ã®(1)ã(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
10 | * ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹
|
---|
11 | * å¤ã»åé
|
---|
12 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
13 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
14 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
15 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
16 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
17 | * ç¨ã§ããå½¢ã§åé
|
---|
18 | å¸ããå ´åã«ã¯ï¼åé
|
---|
19 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
20 | * è
|
---|
21 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
22 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
23 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
24 | * ç¨ã§ããªãå½¢ã§åé
|
---|
25 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
26 | * ã¨ï¼
|
---|
27 | * (a) åé
|
---|
28 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
29 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
30 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
31 | * (b) åé
|
---|
32 | å¸ã®å½¢æ
|
---|
33 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
34 | * å ±åãããã¨ï¼
|
---|
35 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
36 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
37 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
38 | 責ãããã¨ï¼
|
---|
39 | * ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
|
---|
40 | * ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
41 | ããã³TOPPERSããã¸ã§ã¯ãã
|
---|
42 | * å
|
---|
43 | 責ãããã¨ï¼
|
---|
44 | *
|
---|
45 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
46 | ã
|
---|
47 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
|
---|
48 | * ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
|
---|
49 | * ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ã
|
---|
50 | * ã®è²¬ä»»ãè² ããªãï¼
|
---|
51 | *
|
---|
52 | * $Id: hrt_drift1.c 314 2015-02-08 14:54:01Z ertl-hiro $
|
---|
53 | */
|
---|
54 |
|
---|
55 | /*
|
---|
56 | * ããªãã調æ´æ©è½ã®ãã¹ã(1)
|
---|
57 | *
|
---|
58 | * ããã¹ãã®ç®çã
|
---|
59 | *
|
---|
60 | * ããªãã調æ´æ©è½ã網ç¾
|
---|
61 | çã«ãã¹ãããï¼å
|
---|
62 | ·ä½çã«ã¯ï¼ããªãã調æ´æ©è½
|
---|
63 | * ã追å ãããã¨ã§è¿½å ã»æ¡å¼µãããé¢æ°ãä¸å¿ã«ãã¹ãããï¼
|
---|
64 | *
|
---|
65 | * ããã¹ãé
|
---|
66 | ç®ã
|
---|
67 | *
|
---|
68 | * (A) set_timã®è¦æ±ãã¼ã¹ãã¹ã
|
---|
69 | * (A-1) CPUããã¯ç¶æ
|
---|
70 | ããã®å¼åºãï¼»NGKI3598ï¼½
|
---|
71 | * (A-2) driftãTMIN_DRIFTããå°ããï¼»NGKI3599ï¼½
|
---|
72 | * (A-3) driftãTMAX_DRIFTãã大ããï¼»NGKI3599ï¼½
|
---|
73 | * (A-4) ããªããéãdriftã§æå®ããå¤ã«è¨å®ãããï¼»NGKI3601ï¼½
|
---|
74 | * (B) update_current_evttim
|
---|
75 | * (B-1) ããªããéãæ£ã§ç«¯æ°ã®ç¹°ãä¸ããããªãæ
|
---|
76 | * (B-2) ããªããéãæ£ã§ç«¯æ°ã®ç¹°ãä¸ãããããæ
|
---|
77 | * (B-3) ããªããéãè² ã§ç«¯æ°ã®ç¹°ãä¸ããããªãæ
|
---|
78 | * (B-4) ããªããéãè² ã§ç«¯æ°ã®ç¹°ãä¸ãããããæ
|
---|
79 | * â» (current_evttim_frac >= 2000000U)ã®ãã¹ã¯åä½ã§ãã¹ãããã
|
---|
80 | * (C) calc_current_evttim_ubï¼tmevtb_enqueueããã®å¼ã³åºãï¼
|
---|
81 | * (C-1) ããªããéãæ£ã§ç«¯æ°ã®ç¹°ãä¸ããããªãæ
|
---|
82 | * (C-2) ããªããéãæ£ã§ç«¯æ°ã®ç¹°ãä¸ãããããæ
|
---|
83 | * (C-3) ããªããéãè² ã§ç«¯æ°ã®ç¹°ãä¸ããããªãæ
|
---|
84 | * (C-4) ããªããéãè² ã§ç«¯æ°ã®ç¹°ãä¸ãããããæ
|
---|
85 | * (D) calc_current_evttim_ubï¼tmevt_lefttimããã®å¼ã³åºãï¼
|
---|
86 | * (D-1) ããªããéãæ£ã§ç«¯æ°ã®ç¹°ãä¸ããããªãæ
|
---|
87 | * (D-2) ããªããéãæ£ã§ç«¯æ°ã®ç¹°ãä¸ãããããæ
|
---|
88 | * (D-3) ããªããéãè² ã§ç«¯æ°ã®ç¹°ãä¸ããããªãæ
|
---|
89 | * (D-4) ããªããéãè² ã§ç«¯æ°ã®ç¹°ãä¸ãããããæ
|
---|
90 | * (E) set_hrt_event
|
---|
91 | * (E-1) ããªããéãæ£ã§ã¿ã¤ã ã¤ãã³ããã¼ãã空ã®æ
|
---|
92 | * (E-2) ããªããéãæ£ã§hrtcntãHRTCNT_BOUNDãè¶
|
---|
93 | ããæ ⦠å¥ã«ãã¹ã
|
---|
94 | * (E-3) ããªããéãæ£ã§hrtcntãHRTCNT_BOUNDãè¶
|
---|
95 | ããªãæ
|
---|
96 | * (E-4) ããªããéãè² ã§ã¿ã¤ã ã¤ãã³ããã¼ãã空ã®æ
|
---|
97 | * (E-5) ããªããéãè² ã§hrtcntãHRTCNT_BOUNDãè¶
|
---|
98 | ããæ ⦠å¥ã«ãã¹ã
|
---|
99 | * (E-6) ããªããéãè² ã§hrtcntãHRTCNT_BOUNDãè¶
|
---|
100 | ããªãæ
|
---|
101 | * â» (c1 > HRTCNT_BOUND / 1000000U)ã®ãã¹ã¯åä½ã§ãã¹ãããã
|
---|
102 | *
|
---|
103 | * ã使ç¨ãªã½ã¼ã¹ã
|
---|
104 | *
|
---|
105 | * é«å解è½ã¿ã¤ãã¢ã¸ã¥ã¼ã«ã®æ§è³ªï¼HRT_CONFIG1
|
---|
106 | * TCYC_HRTCNT æªå®ç¾©ï¼2^32ã®æå³ï¼
|
---|
107 | * TSTEP_HRTCNT 1U
|
---|
108 | * HRTCNT_BOUND 4000000002U
|
---|
109 | *
|
---|
110 | * TASK1: ä¸åªå
|
---|
111 | 度ã¿ã¹ã¯ï¼ã¡ã¤ã³ã¿ã¹ã¯ï¼æåããèµ·å
|
---|
112 | * ALM1: ã¢ã©ã¼ã ãã³ãã©
|
---|
113 | *
|
---|
114 | * ãè£è¶³èª¬æã
|
---|
115 | *
|
---|
116 | * 以ä¸ã®ãã¹ãã·ã¼ã±ã³ã¹ã®ã³ã¡ã³ãä¸ã§ï¼ãçºçï¼xxxãã¨ã¯ï¼é«å解è½ã¿
|
---|
117 | * ã¤ãã®ã«ã¦ã³ãå¤ãxxxã«ãªã£ãæã«ã¿ã¤ã ã¤ãã³ããçºçãããã¨ãæå³
|
---|
118 | * ããï¼ã¿ã¤ã ã¤ãã³ãã®ã¤ãã³ãçºçæå»ã§ã¯ãªãï¼
|
---|
119 | *
|
---|
120 | * ããã¹ãã·ã¼ã±ã³ã¹ã
|
---|
121 | *
|
---|
122 | * == START ==
|
---|
123 | * // ã«ã¼ãã«èµ·åï¼é«å解è½ã¿ã¤ãã®ã«ã¦ã³ãå¤ã¨ã¤ãã³ãæå»ã¯10ããã
|
---|
124 | * 1: [target_hrt_get_current -> 10U]
|
---|
125 | * 2: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
126 | * == TASK1ï¼åªå
|
---|
127 | 度ï¼ä¸ï¼==
|
---|
128 | * // ããªããéã+1%ã«è¨å®
|
---|
129 | * // ç¾æç¹ï¼hrtcntï¼20ï¼evttimï¼10ï¼evttim_fracï¼0
|
---|
130 | * 3: set_dft(+10000)
|
---|
131 | * 4: [target_hrt_get_current -> 20U]
|
---|
132 | * 5: [target_hrt_set_event <- HRTCNT_EMPTY_P1P] ... (E-1)
|
---|
133 | * // ã¿ã¤ã ã¤ãã³ããç»é²
|
---|
134 | * 6: sta_alm(ALM1, 100) ... (C-2)
|
---|
135 | * 7: [target_hrt_get_current -> 30U]
|
---|
136 | * // ç¾æç¹ï¼hrtcntï¼30ï¼evttimï¼20ï¼evttim_fracï¼100000
|
---|
137 | * // 大ããæ¹ã«ä¸¸ãã ï¼ evttimï¼21ï¼evttim_fracï¼110000
|
---|
138 | * // ç¸å¯¾æéï¼100ï¼ã¤ãã³ãçºçæå»ï¼122
|
---|
139 | * // ã«ã¦ã³ãå¤ï¼(101900000 / 1010000)ã®åãä¸ã â 101
|
---|
140 | * 8: [target_hrt_set_event <- 101U] ... (E-3)
|
---|
141 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
142 | * // ããªãã調æ´ãå¹ãç´å
|
---|
143 | * 9: get_tim(&systim) ... (B-1)
|
---|
144 | * 10: [target_hrt_get_current -> 119U]
|
---|
145 | * // ç¾æç¹ï¼hrtcntï¼119ï¼evttimï¼109ï¼evttim_fracï¼990000
|
---|
146 | * 11: assert(systim == 109U)
|
---|
147 | * // ããã§ããªãã調æ´ãå¹ãï¼ã·ã¹ãã æå»ã2é²ãï¼
|
---|
148 | * 12: get_tim(&systim) ... (B-2)
|
---|
149 | * 13: [target_hrt_get_current -> 120U]
|
---|
150 | * // ç¾æç¹ï¼hrtcntï¼120ï¼evttimï¼111ï¼evttim_fracï¼0
|
---|
151 | * 14: assert(systim == 111U)
|
---|
152 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
153 | * 15: DO(target_raise_hrt_int(0U))
|
---|
154 | * == HRT_HANDLER ==
|
---|
155 | * 16: [target_hrt_get_current -> 131U] // ALM1ãçºç
|
---|
156 | * // ç¾æç¹ï¼hrtcntï¼131ï¼evttimï¼122ï¼evttim_fracï¼110000
|
---|
157 | * == ALM1-1ï¼1åç®ï¼==
|
---|
158 | * 17: RETURN
|
---|
159 | * // ã¿ã¤ã ã¤ãã³ãããªããªã£ãå ´å
|
---|
160 | * 18: [target_hrt_get_current -> 140U]
|
---|
161 | * 19: [target_hrt_set_event <- HRTCNT_EMPTY_P1P]
|
---|
162 | * == TASK1ï¼ç¶ãï¼==
|
---|
163 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
164 | * // ããªãã調æ´ãå¹ãç´å
|
---|
165 | * 20: get_tim(&systim) ... (B-1)
|
---|
166 | * 21: [target_hrt_get_current -> 219U]
|
---|
167 | * // ç¾æç¹ï¼hrtcntï¼219ï¼evttimï¼210ï¼evttim_fracï¼990000
|
---|
168 | * 22: assert(systim == 210U)
|
---|
169 | * // ã¿ã¤ã ã¤ãã³ããç»é²
|
---|
170 | * 23: sta_alm(ALM1, 100U) ... (C-1)
|
---|
171 | * 24: [target_hrt_get_current -> 219U]
|
---|
172 | * // ç¾æç¹ï¼hrtcntï¼219ï¼evttimï¼210ï¼evttim_fracï¼990000
|
---|
173 | * // 大ããæ¹ã«ä¸¸ãã ï¼ evttimï¼212ï¼evttim_fracï¼0
|
---|
174 | * // ç¸å¯¾æéï¼100ï¼ã¤ãã³ãçºçæå»ï¼312
|
---|
175 | * // ã«ã¦ã³ãå¤ï¼(101010000 / 1010000)ã®åãä¸ã â 101
|
---|
176 | * 25: [target_hrt_set_event <- 101U]
|
---|
177 | * // ããã§ããªãã調æ´ãå¹ã
|
---|
178 | * 26: get_tim(&systim) ... (B-2)
|
---|
179 | * 27: [target_hrt_get_current -> 220U]
|
---|
180 | * // ç¾æç¹ï¼hrtcntï¼220ï¼evttimï¼212ï¼evttim_fracï¼0
|
---|
181 | * 28: assert(systim == 212U)
|
---|
182 | *
|
---|
183 | * // ããªããéã-1%ã«è¨å®ï¼ç«¯æ°ã0ã«ãªãã¿ã¤ãã³ã°ã§è¨å®ï¼
|
---|
184 | * 29: set_dft(-10000)
|
---|
185 | * 30: [target_hrt_get_current -> 220U]
|
---|
186 | * // ç¾æç¹ï¼hrtcntï¼220ï¼evttimï¼212ï¼evttim_fracï¼0
|
---|
187 | * // ã«ã¦ã³ãå¤ï¼(100000000 / 990000)ã®åãä¸ã â 102
|
---|
188 | * 31: [target_hrt_set_event <- 102U] ... (E-6)
|
---|
189 | * // ããªãã調æ´ãããã«å¹ã
|
---|
190 | * 32: get_tim(&systim) ... (B-3)
|
---|
191 | * 33: [target_hrt_get_current -> 221U]
|
---|
192 | * // ç¾æç¹ï¼hrtcntï¼221ï¼evttimï¼212ï¼evttim_fracï¼990000
|
---|
193 | * 34: assert(systim == 212U)
|
---|
194 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
195 | * // ããªãã調æ´ã次ã«å¹ãç´å
|
---|
196 | * 35: get_tim(&systim)
|
---|
197 | * 36: [target_hrt_get_current -> 320U] ... (B-4)
|
---|
198 | * // ç¾æç¹ï¼hrtcntï¼320ï¼evttimï¼311ï¼evttim_fracï¼0
|
---|
199 | * 37: assert(systim == 311U)
|
---|
200 | * // ããã§ããªãã調æ´ãå¹ã
|
---|
201 | * 38: get_tim(&systim)
|
---|
202 | * 39: [target_hrt_get_current -> 321U] ... (B-3)
|
---|
203 | * // ç¾æç¹ï¼hrtcntï¼321ï¼evttimï¼311ï¼evttim_fracï¼990000
|
---|
204 | * 40: assert(systim == 311U)
|
---|
205 | * 41: DO(target_raise_hrt_int(0U))
|
---|
206 | * == HRT_HANDLER ==
|
---|
207 | * 42: [target_hrt_get_current -> 322U] // ALM1ãçºç
|
---|
208 | * // ç¾æç¹ï¼hrtcntï¼322ï¼evttimï¼312ï¼evttim_fracï¼980000
|
---|
209 | * == ALM1-2ï¼2åç®ï¼==
|
---|
210 | * 43: RETURN
|
---|
211 | * // ã¿ã¤ã ã¤ãã³ãããªããªã£ãå ´å
|
---|
212 | * 44: [target_hrt_get_current -> 330U]
|
---|
213 | * // ç¾æç¹ï¼hrtcntï¼330ï¼evttimï¼320ï¼evttim_fracï¼900000
|
---|
214 | * 45: [target_hrt_set_event <- HRTCNT_EMPTY_M1P] ... (E-4)
|
---|
215 | * == TASK1ï¼ç¶ãï¼==
|
---|
216 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
217 | *
|
---|
218 | * // ããªããéã+1%ã«è¨å®ï¼ç«¯æ°ã0.5ã«ãªãã¿ã¤ãã³ã°ã§è¨å®ï¼
|
---|
219 | * 46: set_dft(+10000)
|
---|
220 | * 47: [target_hrt_get_current -> 370U]
|
---|
221 | * // ç¾æç¹ï¼hrtcntï¼370ï¼evttimï¼360ï¼evttim_fracï¼500000
|
---|
222 | * 48: [target_hrt_set_event <- HRTCNT_EMPTY_P1P]
|
---|
223 | * 49: get_tim(&systim)
|
---|
224 | * 50: [target_hrt_get_current -> 370U]
|
---|
225 | * // ç¾æç¹ï¼hrtcntï¼370ï¼evttimï¼360ï¼evttim_fracï¼500000
|
---|
226 | * 51: assert(systim == 360U)
|
---|
227 | * // ããªãã調æ´ãå¹ãç´å
|
---|
228 | * 52: get_tim(&systim)
|
---|
229 | * 53: [target_hrt_get_current -> 419U]
|
---|
230 | * // ç¾æç¹ï¼hrtcntï¼419ï¼evttimï¼409ï¼evttim_fracï¼990000
|
---|
231 | * 54: assert(systim == 409U)
|
---|
232 | * // ããã§ããªãã調æ´ãå¹ã
|
---|
233 | * 55: get_tim(&systim)
|
---|
234 | * 56: [target_hrt_get_current -> 420U]
|
---|
235 | * // ç¾æç¹ï¼hrtcntï¼420ï¼evttimï¼411ï¼evttim_fracï¼0
|
---|
236 | * 57: assert(systim == 411U)
|
---|
237 | * 58: END
|
---|
238 | */
|
---|
239 |
|
---|
240 | #include <kernel.h>
|
---|
241 | #include <t_syslog.h>
|
---|
242 | #include "syssvc/test_svc.h"
|
---|
243 | #include "kernel_cfg.h"
|
---|
244 | #include "hrt_drift1.h"
|
---|
245 | #include "target_timer.h"
|
---|
246 |
|
---|
247 | #if !defined(HRT_CONFIG1) || defined(HRT_CONFIG2)
|
---|
248 | #error Compiler option "-DHRT_CONFIG1" is missing.
|
---|
249 | #endif
|
---|
250 |
|
---|
251 | #define HRTCNT_EMPTY 4000000000U
|
---|
252 | #define HRTCNT_EMPTY_P1P 3960396040U
|
---|
253 | #define HRTCNT_EMPTY_M1P HRTCNT_BOUND
|
---|
254 |
|
---|
255 | #define target_hrt_get_current _kernel_target_hrt_get_current
|
---|
256 | #define target_hrt_set_event _kernel_target_hrt_set_event
|
---|
257 | #define target_hrt_raise_event _kernel_target_hrt_raise_event
|
---|
258 |
|
---|
259 | void
|
---|
260 | target_hrt_raise_event(void)
|
---|
261 | {
|
---|
262 | }
|
---|
263 |
|
---|
264 | /* DO NOT DELETE THIS LINE -- gentest depends on it. */
|
---|
265 |
|
---|
266 | static uint_t alarm1_count = 0;
|
---|
267 |
|
---|
268 | void
|
---|
269 | alarm1_handler(intptr_t exinf)
|
---|
270 | {
|
---|
271 |
|
---|
272 | switch (++alarm1_count) {
|
---|
273 | case 1:
|
---|
274 | check_point(17);
|
---|
275 | return;
|
---|
276 |
|
---|
277 | check_point(0);
|
---|
278 |
|
---|
279 | case 2:
|
---|
280 | check_point(43);
|
---|
281 | return;
|
---|
282 |
|
---|
283 | check_point(0);
|
---|
284 |
|
---|
285 | default:
|
---|
286 | check_point(0);
|
---|
287 | }
|
---|
288 | check_point(0);
|
---|
289 | }
|
---|
290 |
|
---|
291 | void
|
---|
292 | task1(intptr_t exinf)
|
---|
293 | {
|
---|
294 | ER_UINT ercd;
|
---|
295 | SYSTIM systim;
|
---|
296 |
|
---|
297 | check_point(3);
|
---|
298 | ercd = set_dft(+10000);
|
---|
299 | check_ercd(ercd, E_OK);
|
---|
300 |
|
---|
301 | check_point(6);
|
---|
302 | ercd = sta_alm(ALM1, 100);
|
---|
303 | check_ercd(ercd, E_OK);
|
---|
304 |
|
---|
305 | check_point(9);
|
---|
306 | ercd = get_tim(&systim);
|
---|
307 | check_ercd(ercd, E_OK);
|
---|
308 |
|
---|
309 | check_point(11);
|
---|
310 | check_assert(systim == 109U);
|
---|
311 |
|
---|
312 | check_point(12);
|
---|
313 | ercd = get_tim(&systim);
|
---|
314 | check_ercd(ercd, E_OK);
|
---|
315 |
|
---|
316 | check_point(14);
|
---|
317 | check_assert(systim == 111U);
|
---|
318 |
|
---|
319 | check_point(15);
|
---|
320 | target_raise_hrt_int(0U);
|
---|
321 |
|
---|
322 | check_point(20);
|
---|
323 | ercd = get_tim(&systim);
|
---|
324 | check_ercd(ercd, E_OK);
|
---|
325 |
|
---|
326 | check_point(22);
|
---|
327 | check_assert(systim == 210U);
|
---|
328 |
|
---|
329 | check_point(23);
|
---|
330 | ercd = sta_alm(ALM1, 100U);
|
---|
331 | check_ercd(ercd, E_OK);
|
---|
332 |
|
---|
333 | check_point(26);
|
---|
334 | ercd = get_tim(&systim);
|
---|
335 | check_ercd(ercd, E_OK);
|
---|
336 |
|
---|
337 | check_point(28);
|
---|
338 | check_assert(systim == 212U);
|
---|
339 |
|
---|
340 | check_point(29);
|
---|
341 | ercd = set_dft(-10000);
|
---|
342 | check_ercd(ercd, E_OK);
|
---|
343 |
|
---|
344 | check_point(32);
|
---|
345 | ercd = get_tim(&systim);
|
---|
346 | check_ercd(ercd, E_OK);
|
---|
347 |
|
---|
348 | check_point(34);
|
---|
349 | check_assert(systim == 212U);
|
---|
350 |
|
---|
351 | check_point(35);
|
---|
352 | ercd = get_tim(&systim);
|
---|
353 | check_ercd(ercd, E_OK);
|
---|
354 |
|
---|
355 | check_point(37);
|
---|
356 | check_assert(systim == 311U);
|
---|
357 |
|
---|
358 | check_point(38);
|
---|
359 | ercd = get_tim(&systim);
|
---|
360 | check_ercd(ercd, E_OK);
|
---|
361 |
|
---|
362 | check_point(40);
|
---|
363 | check_assert(systim == 311U);
|
---|
364 |
|
---|
365 | check_point(41);
|
---|
366 | target_raise_hrt_int(0U);
|
---|
367 |
|
---|
368 | check_point(46);
|
---|
369 | ercd = set_dft(+10000);
|
---|
370 | check_ercd(ercd, E_OK);
|
---|
371 |
|
---|
372 | check_point(49);
|
---|
373 | ercd = get_tim(&systim);
|
---|
374 | check_ercd(ercd, E_OK);
|
---|
375 |
|
---|
376 | check_point(51);
|
---|
377 | check_assert(systim == 360U);
|
---|
378 |
|
---|
379 | check_point(52);
|
---|
380 | ercd = get_tim(&systim);
|
---|
381 | check_ercd(ercd, E_OK);
|
---|
382 |
|
---|
383 | check_point(54);
|
---|
384 | check_assert(systim == 409U);
|
---|
385 |
|
---|
386 | check_point(55);
|
---|
387 | ercd = get_tim(&systim);
|
---|
388 | check_ercd(ercd, E_OK);
|
---|
389 |
|
---|
390 | check_point(57);
|
---|
391 | check_assert(systim == 411U);
|
---|
392 |
|
---|
393 | check_finish(58);
|
---|
394 | check_point(0);
|
---|
395 | }
|
---|
396 |
|
---|
397 | static uint_t target_hrt_get_current_count = 0;
|
---|
398 |
|
---|
399 | HRTCNT
|
---|
400 | target_hrt_get_current(void)
|
---|
401 | {
|
---|
402 |
|
---|
403 | switch (++target_hrt_get_current_count) {
|
---|
404 | case 1:
|
---|
405 | test_start(__FILE__);
|
---|
406 |
|
---|
407 | check_point(1);
|
---|
408 | return(10U);
|
---|
409 |
|
---|
410 | check_point(0);
|
---|
411 |
|
---|
412 | case 2:
|
---|
413 | check_point(4);
|
---|
414 | return(20U);
|
---|
415 |
|
---|
416 | check_point(0);
|
---|
417 |
|
---|
418 | case 3:
|
---|
419 | check_point(7);
|
---|
420 | return(30U);
|
---|
421 |
|
---|
422 | check_point(0);
|
---|
423 |
|
---|
424 | case 4:
|
---|
425 | check_point(10);
|
---|
426 | return(119U);
|
---|
427 |
|
---|
428 | check_point(0);
|
---|
429 |
|
---|
430 | case 5:
|
---|
431 | check_point(13);
|
---|
432 | return(120U);
|
---|
433 |
|
---|
434 | check_point(0);
|
---|
435 |
|
---|
436 | case 6:
|
---|
437 | check_point(16);
|
---|
438 | return(131U);
|
---|
439 |
|
---|
440 | check_point(0);
|
---|
441 |
|
---|
442 | case 7:
|
---|
443 | check_point(18);
|
---|
444 | return(140U);
|
---|
445 |
|
---|
446 | check_point(0);
|
---|
447 |
|
---|
448 | case 8:
|
---|
449 | check_point(21);
|
---|
450 | return(219U);
|
---|
451 |
|
---|
452 | check_point(0);
|
---|
453 |
|
---|
454 | case 9:
|
---|
455 | check_point(24);
|
---|
456 | return(219U);
|
---|
457 |
|
---|
458 | check_point(0);
|
---|
459 |
|
---|
460 | case 10:
|
---|
461 | check_point(27);
|
---|
462 | return(220U);
|
---|
463 |
|
---|
464 | check_point(0);
|
---|
465 |
|
---|
466 | case 11:
|
---|
467 | check_point(30);
|
---|
468 | return(220U);
|
---|
469 |
|
---|
470 | check_point(0);
|
---|
471 |
|
---|
472 | case 12:
|
---|
473 | check_point(33);
|
---|
474 | return(221U);
|
---|
475 |
|
---|
476 | check_point(0);
|
---|
477 |
|
---|
478 | case 13:
|
---|
479 | check_point(36);
|
---|
480 | return(320U);
|
---|
481 |
|
---|
482 | check_point(0);
|
---|
483 |
|
---|
484 | case 14:
|
---|
485 | check_point(39);
|
---|
486 | return(321U);
|
---|
487 |
|
---|
488 | check_point(0);
|
---|
489 |
|
---|
490 | case 15:
|
---|
491 | check_point(42);
|
---|
492 | return(322U);
|
---|
493 |
|
---|
494 | check_point(0);
|
---|
495 |
|
---|
496 | case 16:
|
---|
497 | check_point(44);
|
---|
498 | return(330U);
|
---|
499 |
|
---|
500 | check_point(0);
|
---|
501 |
|
---|
502 | case 17:
|
---|
503 | check_point(47);
|
---|
504 | return(370U);
|
---|
505 |
|
---|
506 | check_point(0);
|
---|
507 |
|
---|
508 | case 18:
|
---|
509 | check_point(50);
|
---|
510 | return(370U);
|
---|
511 |
|
---|
512 | check_point(0);
|
---|
513 |
|
---|
514 | case 19:
|
---|
515 | check_point(53);
|
---|
516 | return(419U);
|
---|
517 |
|
---|
518 | check_point(0);
|
---|
519 |
|
---|
520 | case 20:
|
---|
521 | check_point(56);
|
---|
522 | return(420U);
|
---|
523 |
|
---|
524 | check_point(0);
|
---|
525 |
|
---|
526 | default:
|
---|
527 | check_point(0);
|
---|
528 | }
|
---|
529 | check_point(0);
|
---|
530 | return(0U);
|
---|
531 | }
|
---|
532 |
|
---|
533 | static uint_t target_hrt_set_event_count = 0;
|
---|
534 |
|
---|
535 | void
|
---|
536 | target_hrt_set_event(HRTCNT hrtcnt)
|
---|
537 | {
|
---|
538 |
|
---|
539 | switch (++target_hrt_set_event_count) {
|
---|
540 | case 1:
|
---|
541 | check_point(2);
|
---|
542 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
543 |
|
---|
544 | return;
|
---|
545 |
|
---|
546 | check_point(0);
|
---|
547 |
|
---|
548 | case 2:
|
---|
549 | check_point(5);
|
---|
550 | check_assert(hrtcnt == HRTCNT_EMPTY_P1P);
|
---|
551 |
|
---|
552 | return;
|
---|
553 |
|
---|
554 | check_point(0);
|
---|
555 |
|
---|
556 | case 3:
|
---|
557 | check_point(8);
|
---|
558 | check_assert(hrtcnt == 101U);
|
---|
559 |
|
---|
560 | return;
|
---|
561 |
|
---|
562 | check_point(0);
|
---|
563 |
|
---|
564 | case 4:
|
---|
565 | check_point(19);
|
---|
566 | check_assert(hrtcnt == HRTCNT_EMPTY_P1P);
|
---|
567 |
|
---|
568 | return;
|
---|
569 |
|
---|
570 | check_point(0);
|
---|
571 |
|
---|
572 | case 5:
|
---|
573 | check_point(25);
|
---|
574 | check_assert(hrtcnt == 101U);
|
---|
575 |
|
---|
576 | return;
|
---|
577 |
|
---|
578 | check_point(0);
|
---|
579 |
|
---|
580 | case 6:
|
---|
581 | check_point(31);
|
---|
582 | check_assert(hrtcnt == 102U);
|
---|
583 |
|
---|
584 | return;
|
---|
585 |
|
---|
586 | check_point(0);
|
---|
587 |
|
---|
588 | case 7:
|
---|
589 | check_point(45);
|
---|
590 | check_assert(hrtcnt == HRTCNT_EMPTY_M1P);
|
---|
591 |
|
---|
592 | return;
|
---|
593 |
|
---|
594 | check_point(0);
|
---|
595 |
|
---|
596 | case 8:
|
---|
597 | check_point(48);
|
---|
598 | check_assert(hrtcnt == HRTCNT_EMPTY_P1P);
|
---|
599 |
|
---|
600 | return;
|
---|
601 |
|
---|
602 | check_point(0);
|
---|
603 |
|
---|
604 | default:
|
---|
605 | check_point(0);
|
---|
606 | }
|
---|
607 | check_point(0);
|
---|
608 | }
|
---|