Untitled
unknown
plain_text
5 months ago
1.4 kB
2
Indexable
/// <summary> /// Reinitializes the PCI device by delinking the driver and linking it again. /// </summary> public void ReinitializePCIDevice() { WriteToLog("Reinitializing PCI device..."); try { // Step 1: Close the PCI device and driver bool closeStatus = FPGACommunicationHandler.FPGAInstance.DeviceClose(); WriteToLog($"Device close status: {closeStatus}"); // Step 2: Reinitialize the driver bool driverStatus = FPGACommunicationHandler.FPGAInstance.InitializeWinDriver(); WriteToLog($"Driver reinitialization status: {driverStatus}"); if (!driverStatus) { MessageBox.Show("Failed to reinitialize the driver. Check the logs for details."); return; } // Step 3: Reopen the device bool deviceStatus = FPGACommunicationHandler.FPGAInstance.DeviceOpen(); WriteToLog($"Device reopen status: {deviceStatus}"); if (deviceStatus) { MessageBox.Show("PCI device reinitialized successfully."); } else { MessageBox.Show("Failed to reopen the device. Check the logs for details."); } } catch (Exception ex) { WriteToLog("Error during PCI device reinitialization: " + ex.Message); MessageBox.Show("An error occurred during PCI device reinitialization. Check the logs for details."); } }
Editor is loading...
Leave a Comment