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)
|
#pragma pack(pop)
|
||||||
|
|
||||||
typedef DJ_BOOL (*pfn_DmgrEnumDevices)(int *pcdvc);
|
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_DmgrGetDvc)(int idvc, DJ_DVC *pdvc);
|
||||||
typedef DJ_BOOL (*pfn_DmgrOpen)(DJ_HIF *phif, char *szSel);
|
typedef DJ_BOOL (*pfn_DmgrOpen)(DJ_HIF *phif, char *szSel);
|
||||||
typedef DJ_BOOL (*pfn_DmgrClose)(DJ_HIF hif);
|
typedef DJ_BOOL (*pfn_DmgrClose)(DJ_HIF hif);
|
||||||
@@ -59,6 +60,7 @@ static struct {
|
|||||||
void *libmgr;
|
void *libmgr;
|
||||||
void *libjtg;
|
void *libjtg;
|
||||||
pfn_DmgrEnumDevices EnumDevices;
|
pfn_DmgrEnumDevices EnumDevices;
|
||||||
|
pfn_DmgrFreeDvcEnum FreeDvcEnum;
|
||||||
pfn_DmgrGetDvc GetDvc;
|
pfn_DmgrGetDvc GetDvc;
|
||||||
pfn_DmgrOpen Open;
|
pfn_DmgrOpen Open;
|
||||||
pfn_DmgrClose Close;
|
pfn_DmgrClose Close;
|
||||||
@@ -120,6 +122,7 @@ static int digilent_load(jtag_core *jc)
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
RESOLVE(EnumDevices, libmgr, DmgrEnumDevices);
|
RESOLVE(EnumDevices, libmgr, DmgrEnumDevices);
|
||||||
|
RESOLVE(FreeDvcEnum, libmgr, DmgrFreeDvcEnum);
|
||||||
RESOLVE(GetDvc, libmgr, DmgrGetDvc);
|
RESOLVE(GetDvc, libmgr, DmgrGetDvc);
|
||||||
RESOLVE(Open, libmgr, DmgrOpen);
|
RESOLVE(Open, libmgr, DmgrOpen);
|
||||||
RESOLVE(Close, libmgr, DmgrClose);
|
RESOLVE(Close, libmgr, DmgrClose);
|
||||||
@@ -194,6 +197,10 @@ static int drv_Digilent_Detect(jtag_core *jc)
|
|||||||
subdrv_list[i].sub_drv_id = i;
|
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;
|
g_dj_num_probes = cdvc;
|
||||||
jtagcore_logs_printf(jc, MSG_INFO_1,
|
jtagcore_logs_printf(jc, MSG_INFO_1,
|
||||||
"drv_Digilent_Detect : %d device(s) found\r\n", cdvc);
|
"drv_Digilent_Detect : %d device(s) found\r\n", cdvc);
|
||||||
|
|||||||
Reference in New Issue
Block a user