Insert Timer into the Timer List sorted by Time. \param[in] timer timer object. \param[in] tick timer tick.
| 40 | /// \param[in] timer timer object. |
| 41 | /// \param[in] tick timer tick. |
| 42 | static void TimerInsert (os_timer_t *timer, uint32_t tick) { |
| 43 | os_timer_t *prev, *next; |
| 44 | |
| 45 | prev = NULL; |
| 46 | next = osRtxInfo.timer.list; |
| 47 | while ((next != NULL) && (next->tick <= tick)) { |
| 48 | tick -= next->tick; |
| 49 | prev = next; |
| 50 | next = next->next; |
| 51 | } |
| 52 | timer->tick = tick; |
| 53 | timer->prev = prev; |
| 54 | timer->next = next; |
| 55 | if (next != NULL) { |
| 56 | next->tick -= timer->tick; |
| 57 | next->prev = timer; |
| 58 | } |
| 59 | if (prev != NULL) { |
| 60 | prev->next = timer; |
| 61 | } else { |
| 62 | osRtxInfo.timer.list = timer; |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | /// Remove Timer from the Timer List. |
| 67 | /// \param[in] timer timer object. |
no outgoing calls
no test coverage detected