@@ -63,25 +63,17 @@ static void armv7m_timer_insert(void *context, uint32_t data)
63
63
{
64
64
if (remaining < element -> remaining )
65
65
{
66
+ element -> remaining -= remaining ;
66
67
break ;
67
68
}
68
69
69
70
remaining -= element -> remaining ;
70
71
element = element -> next ;
71
72
}
72
73
73
- if (element != (armv7m_timer_t * )& armv7m_timer_control )
74
- {
75
- timer -> previous = element -> previous ;
76
- timer -> next = element ;
77
-
78
- }
79
- else
80
- {
81
- timer -> previous = element ;
82
- timer -> next = element -> next ;
83
- }
84
-
74
+ timer -> previous = element -> previous ;
75
+ timer -> next = element ;
76
+
85
77
timer -> previous -> next = timer ;
86
78
timer -> next -> previous = timer ;
87
79
@@ -177,25 +169,28 @@ static void armv7m_timer_callback(void *context, uint32_t data)
177
169
{
178
170
timer = armv7m_timer_control .next ;
179
171
180
- while (timer != (armv7m_timer_t * )& armv7m_timer_control )
172
+ if (timer != (armv7m_timer_t * )& armv7m_timer_control )
181
173
{
182
174
timer -> remaining -- ;
183
175
184
- if (timer -> remaining != 0 )
185
- {
186
- break ;
187
- }
188
-
189
- callback = timer -> callback ;
190
-
191
- armv7m_timer_remove (timer , 0 );
192
-
193
- if ((uint32_t )callback & 1 )
176
+ while (timer != (armv7m_timer_t * )& armv7m_timer_control )
194
177
{
195
- (* callback )(timer );
178
+ if (timer -> remaining )
179
+ {
180
+ break ;
181
+ }
182
+
183
+ callback = timer -> callback ;
184
+
185
+ armv7m_timer_remove (timer , 0 );
186
+
187
+ if ((uint32_t )callback & 1 )
188
+ {
189
+ (* callback )(timer );
190
+ }
191
+
192
+ timer = armv7m_timer_control .next ;
196
193
}
197
-
198
- timer = armv7m_timer_control .next ;
199
194
}
200
195
201
196
armv7m_timer_control .millis ++ ;
0 commit comments