u32 ddl_open(u32 **ddl_handle, u32 decoding) { struct ddl_context *ddl_context; struct ddl_client_context *ddl; void *ptr; u32 status; DDL_MSG_HIGH("ddl_open"); if (!ddl_handle) { DDL_MSG_ERROR("ddl_open:Bad_handle"); return VCD_ERR_BAD_HANDLE; } ddl_context = ddl_get_context(); if (!DDL_IS_INITIALIZED(ddl_context)) { DDL_MSG_ERROR("ddl_open:Not_inited"); return VCD_ERR_ILLEGAL_OP; } status = ddl_client_transact(DDL_GET_CLIENT, &ddl); if (status) { DDL_MSG_ERROR("ddl_open:Client_trasac_failed"); return status; } ptr = ddl_pmem_alloc(&ddl->shared_mem[0], DDL_FW_AUX_HOST_CMD_SPACE_SIZE, sizeof(u32)); if (!ptr) status = VCD_ERR_ALLOC_FAIL; if (!status && ddl_context->frame_channel_depth == VCD_DUAL_FRAME_COMMAND_CHANNEL) { ptr = ddl_pmem_alloc(&ddl->shared_mem[1], DDL_FW_AUX_HOST_CMD_SPACE_SIZE, sizeof(u32)); if (!ptr) { ddl_pmem_free(&ddl->shared_mem[0]); status = VCD_ERR_ALLOC_FAIL; } } if (!status) { memset(ddl->shared_mem[0].align_virtual_addr, 0, DDL_FW_AUX_HOST_CMD_SPACE_SIZE); if (ddl_context->frame_channel_depth == VCD_DUAL_FRAME_COMMAND_CHANNEL) { memset(ddl->shared_mem[1].align_virtual_addr, 0, DDL_FW_AUX_HOST_CMD_SPACE_SIZE); } DDL_MSG_LOW("ddl_state_transition: %s ~~> DDL_CLIENT_OPEN", ddl_get_state_string(ddl->client_state)); ddl->client_state = DDL_CLIENT_OPEN; ddl->codec_data.hdr.decoding = decoding; ddl->decoding = decoding; ddl_set_initial_default_values(ddl); *ddl_handle = (u32 *) ddl; } else { ddl_pmem_free(&ddl->shared_mem[0]); if (ddl_context->frame_channel_depth == VCD_DUAL_FRAME_COMMAND_CHANNEL) ddl_pmem_free(&ddl->shared_mem[1]); ddl_client_transact(DDL_FREE_CLIENT, &ddl); } return status; }
u32 ddl_open(u32 **ddl_handle, u32 decoding) { struct ddl_context *ddl_context; struct ddl_client_context *ddl; u32 status; if (!ddl_handle) { VIDC_LOGERR_STRING("ddl_open:Bad_handle"); return VCD_ERR_BAD_HANDLE; } ddl_context = ddl_get_context(); if (!DDL_IS_INITIALIZED(ddl_context)) { VIDC_LOGERR_STRING("ddl_open:Not_inited"); return VCD_ERR_ILLEGAL_OP; } status = ddl_client_transact(DDL_GET_CLIENT, &ddl); if (status) { VIDC_LOGERR_STRING("ddl_open:Client_trasac_failed"); return status; } ddl_move_client_state(ddl, DDL_CLIENT_OPEN); ddl->codec_data.hdr.decoding = decoding; ddl->decoding = decoding; ddl_set_default_meta_data_hdr(ddl); ddl_set_initial_default_values(ddl); *ddl_handle = (u32 *) ddl; return VCD_S_SUCCESS; }