1
This commit is contained in:
parent
a69795e9dd
commit
45963c4a6f
@ -104,10 +104,22 @@ impl XTimer {
|
|||||||
self.get_tick_count = Some(get_tick_count);
|
self.get_tick_count = Some(get_tick_count);
|
||||||
self.cache_timer_num = cache_timer_num;
|
self.cache_timer_num = cache_timer_num;
|
||||||
self.free_timer_num = 0;
|
self.free_timer_num = 0;
|
||||||
self.mut_traverse_timer_list(
|
self.work_list = crate::ListHead::<TimerList>::new_head();
|
||||||
&mut |timer_list: &mut TimerListListHeadRp| {
|
for i in 0..TVR_SIZE-1 {
|
||||||
*timer_list = crate::ListHead::<TimerList>::new_head();
|
self.tv1.push(crate::ListHead::<TimerList>::new_head());
|
||||||
});
|
}
|
||||||
|
for i in 0..TVN_SIZE-1 {
|
||||||
|
self.tv2.push(crate::ListHead::<TimerList>::new_head());
|
||||||
|
}
|
||||||
|
for i in 0..TVN_SIZE-1 {
|
||||||
|
self.tv3.push(crate::ListHead::<TimerList>::new_head());
|
||||||
|
}
|
||||||
|
for i in 0..TVN_SIZE-1 {
|
||||||
|
self.tv4.push(crate::ListHead::<TimerList>::new_head());
|
||||||
|
}
|
||||||
|
for i in 0..TVN_SIZE-1 {
|
||||||
|
self.tv5.push(crate::ListHead::<TimerList>::new_head());
|
||||||
|
}
|
||||||
match &self.get_tick_count {
|
match &self.get_tick_count {
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
self.timer_tick = (*v)();
|
self.timer_tick = (*v)();
|
||||||
@ -140,20 +152,6 @@ impl XTimer {
|
|||||||
for_each_cb(&self.tv5);
|
for_each_cb(&self.tv5);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mut_traverse_timer_list(&mut self, cb: &mut dyn FnMut (&mut TimerListListHeadRp)) {
|
|
||||||
(*cb)(&mut self.work_list);
|
|
||||||
let mut for_each_cb = |tv: &mut [TimerListListHeadRp]| {
|
|
||||||
for i in 0..tv.len() {
|
|
||||||
(*cb)(&mut tv[i]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
for_each_cb(&mut self.tv1);
|
|
||||||
for_each_cb(&mut self.tv2);
|
|
||||||
for_each_cb(&mut self.tv3);
|
|
||||||
for_each_cb(&mut self.tv4);
|
|
||||||
for_each_cb(&mut self.tv5);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn uninit(&mut self) {
|
pub fn uninit(&mut self) {
|
||||||
self.clear();
|
self.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user