static u32 vcd_open_in_ready (struct vcd_drv_ctxt *drv_ctxt, s32 driver_handle, u32 decoding, void (*callback) (u32 event, u32 status, void *info, size_t sz, void *handle, void *const client_data), void *client_data) { struct vcd_clnt_ctxt *cctxt; struct vcd_handle_container container; u32 rc; VCD_MSG_LOW("vcd_open_in_dev_ready:"); rc = vcd_open_cmn(drv_ctxt, driver_handle, decoding, callback, client_data, &cctxt); VCD_FAILED_RETURN(rc, "Failed: vcd_open_cmn"); rc = vcd_init_client_context(cctxt); if (!VCD_FAILED(rc)) { container.handle = (void *)cctxt; callback(VCD_EVT_RESP_OPEN, VCD_S_SUCCESS, &container, sizeof(container), container.handle, client_data); } else { VCD_MSG_ERROR("rc = 0x%x. Failed: vcd_init_client_context", rc); vcd_destroy_client_context(cctxt); } return rc; }
static void vcd_dev_cb_in_initing (struct vcd_drv_ctxt *drv_ctxt, u32 event, u32 status, void *payload, size_t sz, u32 *ddl_handle, void *const client_data) { struct vcd_dev_ctxt *dev_ctxt; struct vcd_clnt_ctxt *client; struct vcd_clnt_ctxt *tmp_client; struct vcd_handle_container container; u32 rc = VCD_S_SUCCESS; u32 client_inited = false; u32 fail_all_open = false; VCD_MSG_LOW("vcd_dev_cb_in_initing:"); if (event != VCD_EVT_RESP_DEVICE_INIT) { VCD_MSG_ERROR("vcd_dev_cb_in_initing: Unexpected event %d", (int)event); return; } dev_ctxt = &drv_ctxt->dev_ctxt; dev_ctxt->command_continue = false; if (VCD_FAILED(status)) { vcd_handle_device_init_failed(drv_ctxt, status); return; } vcd_do_device_state_transition(drv_ctxt, VCD_DEVICE_STATE_READY, DEVICE_STATE_EVENT_NUMBER(open)); if (!dev_ctxt->cctxt_list_head) { VCD_MSG_HIGH("All clients are closed"); dev_ctxt->pending_cmd = VCD_CMD_DEVICE_TERM; return; } if (!dev_ctxt->ddl_cmd_ch_depth || !dev_ctxt->trans_tbl) rc = vcd_setup_with_ddl_capabilities(dev_ctxt); if (VCD_FAILED(rc)) { VCD_MSG_ERROR ("rc = 0x%x: Failed vcd_setup_with_ddl_capabilities", rc); fail_all_open = true; } client = dev_ctxt->cctxt_list_head; while (client) { if (!fail_all_open) rc = vcd_init_client_context(client); if (!VCD_FAILED(rc)) { container.handle = (void *)client; client->callback(VCD_EVT_RESP_OPEN, VCD_S_SUCCESS, &container, sizeof(container), container.handle, client->client_data); client = client->next; client_inited = true; } else { VCD_MSG_ERROR ("rc = 0x%x, Failed: vcd_init_client_context", rc); client->callback(VCD_EVT_RESP_OPEN, rc, NULL, 0, 0, client->client_data); tmp_client = client; client = client->next; vcd_destroy_client_context(tmp_client); } } if (!client_inited || fail_all_open) { VCD_MSG_ERROR("All client open requests failed"); dev_ctxt->pending_cmd = VCD_CMD_DEVICE_TERM; } else { if (vcd_power_event(dev_ctxt, NULL, VCD_EVT_PWR_DEV_INIT_END)) { VCD_MSG_ERROR("VCD_EVT_PWR_DEV_INIT_END failed"); } } }
static void vcd_dev_cb_in_initing (struct vcd_drv_ctxt_type_t *p_drv_ctxt, u32 event, u32 status, void *p_payload, u32 size, u32 *ddl_handle, void *const p_client_data) { struct vcd_dev_ctxt_type *p_dev_ctxt; struct vcd_clnt_ctxt_type_t *p_client; struct vcd_clnt_ctxt_type_t *p_tmp_client; struct vcd_handle_container_type container; u32 rc = VCD_S_SUCCESS; u32 b_client_inited = FALSE; u32 b_fail_all_open = FALSE; VCD_MSG_LOW("vcd_dev_cb_in_initing:"); if (event != VCD_EVT_RESP_DEVICE_INIT) { VCD_MSG_ERROR("vcd_dev_cb_in_initing: Unexpected event %d", (int)event); return; } p_dev_ctxt = &p_drv_ctxt->dev_ctxt; p_dev_ctxt->b_continue = FALSE; if (VCD_FAILED(status)) { vcd_handle_device_init_failed(p_drv_ctxt, status); return; } vcd_do_device_state_transition(p_drv_ctxt, VCD_DEVICE_STATE_READY, DEVICE_STATE_EVENT_NUMBER(pf_open)); if (!p_dev_ctxt->p_cctxt_list_head) { VCD_MSG_HIGH("All clients are closed"); p_dev_ctxt->e_pending_cmd = VCD_CMD_DEVICE_TERM; return; } if (!p_dev_ctxt->n_ddl_cmd_ch_depth || !p_dev_ctxt->a_trans_tbl) rc = vcd_setup_with_ddl_capabilities(p_dev_ctxt); if (VCD_FAILED(rc)) { VCD_MSG_ERROR ("rc = 0x%x: Failed vcd_setup_with_ddl_capabilities", rc); b_fail_all_open = TRUE; } p_client = p_dev_ctxt->p_cctxt_list_head; while (p_client) { if (!b_fail_all_open) rc = vcd_init_client_context(p_client); if (!VCD_FAILED(rc)) { container.handle = (void *)p_client; p_client->callback(VCD_EVT_RESP_OPEN, VCD_S_SUCCESS, &container, sizeof(container), container.handle, p_client->p_client_data); p_client = p_client->p_next; b_client_inited = TRUE; } else { VCD_MSG_ERROR ("rc = 0x%x, Failed: vcd_init_client_context", rc); p_client->callback(VCD_EVT_RESP_OPEN, rc, NULL, 0, 0, p_client->p_client_data); p_tmp_client = p_client; p_client = p_client->p_next; vcd_destroy_client_context(p_tmp_client); } } if (!b_client_inited || b_fail_all_open) { VCD_MSG_ERROR("All client open requests failed"); p_dev_ctxt->e_pending_cmd = VCD_CMD_DEVICE_TERM; } else { if (vcd_power_event(p_dev_ctxt, NULL, VCD_EVT_PWR_DEV_INIT_END)) { VCD_MSG_ERROR("VCD_EVT_PWR_DEV_INIT_END failed"); } } }