static bool calculate_be_cfg( const input_system_input_port_t *input_port, const input_system_cfg_t *isys_cfg, bool metadata, csi_rx_backend_cfg_t *cfg) { memcpy_s( (void *)(&cfg->lut_entry), sizeof(csi_rx_backend_lut_entry_t), metadata ? (void *)(&input_port->metadata.backend_lut_entry) : (void *)(&input_port->csi_rx.backend_lut_entry), sizeof(csi_rx_backend_lut_entry_t)); cfg->csi_mipi_cfg.virtual_channel = isys_cfg->csi_port_attr.ch_id; if (metadata) { cfg->csi_mipi_packet_type = get_csi_mipi_packet_type(isys_cfg->metadata.fmt_type); cfg->csi_mipi_cfg.comp_enable = false; cfg->csi_mipi_cfg.data_type = isys_cfg->metadata.fmt_type; } else { cfg->csi_mipi_packet_type = get_csi_mipi_packet_type(isys_cfg->csi_port_attr.fmt_type); cfg->csi_mipi_cfg.data_type = isys_cfg->csi_port_attr.fmt_type; cfg->csi_mipi_cfg.comp_enable = isys_cfg->csi_port_attr.comp_enable; cfg->csi_mipi_cfg.comp_scheme = isys_cfg->csi_port_attr.comp_scheme; cfg->csi_mipi_cfg.comp_predictor = isys_cfg->csi_port_attr.comp_predictor; cfg->csi_mipi_cfg.comp_bit_idx = cfg->csi_mipi_cfg.data_type - MIPI_FORMAT_CUSTOM0; } return true; }
static bool calculate_be_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, input_system_cfg_t *isys_cfg, csi_rx_backend_cfg_t *cfg) { (void)channel; memcpy( (void *)(&(cfg->lut_entry)), (void *)(&(input_port->csi_rx.backend_lut_entry)), sizeof(csi_rx_backend_lut_entry_t)); cfg->csi_mipi_packet_type = get_csi_mipi_packet_type(isys_cfg->csi_port_attr.fmt_type); cfg->csi_mipi_cfg.virtual_channel = isys_cfg->csi_port_attr.ch_id; cfg->csi_mipi_cfg.data_type = isys_cfg->csi_port_attr.fmt_type; return true; }
static bool create_input_system_input_port( input_system_cfg_t *cfg, input_system_input_port_t *me) { csi_mipi_packet_type_t packet_type; bool rc = true; switch (cfg->input_port_id) { case INPUT_SYSTEM_CSI_PORT0_ID: me->csi_rx.frontend_id = CSI_RX_FRONTEND0_ID; me->csi_rx.backend_id = CSI_RX_BACKEND0_ID; packet_type = get_csi_mipi_packet_type(cfg->csi_port_attr.fmt_type); me->csi_rx.packet_type = packet_type; rc = acquire_be_lut_entry( me->csi_rx.backend_id, packet_type, &(me->csi_rx.backend_lut_entry)); break; case INPUT_SYSTEM_PIXELGEN_PORT0_ID: me->pixelgen.pixelgen_id = PIXELGEN0_ID; break; case INPUT_SYSTEM_CSI_PORT1_ID: me->csi_rx.frontend_id = CSI_RX_FRONTEND1_ID; me->csi_rx.backend_id = CSI_RX_BACKEND1_ID; packet_type = get_csi_mipi_packet_type(cfg->csi_port_attr.fmt_type); me->csi_rx.packet_type = packet_type; rc = acquire_be_lut_entry( me->csi_rx.backend_id, packet_type, &(me->csi_rx.backend_lut_entry)); break; case INPUT_SYSTEM_PIXELGEN_PORT1_ID: me->pixelgen.pixelgen_id = PIXELGEN1_ID; break; case INPUT_SYSTEM_CSI_PORT2_ID: me->csi_rx.frontend_id = CSI_RX_FRONTEND2_ID; me->csi_rx.backend_id = CSI_RX_BACKEND2_ID; packet_type = get_csi_mipi_packet_type(cfg->csi_port_attr.fmt_type); me->csi_rx.packet_type = packet_type; rc = acquire_be_lut_entry( me->csi_rx.backend_id, packet_type, &(me->csi_rx.backend_lut_entry)); break; case INPUT_SYSTEM_PIXELGEN_PORT2_ID: me->pixelgen.pixelgen_id = PIXELGEN2_ID; break; default: rc = false; break; } me->source_type = cfg->mode; /* for metadata */ me->metadata.packet_type = CSI_MIPI_PACKET_TYPE_UNDEFINED; if (rc && cfg->metadata.enable) { me->metadata.packet_type = get_csi_mipi_packet_type( cfg->metadata.fmt_type); rc = acquire_be_lut_entry( me->csi_rx.backend_id, me->metadata.packet_type, &me->metadata.backend_lut_entry); } return rc; }