MX Foundation 4
Channel Class

Accessing a physical ASCB channel requires a handle to the channel.

A channel handle is a reference to a channel holding a physical resource (port), and is the first argument to be passed to many MXF channel oriented functions.

To get the handle to an ASCB physical port, regardless of the installed devices, use the mxfModuleChannelGet() function by specifying the physical port index.

The mxfModuleChannelAllGet() function with the chnClass argument MXF_CLASS_ASCB can also be used.

If MXF_DEVICE_ALL is specified with mxfSystemDeviceAllGet() function, all handles of detected devices are returned.

HMXF_SERVER server=0;
HMXF_DEVICE devices[2];
HMXF_MODULE module;
HMXF_CHANNEL bm;
uint32 rc;
uint64 deviceCount;
uint64 moduleCount;
uint64 channelCount;
uint64 deviceIndex;
uint32 deviceType = MXF_DEVICE_ALL; // All devices
uint32 moduleType = MXF_MODULE_ASCBMRT; // ASCB module
uint32 chnClass = MXF_CLASS_ASCB; // ASCB Channel
uint32 subClass = MXF_SCLASS_BM_CHANNEL; // Bus Monitor
rc = mxfServerConnect("0.0.0.0", "", "", FALSE, &server);
if(rc == MAXT_SUCCESS)
rc = mxfSystemDeviceAllGet(server, deviceType, 2, &deviceCount, devices);
for(deviceIndex=0; rc==MAXT_SUCCESS && deviceIndex<deviceCount; deviceIndex++)
{
rc = mxfDeviceModuleAllGet(devices[deviceIndex], moduleType, 1, &moduleCount, &module);
if(rc == MAXT_SUCCESS && moduleCount != 0)
{
rc = mxfModuleChannelAllGet(module, chnClass, subClass, 1, &channelCount, &bm);
if(rc == MAXT_SUCCESS && channelCount != 0)
{
break; // Found first BM channel
}
}
}

To obtain the handle for a specific channel location on a specific device model, pass the device type constant to the device argument and physical location.

HMXF_SERVER server=0;
HMXF_DEVICE device=0;
HMXF_MODULE module=0;
HMXF_CHANNEL bc;
uint32 rc;
uint64 deviceCount=0;
uint64 deviceType = MXF_DEVICE_PCIE502; // PCIe502 device
uint64 moduleIndex = 0; // First module
uint64 channelIndex = 4; // First BC channel
rc = mxfServerConnect("0.0.0.0", "", "", FALSE, &server);
if(rc == MAXT_SUCCESS)
rc = mxfSystemDeviceAllGet(server, deviceType, 1, &deviceCount, &device);
if(rc == MAXT_SUCCESS && deviceCount == 1)
{
rc = mxfDeviceModuleGet(device, moduleIndex, &module);
if(rc == MAXT_SUCCESS)
rc = mxfModuleChannelGet(module, channelIndex, &bc);
}
Updated 10/23/2023