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

Function sys_run_task

bsp/ht32/ht32f12366/applications/test.c:122–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122static int sys_run_task(int argc, char *argv[])
123{
124 if(argc == 2)
125 {
126 if(rt_strcmp(argv[1],"start") == 0)
127 {
128 if(rt_mutex_take(task_mutex, RT_WAITING_NO) != RT_EOK)
129 {
130 rt_kprintf("The test thread is occupied.\n");
131 return -RT_ERROR;
132 }
133 else
134 {
135 /* Register the system indicator task */
136 rt_thread_t sys_led_task = rt_thread_create("sys_led_task",
137 sys_run_dir, RT_NULL,
138 THREAD_STACK_SIZE,
139 THREAD_PRIORITY, THREAD_TIMESLICE);
140 if (sys_led_task != RT_NULL)
141 rt_thread_startup(sys_led_task);
142 rt_kprintf("The sys run task is registered.\n");
143 }
144 }
145 else if(rt_strcmp(argv[1],"end") == 0)
146 {
147 rt_event_send(&task_event,TASK_KILL_FLAG);
148 rt_mutex_release(task_mutex);
149 rt_kprintf("The sys run task has been deleted.\n");
150 }
151 }
152 else
153 {
154 rt_kprintf("Necessary parameters are missing.\n");
155 rt_kprintf("You can use the following commands.\n");
156 rt_kprintf("%s start\n",__func__);
157 rt_kprintf("%s end\n",__func__);
158 return -1;
159 }
160 return -1;
161}
162MSH_CMD_EXPORT(sys_run_task, sys run task operation);
163
164/* Gpio output test */

Callers

nothing calls this directly

Calls 7

rt_strcmpFunction · 0.85
rt_mutex_takeFunction · 0.85
rt_kprintfFunction · 0.85
rt_thread_createFunction · 0.85
rt_thread_startupFunction · 0.85
rt_event_sendFunction · 0.85
rt_mutex_releaseFunction · 0.85

Tested by

no test coverage detected