* @ingroup group_system_init * * @brief This function will initialize system timer thread */
| 840 | * @brief This function will initialize system timer thread |
| 841 | */ |
| 842 | void rt_system_timer_thread_init(void) |
| 843 | { |
| 844 | #ifdef RT_USING_TIMER_SOFT |
| 845 | int i; |
| 846 | |
| 847 | for (i = 0; |
| 848 | i < sizeof(_soft_timer_list) / sizeof(_soft_timer_list[0]); |
| 849 | i++) |
| 850 | { |
| 851 | rt_list_init(_soft_timer_list + i); |
| 852 | } |
| 853 | rt_spin_lock_init(&_stimer_lock); |
| 854 | rt_sem_init(&_soft_timer_sem, "stimer", 0, RT_IPC_FLAG_PRIO); |
| 855 | rt_sem_control(&_soft_timer_sem, RT_IPC_CMD_SET_VLIMIT, (void*)1); |
| 856 | /* start software timer thread */ |
| 857 | rt_thread_init(&_timer_thread, |
| 858 | "timer", |
| 859 | _timer_thread_entry, |
| 860 | RT_NULL, |
| 861 | &_timer_thread_stack[0], |
| 862 | sizeof(_timer_thread_stack), |
| 863 | RT_TIMER_THREAD_PRIO, |
| 864 | 10); |
| 865 | |
| 866 | /* startup */ |
| 867 | rt_thread_startup(&_timer_thread); |
| 868 | #endif /* RT_USING_TIMER_SOFT */ |
| 869 | } |
| 870 | |
| 871 | /**@}*/ |
no test coverage detected