MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / list_timer

Function list_timer

components/finsh/cmd.c:776–838  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

774#endif /* RT_USING_MEMPOOL */
775
776long list_timer(void)
777{
778 rt_base_t level;
779 list_get_next_t find_arg;
780 struct rt_object_information *info;
781 rt_list_t *obj_list[LIST_FIND_OBJ_NR];
782 rt_list_t *next = (rt_list_t *)RT_NULL;
783
784 int maxlen;
785 const char *item_title = "timer";
786
787 list_find_init(&find_arg, RT_Object_Class_Timer, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
788 info = rt_list_entry(find_arg.list, struct rt_object_information, object_list);
789
790 maxlen = RT_NAME_MAX;
791
792 rt_kprintf("%-*.*s periodic timeout activated mode\n", maxlen, maxlen, item_title);
793 object_split(maxlen);
794 rt_kprintf(" ---------- ---------- ----------- ---------\n");
795 do
796 {
797 next = list_get_next(next, &find_arg);
798 {
799 int i;
800 for (i = 0; i < find_arg.nr_out; i++)
801 {
802 struct rt_object *obj;
803 struct rt_timer *timer;
804
805 obj = rt_list_entry(obj_list[i], struct rt_object, list);
806 level = rt_spin_lock_irqsave(&info->spinlock);
807 if ((obj->type & ~RT_Object_Class_Static) != find_arg.type)
808 {
809 rt_spin_unlock_irqrestore(&info->spinlock, level);
810 continue;
811 }
812
813 rt_spin_unlock_irqrestore(&info->spinlock, level);
814
815 timer = (struct rt_timer *)obj;
816 rt_kprintf("%-*.*s 0x%08x 0x%08x ",
817 maxlen, RT_NAME_MAX,
818 timer->parent.name,
819 timer->init_tick,
820 timer->timeout_tick);
821 if (timer->parent.flag & RT_TIMER_FLAG_ACTIVATED)
822 rt_kprintf("activated ");
823 else
824 rt_kprintf("deactivated ");
825 if (timer->parent.flag & RT_TIMER_FLAG_PERIODIC)
826 rt_kprintf("periodic\n");
827 else
828 rt_kprintf("one shot\n");
829
830 }
831 }
832 }
833 while (next != (rt_list_t *)RT_NULL);

Callers 1

cmd_listFunction · 0.85

Calls 7

rt_kprintfFunction · 0.85
rt_tick_getFunction · 0.85
list_find_initFunction · 0.70
object_splitFunction · 0.70
list_get_nextFunction · 0.70
rt_spin_lock_irqsaveFunction · 0.50

Tested by

no test coverage detected