Lines Matching defs:task_id
85 UINT8 task_id; /* GKI task id */
106 GKI_TRACE_5("gki_task_entry task_id=%i, thread_id=%x/%x, pCond/pMutex=%x/%x", p_pthread_info->task_id,
107 gki_cb.os.thread_id[p_pthread_info->task_id], pthread_self(),
110 gki_cb.os.thread_id[p_pthread_info->task_id] = thread_id;
114 GKI_TRACE_1("gki_task task_id=%i terminating", p_pthread_info->task_id);
115 gki_cb.os.thread_id[p_pthread_info->task_id] = 0;
204 ** task_id - (input) Task id is mapped to priority
216 UINT8 GKI_create_task (TASKPTR task_entry, UINT8 task_id, INT8 *taskname, UINT16 *stack, UINT16 stacksize, void* pCondVar, void* pMutex)
224 GKI_TRACE_5 ("GKI_create_task func=0x%x id=%d name=%s stack=0x%x stackSize=%d", task_entry, task_id, taskname, stack, stacksize);
226 if (task_id >= GKI_MAX_TASKS)
233 gki_cb.com.OSRdyTbl[task_id] = TASK_READY;
234 gki_cb.com.OSTName[task_id] = taskname;
235 gki_cb.com.OSWaitTmr[task_id] = 0;
236 gki_cb.com.OSWaitEvt[task_id] = 0;
239 pthread_mutex_init(&gki_cb.os.thread_evt_mutex[task_id], NULL);
240 pthread_cond_init (&gki_cb.os.thread_evt_cond[task_id], NULL);
241 pthread_mutex_init(&gki_cb.os.thread_timeout_mutex[task_id], NULL);
242 pthread_cond_init (&gki_cb.os.thread_timeout_cond[task_id], NULL);
249 GKI_TRACE_3("GKI creating task %i, pCond/pMutex=%x/%x", task_id, pCondVar, pMutex);
251 GKI_TRACE_1("GKI creating JOINABLE task %i", task_id);
254 /* On Android, the new tasks starts running before 'gki_cb.os.thread_id[task_id]' is initialized */
255 /* Pass task_id to new task so it can initialize gki_cb.os.thread_id[task_id] for it calls GKI_wait */
256 gki_pthread_info[task_id].task_id = task_id;
257 gki_pthread_info[task_id].task_entry = task_entry;
258 gki_pthread_info[task_id].params = 0;
259 gki_pthread_info[task_id].pCond = (pthread_cond_t*)pCondVar;
260 gki_pthread_info[task_id].pMutex = (pthread_mutex_t*)pMutex;
262 ret = pthread_create( &gki_cb.os.thread_id[task_id],
265 &gki_pthread_info[task_id]);
273 if(pthread_getschedparam(gki_cb.os.thread_id[task_id], &policy, ¶m)==0)
276 if (task_id == PBS_SQL_TASK)
285 param.sched_priority = 30 - task_id - 2;
287 pthread_setschedparam(gki_cb.os.thread_id[task_id], policy, ¶m);
292 task_id,
293 gki_cb.os.thread_id[task_id],
320 UINT8 task_id;
331 for (task_id = GKI_MAX_TASKS; task_id > 0; task_id--)
333 if (gki_cb.com.OSRdyTbl[task_id - 1] != TASK_DEAD)
335 gki_cb.com.OSRdyTbl[task_id - 1] = TASK_DEAD;
338 gki_cb.com.OSWaitEvt[task_id-1] &= ~(TASK_MBOX_0_EVT_MASK|TASK_MBOX_1_EVT_MASK|
340 GKI_send_event(task_id - 1, EVENT_MASK(GKI_SHUTDOWN_EVT));
345 while ((gki_cb.com.OSWaitEvt[task_id - 1] != 0) && (++i < 10))
349 result = pthread_join( gki_cb.os.thread_id[task_id-1], NULL );
355 GKI_TRACE_1( "GKI_shutdown(): task %s dead", gki_cb.com.OSTName[task_id]);
356 GKI_exit_task(task_id - 1);
586 UINT8 task_id;
591 for(task_id = 0; task_id<GKI_MAX_TASKS; task_id++)
593 if(gki_cb.com.OSRdyTbl[task_id] != TASK_DEAD)
595 GKI_exit_task(task_id);
788 ** Parameters: task_id - (input) The id of the task to which the event has to
796 UINT8 GKI_send_event (UINT8 task_id, UINT16 event)
798 GKI_TRACE_2("GKI_send_event %d %x", task_id, event);
801 if (task_id < GKI_MAX_TASKS)
803 /* protect OSWaitEvt[task_id] from manipulation in GKI_wait() */
804 pthread_mutex_lock(&gki_cb.os.thread_evt_mutex[task_id]);
807 gki_cb.com.OSWaitEvt[task_id] |= event;
809 pthread_cond_signal(&gki_cb.os.thread_evt_cond[task_id]);
811 pthread_mutex_unlock(&gki_cb.os.thread_evt_mutex[task_id]);
813 GKI_TRACE_2("GKI_send_event %d %x done", task_id, event);
828 ** Parameters: task_id - (input) The destination task Id for the event.
839 UINT8 GKI_isend_event (UINT8 task_id, UINT16 event)
842 GKI_TRACE_2("GKI_isend_event %d %x", task_id, event);
843 GKI_TRACE_2("GKI_isend_event %d %x done", task_id, event);
844 return GKI_send_event(task_id, event);
887 ** Parameters: task_id - (input) The id of the task whose name is being
896 INT8 *GKI_map_taskname (UINT8 task_id)
898 GKI_TRACE_1("GKI_map_taskname %d", task_id);
900 if (task_id < GKI_MAX_TASKS)
902 GKI_TRACE_2("GKI_map_taskname %d %s done", task_id, gki_cb.com.OSTName[task_id]);
903 return (gki_cb.com.OSTName[task_id]);
905 else if (task_id == GKI_MAX_TASKS )
974 UINT8 task_id;
979 for(task_id = 0; task_id < GKI_MAX_TASKS; task_id++)
982 task_id,
983 gki_cb.com.OSTName[task_id],
984 gki_cb.com.OSRdyTbl[task_id]);
1137 ** Parameters: task_id - (input) the id of the task that has to suspended
1146 UINT8 GKI_suspend_task (UINT8 task_id)
1148 GKI_TRACE_1("GKI_suspend_task %d - NOT implemented", task_id);
1151 GKI_TRACE_1("GKI_suspend_task %d done", task_id);
1163 ** Parameters: task_id - (input) the id of the task that has to resumed
1172 UINT8 GKI_resume_task (UINT8 task_id)
1174 GKI_TRACE_1("GKI_resume_task %d - NOT implemented", task_id);
1177 GKI_TRACE_1("GKI_resume_task %d done", task_id);
1189 ** Parameters: task_id - (input) the id of the task that has to be stopped
1198 void GKI_exit_task (UINT8 task_id)
1201 gki_cb.com.OSRdyTbl[task_id] = TASK_DEAD;
1204 pthread_mutex_destroy(&gki_cb.os.thread_evt_mutex[task_id]);
1205 pthread_cond_destroy (&gki_cb.os.thread_evt_cond[task_id]);
1206 pthread_mutex_destroy(&gki_cb.os.thread_timeout_mutex[task_id]);
1207 pthread_cond_destroy (&gki_cb.os.thread_timeout_cond[task_id]);
1211 //GKI_send_event(task_id, EVENT_MASK(GKI_SHUTDOWN_EVT));
1213 GKI_TRACE_1("GKI_exit_task %d done", task_id);