static u32 vcd_pause_in_run(struct vcd_clnt_ctxt_type_t *p_cctxt) { u32 rc = VCD_S_SUCCESS; VCD_MSG_LOW("vcd_pause_in_run:"); if (p_cctxt->b_sched_clnt_valid) { rc = vcd_map_sched_status(sched_suspend_resume_client (p_cctxt->p_dev_ctxt->sched_hdl, p_cctxt->sched_clnt_hdl, FALSE)); } VCD_FAILED_RETURN(rc, "Failed: sched_suspend_resume_client"); if (p_cctxt->status.n_frame_submitted > 0) { vcd_do_client_state_transition(p_cctxt, VCD_CLIENT_STATE_PAUSING, CLIENT_STATE_EVENT_NUMBER (pf_pause)); } else { VCD_MSG_HIGH("No client frames are currently being processed"); vcd_do_client_state_transition(p_cctxt, VCD_CLIENT_STATE_PAUSED, CLIENT_STATE_EVENT_NUMBER (pf_pause)); p_cctxt->callback(VCD_EVT_RESP_PAUSE, VCD_S_SUCCESS, NULL, 0, p_cctxt, p_cctxt->p_client_data); rc = vcd_power_event(p_cctxt->p_dev_ctxt, p_cctxt, VCD_EVT_PWR_CLNT_PAUSE); if (VCD_FAILED(rc)) VCD_MSG_ERROR("VCD_EVT_PWR_CLNT_PAUSE_END failed"); } return VCD_S_SUCCESS; }
static u32 vcd_resume_in_paused(struct vcd_clnt_ctxt *cctxt) { struct vcd_dev_ctxt *dev_ctxt = cctxt->dev_ctxt; u32 rc = VCD_S_SUCCESS; VCD_MSG_LOW("vcd_resume_in_paused:"); if (cctxt->sched_clnt_hdl) { rc = vcd_power_event(cctxt->dev_ctxt, cctxt, VCD_EVT_PWR_CLNT_RESUME); if (VCD_FAILED(rc)) { VCD_MSG_ERROR("VCD_EVT_PWR_CLNT_RESUME failed"); } else { rc = vcd_sched_suspend_resume_clnt(cctxt, true); if (VCD_FAILED(rc)) { VCD_MSG_ERROR ("rc = 0x%x. Failed: " "vcd_sched_suspend_resume_clnt", rc); } } if (!VCD_FAILED(rc)) { vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_RUN, CLIENT_STATE_EVENT_NUMBER (resume)); vcd_try_submit_frame(dev_ctxt); } } else { vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_RUN, CLIENT_STATE_EVENT_NUMBER (resume)); } return rc; }
//LGE_S NEXTi dongkyu31.lee //static u32 vcd_pause_in_run(struct vcd_clnt_ctxt *cctxt) static u32 vcd_pause_cmn(struct vcd_clnt_ctxt *cctxt) { u32 rc = VCD_S_SUCCESS; //VCD_MSG_LOW("vcd_pause_in_run:"); VCD_MSG_LOW("vcd_pause_cmn:"); if (cctxt->sched_clnt_hdl) { rc = vcd_sched_suspend_resume_clnt(cctxt, false); VCD_FAILED_RETURN(rc, "Failed: vcd_sched_suspend_resume_clnt"); } if (cctxt->status.frame_submitted > 0) { vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_PAUSING, CLIENT_STATE_EVENT_NUMBER (pause)); } else { VCD_MSG_HIGH("No client frames are currently being processed"); vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_PAUSED, CLIENT_STATE_EVENT_NUMBER (pause)); cctxt->callback(VCD_EVT_RESP_PAUSE, VCD_S_SUCCESS, NULL, 0, cctxt, cctxt->client_data); rc = vcd_power_event(cctxt->dev_ctxt, cctxt, VCD_EVT_PWR_CLNT_PAUSE); if (VCD_FAILED(rc)) VCD_MSG_ERROR("VCD_EVT_PWR_CLNT_PAUSE_END failed"); } return VCD_S_SUCCESS; }
static u32 vcd_stop_cmn(struct vcd_clnt_ctxt *cctxt) { struct vcd_dev_ctxt *dev_ctxt = cctxt->dev_ctxt; u32 rc = VCD_S_SUCCESS; struct vcd_transc *transc; VCD_MSG_LOW("vcd_stop_cmn in %d:", cctxt->clnt_state.state); rc = vcd_flush_buffers(cctxt, VCD_FLUSH_ALL); VCD_FAILED_RETURN(rc, "Failed: vcd_flush_buffers"); if (!cctxt->status.frame_submitted) { if (vcd_get_command_channel(dev_ctxt, &transc)) { rc = vcd_power_event(dev_ctxt, cctxt, VCD_EVT_PWR_CLNT_CMD_BEGIN); if (!VCD_FAILED(rc)) { transc->type = VCD_CMD_CODEC_STOP; transc->cctxt = cctxt; rc = vcd_submit_cmd_sess_end(transc); } else { VCD_MSG_ERROR("Failed:" " VCD_EVT_PWR_CLNT_CMD_BEGIN"); } if (VCD_FAILED(rc)) { vcd_release_command_channel(dev_ctxt, transc); } } else { vcd_client_cmd_flush_and_en_q(cctxt, VCD_CMD_CODEC_STOP); } } if (VCD_FAILED(rc)) { (void)vcd_power_event(dev_ctxt, cctxt, VCD_EVT_PWR_CLNT_CMD_FAIL); } else { vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_STOPPING, CLIENT_STATE_EVENT_NUMBER (stop)); } return rc; }
static u32 vcd_encode_start_in_open(struct vcd_clnt_ctxt_type_t *p_cctxt) { u32 rc = VCD_S_SUCCESS; struct vcd_property_hdr_type prop_hdr; struct vcd_property_vop_timing_type timing; VCD_MSG_LOW("vcd_encode_start_in_open:"); if (p_cctxt->b_decoding) { VCD_MSG_ERROR("vcd_encode_init for decoder client"); return VCD_ERR_ILLEGAL_OP; } if (!p_cctxt->in_buf_pool.a_entries || !p_cctxt->out_buf_pool.a_entries || p_cctxt->in_buf_pool.n_validated != p_cctxt->in_buf_pool.n_count || p_cctxt->out_buf_pool.n_validated != p_cctxt->out_buf_pool.n_count) { VCD_MSG_ERROR("Buffer pool is not completely setup yet"); return VCD_ERR_BAD_STATE; } rc = vcd_sched_add_client(p_cctxt); VCD_FAILED_RETURN(rc, "Failed: vcd_sched_add_client"); prop_hdr.prop_id = VCD_I_VOP_TIMING; prop_hdr.n_size = sizeof(struct vcd_property_vop_timing_type); rc = ddl_get_property(p_cctxt->ddl_handle, &prop_hdr, &timing); VCD_FAILED_RETURN(rc, "Failed: Get VCD_I_VOP_TIMING"); if (!timing.n_vop_time_resolution) { VCD_MSG_ERROR("Vop_time_resolution value is zero"); return VCD_ERR_FAIL; } p_cctxt->n_time_resoln = timing.n_vop_time_resolution; rc = vcd_process_cmd_sess_start(p_cctxt); if (!VCD_FAILED(rc)) { vcd_do_client_state_transition(p_cctxt, VCD_CLIENT_STATE_STARTING, CLIENT_STATE_EVENT_NUMBER (pf_encode_start)); } return rc; }
static u32 vcd_encode_start_in_open(struct vcd_clnt_ctxt *cctxt) { u32 rc = VCD_S_SUCCESS; struct vcd_property_hdr prop_hdr; struct vcd_property_vop_timing timing; VCD_MSG_LOW("vcd_encode_start_in_open:"); if (cctxt->decoding) { VCD_MSG_ERROR("vcd_encode_init for decoder client"); return VCD_ERR_ILLEGAL_OP; } if ((!cctxt->meta_mode && !cctxt->in_buf_pool.entries) || !cctxt->out_buf_pool.entries || (!cctxt->meta_mode && cctxt->in_buf_pool.validated != cctxt->in_buf_pool.count) || cctxt->out_buf_pool.validated != cctxt->out_buf_pool.count) { VCD_MSG_HIGH("%s: Buffer pool is not completely setup yet", __func__); } rc = vcd_sched_add_client(cctxt); VCD_FAILED_RETURN(rc, "Failed: vcd_sched_add_client"); prop_hdr.prop_id = VCD_I_VOP_TIMING; prop_hdr.sz = sizeof(struct vcd_property_vop_timing); rc = ddl_get_property(cctxt->ddl_handle, &prop_hdr, &timing); VCD_FAILED_RETURN(rc, "Failed: Get VCD_I_VOP_TIMING"); if (!timing.vop_time_resolution) { VCD_MSG_ERROR("Vop_time_resolution value is zero"); return VCD_ERR_FAIL; } cctxt->time_resoln = timing.vop_time_resolution; rc = vcd_process_cmd_sess_start(cctxt); if (!VCD_FAILED(rc)) { vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_STARTING, CLIENT_STATE_EVENT_NUMBER (encode_start)); } return rc; }
static u32 vcd_fill_output_buffer_in_eos (struct vcd_clnt_ctxt_type_t *p_cctxt, struct vcd_frame_data_type *p_buffer) { u32 rc = VCD_S_SUCCESS; struct vcd_buffer_entry_type *p_buf_entry; VCD_MSG_LOW("vcd_fill_output_buffer_in_eos:"); p_buf_entry = vcd_check_fill_output_buffer(p_cctxt, p_buffer); if (!p_buf_entry) return VCD_ERR_BAD_POINTER; if (p_cctxt->status.b_eos_wait_for_op_buf) { VCD_MSG_HIGH("Got an output buffer we were waiting for"); p_buf_entry->frame = *p_buffer; p_buf_entry->frame.n_data_len = 0; p_buf_entry->frame.n_flags |= VCD_FRAME_FLAG_EOS; p_buf_entry->frame.n_ip_frm_tag = p_cctxt->status.eos_trig_ip_frm.n_ip_frm_tag; p_buf_entry->frame.time_stamp = p_cctxt->status.eos_trig_ip_frm.time_stamp; p_cctxt->callback(VCD_EVT_RESP_OUTPUT_DONE, VCD_S_SUCCESS, &p_buf_entry->frame, sizeof(struct vcd_frame_data_type), p_cctxt, p_cctxt->p_client_data); p_cctxt->status.b_eos_wait_for_op_buf = FALSE; vcd_do_client_state_transition(p_cctxt, VCD_CLIENT_STATE_RUN, CLIENT_STATE_EVENT_NUMBER (pf_fill_output_buffer)); } else { rc = vcd_fill_output_buffer_cmn(p_cctxt, p_buffer); } return rc; }
static u32 vcd_fill_output_buffer_in_eos (struct vcd_clnt_ctxt *cctxt, struct vcd_frame_data *buffer) { u32 rc = VCD_S_SUCCESS; struct vcd_buffer_entry *buf_entry; VCD_MSG_LOW("vcd_fill_output_buffer_in_eos:"); buf_entry = vcd_check_fill_output_buffer(cctxt, buffer); if (!buf_entry) return VCD_ERR_BAD_POINTER; if (cctxt->status.mask & VCD_EOS_WAIT_OP_BUF) { VCD_MSG_HIGH("Got an output buffer we were waiting for"); buf_entry->frame = *buffer; buf_entry->frame.data_len = 0; buf_entry->frame.flags |= VCD_FRAME_FLAG_EOS; buf_entry->frame.ip_frm_tag = cctxt->status.eos_trig_ip_frm.ip_frm_tag; buf_entry->frame.time_stamp = cctxt->status.eos_trig_ip_frm.time_stamp; cctxt->callback(VCD_EVT_RESP_OUTPUT_DONE, VCD_S_SUCCESS, &buf_entry->frame, sizeof(struct vcd_frame_data), cctxt, cctxt->client_data); cctxt->status.mask &= ~VCD_EOS_WAIT_OP_BUF; vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_RUN, CLIENT_STATE_EVENT_NUMBER (fill_output_buffer)); } else { rc = vcd_fill_output_buffer_cmn(cctxt, buffer); } return rc; }
void vcd_clnt_handle_device_err_fatal(struct vcd_clnt_ctxt *cctxt, u32 event) { if (cctxt->clnt_state.state != VCD_CLIENT_STATE_NULL) { cctxt->callback(VCD_EVT_RESP_OPEN, VCD_ERR_HW_FATAL, NULL, 0, cctxt, cctxt->client_data); vcd_destroy_client_context(cctxt); return; } if (cctxt->clnt_state.state != VCD_CLIENT_STATE_INVALID) { cctxt->callback(event, VCD_ERR_HW_FATAL, NULL, 0, cctxt, cctxt->client_data); vcd_flush_buffers_in_err_fatal(cctxt); vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_INVALID, CLIENT_STATE_EVENT_NUMBER(clnt_cb)); } }
static u32 vcd_resume_in_paused(struct vcd_clnt_ctxt_type_t *p_cctxt) { struct vcd_dev_ctxt_type *p_dev_ctxt = p_cctxt->p_dev_ctxt; u32 rc = VCD_S_SUCCESS; VCD_MSG_LOW("vcd_resume_in_paused:"); if (p_cctxt->b_sched_clnt_valid) { rc = vcd_power_event(p_cctxt->p_dev_ctxt, p_cctxt, VCD_EVT_PWR_CLNT_RESUME); if (VCD_FAILED(rc)) { VCD_MSG_ERROR("VCD_EVT_PWR_CLNT_RESUME failed"); } else { rc = vcd_map_sched_status(sched_suspend_resume_client (p_cctxt->p_dev_ctxt-> sched_hdl, p_cctxt->sched_clnt_hdl, TRUE)); if (VCD_FAILED(rc)) { VCD_MSG_ERROR ("rc = 0x%x. Failed: " "sched_suspend_resume_client", rc); } } if (!VCD_FAILED(rc)) vcd_try_submit_frame(p_dev_ctxt); } if (!VCD_FAILED(rc)) { vcd_do_client_state_transition(p_cctxt, VCD_CLIENT_STATE_RUN, CLIENT_STATE_EVENT_NUMBER (pf_resume)); } return rc; }
static u32 vcd_decode_start_in_open (struct vcd_clnt_ctxt *cctxt, struct vcd_sequence_hdr *seq_hdr) { u32 rc = VCD_S_SUCCESS; VCD_MSG_LOW("vcd_decode_start_in_open:"); if (!cctxt->decoding) { VCD_MSG_ERROR("vcd_decode_init for encoder client"); return VCD_ERR_ILLEGAL_OP; } if (seq_hdr) { VCD_MSG_HIGH("Seq hdr supplied. len = %d", seq_hdr->sequence_header_len); rc = vcd_store_seq_hdr(cctxt, seq_hdr); } else { VCD_MSG_HIGH("Seq hdr not supplied"); cctxt->seq_hdr.sequence_header_len = 0; cctxt->seq_hdr.sequence_header = NULL; } VCD_FAILED_RETURN(rc, "Err processing seq hdr"); rc = vcd_process_cmd_sess_start(cctxt); if (!VCD_FAILED(rc)) { vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_STARTING, CLIENT_STATE_EVENT_NUMBER (decode_start)); } return rc; }
static u32 vcd_flush_cmn(struct vcd_clnt_ctxt *cctxt, u32 mode) { u32 rc = VCD_S_SUCCESS; VCD_MSG_LOW("vcd_flush_cmn in %d:", cctxt->clnt_state.state); rc = vcd_flush_buffers(cctxt, mode); VCD_FAILED_RETURN(rc, "Failed: vcd_flush_buffers"); if (cctxt->status.frame_submitted > 0) { vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_FLUSHING, CLIENT_STATE_EVENT_NUMBER (flush)); } else { VCD_MSG_HIGH("All buffers are flushed"); cctxt->status.mask |= (mode & VCD_FLUSH_ALL); vcd_send_flush_done(cctxt, VCD_S_SUCCESS); } return rc; }
static u32 vcd_flush_cmn(struct vcd_clnt_ctxt_type_t *p_cctxt, u32 n_mode) { u32 rc = VCD_S_SUCCESS; VCD_MSG_LOW("vcd_flush_cmn in %d:", p_cctxt->clnt_state.e_state); rc = vcd_flush_buffers(p_cctxt, n_mode); VCD_FAILED_RETURN(rc, "Failed: vcd_flush_buffers"); if (p_cctxt->status.n_frame_submitted > 0) { vcd_do_client_state_transition(p_cctxt, VCD_CLIENT_STATE_FLUSHING, CLIENT_STATE_EVENT_NUMBER (pf_flush)); } else { VCD_MSG_HIGH("All buffers are flushed"); p_cctxt->status.n_flush_mode = n_mode; vcd_send_flush_done(p_cctxt, VCD_S_SUCCESS); } return rc; }
static void vcd_clnt_cb_in_pausing (struct vcd_clnt_ctxt *cctxt, u32 event, u32 status, void *payload, size_t sz, u32 *ddl_handle, void *const client_data) { struct vcd_dev_ctxt *dev_ctxt = cctxt->dev_ctxt; u32 rc = VCD_S_SUCCESS; u32 frm_trans_end = false; VCD_MSG_LOW("vcd_clnt_cb_in_pausing:"); if (cctxt->ddl_handle != ddl_handle) { VCD_MSG_ERROR("ddl_handle mismatch"); return; } switch (event) { case VCD_EVT_RESP_INPUT_DONE: { rc = vcd_handle_input_done(cctxt, payload, event, status); break; } case VCD_EVT_RESP_OUTPUT_DONE: { rc = vcd_handle_frame_done(cctxt, payload, event, status); break; } case VCD_EVT_RESP_OUTPUT_REQ: { rc = vcd_handle_output_required(cctxt, payload, status); break; } case VCD_EVT_IND_OUTPUT_RECONFIG: { rc = vcd_handle_ind_output_reconfig(cctxt, payload, status); if (!VCD_FAILED(rc)) { frm_trans_end = true; payload = NULL; } break; } case VCD_EVT_IND_HWERRFATAL: { vcd_handle_ind_hw_err_fatal(cctxt, VCD_EVT_RESP_PAUSE, status); rc = VCD_ERR_FAIL; break; } default: { VCD_MSG_ERROR ("Unexpected callback event=%d status=%d from DDL", event, status); dev_ctxt->command_continue = false; break; } } if (!VCD_FAILED(rc)) { if (payload && ((struct ddl_frame_data_tag *)\ payload)->frm_trans_end) { vcd_mark_frame_channel(cctxt->dev_ctxt); frm_trans_end = true; } if (frm_trans_end && !cctxt->status.frame_submitted) { VCD_MSG_HIGH ("All pending frames recvd from DDL"); cctxt->callback(VCD_EVT_RESP_PAUSE, VCD_S_SUCCESS, NULL, 0, cctxt, cctxt->client_data); vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_PAUSED, CLIENT_STATE_EVENT_NUMBER (clnt_cb)); rc = vcd_power_event(cctxt->dev_ctxt, cctxt, VCD_EVT_PWR_CLNT_PAUSE); if (VCD_FAILED(rc)) { VCD_MSG_ERROR ("VCD_EVT_PWR_CLNT_PAUSE_END" "failed"); } } } }
static void vcd_clnt_cb_in_pausing (struct vcd_clnt_ctxt_type_t *p_cctxt, 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 = p_cctxt->p_dev_ctxt; u32 rc = VCD_S_SUCCESS; u32 b_frm_trans_end = FALSE; VCD_MSG_LOW("vcd_clnt_cb_in_pausing:"); if (p_cctxt->ddl_handle != ddl_handle) { VCD_MSG_ERROR("ddl_handle mismatch"); return; } switch (event) { case VCD_EVT_RESP_INPUT_DONE: { rc = vcd_handle_input_done(p_cctxt, p_payload, event, status); break; } case VCD_EVT_RESP_OUTPUT_DONE: { rc = vcd_handle_frame_done(p_cctxt, p_payload, event, status); break; } case VCD_EVT_RESP_OUTPUT_REQ: { rc = vcd_handle_output_required(p_cctxt, p_payload, status); break; } case VCD_EVT_IND_OUTPUT_RECONFIG: { (void) vcd_handle_ind_output_reconfig(p_cctxt, p_payload, status); b_frm_trans_end = TRUE; p_payload = NULL; break; } case VCD_EVT_IND_HWERRFATAL: { vcd_handle_ind_hw_err_fatal(p_cctxt, VCD_EVT_RESP_PAUSE, status); rc = VCD_ERR_FAIL; break; } default: { VCD_MSG_ERROR ("Unexpected callback event=%d status=%d from DDL", event, status); p_dev_ctxt->b_continue = FALSE; break; } } if (!VCD_FAILED(rc)) { if (p_payload && ((struct ddl_frame_data_type_tag *)\ p_payload)->b_frm_trans_end) { vcd_mark_frame_channel(p_cctxt->p_dev_ctxt); b_frm_trans_end = TRUE; } if (b_frm_trans_end && !p_cctxt->status.n_frame_submitted) { VCD_MSG_HIGH ("All pending frames recvd from DDL"); p_cctxt->callback(VCD_EVT_RESP_PAUSE, VCD_S_SUCCESS, NULL, 0, p_cctxt, p_cctxt->p_client_data); vcd_do_client_state_transition(p_cctxt, VCD_CLIENT_STATE_PAUSED, CLIENT_STATE_EVENT_NUMBER (pf_clnt_cb)); rc = vcd_power_event(p_cctxt->p_dev_ctxt, p_cctxt, VCD_EVT_PWR_CLNT_PAUSE); if (VCD_FAILED(rc)) { VCD_MSG_ERROR ("VCD_EVT_PWR_CLNT_PAUSE_END" "failed"); } } } }
static void vcd_clnt_cb_in_flushing (struct vcd_clnt_ctxt_type_t *p_cctxt, 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 = p_cctxt->p_dev_ctxt; u32 rc = VCD_S_SUCCESS; u32 b_frm_trans_end = FALSE; VCD_MSG_LOW("vcd_clnt_cb_in_flushing:"); if (p_cctxt->ddl_handle != ddl_handle) { VCD_MSG_ERROR("ddl_handle mismatch"); return; } switch (event) { case VCD_EVT_RESP_INPUT_DONE: { rc = vcd_handle_input_done(p_cctxt, p_payload, VCD_EVT_RESP_INPUT_FLUSHED, status); break; } case VCD_EVT_RESP_OUTPUT_DONE: { rc = vcd_handle_frame_done(p_cctxt, p_payload, VCD_EVT_RESP_OUTPUT_FLUSHED, status); break; } case VCD_EVT_RESP_OUTPUT_REQ: { rc = vcd_handle_output_required_in_flushing(p_cctxt, p_payload); break; } case VCD_EVT_IND_OUTPUT_RECONFIG: { (void) vcd_handle_ind_output_reconfig(p_cctxt, p_payload, status); b_frm_trans_end = TRUE; p_payload = NULL; break; } case VCD_EVT_IND_HWERRFATAL: { vcd_handle_ind_hw_err_fatal(p_cctxt, VCD_EVT_IND_HWERRFATAL, status); break; } default: { VCD_MSG_ERROR ("Unexpected callback event=%d status=%d from DDL", event, status); p_dev_ctxt->b_continue = FALSE; break; } } if (!VCD_FAILED(rc) && ((event == VCD_EVT_RESP_INPUT_DONE || event == VCD_EVT_RESP_OUTPUT_DONE || event == VCD_EVT_RESP_OUTPUT_REQ || event == VCD_EVT_IND_OUTPUT_RECONFIG))) { if (p_payload && ((struct ddl_frame_data_type_tag *)\ p_payload)->b_frm_trans_end) { vcd_mark_frame_channel(p_cctxt->p_dev_ctxt); b_frm_trans_end = TRUE; } if (b_frm_trans_end && !p_cctxt->status.n_frame_submitted) { VCD_MSG_HIGH ("All pending frames recvd from DDL"); if (p_cctxt->status. n_flush_mode & VCD_FLUSH_OUTPUT) { vcd_flush_output_buffers(p_cctxt); vcd_release_all_clnt_frm_transc (p_cctxt); } vcd_send_flush_done(p_cctxt, VCD_S_SUCCESS); vcd_release_interim_frame_channels(p_dev_ctxt); VCD_MSG_HIGH("Flush complete"); vcd_release_all_clnt_def_frm_transc(p_cctxt); vcd_do_client_state_transition(p_cctxt, VCD_CLIENT_STATE_RUN, CLIENT_STATE_EVENT_NUMBER (pf_clnt_cb)); } } }
static void vcd_clnt_cb_in_eos (struct vcd_clnt_ctxt *cctxt, u32 event, u32 status, void *payload, size_t sz, u32 *ddl_handle, void *const client_data) { struct vcd_dev_ctxt *dev_ctxt = cctxt->dev_ctxt; struct vcd_transc *transc = NULL; u32 frm_trans_end = false, rc = VCD_S_SUCCESS; if (cctxt->ddl_handle != ddl_handle) { VCD_MSG_ERROR("ddl_handle mismatch"); return; } switch (event) { case VCD_EVT_RESP_INPUT_DONE: { rc = vcd_handle_input_done_in_eos(cctxt, payload, status); break; } case VCD_EVT_RESP_OUTPUT_DONE: { rc = vcd_handle_frame_done_in_eos(cctxt, payload, status); break; } case VCD_EVT_RESP_OUTPUT_REQ: { rc = vcd_handle_output_required(cctxt, payload, status); break; } case VCD_EVT_RESP_EOS_DONE: { transc = (struct vcd_transc *)client_data; vcd_handle_eos_done(cctxt, transc, status); vcd_mark_frame_channel(cctxt->dev_ctxt); break; } case VCD_EVT_IND_OUTPUT_RECONFIG: { rc = vcd_handle_ind_output_reconfig(cctxt, payload, status); if (!VCD_FAILED(rc)) { frm_trans_end = true; payload = NULL; vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_RUN, CLIENT_STATE_EVENT_NUMBER (clnt_cb)); VCD_MSG_LOW ("RECONFIGinEOS:Suspending Client"); rc = vcd_sched_suspend_resume_clnt(cctxt, false); if (VCD_FAILED(rc)) { VCD_MSG_ERROR ("Failed: suspend_resume_clnt. rc=0x%x", rc); } } break; } case VCD_EVT_IND_HWERRFATAL: { vcd_handle_ind_hw_err_fatal(cctxt, VCD_EVT_IND_HWERRFATAL, status); break; } case VCD_EVT_IND_INFO_OUTPUT_RECONFIG: { vcd_handle_ind_info_output_reconfig(cctxt, status); break; } default: { VCD_MSG_ERROR ("Unexpected callback event=%d status=%d from DDL", event, status); dev_ctxt->command_continue = false; break; } } if (!VCD_FAILED(rc) && (event == VCD_EVT_RESP_INPUT_DONE || event == VCD_EVT_RESP_OUTPUT_DONE || event == VCD_EVT_RESP_OUTPUT_REQ || event == VCD_EVT_IND_OUTPUT_RECONFIG)) { if (payload && ((struct ddl_frame_data_tag *) payload)->frm_trans_end) { vcd_mark_frame_channel(cctxt->dev_ctxt); frm_trans_end = true; } if (frm_trans_end && !cctxt->status.frame_submitted) vcd_handle_eos_trans_end(cctxt); } }
static void vcd_clnt_cb_in_flushing (struct vcd_clnt_ctxt *cctxt, u32 event, u32 status, void *payload, size_t sz, u32 *ddl_handle, void *const client_data) { struct vcd_dev_ctxt *dev_ctxt = cctxt->dev_ctxt; u32 rc = VCD_S_SUCCESS; u32 frm_trans_end = false; VCD_MSG_LOW("vcd_clnt_cb_in_flushing:"); if (cctxt->ddl_handle != ddl_handle) { VCD_MSG_ERROR("ddl_handle mismatch"); return; } switch (event) { case VCD_EVT_RESP_INPUT_DONE: { rc = vcd_handle_input_done(cctxt, payload, VCD_EVT_RESP_INPUT_FLUSHED, status); break; } case VCD_EVT_RESP_OUTPUT_DONE: { rc = vcd_handle_frame_done(cctxt, payload, VCD_EVT_RESP_OUTPUT_FLUSHED, status); break; } case VCD_EVT_RESP_OUTPUT_REQ: { rc = vcd_handle_output_required_in_flushing(cctxt, payload); break; } case VCD_EVT_IND_OUTPUT_RECONFIG: { rc = vcd_handle_ind_output_reconfig(cctxt, payload, status); if (!VCD_FAILED(rc)) { frm_trans_end = true; payload = NULL; } break; } case VCD_EVT_IND_HWERRFATAL: { vcd_handle_ind_hw_err_fatal(cctxt, VCD_EVT_IND_HWERRFATAL, status); break; } default: { VCD_MSG_ERROR ("Unexpected callback event=%d status=%d from DDL", event, status); dev_ctxt->command_continue = false; break; } } if (!VCD_FAILED(rc) && ((event == VCD_EVT_RESP_INPUT_DONE || event == VCD_EVT_RESP_OUTPUT_DONE || event == VCD_EVT_RESP_OUTPUT_REQ || event == VCD_EVT_IND_OUTPUT_RECONFIG))) { if (payload && ((struct ddl_frame_data_tag *)\ payload)->frm_trans_end) { vcd_mark_frame_channel(cctxt->dev_ctxt); frm_trans_end = true; } if (frm_trans_end && !cctxt->status.frame_submitted) { VCD_MSG_HIGH ("All pending frames recvd from DDL"); if (cctxt->status.mask & VCD_FLUSH_INPUT) vcd_flush_bframe_buffers(cctxt, VCD_FLUSH_INPUT); if (cctxt->status.mask & VCD_FLUSH_OUTPUT) vcd_flush_output_buffers(cctxt); vcd_send_flush_done(cctxt, VCD_S_SUCCESS); vcd_release_interim_frame_channels(dev_ctxt); VCD_MSG_HIGH("Flush complete"); vcd_do_client_state_transition(cctxt, VCD_CLIENT_STATE_RUN, CLIENT_STATE_EVENT_NUMBER (clnt_cb)); } } }