Skip to content

Commit

Permalink
Added conditional compilation for discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMutta committed Jul 11, 2024
1 parent 9c698b7 commit 89095e5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/pc/PlatformDeviceSearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ static xLinkPlatformErrorCode_t getPCIeDeviceName(int index,
static xLinkPlatformErrorCode_t getTcpIpDevices(const deviceDesc_t in_deviceRequirements,
deviceDesc_t* out_foundDevices, int sizeFoundDevices,
unsigned int *out_amountOfFoundDevices);

#if defined(__unix__)
static xLinkPlatformErrorCode_t getLocalShdmemDevices(const deviceDesc_t in_deviceRequirements,
deviceDesc_t* out_foundDevices, int sizeFoundDevices,
unsigned int *out_amountOfFoundDevices);
#endif

// ------------------------------------
// Helpers declaration. End.
Expand Down Expand Up @@ -76,11 +79,13 @@ xLinkPlatformErrorCode_t XLinkPlatformFindDevices(const deviceDesc_t in_deviceRe
}
return getTcpIpDevices(in_deviceRequirements, out_foundDevices, sizeFoundDevices, out_amountOfFoundDevices);

#if defined(__unix__)
case X_LINK_LOCAL_SHDMEM:
if(!XLinkIsProtocolInitialized(in_deviceRequirements.protocol)) {
return X_LINK_PLATFORM_DRIVER_NOT_LOADED+in_deviceRequirements.protocol;
}
return getLocalShdmemDevices(in_deviceRequirements, out_foundDevices, sizeFoundDevices, out_amountOfFoundDevices);
#endif

case X_LINK_ANY_PROTOCOL:
// If USB protocol is initialized
Expand Down Expand Up @@ -117,6 +122,7 @@ xLinkPlatformErrorCode_t XLinkPlatformFindDevices(const deviceDesc_t in_deviceRe
*/

case X_LINK_TCP_IP_OR_LOCAL_SHDMEM:
#if defined(__unix__)
if(XLinkIsProtocolInitialized(X_LINK_LOCAL_SHDMEM)) {
numFoundDevices = 0;
SHDMEM_rc = getLocalShdmemDevices(in_deviceRequirements, out_foundDevices, sizeFoundDevices, &numFoundDevices);
Expand All @@ -129,6 +135,7 @@ xLinkPlatformErrorCode_t XLinkPlatformFindDevices(const deviceDesc_t in_deviceRe
sizeFoundDevices -= numFoundDevices;
}
}
#endif

// Try find TCPIP device
if(XLinkIsProtocolInitialized(X_LINK_TCP_IP)) {
Expand Down Expand Up @@ -317,6 +324,8 @@ xLinkPlatformErrorCode_t getTcpIpDevices(const deviceDesc_t in_deviceRequirement
return tcpip_get_devices(in_deviceRequirements, out_foundDevices, sizeFoundDevices, out_amountOfFoundDevices);
}


#if defined(__unix__)
xLinkPlatformErrorCode_t getLocalShdmemDevices(const deviceDesc_t in_deviceRequirements,
deviceDesc_t* out_foundDevices, int sizeFoundDevices,
unsigned int *out_amountOfFoundDevices)
Expand All @@ -340,6 +349,7 @@ xLinkPlatformErrorCode_t getLocalShdmemDevices(const deviceDesc_t in_deviceRequi

return shdmemGetDevices(in_deviceRequirements, out_foundDevices, sizeFoundDevices, out_amountOfFoundDevices);
}
#endif

// ------------------------------------
// Helpers implementation. End.
Expand Down

0 comments on commit 89095e5

Please sign in to comment.