File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -451,6 +451,16 @@ int devPCIDisableInterrupt(const epicsPCIDevice *dev);
451451epicsShareFunc
452452const char * devPCIDeviceClassToString (int classId );
453453
454+ /**
455+ * @brief Optional callback invoked on PCI device hot-swap.
456+ *
457+ * This function pointer may be set to a custom handler that will be called
458+ * when a PCI device is successfully reopened (e.g. after hot-swap).
459+ *
460+ * @param name Identifier or name of the reopened PCI device.
461+ */
462+ epicsShareExtern void (* devPCIonHotSwapHook )(const char * );
463+
454464#ifdef __cplusplus
455465} /* extern "C" */
456466#endif
Original file line number Diff line number Diff line change @@ -944,6 +944,8 @@ static int reopen_uio(struct osdPCIDevice *osd)
944944 return 0 ;
945945}
946946
947+ epicsShareDef void (* devPCIonHotSwapHook )(const char * name ) = NULL ;
948+
947949static
948950void isrThread (void * arg )
949951{
@@ -995,6 +997,7 @@ void isrThread(void* arg)
995997 epicsMutexMustLock (osd -> devLock );
996998 if (reopen_uio (osd ) == 0 ) {
997999 errlogPrintf ("isrThread '%s': Successfully reopened UIO device\n" , name );
1000+ if (devPCIonHotSwapHook ) devPCIonHotSwapHook (name );
9981001 } else {
9991002 errlogPrintf ("isrThread '%s': UIO reopen failed. Will retry.\n" , name );
10001003 }
You can’t perform that action at this time.
0 commit comments