aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/tl_mbox/unsafe_linked_list.rs44
1 files changed, 22 insertions, 22 deletions
diff --git a/embassy-stm32/src/tl_mbox/unsafe_linked_list.rs b/embassy-stm32/src/tl_mbox/unsafe_linked_list.rs
index 45bf5bdae..482e2bf5a 100644
--- a/embassy-stm32/src/tl_mbox/unsafe_linked_list.rs
+++ b/embassy-stm32/src/tl_mbox/unsafe_linked_list.rs
@@ -30,29 +30,29 @@ impl Default for LinkedListNode {
30} 30}
31 31
32impl LinkedListNode { 32impl LinkedListNode {
33 pub unsafe fn init_head(mut listHead: *mut LinkedListNode) { 33 pub unsafe fn init_head(mut list_head: *mut LinkedListNode) {
34 (*listHead).next = listHead; 34 (*list_head).next = list_head;
35 (*listHead).prev = listHead; 35 (*list_head).prev = list_head;
36 } 36 }
37 37
38 pub unsafe fn is_empty(mut listHead: *mut LinkedListNode) -> bool { 38 pub unsafe fn is_empty(mut list_head: *mut LinkedListNode) -> bool {
39 interrupt::free(|_| ((*listHead).next) == listHead) 39 interrupt::free(|_| ((*list_head).next) == list_head)
40 } 40 }
41 41
42 pub unsafe fn insert_head(mut listHead: *mut LinkedListNode, mut node: *mut LinkedListNode) { 42 pub unsafe fn insert_head(mut list_head: *mut LinkedListNode, mut node: *mut LinkedListNode) {
43 interrupt::free(|_| { 43 interrupt::free(|_| {
44 (*node).next = (*listHead).next; 44 (*node).next = (*list_head).next;
45 (*node).prev = listHead; 45 (*node).prev = list_head;
46 (*listHead).next = node; 46 (*list_head).next = node;
47 (*(*node).next).prev = node; 47 (*(*node).next).prev = node;
48 }); 48 });
49 } 49 }
50 50
51 pub unsafe fn insert_tail(mut listHead: *mut LinkedListNode, mut node: *mut LinkedListNode) { 51 pub unsafe fn insert_tail(mut list_head: *mut LinkedListNode, mut node: *mut LinkedListNode) {
52 interrupt::free(|_| { 52 interrupt::free(|_| {
53 (*node).next = listHead; 53 (*node).next = list_head;
54 (*node).prev = (*listHead).prev; 54 (*node).prev = (*list_head).prev;
55 (*listHead).prev = node; 55 (*list_head).prev = node;
56 (*(*node).prev).next = node; 56 (*(*node).prev).next = node;
57 }); 57 });
58 } 58 }
@@ -64,17 +64,17 @@ impl LinkedListNode {
64 }); 64 });
65 } 65 }
66 66
67 pub unsafe fn remove_head(mut listHead: *mut LinkedListNode, mut node: *mut *mut LinkedListNode) { 67 pub unsafe fn remove_head(mut list_head: *mut LinkedListNode, mut node: *mut *mut LinkedListNode) {
68 interrupt::free(|_| { 68 interrupt::free(|_| {
69 *node = (*listHead).next; 69 *node = (*list_head).next;
70 Self::remove_node((*listHead).next); 70 Self::remove_node((*list_head).next);
71 }); 71 });
72 } 72 }
73 73
74 pub unsafe fn remove_tail(mut listHead: *mut LinkedListNode, mut node: *mut *mut LinkedListNode) { 74 pub unsafe fn remove_tail(mut list_head: *mut LinkedListNode, mut node: *mut *mut LinkedListNode) {
75 interrupt::free(|_| { 75 interrupt::free(|_| {
76 *node = (*listHead).prev; 76 *node = (*list_head).prev;
77 Self::remove_node((*listHead).prev); 77 Self::remove_node((*list_head).prev);
78 }); 78 });
79 } 79 }
80 80
@@ -96,13 +96,13 @@ impl LinkedListNode {
96 }); 96 });
97 } 97 }
98 98
99 pub unsafe fn get_size(mut listHead: *mut LinkedListNode) -> usize { 99 pub unsafe fn get_size(mut list_head: *mut LinkedListNode) -> usize {
100 interrupt::free(|_| { 100 interrupt::free(|_| {
101 let mut size = 0; 101 let mut size = 0;
102 let mut temp: *mut LinkedListNode = core::ptr::null_mut::<LinkedListNode>(); 102 let mut temp: *mut LinkedListNode = core::ptr::null_mut::<LinkedListNode>();
103 103
104 temp = (*listHead).next; 104 temp = (*list_head).next;
105 while temp != listHead { 105 while temp != list_head {
106 size += 1; 106 size += 1;
107 temp = (*temp).next 107 temp = (*temp).next
108 } 108 }