Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D430 gmsl rebased #13783

Merged
merged 13 commits into from
Feb 27, 2025
5 changes: 3 additions & 2 deletions common/fw-update-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,11 @@ namespace rs2
std::function<void()> cleanup,
invoker invoke)
{
// if device is D457, and fw is signed - using mipi specific procedure
// if device is MIPI device, and fw is signed - using mipi specific procedure
if (_is_signed
&& (!strcmp(_dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID), "ABCD")
|| !strcmp(_dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID), "BBCD"))
|| !strcmp(_dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID), "BBCD")
|| !strcmp(_dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID), "ABCE"))
)
{
process_mipi();
Expand Down
7 changes: 5 additions & 2 deletions common/on-chip-calib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ namespace rs2
device_name_string = _dev.get_info( RS2_CAMERA_INFO_NAME );
if( val_in_range( device_name_string, { std::string( "Intel RealSense D415" ) } ) )
speed = 4;

if ( strcmp(_dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID), "ABCD") || strcmp(_dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID), "ABCE"))
is_mipi_sku = true;
}
if (dev.supports(RS2_CAMERA_INFO_FIRMWARE_VERSION))
{
Expand Down Expand Up @@ -2089,7 +2092,7 @@ namespace rs2
RsImGui::CustomTooltip("%s", "Calculate ground truth for the specific target");

ImGui::SetCursorScreenPos({ float(x + 9), float(y + height - ImGui::GetTextLineHeightWithSpacing() - 30) });
get_manager().host_assistance = (get_manager().device_name_string == std::string("Intel RealSense D457") ); // To be used for MIPI SKU only
get_manager().host_assistance = get_manager().is_mipi_sku; // To be used for MIPI SKU only
bool assistance = (get_manager().host_assistance != 0);
if (ImGui::Checkbox("Host Assistance", &assistance))
get_manager().host_assistance = (assistance ? 1 : 0);
Expand Down Expand Up @@ -2185,7 +2188,7 @@ namespace rs2
// RsImGui::CustomTooltip("%s", "On-Chip Calibration Extended");

ImGui::SetCursorScreenPos({ float(x + 9), float(y + height - ImGui::GetTextLineHeightWithSpacing() - 31) });
get_manager().host_assistance = (get_manager().device_name_string == std::string("Intel RealSense D457") ); // To be used for MIPI SKU only
get_manager().host_assistance = get_manager().is_mipi_sku; // To be used for MIPI SKU only
bool assistance = (get_manager().host_assistance != 0);
ImGui::Checkbox("Host Assistance", &assistance);
if (ImGui::IsItemHovered())
Expand Down
1 change: 1 addition & 0 deletions common/on-chip-calib.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ namespace rs2
const std::string Z16_FORMAT = "Z16";
const std::string RGB8_FORMAT = "RGB8";
std::string device_name_string;
bool is_mipi_sku = false;

void calibrate();
void calibrate_fl();
Expand Down
1 change: 1 addition & 0 deletions src/ds/advanced_mode/advanced_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ namespace librealsense
case ds::RS421_PID:
case ds::RS430_PID:
case ds::RS430I_PID:
case ds::RS430_GMSL_PID:
case ds::RS435_RGB_PID:
case ds::RS435I_PID:
default_430(p);
Expand Down
2 changes: 1 addition & 1 deletion src/ds/d400/d400-active.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace librealsense
auto pid = this->_pid;
auto& depth_ep = get_depth_sensor();

if( pid == ds::RS457_PID )
if( pid == ds::RS457_PID || pid == ds::RS430_GMSL_PID)
{
depth_ep.register_option( RS2_OPTION_PROJECTOR_TEMPERATURE,
std::make_shared< projector_temperature_option_mipi >(
Expand Down
12 changes: 6 additions & 6 deletions src/ds/d400/d400-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ namespace librealsense

std::unique_ptr< frame_timestamp_reader > timestamp_reader_backup( new ds_timestamp_reader() );
frame_timestamp_reader* timestamp_reader_from_metadata;
if (all_device_infos.front().pid != RS457_PID)
if (all_device_infos.front().pid != RS457_PID && all_device_infos.front().pid != RS430_GMSL_PID)
timestamp_reader_from_metadata = new ds_timestamp_reader_from_metadata(std::move(timestamp_reader_backup));
else
timestamp_reader_from_metadata = new ds_timestamp_reader_from_metadata_mipi(std::move(timestamp_reader_backup));
Expand Down Expand Up @@ -566,7 +566,7 @@ namespace librealsense
auto raw_sensor = get_raw_depth_sensor();
_pid = group.uvc_devices.front().pid;
// to be changed for D457
bool mipi_sensor = (RS457_PID == _pid);
bool mipi_sensor = (RS457_PID == _pid || RS430_GMSL_PID == _pid);

_color_calib_table_raw = [this]()
{
Expand Down Expand Up @@ -699,7 +699,7 @@ namespace librealsense
//if hw_monitor was created by usb replace it with xu
// D400_IMU will remain using USB interface due to HW limitations
{
if (_pid == ds::RS457_PID)
if (_pid == ds::RS457_PID || _pid == ds::RS430_GMSL_PID)
{
depth_sensor.register_option(RS2_OPTION_ASIC_TEMPERATURE,
std::make_shared<asic_temperature_option_mipi>(_hw_monitor,
Expand Down Expand Up @@ -920,7 +920,7 @@ namespace librealsense
}
}

if (!val_in_range(_pid, { ds::RS457_PID }))
if (!val_in_range(_pid, { ds::RS457_PID, RS430_GMSL_PID }))
{
depth_sensor.register_option( RS2_OPTION_STEREO_BASELINE,
std::make_shared< const_value_option >(
Expand Down Expand Up @@ -1003,7 +1003,7 @@ namespace librealsense
firmware_version fw_ver = firmware_version( get_info( RS2_CAMERA_INFO_FIRMWARE_VERSION ) );
auto pid = get_pid();

if( ( pid == ds::RS457_PID || pid == ds::RS455_PID ) && fw_ver >= firmware_version( 5, 14, 0, 0 ) )
if( ( pid == ds::RS457_PID || pid == ds::RS455_PID || pid == ds::RS430_GMSL_PID ) && fw_ver >= firmware_version( 5, 14, 0, 0 ) )
register_feature( std::make_shared< emitter_frequency_feature >( get_depth_sensor() ) );

if( fw_ver >= firmware_version( 5, 11, 9, 0 ) )
Expand All @@ -1014,7 +1014,7 @@ namespace librealsense

register_feature( std::make_shared< auto_exposure_roi_feature >( get_depth_sensor(), _hw_monitor ) );

if( pid != ds::RS457_PID && pid != ds::RS415_PID && fw_ver >= firmware_version( 5, 12, 10, 11 ) )
if( pid != ds::RS457_PID && pid != ds::RS415_PID && pid != ds::RS430_GMSL_PID && fw_ver >= firmware_version( 5, 12, 10, 11 ) )
{
register_feature(
std::make_shared< auto_exposure_limit_feature >( get_depth_sensor(), d400_device::_hw_monitor ) );
Expand Down
76 changes: 76 additions & 0 deletions src/ds/d400/d400-factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,69 @@ namespace librealsense

};


class rs430_gmsl_device : public d400_active,
public d400_motion_uvc,
public ds_advanced_mode_base,
public firmware_logger_device
{
public:
rs430_gmsl_device( std::shared_ptr< const d400_info > const & dev_info, bool register_device_notifications )
: device( dev_info, register_device_notifications )
, backend_device( dev_info, register_device_notifications )
, d400_device( dev_info )
, d400_active( dev_info )
, d400_motion_uvc( dev_info )
, ds_advanced_mode_base( d400_device::_hw_monitor, get_depth_sensor() )
, firmware_logger_device(
dev_info, d400_device::_hw_monitor, get_firmware_logs_command(), get_flash_logs_command() )
{
}

std::shared_ptr<matcher> create_matcher(const frame_holder& frame) const override;

std::vector<tagged_profile> get_profiles_tags() const override
{
std::vector<tagged_profile> tags;

tags.push_back({ RS2_STREAM_DEPTH, -1, 640, 480, RS2_FORMAT_Z16, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT });

return tags;
};

void hardware_reset() override
{
d400_device::hardware_reset();
//limitation: the user must hold the context from which the device was created
//creating fake notification to trigger invoke_devices_changed_callbacks, causing disconnection and connection
auto dev_info = this->get_device_info();
auto non_const_device_info = std::const_pointer_cast< librealsense::device_info >( dev_info );
std::vector< std::shared_ptr< device_info > > devices{ non_const_device_info };
auto ctx = std::weak_ptr< context >( get_context() );
std::thread fake_notification(
[ ctx, devs = std::move( devices ) ]()
{
try
{
if( auto strong = ctx.lock() )
{
strong->invoke_devices_changed_callbacks( devs, {} );
// MIPI devices do not re-enumerate so we need to give them some time to restart
std::this_thread::sleep_for( std::chrono::milliseconds( 3000 ) );
}
if( auto strong = ctx.lock() )
strong->invoke_devices_changed_callbacks( {}, devs );
}
catch( const std::exception & e )
{
LOG_ERROR( e.what() );
return;
}
} );
fake_notification.detach();
}
};

// AWGCT
class rs430_rgb_mm_device : public d400_active,
public d400_color,
Expand Down Expand Up @@ -1128,6 +1191,7 @@ namespace librealsense
bool const register_device_notifications = true;

auto pid = _group.uvc_devices.front().pid;

switch(pid)
{
case RS400_PID:
Expand Down Expand Up @@ -1171,6 +1235,8 @@ namespace librealsense
return std::make_shared< rs455_device >( dev_info, register_device_notifications );
case RS457_PID:
return std::make_shared< rs457_device >( dev_info, register_device_notifications );
case RS430_GMSL_PID:
return std::make_shared< rs430_gmsl_device >( dev_info, register_device_notifications );
default:
throw std::runtime_error( rsutils::string::from() << "Unsupported RS400 model! 0x" << std::hex
<< std::setw( 4 ) << std::setfill( '0' ) << (int)pid );
Expand Down Expand Up @@ -1369,6 +1435,16 @@ namespace librealsense
return matcher_factory::create(RS2_MATCHER_DEFAULT, streams);
}


std::shared_ptr<matcher> rs430_gmsl_device::create_matcher(const frame_holder& frame) const
{
std::vector<stream_interface*> streams = { _depth_stream.get() , _left_ir_stream.get() , _right_ir_stream.get() };
std::vector<stream_interface*> mm_streams = { _accel_stream.get(), _gyro_stream.get()};
streams.insert(streams.end(), mm_streams.begin(), mm_streams.end());
return matcher_factory::create(RS2_MATCHER_DEFAULT, streams);
}


std::shared_ptr<matcher> rs400_imu_device::create_matcher(const frame_holder& frame) const
{
// TODO - A proper matcher for High-FPS sensor is required
Expand Down
18 changes: 12 additions & 6 deletions src/ds/d400/d400-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ namespace librealsense
const uint16_t RS405_PID = 0x0B5B; // D405
const uint16_t RS455_PID = 0x0B5C; // D455
const uint16_t RS457_PID = 0xabcd; // D457
const uint16_t RS457_RECOVERY_PID = 0xbbcd; // D457 DFU Recovery
const uint16_t RS400_MIPI_RECOVERY_PID = 0xbbcd; // D4XX MIPI DFU Recovery
const uint16_t RS430_GMSL_PID = 0xabce; // D430 GMSL

// d400 Devices supported by the current version
static const std::set<std::uint16_t> rs400_sku_pid = {
Expand All @@ -64,7 +65,8 @@ namespace librealsense
ds::RS416_PID,
ds::RS405_PID,
ds::RS455_PID,
ds::RS457_PID
ds::RS457_PID,
ds::RS430_GMSL_PID
};

static const std::set<std::uint16_t> d400_multi_sensors_pid = {
Expand All @@ -77,11 +79,13 @@ namespace librealsense
ds::RS435_RGB_PID,
ds::RS435I_PID,
ds::RS455_PID,
ds::RS457_PID
ds::RS457_PID,
ds::RS430_GMSL_PID
};

static const std::set<std::uint16_t> d400_mipi_device_pid = {
ds::RS457_PID
ds::RS457_PID,
ds::RS430_GMSL_PID
};

static const std::set<std::uint16_t> d400_hid_sensors_pid = {
Expand Down Expand Up @@ -132,7 +136,8 @@ namespace librealsense
{ RS405_PID, "Intel RealSense D405" },
{ RS455_PID, "Intel RealSense D455" },
{ RS457_PID, "Intel RealSense D457" },
{ RS457_RECOVERY_PID, "Intel RealSense D457 Recovery"},
{ RS400_MIPI_RECOVERY_PID, "Intel RealSense D4XX MIPI Recovery"},
{ RS430_GMSL_PID, "Intel RealSense D430" },
};

static std::map<uint16_t, std::string> d400_device_to_fw_min_version = {
Expand Down Expand Up @@ -161,7 +166,8 @@ namespace librealsense
{RS405_PID, "5.12.11.8" },
{RS455_PID, "5.13.0.50" },
{RS457_PID, "5.13.1.1" },
{RS457_RECOVERY_PID, "5.13.1.1" }
{RS400_MIPI_RECOVERY_PID, "5.13.1.1" },
{RS430_GMSL_PID, "5.16.5.1" }
};

std::vector<platform::uvc_device_info> filter_d400_device_by_capability(
Expand Down
2 changes: 1 addition & 1 deletion src/fw-update/fw-update-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ namespace librealsense
void update_device::update(const void* fw_image, int fw_image_size, rs2_update_progress_callback_sptr update_progress_callback) const
{
LOG_INFO( "Uploading FW image ..." );
if(_pid == "ABCD" || _pid == "BBCD")
if(_pid == "ABCD" || _pid == "BBCD" || _pid == "ABCE")
{
update_mipi(fw_image, fw_image_size, update_progress_callback);
}
Expand Down
2 changes: 1 addition & 1 deletion src/fw-update/fw-update-factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace librealsense
continue;
switch (info.pid)
{
case ds::RS457_RECOVERY_PID:
case ds::RS400_MIPI_RECOVERY_PID:
return std::make_shared< ds_d400_update_device >(shared_from_this(), mipi);
default:
// Do nothing
Expand Down
Loading