Lines Matching refs:c_idx

160 	uint32_t c_idx = SIP_SVC_ID_INVALID;  in sip_svc_register()  local
174 c_idx = sip_svc_id_mgr_alloc(ctrl->client_id_pool); in sip_svc_register()
175 if (c_idx != SIP_SVC_ID_INVALID) { in sip_svc_register()
176 ctrl->clients[c_idx].id = c_idx; in sip_svc_register()
177 ctrl->clients[c_idx].token = sip_svc_generate_c_token(); in sip_svc_register()
178 ctrl->clients[c_idx].state = SIP_SVC_CLIENT_ST_IDLE; in sip_svc_register()
179 ctrl->clients[c_idx].priv_data = priv_data; in sip_svc_register()
181 LOG_INF("Register the client channel 0x%x", ctrl->clients[c_idx].token); in sip_svc_register()
182 return ctrl->clients[c_idx].token; in sip_svc_register()
192 uint32_t c_idx; in sip_svc_unregister() local
206 c_idx = sip_svc_get_c_idx(ctrl, c_token); in sip_svc_unregister()
207 if (c_idx == SIP_SVC_ID_INVALID) { in sip_svc_unregister()
212 if (ctrl->clients[c_idx].id == SIP_SVC_ID_INVALID) { in sip_svc_unregister()
217 if (ctrl->clients[c_idx].active_trans_cnt != 0) { in sip_svc_unregister()
222 if (ctrl->clients[c_idx].state != SIP_SVC_CLIENT_ST_IDLE) { in sip_svc_unregister()
227 LOG_INF("Unregister the client channel 0x%x", ctrl->clients[c_idx].token); in sip_svc_unregister()
228 ctrl->clients[c_idx].id = SIP_SVC_ID_INVALID; in sip_svc_unregister()
229 ctrl->clients[c_idx].state = SIP_SVC_CLIENT_ST_INVALID; in sip_svc_unregister()
230 ctrl->clients[c_idx].token = SIP_SVC_ID_INVALID; in sip_svc_unregister()
231 ctrl->clients[c_idx].priv_data = NULL; in sip_svc_unregister()
232 sip_svc_id_mgr_free(ctrl->client_id_pool, c_idx); in sip_svc_unregister()
266 uint32_t c_idx; in sip_svc_open() local
294 c_idx = sip_svc_get_c_idx(ctrl, c_token); in sip_svc_open()
295 if (c_idx == SIP_SVC_ID_INVALID) { in sip_svc_open()
303 if (ctrl->clients[c_idx].state == SIP_SVC_CLIENT_ST_OPEN) { in sip_svc_open()
311 if (ctrl->clients[c_idx].state != SIP_SVC_CLIENT_ST_IDLE) { in sip_svc_open()
330 ctrl->clients[c_idx].state = SIP_SVC_CLIENT_ST_OPEN; in sip_svc_open()
344 uint32_t c_idx; in sip_svc_close() local
368 c_idx = sip_svc_get_c_idx(ctrl, c_token); in sip_svc_close()
369 if (c_idx == SIP_SVC_ID_INVALID) { in sip_svc_close()
374 if (ctrl->clients[c_idx].state != SIP_SVC_CLIENT_ST_OPEN) { in sip_svc_close()
375 LOG_ERR("Client is in wrong state %d", ctrl->clients[c_idx].state); in sip_svc_close()
380 if (ctrl->clients[c_idx].active_trans_cnt != 0) { in sip_svc_close()
381 ctrl->clients[c_idx].state = SIP_SVC_CLIENT_ST_ABORT; in sip_svc_close()
383 ctrl->clients[c_idx].state = SIP_SVC_CLIENT_ST_IDLE; in sip_svc_close()
391 LOG_INF("Close the client channel 0x%x", ctrl->clients[c_idx].token); in sip_svc_close()
400 uint64_t c_idx; in sip_svc_callback() local
424 c_idx = (uint64_t)trans_id_item->arg6; in sip_svc_callback()
425 __ASSERT(c_idx < ctrl->num_clients, "c_idx shouldn't be greater than ctrl->num_clients"); in sip_svc_callback()
427 __ASSERT(ctrl->clients[c_idx].active_trans_cnt != 0, in sip_svc_callback()
429 --ctrl->clients[c_idx].active_trans_cnt; in sip_svc_callback()
431 if (ctrl->clients[c_idx].state == SIP_SVC_CLIENT_ST_OPEN && trans_id_item->arg1) { in sip_svc_callback()
433 ((sip_svc_cb_fn)(trans_id_item->arg1))(ctrl->clients[c_idx].token, response); in sip_svc_callback()
447 sip_svc_id_mgr_free(ctrl->clients[c_idx].trans_idx_pool, in sip_svc_callback()
450 if (ctrl->clients[c_idx].active_trans_cnt != 0) { in sip_svc_callback()
455 if (ctrl->clients[c_idx].state == SIP_SVC_CLIENT_ST_ABORT) { in sip_svc_callback()
456 ctrl->clients[c_idx].state = SIP_SVC_CLIENT_ST_IDLE; in sip_svc_callback()
674 uint32_t c_idx; in sip_svc_send() local
695 c_idx = sip_svc_get_c_idx(ctrl, c_token); in sip_svc_send()
696 if (c_idx == SIP_SVC_ID_INVALID) { in sip_svc_send()
701 if (ctrl->clients[c_idx].state != SIP_SVC_CLIENT_ST_OPEN) { in sip_svc_send()
707 trans_idx = sip_svc_id_mgr_alloc(ctrl->clients[c_idx].trans_idx_pool); in sip_svc_send()
714 trans_id = sip_svc_plat_format_trans_id(ctrl->dev, c_idx, trans_idx); in sip_svc_send()
718 sip_svc_id_mgr_free(ctrl->clients[c_idx].trans_idx_pool, trans_idx); in sip_svc_send()
731 request->priv_data, (void *)(uint64_t)c_idx) != 0) { in sip_svc_send()
734 sip_svc_id_mgr_free(ctrl->clients[c_idx].trans_idx_pool, trans_idx); in sip_svc_send()
744 sip_svc_id_mgr_free(ctrl->clients[c_idx].trans_idx_pool, trans_idx); in sip_svc_send()
748 ++ctrl->clients[c_idx].active_trans_cnt; in sip_svc_send()
753 sip_svc_id_mgr_free(ctrl->clients[c_idx].trans_idx_pool, trans_idx); in sip_svc_send()
767 uint32_t c_idx; in sip_svc_get_priv_data() local
782 c_idx = sip_svc_get_c_idx(ctrl, c_token); in sip_svc_get_priv_data()
783 if (c_idx == SIP_SVC_ID_INVALID) { in sip_svc_get_priv_data()
790 return ctrl->clients[c_idx].priv_data; in sip_svc_get_priv_data()