digilent: free device enumeration after Detect
DmgrEnumDevices builds an internal device table that must be released with DmgrFreeDvcEnum, otherwise a second enumeration (e.g. opening a probe by index, which re-runs Detect) fails.
This commit is contained in:
@@ -45,6 +45,7 @@ typedef struct dj_dvc {
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef DJ_BOOL (*pfn_DmgrEnumDevices)(int *pcdvc);
|
||||
typedef DJ_BOOL (*pfn_DmgrFreeDvcEnum)(void);
|
||||
typedef DJ_BOOL (*pfn_DmgrGetDvc)(int idvc, DJ_DVC *pdvc);
|
||||
typedef DJ_BOOL (*pfn_DmgrOpen)(DJ_HIF *phif, char *szSel);
|
||||
typedef DJ_BOOL (*pfn_DmgrClose)(DJ_HIF hif);
|
||||
@@ -59,6 +60,7 @@ static struct {
|
||||
void *libmgr;
|
||||
void *libjtg;
|
||||
pfn_DmgrEnumDevices EnumDevices;
|
||||
pfn_DmgrFreeDvcEnum FreeDvcEnum;
|
||||
pfn_DmgrGetDvc GetDvc;
|
||||
pfn_DmgrOpen Open;
|
||||
pfn_DmgrClose Close;
|
||||
@@ -120,6 +122,7 @@ static int digilent_load(jtag_core *jc)
|
||||
} while (0)
|
||||
|
||||
RESOLVE(EnumDevices, libmgr, DmgrEnumDevices);
|
||||
RESOLVE(FreeDvcEnum, libmgr, DmgrFreeDvcEnum);
|
||||
RESOLVE(GetDvc, libmgr, DmgrGetDvc);
|
||||
RESOLVE(Open, libmgr, DmgrOpen);
|
||||
RESOLVE(Close, libmgr, DmgrClose);
|
||||
@@ -194,6 +197,10 @@ static int drv_Digilent_Detect(jtag_core *jc)
|
||||
subdrv_list[i].sub_drv_id = i;
|
||||
}
|
||||
|
||||
/* Release the enumeration table — required before EnumDevices can be
|
||||
* called again (e.g. a second jtag_get_probes_list / open by index). */
|
||||
g_dj.FreeDvcEnum();
|
||||
|
||||
g_dj_num_probes = cdvc;
|
||||
jtagcore_logs_printf(jc, MSG_INFO_1,
|
||||
"drv_Digilent_Detect : %d device(s) found\r\n", cdvc);
|
||||
|
||||
Reference in New Issue
Block a user