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_systim2.c 310 2015-02-08 13:46:46Z ertl-hiro $
|
---|
53 | */
|
---|
54 |
|
---|
55 | /*
|
---|
56 | * ã·ã¹ãã æå»ç®¡çæ©è½ã®ãã¹ã(2)
|
---|
57 | *
|
---|
58 | * ããã¹ãã®ç®çã
|
---|
59 | *
|
---|
60 | * ã·ã¹ãã æå»ç®¡çæ©è½ã®æ¨æºã®ãµã¼ãã¹ã³ã¼ã«ï¼set_timï¼get_timï¼
|
---|
61 | * adj_timï¼ãï¼è¦æ±ãã¼ã¹ã§ãã¹ãããï¼
|
---|
62 | *
|
---|
63 | * ãã¹ã対象ã®ãµã¼ãã¹ã³ã¼ã«å¦çé¢æ°ããã³ããããå¼ã³åºããã以ä¸ã®
|
---|
64 | * é¢æ°ã®C1ã«ãã¬ãã¸ãéæããï¼
|
---|
65 | * set_tim ⦠é¢æ°å
|
---|
66 | ã«åå²ããªã
|
---|
67 | * get_tim ⦠é¢æ°å
|
---|
68 | ã«åå²ããªã
|
---|
69 | * adj_tim
|
---|
70 | * check_adjtim
|
---|
71 | * update_current_evttimï¼TCYC_HRTCNTãå®ç¾©ããã¦ããªãå ´åï¼
|
---|
72 | *
|
---|
73 | * ããã¹ãé
|
---|
74 | ç®ã
|
---|
75 | *
|
---|
76 | * (A) set_timã®è¦æ±ãã¼ã¹ãã¹ã
|
---|
77 | * (A-1) éã¿ã¹ã¯ã³ã³ããã¹ãããã®å¼åºãï¼»NGKI3564ï¼½
|
---|
78 | * (A-2) CPUããã¯ç¶æ
|
---|
79 | ããã®å¼åºãï¼»NGKI3565ï¼½
|
---|
80 | * (A-3) ã·ã¹ãã æå»ã®ç¾å¨å¤ãæ£ããè¨å®ããããã¨ï¼»NGKI3567ï¼½
|
---|
81 | * (B) get_timã®è¦æ±ãã¼ã¹ãã¹ã
|
---|
82 | * (B-1) éã¿ã¹ã¯ã³ã³ããã¹ãããã®å¼åºãï¼»NGKI2350ï¼½
|
---|
83 | * (B-2) CPUããã¯ç¶æ
|
---|
84 | ããã®å¼åºãï¼»NGKI2351ï¼½
|
---|
85 | * (B-3) ã·ã¹ãã æå»ã®ç¾å¨å¤ãæ£ããåç
|
---|
86 | §ããããã¨ï¼»NGKI2354ï¼½
|
---|
87 | * (B-4) adj_timã«ãã£ã¦ã·ã¹ãã æå»ãæ»ããå ´åï¼ã·ã¹ãã æå»ãæã
|
---|
88 | * é²ãã§ããæã®ã·ã¹ãã æå»ãè¿ããã¨ï¼»NGKI3591ï¼½
|
---|
89 | * (B-5) åç
|
---|
90 | §ããã·ã¹ãã æå»ã®é²ã¿ãæ¢ã¾ã£ã¦ããéã«ï¼set_timã«ã
|
---|
91 | * ãã·ã¹ãã æå»ãè¨å®ããå ´åã§ãï¼åç
|
---|
92 | §ããã·ã¹ãã æå»ã®é²
|
---|
93 | * ã¿ãæ¢ã¾ã£ã¦ããæéã¯å¤åããªããã¨ï¼»NGKI3592ï¼½
|
---|
94 | * (C) adj_timã®è¦æ±ãã¼ã¹ãã¹ã
|
---|
95 | * (C-1) CPUããã¯ç¶æ
|
---|
96 | ããã®å¼åºãï¼»NGKI3583ï¼½
|
---|
97 | * (C-2) adjtimãå°ããããï¼»NGKI3584ï¼½
|
---|
98 | * (C-3) adjtimã大ããããï¼»NGKI3584ï¼½
|
---|
99 | * (C-4) ã·ã¹ãã æå»ã«adjtimãå ãããããã¨ï¼»NGKI3586ï¼½
|
---|
100 | * (C-5) ã·ã¹ãã æå»ã®çµéããã£ããã«çºçããã¿ã¤ã ã¤ãã³ããçºç
|
---|
101 | * ããã¾ã§ã®ç¸å¯¾æéã調æ´ããããã¨ï¼»NGKI3587ï¼½
|
---|
102 | * (C-6) (adj_tim > 0)ã§ï¼1ç§ä»¥ä¸éå»ã®çºçæå»ãæã¤ã¿ã¤ã ã¤ãã³ã
|
---|
103 | * ãæ®ã£ã¦ããå ´åã«ï¼E_OBJã¨ã©ã¼ã¨ãªããã¨ï¼»NGKI3588ï¼½
|
---|
104 | * (C-7) (adj_tim < 0)ã§ï¼ç¾å¨ã®ã·ã¹ãã æå»ãï¼ã·ã¹ãã æå»ãæãé²
|
---|
105 | * ãã§ããæã®ã·ã¹ãã æå»ãã1ç§ä»¥ä¸æ»ã£ã¦ããå ´åã«ï¼E_OBJ
|
---|
106 | * ã¨ã©ã¼ã¨ãªããã¨ï¼»NGKI3589ï¼½
|
---|
107 | * (C-8) éã¿ã¹ã¯ã³ã³ããã¹ãããã®å¼åºãã§ï¼ã·ã¹ãã æå»ã«adjtimã
|
---|
108 | * å ãããããã¨
|
---|
109 | * (D) adj_timã®å®è¡/åå²ãã¹ã®ç¶²ç¾
|
---|
110 |
|
---|
111 | * (D-1) (adjtim <= 0)ã®å ´å
|
---|
112 | * (D-2) (adjtim > 0)ã§ï¼æãé²ãã§ããæã®ã¤ãã³ãæå»ã®æ´æ°ãå¿
|
---|
113 | è¦
|
---|
114 | * ãªãå ´å
|
---|
115 | * (D-3) (adjtim > 0)ã§ï¼æãé²ãã§ããæã®ã¤ãã³ãæå»ã®æ´æ°ãå¿
|
---|
116 | è¦
|
---|
117 | * ã§ï¼ã·ã¹ãã æå»ã®ãªãã»ãããé²ããå¿
|
---|
118 | è¦ããªãå ´å
|
---|
119 | * (D-4) (adjtim > 0)ã§ï¼æãé²ãã§ããæã®ã¤ãã³ãæå»ã®æ´æ°ãå¿
|
---|
120 | è¦
|
---|
121 | * ã§ï¼ã·ã¹ãã æå»ã®ãªãã»ãããé²ããå¿
|
---|
122 | è¦ãããå ´å
|
---|
123 | * (E) check_adjtimã®å®è¡/åå²ãã¹/æ»ãå¤ã®ç¶²ç¾
|
---|
124 |
|
---|
125 | * (E-1) (adjtim > 0)ã§ï¼ã¿ã¤ã ã¤ãã³ããç»é²ããã¦ããªãå ´å
|
---|
126 | * (E-2) (adjtim > 0)ã§ï¼å
|
---|
127 | é ã®ã¿ã¤ã ã¤ãã³ãã®çºçæå»ã1ç§å以éã§
|
---|
128 | * ããå ´å
|
---|
129 | * (E-3) (adjtim > 0)ã§ï¼å
|
---|
130 | é ã®ã¿ã¤ã ã¤ãã³ãã®çºçæå»ã1ç§å以åã§
|
---|
131 | * ããå ´åï¼adj_timãE_OBJã¨ã©ã¼ã¨ãªãï¼
|
---|
132 | * (E-4) (adjtim < 0)ã§ï¼ç¾å¨ã®ã·ã¹ãã æå»ãï¼ã·ã¹ãã æå»ãæãé²
|
---|
133 | * ãã§ããæã®ã·ã¹ãã æå»ãã1ç§ä»¥ä¸æ»ã£ã¦ããªãå ´å
|
---|
134 | * (E-5) (adjtim < 0)ã§ï¼ç¾å¨ã®ã·ã¹ãã æå»ãï¼ã·ã¹ãã æå»ãæãé²
|
---|
135 | * ãã§ããæã®ã·ã¹ãã æå»ãã1ç§ä»¥ä¸æ»ã£ã¦ããå ´åï¼adj_tim
|
---|
136 | * ãE_OBJã¨ã©ã¼ã¨ãªãï¼
|
---|
137 | * (E-6) (adjtim == 0)ã®å ´å
|
---|
138 | * (F) update_current_evttimã®å®è¡/åå²ãã¹ã®ç¶²ç¾
|
---|
139 |
|
---|
140 | * (F-1) æãé²ãã§ããæã®ã¤ãã³ãæå»ã®æ´æ°ãå¿
|
---|
141 | è¦ãªãå ´å
|
---|
142 | * (F-2) æãé²ãã§ããæã®ã¤ãã³ãæå»ã®æ´æ°ãå¿
|
---|
143 | è¦ã§ï¼ã·ã¹ãã æå»
|
---|
144 | * ã®ãªãã»ãããé²ããå¿
|
---|
145 | è¦ããªãå ´å
|
---|
146 | * (F-3) æãé²ãã§ããæã®ã¤ãã³ãæå»ã®æ´æ°ãå¿
|
---|
147 | è¦ã§ï¼ã·ã¹ãã æå»
|
---|
148 | * ã®ãªãã»ãããé²ããå¿
|
---|
149 | è¦ãããå ´å
|
---|
150 | *
|
---|
151 | * ã使ç¨ãªã½ã¼ã¹ã
|
---|
152 | *
|
---|
153 | * é«å解è½ã¿ã¤ãã¢ã¸ã¥ã¼ã«ã®æ§è³ªï¼HRT_CONFIG1
|
---|
154 | * TCYC_HRTCNT æªå®ç¾©ï¼2^32ã®æå³ï¼
|
---|
155 | * TSTEP_HRTCNT 1U
|
---|
156 | * HRTCNT_BOUND 4000000002U
|
---|
157 | *
|
---|
158 | * TASK1: ä¸åªå
|
---|
159 | 度ã¿ã¹ã¯ï¼ã¡ã¤ã³ã¿ã¹ã¯ï¼æåããèµ·å
|
---|
160 | * ALM1: ã¢ã©ã¼ã ãã³ãã©
|
---|
161 | * ALM2: ã¢ã©ã¼ã ãã³ãã©
|
---|
162 | * ALM3: ã¢ã©ã¼ã ãã³ãã©
|
---|
163 | *
|
---|
164 | * ãè£è¶³èª¬æã
|
---|
165 | *
|
---|
166 | * ã¿ã¤ã ã¤ãã³ããç»é²ããã¦ããªãæã«é«å解è½ã¿ã¤ãã«è¨å®ããç¸å¯¾ã¯ï¼
|
---|
167 | * ããªãã調æ´æ©è½ãæããªãå ´åã¯HRTCNT_BOUNDã§ããã®ã«å¯¾ãã¦ï¼ããª
|
---|
168 | * ãã調æ´æ©è½ãæã¤å ´åã¯TMAX_RELTIMãã¤ãã³ãæå»ã®ä¼¸ç¸®çã§å²ã£ãå¤
|
---|
169 | * ã¨HRTCNT_BOUNDã®å°ããæ¹ã®å¤ï¼ãã®ãã¹ãã§ã¯ï¼ããªããéãè¨å®ããï¼
|
---|
170 | * HRTCNT_BOUNDï¼TMAX_RELTIMã§ããããï¼TMAX_RELTIMã«ä¸è´ï¼ã¨ãªãï¼ã
|
---|
171 | * ãã§ï¼HRTCNT_EMPTYããã®å¤ã«å®ç¾©ãï¼ããªãã調æ´æ©è½ã®æç¡ã«ããã
|
---|
172 | * åããã¹ãã·ã¼ã±ã³ã¹ã使ããããã«ããï¼
|
---|
173 | *
|
---|
174 | * 以ä¸ã®ãã¹ãã·ã¼ã±ã³ã¹ã®ã³ã¡ã³ãä¸ã§ï¼ãçºçï¼xxxãã¨ã¯ï¼é«å解è½ã¿
|
---|
175 | * ã¤ãã®ã«ã¦ã³ãå¤ãxxxã«ãªã£ãæã«ã¿ã¤ã ã¤ãã³ããçºçãããã¨ãæå³
|
---|
176 | * ããï¼ã¿ã¤ã ã¤ãã³ãã®ã¤ãã³ãçºçæå»ã§ã¯ãªãï¼
|
---|
177 | *
|
---|
178 | * ããã¹ãã·ã¼ã±ã³ã¹ã
|
---|
179 | *
|
---|
180 | * == START ==
|
---|
181 | * // ã«ã¼ãã«èµ·åï¼é«å解è½ã¿ã¤ãã®ã«ã¦ã³ãå¤ã¨ã¤ãã³ãæå»ã¯10ããã
|
---|
182 | * 1: [target_hrt_get_current -> 10U]
|
---|
183 | * 2: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
184 | * == TASK1ï¼åªå
|
---|
185 | 度ï¼ä¸ï¼==
|
---|
186 | * // CPUããã¯ç¶æ
|
---|
187 | ã§åãµã¼ãã¹ã³ã¼ã«ãå¼ã³åºã
|
---|
188 | * 3: loc_cpu()
|
---|
189 | * set_tim(1000000LLU) -> E_CTX ... (A-2)
|
---|
190 | * get_tim(&systim) -> E_CTX ... (B-2)
|
---|
191 | * adj_tim(100) -> E_CTX ... (C-1)
|
---|
192 | * unl_cpu()
|
---|
193 | * // ã¾ãã¯get_timã®ä¸è¬çãªåä½ã確èª
|
---|
194 | * 4: get_tim(&systim) ... (B-3)
|
---|
195 | * 5: [target_hrt_get_current -> 40U]
|
---|
196 | * 6: assert(systim == 40U - 10U)
|
---|
197 | * // ã·ã¹ãã æå»ã32ããããè¶
|
---|
198 | ããå¤ã«è¨å®
|
---|
199 | * set_tim(2LLU << 32) ... (A-3)
|
---|
200 | * 7: [target_hrt_get_current -> 50U] ... (F-2)
|
---|
201 | * // ã·ã¹ãã æå»ãæå¾
|
---|
202 | éãã«è¨å®ããã¦ãããã¨ã確èª
|
---|
203 | * 8: get_tim(&systim) ... (B-3)
|
---|
204 | * 9: [target_hrt_get_current -> 60U]
|
---|
205 | * 10: assert(systim == (2LLU << 32) + 10U)
|
---|
206 | * 11: DO(target_raise_hrt_int(1U))
|
---|
207 | * tslp_tsk(TMAX_RELTIM) -> E_TMOUT
|
---|
208 | * 12: [target_hrt_get_current -> 70U] // TMOUTã®çºçï¼4000000071U
|
---|
209 | * 13: [target_hrt_set_event <- 4000000001U]
|
---|
210 | * // ããã§é·æéçµéãããã¨ãæ³å®
|
---|
211 | * == HRT_HANDLER ==
|
---|
212 | * 14: [target_hrt_get_current -> 4000000080U] // TMOUTãçºç
|
---|
213 | * // ããã§ã¿ã¤ã ã¢ã¦ãå¦çãè¡ããã
|
---|
214 | * 15: [target_hrt_get_current -> 4000000090U]
|
---|
215 | * 16: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
216 | * == TASK1ï¼ç¶ãï¼==
|
---|
217 | * 17: get_tim(&systim) ... (B-3)
|
---|
218 | * 18: [target_hrt_get_current -> 4000000100U]
|
---|
219 | * 19: assert(systim == (2LLU << 32) + 4000000050U)
|
---|
220 | * // ããã§æéãçµéãã¦ï¼HRTãå·¡åãããã¨ãæ³å®
|
---|
221 | * 20: get_tim(&systim) ... (B-3)
|
---|
222 | * 21: [target_hrt_get_current -> 100U] ... (F-3)
|
---|
223 | * 22: assert(systim == (3LLU << 32) + 50U)
|
---|
224 | * // adj_timã®ãã©ã¡ã¼ã¿ã¨ã©ã¼ã®ãã¹ã
|
---|
225 | * adj_tim(-1000001) -> E_PAR ... (C-2)
|
---|
226 | * adj_tim(+1000001) -> E_PAR ... (C-3)
|
---|
227 | *
|
---|
228 | * // adj_timã§ã·ã¹ãã æå»ãé²ãããã¹ã
|
---|
229 | * // ã¿ã¤ã ã¤ãã³ãã1ã¤ç»é²
|
---|
230 | * sta_alm(ALM1, 2000000U)
|
---|
231 | * 23: [target_hrt_get_current -> 120U] // ALM1ã®çºçï¼2,000,121
|
---|
232 | * 24: [target_hrt_set_event <- 2000001U]
|
---|
233 | * 25: get_tim(&systim)
|
---|
234 | * 26: [target_hrt_get_current -> 130U]
|
---|
235 | * 27: assert(systim == (3LLU << 32) + 80U)
|
---|
236 | * // adj_timã§ã·ã¹ãã æå»ãé²ãã
|
---|
237 | * adj_tim(+1000000) ... (C-4)(D-3)(E-2)
|
---|
238 | * 28: [target_hrt_get_current -> 140U] // ALM1ã®çºçï¼1,000,121
|
---|
239 | * 29: [target_hrt_set_event <- 999981U] ... (C-5)
|
---|
240 | * 30: get_tim(&systim)
|
---|
241 | * 31: [target_hrt_get_current -> 150U]
|
---|
242 | * 32: assert(systim == (3LLU << 32) + 1000000U + 100U)
|
---|
243 | * // ã¿ã¤ã ã¤ãã³ãçºçã¾ã§ã®æéããã§ãã¯
|
---|
244 | * ref_alm(ALM1, &ralm)
|
---|
245 | * 33: [target_hrt_get_current -> 160U]
|
---|
246 | * 34: assert(ralm.lefttim == 999960U)
|
---|
247 | * // ããã§é·æéçµéãããã¨ãæ³å®
|
---|
248 | * DO(target_raise_hrt_int(0U))
|
---|
249 | * == HRT_HANDLER ==
|
---|
250 | * 35: [target_hrt_get_current -> 1000130U] // ALM1ãçºç
|
---|
251 | * == ALM1-1ï¼1åç®ï¼==
|
---|
252 | * // éã¿ã¹ã¯ã³ã³ããã¹ãããåãµã¼ãã¹ã³ã¼ã«ãå¼ã³åºã
|
---|
253 | * 36: set_tim(1LLU << 32) -> E_CTX ... (A-1)
|
---|
254 | * get_tim(&systim) -> E_CTX ... (B-1)
|
---|
255 | * RETURN
|
---|
256 | * 37: [target_hrt_get_current -> 1000140U]
|
---|
257 | * 38: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
258 | * == TASK1ï¼ç¶ãï¼==
|
---|
259 | *
|
---|
260 | * // adj_timã§ã·ã¹ãã æå»ãæ»ããã¹ã
|
---|
261 | * // ã¿ã¤ã ã¤ãã³ãã1ã¤ç»é²
|
---|
262 | * 39: sta_alm(ALM1, 2000000U)
|
---|
263 | * 40: [target_hrt_get_current -> 1000150U] // ALM1ã®çºçï¼3,000,151
|
---|
264 | * 41: [target_hrt_set_event <- 2000001U]
|
---|
265 | * // ã·ã¹ãã æå»ã確èªãã¦ãã
|
---|
266 | * 42: get_tim(&systim)
|
---|
267 | * 43: [target_hrt_get_current -> 1000160U]
|
---|
268 | * 44: assert(systim == (3LLU << 32) + 1000000U + 1000110U)
|
---|
269 | * // adj_timã§ã·ã¹ãã æå»ãæ»ã
|
---|
270 | * adj_tim(-1000000) ... (C-4)(D-1)(E-4)
|
---|
271 | * 45: [target_hrt_get_current -> 1000170U] // ALM1ã®çºçï¼4,000,151
|
---|
272 | * 46: [target_hrt_set_event <- 2999981U] ... (C-5)
|
---|
273 | * // ã·ã¹ãã æå»ãæ»ã£ã¦ããªããã¨ããã§ãã¯
|
---|
274 | * // adj_timãå¼ã³åºããæç¹ã®ã·ã¹ãã æå»ã«ãªã£ã¦ããã¯ã
|
---|
275 | * 47: get_tim(&systim) ... (B-4)
|
---|
276 | * 48: [target_hrt_get_current -> 1000180U]
|
---|
277 | * 49: assert(systim == (3LLU << 32) + 1000000U + 1000120U)
|
---|
278 | * // ã¿ã¤ã ã¤ãã³ãçºçã¾ã§ã®æéããã§ãã¯
|
---|
279 | * ref_alm(ALM1, &ralm)
|
---|
280 | * 50: [target_hrt_get_current -> 1000190U]
|
---|
281 | * assert(ralm.lefttim == 2999960U)
|
---|
282 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
283 | * // ã·ã¹ãã æå»ãé²ãã§ããªããã¨ããã§ãã¯
|
---|
284 | * get_tim(&systim) ... (B-4)
|
---|
285 | * 51: [target_hrt_get_current -> 1500200U] ... (F-1)
|
---|
286 | * 52: assert(systim == (3LLU << 32) + 1000000U + 1000120U)
|
---|
287 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
288 | * // ã·ã¹ãã æå»ãé²ãã§ãããã¨ããã§ãã¯
|
---|
289 | * get_tim(&systim) ... (B-4)
|
---|
290 | * 53: [target_hrt_get_current -> 2000210U]
|
---|
291 | * 54: assert(systim == (3LLU << 32) + 2000160U)
|
---|
292 | * // adj_timã§ã·ã¹ãã æå»ãæ»ã
|
---|
293 | * adj_tim(-1000000) ... (C-4)(D-1)(E-4)
|
---|
294 | * 55: [target_hrt_get_current -> 2000220U] // ALM1ã®çºçï¼5,000,151
|
---|
295 | * 56: [target_hrt_set_event <- 2999931U] ... (C-5)
|
---|
296 | * // ã·ã¹ãã æå»ãæ»ã£ã¦ããªããã¨ããã§ãã¯
|
---|
297 | * // adj_timãå¼ã³åºããæç¹ã®ã·ã¹ãã æå»ã«ãªã£ã¦ããã¯ã
|
---|
298 | * get_tim(&systim) ... (B-4)
|
---|
299 | * 57: [target_hrt_get_current -> 2000230U]
|
---|
300 | * 58: assert(systim == (3LLU << 32) + 2000170U)
|
---|
301 | * // ããã§ã·ã¹ãã æå»ãè¨å®
|
---|
302 | * // ãã®æç¹ã§ï¼get_timã§åç
|
---|
303 | §ããã·ã¹ãã æå»ã¯20æ¢ã¾ã£ã¦ãã
|
---|
304 | * // ãã以éï¼ããã«999980ã®éï¼ã·ã¹ãã æå»ã¯æ¢ã¾ã£ã¦ããã¯ã
|
---|
305 | * set_tim(4LLU << 32)
|
---|
306 | * 59: [target_hrt_get_current -> 2000240U]
|
---|
307 | * // ã·ã¹ãã æå»ãé²ãã§ããªããã¨ããã§ãã¯
|
---|
308 | * get_tim(&systim) ... (B-5)
|
---|
309 | * 60: [target_hrt_get_current -> 2000250U]
|
---|
310 | * 61: assert(systim == (4LLU << 32))
|
---|
311 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
312 | * // ã·ã¹ãã æå»ãé²ãã§ããªããã¨ããã§ãã¯
|
---|
313 | * get_tim(&systim) ... (B-5)
|
---|
314 | * 62: [target_hrt_get_current -> 2500250U]
|
---|
315 | * 63: assert(systim == (4LLU << 32))
|
---|
316 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
317 | * // ã·ã¹ãã æå»ãé²ãã§ãããã¨ããã§ãã¯
|
---|
318 | * get_tim(&systim) ... (B-5)
|
---|
319 | * 64: [target_hrt_get_current -> 3000260U]
|
---|
320 | * 65: assert(systim == (4LLU << 32) - 999980U + 1000020U)
|
---|
321 | *
|
---|
322 | * // adj_timã§ç¹°ãè¿ãã·ã¹ãã æå»ãé²ãããã¹ã
|
---|
323 | * // ã¿ã¤ã ã¤ãã³ãã2ã¤ç»é²
|
---|
324 | * sta_alm(ALM1, 1000U)
|
---|
325 | * 66: [target_hrt_get_current -> 3000270U] // ALM1ã®åæ¢
|
---|
326 | * 67: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
327 | * 68: [target_hrt_get_current -> 3000270U] // ALM1ã®çºçï¼3,001,271
|
---|
328 | * 69: [target_hrt_set_event <- 1001U]
|
---|
329 | * 70: sta_alm(ALM2, 1000U)
|
---|
330 | * 71: [target_hrt_get_current -> 3000280U] // ALM2ã®çºçï¼3,001,281
|
---|
331 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
332 | * 72: DO(target_raise_hrt_int(0U))
|
---|
333 | * == HRT_HANDLER ==
|
---|
334 | * 73: [target_hrt_get_current -> 3001280U] // ALM1ãçºç
|
---|
335 | * == ALM1-2ï¼2åç®ï¼==
|
---|
336 | * 74: adj_tim(+1000000) ... (C-8)(D-3)(E-2)
|
---|
337 | * 75: [target_hrt_get_current -> 3001290U] // ALM2ã®çºçï¼2,001,281
|
---|
338 | * 76: adj_tim(+1000000) -> E_OBJ ... (C-6)(E-3)
|
---|
339 | * 77: [target_hrt_get_current -> 3001300U]
|
---|
340 | * 78: RETURN
|
---|
341 | * == ALM2-1ï¼1åç®ï¼==
|
---|
342 | * 79: RETURN
|
---|
343 | * 80: [target_hrt_get_current -> 3001400U]
|
---|
344 | * 81: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
345 | * == TASK1ï¼ç¶ãï¼==
|
---|
346 | *
|
---|
347 | * // (D-4)ã®ãã¹ã
|
---|
348 | * // ããã§é·æéçµéãããã¨ãæ³å®
|
---|
349 | * 82: DO(target_raise_hrt_int(0U))
|
---|
350 | * == HRT_HANDLER ==
|
---|
351 | * 83: [target_hrt_get_current -> -100U]
|
---|
352 | * 84: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
353 | * == TASK1ï¼ç¶ãï¼==
|
---|
354 | * // ã·ã¹ãã æå»ãè¨å®ããï¼ãã®å¾ã®è¨ç®ã楽ã«ããããï¼
|
---|
355 | * 85: set_tim(5LLU << 32)
|
---|
356 | * 86: [target_hrt_get_current -> -90U]
|
---|
357 | * // adj_timã§ã·ã¹ãã æå»ãé²ãã
|
---|
358 | * 87: adj_tim(200) ... (C-4)(D-4)(E-1)
|
---|
359 | * 88: [target_hrt_get_current -> -80U]
|
---|
360 | * 89: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
361 | * // ã·ã¹ãã æå»ã確èª
|
---|
362 | * 90: get_tim(&systim)
|
---|
363 | * 91: [target_hrt_get_current -> -70U]
|
---|
364 | * 92: assert(systim == (5LLU << 32) + 200U + 20U)
|
---|
365 | *
|
---|
366 | * // adj_timã§ç¹°ãè¿ãã·ã¹ãã æå»ãæ»ããã¹ã
|
---|
367 | * // ããã§å°ãæéãçµéãããã¨ãæ³å®
|
---|
368 | * // ã·ã¹ãã æå»ãè¨å®ããï¼ãã®å¾ã®è¨ç®ã楽ã«ããããï¼
|
---|
369 | * 93: set_tim(6LLU << 32)
|
---|
370 | * 94: [target_hrt_get_current -> 110U]
|
---|
371 | * // adj_timã§ã·ã¹ãã æå»ãæ»ã
|
---|
372 | * 95: adj_tim(-200) ... (C-4)(D-1)(E-4)
|
---|
373 | * 96: [target_hrt_get_current -> 120U]
|
---|
374 | * 97: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
375 | * // ã·ã¹ãã æå»ã確èª
|
---|
376 | * 98: get_tim(&systim)
|
---|
377 | * 99: [target_hrt_get_current -> 130U]
|
---|
378 | * 100:assert(systim == (6LLU << 32) + 10U)
|
---|
379 | * // adj_timã§ã·ã¹ãã æå»ãããã«æ»ã
|
---|
380 | * adj_tim(-1000000) ... (C-4)(D-1)(E-4)
|
---|
381 | * 101: [target_hrt_get_current -> 140U]
|
---|
382 | * 102: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
383 | * 103:adj_tim(-1000000) -> E_OBJ ... (C-7)(E-5)
|
---|
384 | * 104: [target_hrt_get_current -> 150U]
|
---|
385 | * 105:adj_tim(+1000000) ... (C-4)(D-2)(E-1)
|
---|
386 | * 106: [target_hrt_get_current -> 160U]
|
---|
387 | * 107: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
388 | * // ã·ã¹ãã æå»ã確èª
|
---|
389 | * // adj_tim(-200)ãå¼ã³åºããæç¹ã§ã®ã·ã¹ãã æå»ã«ãªã£ã¦ããã¯ã
|
---|
390 | * 108:get_tim(&systim)
|
---|
391 | * 109: [target_hrt_get_current -> 170U]
|
---|
392 | * 110:assert(systim == (6LLU << 32) + 10U)
|
---|
393 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
394 | * 111:get_tim(&systim)
|
---|
395 | * 112: [target_hrt_get_current -> 370U]
|
---|
396 | * 113:assert(systim == (6LLU << 32) - 200U + 260U)
|
---|
397 | * // adj_tim(0)ã®åä½ã確èª
|
---|
398 | * adj_tim(0) ... (C-4)(D-1)(E-6)
|
---|
399 | * 114: [target_hrt_get_current -> 380U]
|
---|
400 | * 115: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
401 | * // ã·ã¹ãã æå»ã確èª
|
---|
402 | * 116:get_tim(&systim)
|
---|
403 | * 117: [target_hrt_get_current -> 390U]
|
---|
404 | * 118:assert(systim == (6LLU << 32) - 200U + 280U)
|
---|
405 | * 119:END
|
---|
406 | */
|
---|
407 |
|
---|
408 | #include <kernel.h>
|
---|
409 | #include <t_syslog.h>
|
---|
410 | #include "syssvc/test_svc.h"
|
---|
411 | #include "kernel_cfg.h"
|
---|
412 | #include "hrt_systim2.h"
|
---|
413 | #include "target_timer.h"
|
---|
414 |
|
---|
415 | #if !defined(HRT_CONFIG1) || defined(HRT_CONFIG2)
|
---|
416 | #error Compiler option "-DHRT_CONFIG1" is missing.
|
---|
417 | #endif
|
---|
418 |
|
---|
419 | #ifdef TOPPERS_SUPPORT_DRIFT
|
---|
420 | #define HRTCNT_EMPTY TMAX_RELTIM
|
---|
421 | #else /* TOPPERS_SUPPORT_DRIFT */
|
---|
422 | #define HRTCNT_EMPTY HRTCNT_BOUND
|
---|
423 | #endif /* TOPPERS_SUPPORT_DRIFT */
|
---|
424 |
|
---|
425 | #define target_hrt_get_current _kernel_target_hrt_get_current
|
---|
426 | #define target_hrt_set_event _kernel_target_hrt_set_event
|
---|
427 | #define target_hrt_raise_event _kernel_target_hrt_raise_event
|
---|
428 |
|
---|
429 | void
|
---|
430 | target_hrt_raise_event(void)
|
---|
431 | {
|
---|
432 | }
|
---|
433 |
|
---|
434 | /* DO NOT DELETE THIS LINE -- gentest depends on it. */
|
---|
435 |
|
---|
436 | static uint_t alarm1_count = 0;
|
---|
437 |
|
---|
438 | void
|
---|
439 | alarm1_handler(intptr_t exinf)
|
---|
440 | {
|
---|
441 | ER_UINT ercd;
|
---|
442 | SYSTIM systim;
|
---|
443 |
|
---|
444 | switch (++alarm1_count) {
|
---|
445 | case 1:
|
---|
446 | check_point(36);
|
---|
447 | ercd = set_tim(1LLU << 32);
|
---|
448 | check_ercd(ercd, E_CTX);
|
---|
449 |
|
---|
450 | ercd = get_tim(&systim);
|
---|
451 | check_ercd(ercd, E_CTX);
|
---|
452 |
|
---|
453 | return;
|
---|
454 |
|
---|
455 | check_point(0);
|
---|
456 |
|
---|
457 | case 2:
|
---|
458 | check_point(74);
|
---|
459 | ercd = adj_tim(+1000000);
|
---|
460 | check_ercd(ercd, E_OK);
|
---|
461 |
|
---|
462 | check_point(76);
|
---|
463 | ercd = adj_tim(+1000000);
|
---|
464 | check_ercd(ercd, E_OBJ);
|
---|
465 |
|
---|
466 | check_point(78);
|
---|
467 | return;
|
---|
468 |
|
---|
469 | check_point(0);
|
---|
470 |
|
---|
471 | default:
|
---|
472 | check_point(0);
|
---|
473 | }
|
---|
474 | check_point(0);
|
---|
475 | }
|
---|
476 |
|
---|
477 | static uint_t alarm2_count = 0;
|
---|
478 |
|
---|
479 | void
|
---|
480 | alarm2_handler(intptr_t exinf)
|
---|
481 | {
|
---|
482 |
|
---|
483 | switch (++alarm2_count) {
|
---|
484 | case 1:
|
---|
485 | check_point(79);
|
---|
486 | return;
|
---|
487 |
|
---|
488 | check_point(0);
|
---|
489 |
|
---|
490 | default:
|
---|
491 | check_point(0);
|
---|
492 | }
|
---|
493 | check_point(0);
|
---|
494 | }
|
---|
495 |
|
---|
496 | void
|
---|
497 | task1(intptr_t exinf)
|
---|
498 | {
|
---|
499 | ER_UINT ercd;
|
---|
500 | T_RALM ralm;
|
---|
501 | SYSTIM systim;
|
---|
502 |
|
---|
503 | check_point(3);
|
---|
504 | ercd = loc_cpu();
|
---|
505 | check_ercd(ercd, E_OK);
|
---|
506 |
|
---|
507 | ercd = set_tim(1000000LLU);
|
---|
508 | check_ercd(ercd, E_CTX);
|
---|
509 |
|
---|
510 | ercd = get_tim(&systim);
|
---|
511 | check_ercd(ercd, E_CTX);
|
---|
512 |
|
---|
513 | ercd = adj_tim(100);
|
---|
514 | check_ercd(ercd, E_CTX);
|
---|
515 |
|
---|
516 | ercd = unl_cpu();
|
---|
517 | check_ercd(ercd, E_OK);
|
---|
518 |
|
---|
519 | check_point(4);
|
---|
520 | ercd = get_tim(&systim);
|
---|
521 | check_ercd(ercd, E_OK);
|
---|
522 |
|
---|
523 | check_point(6);
|
---|
524 | check_assert(systim == 40U - 10U);
|
---|
525 |
|
---|
526 | ercd = set_tim(2LLU << 32);
|
---|
527 | check_ercd(ercd, E_OK);
|
---|
528 |
|
---|
529 | check_point(8);
|
---|
530 | ercd = get_tim(&systim);
|
---|
531 | check_ercd(ercd, E_OK);
|
---|
532 |
|
---|
533 | check_point(10);
|
---|
534 | check_assert(systim == (2LLU << 32) + 10U);
|
---|
535 |
|
---|
536 | check_point(11);
|
---|
537 | target_raise_hrt_int(1U);
|
---|
538 |
|
---|
539 | ercd = tslp_tsk(TMAX_RELTIM);
|
---|
540 | check_ercd(ercd, E_TMOUT);
|
---|
541 |
|
---|
542 | check_point(17);
|
---|
543 | ercd = get_tim(&systim);
|
---|
544 | check_ercd(ercd, E_OK);
|
---|
545 |
|
---|
546 | check_point(19);
|
---|
547 | check_assert(systim == (2LLU << 32) + 4000000050U);
|
---|
548 |
|
---|
549 | check_point(20);
|
---|
550 | ercd = get_tim(&systim);
|
---|
551 | check_ercd(ercd, E_OK);
|
---|
552 |
|
---|
553 | check_point(22);
|
---|
554 | check_assert(systim == (3LLU << 32) + 50U);
|
---|
555 |
|
---|
556 | ercd = adj_tim(-1000001);
|
---|
557 | check_ercd(ercd, E_PAR);
|
---|
558 |
|
---|
559 | ercd = adj_tim(+1000001);
|
---|
560 | check_ercd(ercd, E_PAR);
|
---|
561 |
|
---|
562 | ercd = sta_alm(ALM1, 2000000U);
|
---|
563 | check_ercd(ercd, E_OK);
|
---|
564 |
|
---|
565 | check_point(25);
|
---|
566 | ercd = get_tim(&systim);
|
---|
567 | check_ercd(ercd, E_OK);
|
---|
568 |
|
---|
569 | check_point(27);
|
---|
570 | check_assert(systim == (3LLU << 32) + 80U);
|
---|
571 |
|
---|
572 | ercd = adj_tim(+1000000);
|
---|
573 | check_ercd(ercd, E_OK);
|
---|
574 |
|
---|
575 | check_point(30);
|
---|
576 | ercd = get_tim(&systim);
|
---|
577 | check_ercd(ercd, E_OK);
|
---|
578 |
|
---|
579 | check_point(32);
|
---|
580 | check_assert(systim == (3LLU << 32) + 1000000U + 100U);
|
---|
581 |
|
---|
582 | ercd = ref_alm(ALM1, &ralm);
|
---|
583 | check_ercd(ercd, E_OK);
|
---|
584 |
|
---|
585 | check_point(34);
|
---|
586 | check_assert(ralm.lefttim == 999960U);
|
---|
587 |
|
---|
588 | target_raise_hrt_int(0U);
|
---|
589 |
|
---|
590 | check_point(39);
|
---|
591 | ercd = sta_alm(ALM1, 2000000U);
|
---|
592 | check_ercd(ercd, E_OK);
|
---|
593 |
|
---|
594 | check_point(42);
|
---|
595 | ercd = get_tim(&systim);
|
---|
596 | check_ercd(ercd, E_OK);
|
---|
597 |
|
---|
598 | check_point(44);
|
---|
599 | check_assert(systim == (3LLU << 32) + 1000000U + 1000110U);
|
---|
600 |
|
---|
601 | ercd = adj_tim(-1000000);
|
---|
602 | check_ercd(ercd, E_OK);
|
---|
603 |
|
---|
604 | check_point(47);
|
---|
605 | ercd = get_tim(&systim);
|
---|
606 | check_ercd(ercd, E_OK);
|
---|
607 |
|
---|
608 | check_point(49);
|
---|
609 | check_assert(systim == (3LLU << 32) + 1000000U + 1000120U);
|
---|
610 |
|
---|
611 | ercd = ref_alm(ALM1, &ralm);
|
---|
612 | check_ercd(ercd, E_OK);
|
---|
613 |
|
---|
614 | check_assert(ralm.lefttim == 2999960U);
|
---|
615 |
|
---|
616 | ercd = get_tim(&systim);
|
---|
617 | check_ercd(ercd, E_OK);
|
---|
618 |
|
---|
619 | check_point(52);
|
---|
620 | check_assert(systim == (3LLU << 32) + 1000000U + 1000120U);
|
---|
621 |
|
---|
622 | ercd = get_tim(&systim);
|
---|
623 | check_ercd(ercd, E_OK);
|
---|
624 |
|
---|
625 | check_point(54);
|
---|
626 | check_assert(systim == (3LLU << 32) + 2000160U);
|
---|
627 |
|
---|
628 | ercd = adj_tim(-1000000);
|
---|
629 | check_ercd(ercd, E_OK);
|
---|
630 |
|
---|
631 | ercd = get_tim(&systim);
|
---|
632 | check_ercd(ercd, E_OK);
|
---|
633 |
|
---|
634 | check_point(58);
|
---|
635 | check_assert(systim == (3LLU << 32) + 2000170U);
|
---|
636 |
|
---|
637 | ercd = set_tim(4LLU << 32);
|
---|
638 | check_ercd(ercd, E_OK);
|
---|
639 |
|
---|
640 | ercd = get_tim(&systim);
|
---|
641 | check_ercd(ercd, E_OK);
|
---|
642 |
|
---|
643 | check_point(61);
|
---|
644 | check_assert(systim == (4LLU << 32));
|
---|
645 |
|
---|
646 | ercd = get_tim(&systim);
|
---|
647 | check_ercd(ercd, E_OK);
|
---|
648 |
|
---|
649 | check_point(63);
|
---|
650 | check_assert(systim == (4LLU << 32));
|
---|
651 |
|
---|
652 | ercd = get_tim(&systim);
|
---|
653 | check_ercd(ercd, E_OK);
|
---|
654 |
|
---|
655 | check_point(65);
|
---|
656 | check_assert(systim == (4LLU << 32) - 999980U + 1000020U);
|
---|
657 |
|
---|
658 | ercd = sta_alm(ALM1, 1000U);
|
---|
659 | check_ercd(ercd, E_OK);
|
---|
660 |
|
---|
661 | check_point(70);
|
---|
662 | ercd = sta_alm(ALM2, 1000U);
|
---|
663 | check_ercd(ercd, E_OK);
|
---|
664 |
|
---|
665 | check_point(72);
|
---|
666 | target_raise_hrt_int(0U);
|
---|
667 |
|
---|
668 | check_point(82);
|
---|
669 | target_raise_hrt_int(0U);
|
---|
670 |
|
---|
671 | check_point(85);
|
---|
672 | ercd = set_tim(5LLU << 32);
|
---|
673 | check_ercd(ercd, E_OK);
|
---|
674 |
|
---|
675 | check_point(87);
|
---|
676 | ercd = adj_tim(200);
|
---|
677 | check_ercd(ercd, E_OK);
|
---|
678 |
|
---|
679 | check_point(90);
|
---|
680 | ercd = get_tim(&systim);
|
---|
681 | check_ercd(ercd, E_OK);
|
---|
682 |
|
---|
683 | check_point(92);
|
---|
684 | check_assert(systim == (5LLU << 32) + 200U + 20U);
|
---|
685 |
|
---|
686 | check_point(93);
|
---|
687 | ercd = set_tim(6LLU << 32);
|
---|
688 | check_ercd(ercd, E_OK);
|
---|
689 |
|
---|
690 | check_point(95);
|
---|
691 | ercd = adj_tim(-200);
|
---|
692 | check_ercd(ercd, E_OK);
|
---|
693 |
|
---|
694 | check_point(98);
|
---|
695 | ercd = get_tim(&systim);
|
---|
696 | check_ercd(ercd, E_OK);
|
---|
697 |
|
---|
698 | check_point(100);
|
---|
699 | check_assert(systim == (6LLU << 32) + 10U);
|
---|
700 |
|
---|
701 | ercd = adj_tim(-1000000);
|
---|
702 | check_ercd(ercd, E_OK);
|
---|
703 |
|
---|
704 | check_point(103);
|
---|
705 | ercd = adj_tim(-1000000);
|
---|
706 | check_ercd(ercd, E_OBJ);
|
---|
707 |
|
---|
708 | check_point(105);
|
---|
709 | ercd = adj_tim(+1000000);
|
---|
710 | check_ercd(ercd, E_OK);
|
---|
711 |
|
---|
712 | check_point(108);
|
---|
713 | ercd = get_tim(&systim);
|
---|
714 | check_ercd(ercd, E_OK);
|
---|
715 |
|
---|
716 | check_point(110);
|
---|
717 | check_assert(systim == (6LLU << 32) + 10U);
|
---|
718 |
|
---|
719 | check_point(111);
|
---|
720 | ercd = get_tim(&systim);
|
---|
721 | check_ercd(ercd, E_OK);
|
---|
722 |
|
---|
723 | check_point(113);
|
---|
724 | check_assert(systim == (6LLU << 32) - 200U + 260U);
|
---|
725 |
|
---|
726 | ercd = adj_tim(0);
|
---|
727 | check_ercd(ercd, E_OK);
|
---|
728 |
|
---|
729 | check_point(116);
|
---|
730 | ercd = get_tim(&systim);
|
---|
731 | check_ercd(ercd, E_OK);
|
---|
732 |
|
---|
733 | check_point(118);
|
---|
734 | check_assert(systim == (6LLU << 32) - 200U + 280U);
|
---|
735 |
|
---|
736 | check_finish(119);
|
---|
737 | check_point(0);
|
---|
738 | }
|
---|
739 |
|
---|
740 | static uint_t target_hrt_get_current_count = 0;
|
---|
741 |
|
---|
742 | HRTCNT
|
---|
743 | target_hrt_get_current(void)
|
---|
744 | {
|
---|
745 |
|
---|
746 | switch (++target_hrt_get_current_count) {
|
---|
747 | case 1:
|
---|
748 | test_start(__FILE__);
|
---|
749 |
|
---|
750 | check_point(1);
|
---|
751 | return(10U);
|
---|
752 |
|
---|
753 | check_point(0);
|
---|
754 |
|
---|
755 | case 2:
|
---|
756 | check_point(5);
|
---|
757 | return(40U);
|
---|
758 |
|
---|
759 | check_point(0);
|
---|
760 |
|
---|
761 | case 3:
|
---|
762 | check_point(7);
|
---|
763 | return(50U);
|
---|
764 |
|
---|
765 | check_point(0);
|
---|
766 |
|
---|
767 | case 4:
|
---|
768 | check_point(9);
|
---|
769 | return(60U);
|
---|
770 |
|
---|
771 | check_point(0);
|
---|
772 |
|
---|
773 | case 5:
|
---|
774 | check_point(12);
|
---|
775 | return(70U);
|
---|
776 |
|
---|
777 | check_point(0);
|
---|
778 |
|
---|
779 | case 6:
|
---|
780 | check_point(14);
|
---|
781 | return(4000000080U);
|
---|
782 |
|
---|
783 | check_point(0);
|
---|
784 |
|
---|
785 | case 7:
|
---|
786 | check_point(15);
|
---|
787 | return(4000000090U);
|
---|
788 |
|
---|
789 | check_point(0);
|
---|
790 |
|
---|
791 | case 8:
|
---|
792 | check_point(18);
|
---|
793 | return(4000000100U);
|
---|
794 |
|
---|
795 | check_point(0);
|
---|
796 |
|
---|
797 | case 9:
|
---|
798 | check_point(21);
|
---|
799 | return(100U);
|
---|
800 |
|
---|
801 | check_point(0);
|
---|
802 |
|
---|
803 | case 10:
|
---|
804 | check_point(23);
|
---|
805 | return(120U);
|
---|
806 |
|
---|
807 | check_point(0);
|
---|
808 |
|
---|
809 | case 11:
|
---|
810 | check_point(26);
|
---|
811 | return(130U);
|
---|
812 |
|
---|
813 | check_point(0);
|
---|
814 |
|
---|
815 | case 12:
|
---|
816 | check_point(28);
|
---|
817 | return(140U);
|
---|
818 |
|
---|
819 | check_point(0);
|
---|
820 |
|
---|
821 | case 13:
|
---|
822 | check_point(31);
|
---|
823 | return(150U);
|
---|
824 |
|
---|
825 | check_point(0);
|
---|
826 |
|
---|
827 | case 14:
|
---|
828 | check_point(33);
|
---|
829 | return(160U);
|
---|
830 |
|
---|
831 | check_point(0);
|
---|
832 |
|
---|
833 | case 15:
|
---|
834 | check_point(35);
|
---|
835 | return(1000130U);
|
---|
836 |
|
---|
837 | check_point(0);
|
---|
838 |
|
---|
839 | case 16:
|
---|
840 | check_point(37);
|
---|
841 | return(1000140U);
|
---|
842 |
|
---|
843 | check_point(0);
|
---|
844 |
|
---|
845 | case 17:
|
---|
846 | check_point(40);
|
---|
847 | return(1000150U);
|
---|
848 |
|
---|
849 | check_point(0);
|
---|
850 |
|
---|
851 | case 18:
|
---|
852 | check_point(43);
|
---|
853 | return(1000160U);
|
---|
854 |
|
---|
855 | check_point(0);
|
---|
856 |
|
---|
857 | case 19:
|
---|
858 | check_point(45);
|
---|
859 | return(1000170U);
|
---|
860 |
|
---|
861 | check_point(0);
|
---|
862 |
|
---|
863 | case 20:
|
---|
864 | check_point(48);
|
---|
865 | return(1000180U);
|
---|
866 |
|
---|
867 | check_point(0);
|
---|
868 |
|
---|
869 | case 21:
|
---|
870 | check_point(50);
|
---|
871 | return(1000190U);
|
---|
872 |
|
---|
873 | check_point(0);
|
---|
874 |
|
---|
875 | case 22:
|
---|
876 | check_point(51);
|
---|
877 | return(1500200U);
|
---|
878 |
|
---|
879 | check_point(0);
|
---|
880 |
|
---|
881 | case 23:
|
---|
882 | check_point(53);
|
---|
883 | return(2000210U);
|
---|
884 |
|
---|
885 | check_point(0);
|
---|
886 |
|
---|
887 | case 24:
|
---|
888 | check_point(55);
|
---|
889 | return(2000220U);
|
---|
890 |
|
---|
891 | check_point(0);
|
---|
892 |
|
---|
893 | case 25:
|
---|
894 | check_point(57);
|
---|
895 | return(2000230U);
|
---|
896 |
|
---|
897 | check_point(0);
|
---|
898 |
|
---|
899 | case 26:
|
---|
900 | check_point(59);
|
---|
901 | return(2000240U);
|
---|
902 |
|
---|
903 | check_point(0);
|
---|
904 |
|
---|
905 | case 27:
|
---|
906 | check_point(60);
|
---|
907 | return(2000250U);
|
---|
908 |
|
---|
909 | check_point(0);
|
---|
910 |
|
---|
911 | case 28:
|
---|
912 | check_point(62);
|
---|
913 | return(2500250U);
|
---|
914 |
|
---|
915 | check_point(0);
|
---|
916 |
|
---|
917 | case 29:
|
---|
918 | check_point(64);
|
---|
919 | return(3000260U);
|
---|
920 |
|
---|
921 | check_point(0);
|
---|
922 |
|
---|
923 | case 30:
|
---|
924 | check_point(66);
|
---|
925 | return(3000270U);
|
---|
926 |
|
---|
927 | check_point(0);
|
---|
928 |
|
---|
929 | case 31:
|
---|
930 | check_point(68);
|
---|
931 | return(3000270U);
|
---|
932 |
|
---|
933 | check_point(0);
|
---|
934 |
|
---|
935 | case 32:
|
---|
936 | check_point(71);
|
---|
937 | return(3000280U);
|
---|
938 |
|
---|
939 | check_point(0);
|
---|
940 |
|
---|
941 | case 33:
|
---|
942 | check_point(73);
|
---|
943 | return(3001280U);
|
---|
944 |
|
---|
945 | check_point(0);
|
---|
946 |
|
---|
947 | case 34:
|
---|
948 | check_point(75);
|
---|
949 | return(3001290U);
|
---|
950 |
|
---|
951 | check_point(0);
|
---|
952 |
|
---|
953 | case 35:
|
---|
954 | check_point(77);
|
---|
955 | return(3001300U);
|
---|
956 |
|
---|
957 | check_point(0);
|
---|
958 |
|
---|
959 | case 36:
|
---|
960 | check_point(80);
|
---|
961 | return(3001400U);
|
---|
962 |
|
---|
963 | check_point(0);
|
---|
964 |
|
---|
965 | case 37:
|
---|
966 | check_point(83);
|
---|
967 | return(-100U);
|
---|
968 |
|
---|
969 | check_point(0);
|
---|
970 |
|
---|
971 | case 38:
|
---|
972 | check_point(86);
|
---|
973 | return(-90U);
|
---|
974 |
|
---|
975 | check_point(0);
|
---|
976 |
|
---|
977 | case 39:
|
---|
978 | check_point(88);
|
---|
979 | return(-80U);
|
---|
980 |
|
---|
981 | check_point(0);
|
---|
982 |
|
---|
983 | case 40:
|
---|
984 | check_point(91);
|
---|
985 | return(-70U);
|
---|
986 |
|
---|
987 | check_point(0);
|
---|
988 |
|
---|
989 | case 41:
|
---|
990 | check_point(94);
|
---|
991 | return(110U);
|
---|
992 |
|
---|
993 | check_point(0);
|
---|
994 |
|
---|
995 | case 42:
|
---|
996 | check_point(96);
|
---|
997 | return(120U);
|
---|
998 |
|
---|
999 | check_point(0);
|
---|
1000 |
|
---|
1001 | case 43:
|
---|
1002 | check_point(99);
|
---|
1003 | return(130U);
|
---|
1004 |
|
---|
1005 | check_point(0);
|
---|
1006 |
|
---|
1007 | case 44:
|
---|
1008 | check_point(101);
|
---|
1009 | return(140U);
|
---|
1010 |
|
---|
1011 | check_point(0);
|
---|
1012 |
|
---|
1013 | case 45:
|
---|
1014 | check_point(104);
|
---|
1015 | return(150U);
|
---|
1016 |
|
---|
1017 | check_point(0);
|
---|
1018 |
|
---|
1019 | case 46:
|
---|
1020 | check_point(106);
|
---|
1021 | return(160U);
|
---|
1022 |
|
---|
1023 | check_point(0);
|
---|
1024 |
|
---|
1025 | case 47:
|
---|
1026 | check_point(109);
|
---|
1027 | return(170U);
|
---|
1028 |
|
---|
1029 | check_point(0);
|
---|
1030 |
|
---|
1031 | case 48:
|
---|
1032 | check_point(112);
|
---|
1033 | return(370U);
|
---|
1034 |
|
---|
1035 | check_point(0);
|
---|
1036 |
|
---|
1037 | case 49:
|
---|
1038 | check_point(114);
|
---|
1039 | return(380U);
|
---|
1040 |
|
---|
1041 | check_point(0);
|
---|
1042 |
|
---|
1043 | case 50:
|
---|
1044 | check_point(117);
|
---|
1045 | return(390U);
|
---|
1046 |
|
---|
1047 | check_point(0);
|
---|
1048 |
|
---|
1049 | default:
|
---|
1050 | check_point(0);
|
---|
1051 | }
|
---|
1052 | check_point(0);
|
---|
1053 | return(0U);
|
---|
1054 | }
|
---|
1055 |
|
---|
1056 | static uint_t target_hrt_set_event_count = 0;
|
---|
1057 |
|
---|
1058 | void
|
---|
1059 | target_hrt_set_event(HRTCNT hrtcnt)
|
---|
1060 | {
|
---|
1061 |
|
---|
1062 | switch (++target_hrt_set_event_count) {
|
---|
1063 | case 1:
|
---|
1064 | check_point(2);
|
---|
1065 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
1066 |
|
---|
1067 | return;
|
---|
1068 |
|
---|
1069 | check_point(0);
|
---|
1070 |
|
---|
1071 | case 2:
|
---|
1072 | check_point(13);
|
---|
1073 | check_assert(hrtcnt == 4000000001U);
|
---|
1074 |
|
---|
1075 | return;
|
---|
1076 |
|
---|
1077 | check_point(0);
|
---|
1078 |
|
---|
1079 | case 3:
|
---|
1080 | check_point(16);
|
---|
1081 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
1082 |
|
---|
1083 | return;
|
---|
1084 |
|
---|
1085 | check_point(0);
|
---|
1086 |
|
---|
1087 | case 4:
|
---|
1088 | check_point(24);
|
---|
1089 | check_assert(hrtcnt == 2000001U);
|
---|
1090 |
|
---|
1091 | return;
|
---|
1092 |
|
---|
1093 | check_point(0);
|
---|
1094 |
|
---|
1095 | case 5:
|
---|
1096 | check_point(29);
|
---|
1097 | check_assert(hrtcnt == 999981U);
|
---|
1098 |
|
---|
1099 | return;
|
---|
1100 |
|
---|
1101 | check_point(0);
|
---|
1102 |
|
---|
1103 | case 6:
|
---|
1104 | check_point(38);
|
---|
1105 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
1106 |
|
---|
1107 | return;
|
---|
1108 |
|
---|
1109 | check_point(0);
|
---|
1110 |
|
---|
1111 | case 7:
|
---|
1112 | check_point(41);
|
---|
1113 | check_assert(hrtcnt == 2000001U);
|
---|
1114 |
|
---|
1115 | return;
|
---|
1116 |
|
---|
1117 | check_point(0);
|
---|
1118 |
|
---|
1119 | case 8:
|
---|
1120 | check_point(46);
|
---|
1121 | check_assert(hrtcnt == 2999981U);
|
---|
1122 |
|
---|
1123 | return;
|
---|
1124 |
|
---|
1125 | check_point(0);
|
---|
1126 |
|
---|
1127 | case 9:
|
---|
1128 | check_point(56);
|
---|
1129 | check_assert(hrtcnt == 2999931U);
|
---|
1130 |
|
---|
1131 | return;
|
---|
1132 |
|
---|
1133 | check_point(0);
|
---|
1134 |
|
---|
1135 | case 10:
|
---|
1136 | check_point(67);
|
---|
1137 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
1138 |
|
---|
1139 | return;
|
---|
1140 |
|
---|
1141 | check_point(0);
|
---|
1142 |
|
---|
1143 | case 11:
|
---|
1144 | check_point(69);
|
---|
1145 | check_assert(hrtcnt == 1001U);
|
---|
1146 |
|
---|
1147 | return;
|
---|
1148 |
|
---|
1149 | check_point(0);
|
---|
1150 |
|
---|
1151 | case 12:
|
---|
1152 | check_point(81);
|
---|
1153 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
1154 |
|
---|
1155 | return;
|
---|
1156 |
|
---|
1157 | check_point(0);
|
---|
1158 |
|
---|
1159 | case 13:
|
---|
1160 | check_point(84);
|
---|
1161 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
1162 |
|
---|
1163 | return;
|
---|
1164 |
|
---|
1165 | check_point(0);
|
---|
1166 |
|
---|
1167 | case 14:
|
---|
1168 | check_point(89);
|
---|
1169 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
1170 |
|
---|
1171 | return;
|
---|
1172 |
|
---|
1173 | check_point(0);
|
---|
1174 |
|
---|
1175 | case 15:
|
---|
1176 | check_point(97);
|
---|
1177 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
1178 |
|
---|
1179 | return;
|
---|
1180 |
|
---|
1181 | check_point(0);
|
---|
1182 |
|
---|
1183 | case 16:
|
---|
1184 | check_point(102);
|
---|
1185 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
1186 |
|
---|
1187 | return;
|
---|
1188 |
|
---|
1189 | check_point(0);
|
---|
1190 |
|
---|
1191 | case 17:
|
---|
1192 | check_point(107);
|
---|
1193 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
1194 |
|
---|
1195 | return;
|
---|
1196 |
|
---|
1197 | check_point(0);
|
---|
1198 |
|
---|
1199 | case 18:
|
---|
1200 | check_point(115);
|
---|
1201 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
1202 |
|
---|
1203 | return;
|
---|
1204 |
|
---|
1205 | check_point(0);
|
---|
1206 |
|
---|
1207 | default:
|
---|
1208 | check_point(0);
|
---|
1209 | }
|
---|
1210 | check_point(0);
|
---|
1211 | }
|
---|