MX Foundation 4
Host-side communication queues

Functions

uint32 mxfDeviceCommBufferAlloc (HMXF_DEVICE device, uint64 index, uint64 size, HMXF_BUFFER *buffer, uint64 *allocated)
 
uint32 mxfDeviceCommBufferGet (HMXF_DEVICE device, uint64 index, HMXF_BUFFER *buffer)
 
uint32 mxfDeviceCommBufferFree (HMXF_BUFFER buffer)
 
uint32 mxfDeviceCommBufferStatusGet (HMXF_BUFFER buffer, uint64 *status, uint64 *msgCount, uint64 *pendingBytes, uint64 *freeBytes)
 
uint32 mxfDeviceCommBufferInfoGet (HMXF_BUFFER buffer, HMXF_DEVICE *device, uint64 *index)
 
uint32 mxfDeviceCommBufferWrite (HMXF_BUFFER buffer, uint64 count, MXF_EMBEDDED_DATAREC *rec)
 
uint32 mxfDeviceCommBufferWriteAsync (HMXF_BUFFER buffer, uint64 count, MXF_EMBEDDED_DATAREC *hostBuffer, MXF_ASYNCHRONOUS_CALLBACK writeCompletion, void *context)
 
uint32 mxfDeviceCommBufferRead (HMXF_BUFFER buffer, uint64 maxMsgCount, uint64 maxBytesCount, uint64 *msgReadCount, uint64 *byteReadCount, MXF_EMBEDDED_DATAREC *rec)
 
uint32 mxfDeviceCommBufferReadAsync (HMXF_BUFFER buffer, uint64 maxMsgCount, uint64 maxBytesCount, MXF_EMBEDDED_DATAREC *hostBuffer, MXF_ASYNCHRONOUS_CALLBACK readCompletion, void *context)
 
uint32 mxfDeviceCommBufferClear (HMXF_BUFFER buffer)
 
uint32 mxfDeviceCommRxBufferAsyncEventInit (HMXF_BUFFER buffer, uint64 almostFull, void *context, MXF_ASYNCEVENT_BUFFER_HANDLER callback)
 
uint32 mxfDeviceCommRxBufferAsyncEventTerminate (HMXF_BUFFER buffer)
 
uint32 mxfDeviceCommTxBufferAsyncEventInit (HMXF_BUFFER buffer, uint64 almostEmpty, void *context, MXF_ASYNCEVENT_BUFFER_HANDLER callback)
 
uint32 mxfDeviceCommTxBufferAsyncEventTerminate (HMXF_BUFFER buffer)
 

Detailed Description

Function Documentation

uint32 mxfDeviceCommBufferAlloc ( HMXF_DEVICE  device,
uint64  index,
uint64  size,
HMXF_BUFFER *  buffer,
uint64 *  allocated 
)
C#
public static extern UInt32 mxfDeviceCommBufferAlloc(UInt64 device, UInt64 index, UInt64 size, out UInt64 buffer, out UInt64 allocated);

public static extern UInt32 mxfDeviceCommBufferAlloc(UInt64 device, UInt64 index, UInt64 size, out UInt64 buffer, IntPtr allocated);

Allocates a communication buffer area used between an application and an embedded application. The allocated size can be greater than the asked size (rounding is done for internal buffer alignment). allocated parameter can return the actual allocated size.

Parameters
[in]devicedevice handle
[in]indexcommunication buffer index. KMXF_DEVICE_COMM_QUEUE_NUM attribute is used to define the number of available communication buffer.
[in]sizesize in bytes to allocate
[out]bufferhandle of communication buffer area
[out]allocatedreturned allocated size. Optional, pass NULL to if not needed.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.0 and later.
See also
mxfDeviceCommBufferFree()
mxfSystemInitAttributeUint64CallbackHandler()
mxfDeviceCommBufferGet()
mxfDeviceCommBufferStatusGet()
Examples:
ar429_comm_queues.c, ar429_comm_queues.cs, mil1553_embedded_async_to_1553.c, mil1553_embedded_async_to_1553.cs, mil1553_embedded_update_host.c, and mil1553_embedded_update_host.cs.
uint32 mxfDeviceCommBufferGet ( HMXF_DEVICE  device,
uint64  index,
HMXF_BUFFER *  buffer 
)
C#
public static extern UInt32 mxfDeviceCommBufferGet(UInt64 device, UInt64 index, out UInt64 buffer);

Returns the handle of the specified communication buffer index.

Parameters
[in]devicedevice handle
[in]indexcommunication buffer index. KMXF_DEVICE_COMM_QUEUE_NUM attribute is used to define the number of available communication buffer.
[out]bufferreturned handle of communication buffer area
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.0 and later.
See also
mxfDeviceCommBufferAlloc()
mxfDeviceCommBufferStatusGet()
Examples:
ar429_embedded_comm_queues.c, mil1553_embedded_async_to_1553.c, and mil1553_embedded_update_embedded.c.
uint32 mxfDeviceCommBufferFree ( HMXF_BUFFER  buffer)
C#
public static extern UInt32 mxfDeviceCommBufferFree(UInt64 buffer);

Deallocates the memory previously allocated by mxfDeviceCommBufferAlloc().

Parameters
[in]bufferbuffer handle.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.0 and later.
See also
mxfDeviceCommBufferAlloc()
uint32 mxfDeviceCommBufferStatusGet ( HMXF_BUFFER  buffer,
uint64 *  status,
uint64 *  msgCount,
uint64 *  pendingBytes,
uint64 *  freeBytes 
)
C#
public static extern UInt32 mxfDeviceCommBufferStatusGet(UInt64 buffer, out UInt64 status, out UInt64 msgCount, out UInt64 pendingBytes, out UInt64 freeBytes);

public static extern UInt32 mxfDeviceCommBufferStatusGet(UInt64 buffer, IntPtr status, IntPtr msgCount, IntPtr pendingBytes, IntPtr freeBytes);

Returns the status and the number of messages/bytes pending in a communication buffer.

Parameters
[in]bufferbuffer handle
[out]statusReserved for future use. Pass NULL to ignore this parameter.
[out]msgCountnumber of unread messages of MXF_EMBEDDED_DATAREC type. Pass NULL to ignore this parameter.
[out]pendingBytesnumber of unread bytes. Pass NULL to ignore this parameter.
[out]freeBytesnumber of free bytes. Pass NULL to ignore this parameter.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.0 and later.
See also
mxfDeviceCommBufferAlloc()
mxfDeviceCommBufferWrite()
mxfDeviceCommBufferRead()
uint32 mxfDeviceCommBufferInfoGet ( HMXF_BUFFER  buffer,
HMXF_DEVICE *  device,
uint64 *  index 
)
C#
public static extern UInt32 mxfDeviceCommBufferInfoGet(UInt64 buffer, out UInt64 device, out UInt64 index);

public static extern UInt32 mxfDeviceCommBufferInfoGet(UInt64 buffer, IntPtr device, IntPtr index);

Returns the device handle and communication buffer index from a communication buffer handle.

Parameters
[in]bufferbuffer handle
[out]devicedevice handle. Pass NULL to ignore this parameter.
[out]indexcommunication buffer index. Pass NULL to ignore this parameter.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.0 and later.
See also
mxfDeviceCommBufferAlloc()
uint32 mxfDeviceCommBufferWrite ( HMXF_BUFFER  buffer,
uint64  count,
MXF_EMBEDDED_DATAREC rec 
)
C#
public static extern UInt32 mxfDeviceCommBufferWrite(UInt64 buffer, UInt64 count, IntPtr rec);

Writes data records in the specified communication buffer.

Parameters
[in]bufferbuffer handle
[in]countnumber of records to write
[in]recarray of MXF_EMBEDDED_DATAREC records. The records are packed in the buffer. mxfNextRecordPtrGet() function must be used to navigate from one record to the other in the buffer.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.0 and later.
See also
mxfDeviceCommBufferAlloc()
mxfDeviceCommBufferRead()
mxfDeviceCommBufferStatusGet()
mxfDeviceCommBufferWriteAsync()
Examples:
ar429_comm_queues.c, ar429_comm_queues.cs, ar429_embedded_comm_queues.c, mil1553_embedded_async_to_1553.c, mil1553_embedded_async_to_1553.cs, mil1553_embedded_update_embedded.c, mil1553_embedded_update_host.c, and mil1553_embedded_update_host.cs.
uint32 mxfDeviceCommBufferWriteAsync ( HMXF_BUFFER  buffer,
uint64  count,
MXF_EMBEDDED_DATAREC hostBuffer,
MXF_ASYNCHRONOUS_CALLBACK  writeCompletion,
void *  context 
)
C#
public static extern UInt32 mxfDeviceCommBufferWriteAsync(UInt64 buffer, UInt64 count, IntPtr hostBuffer, MXF_ASYNCHRONOUS_CALLBACK writeCompletion, IntPtr context);

Writes asynchronously data records in the specified communication buffer. The function will return immediately after it has been registered to be executed by another thread. A callback function will be called when the asynchronous function has finished.

A maximum of 1000 asynchronous function calls can be queued.

Parameters
[in]bufferbuffer handle
[in]countnumber of records to write
[in]hostBufferarray of MXF_EMBEDDED_DATAREC records. The records are packed in the buffer. mxfNextRecordPtrGet() function must be used to navigate from one record to the other in the buffer.
[in]writeCompletioncallback function to be called when write process has been completed. Callback function is defined as follow:
1 typedef void (*MXF_ASYNCHRONOUS_CALLBACK)(HMXF_BUFFER bufferHandle, uint32 result, void* context, uint64* output);
[in] bufferHandle: buffer handle.
[in] result: return code of the function.
[in] context: pointer to a value that has been passed for the callback.
[in] output: array of additional information. output[0] contains the number of records to write.
[in]contextpointer to a value that will be passed to the callback handler (optional).
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.0 and later.
See also
mxfDeviceCommBufferWrite()
uint32 mxfDeviceCommBufferRead ( HMXF_BUFFER  buffer,
uint64  maxMsgCount,
uint64  maxBytesCount,
uint64 *  msgReadCount,
uint64 *  byteReadCount,
MXF_EMBEDDED_DATAREC rec 
)
C#
public static extern UInt32 mxfDeviceCommBufferRead(UInt64 buffer, UInt64 maxMsgCount, UInt64 maxBytesCount, out UInt64 msgReadCount, out UInt64 byteReadCount, IntPtr rec);

Reads data records from a communication buffer.

Parameters
[in]bufferbuffer handle
[in]maxMsgCountnumber maximum of records to read (0 means all messages)
[in]maxBytesCountnumber maximum of bytes to read
[out]msgReadCountnumber of messages returned
[out]byteReadCountnumber of bytes to returned
[out]recarray of MXF_EMBEDDED_DATAREC records. The records are packed in the buffer. mxfNextRecordPtrGet() function must be used to navigate from one record to the other in the buffer.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.0 and later.
See also
mxfDeviceCommBufferAlloc()
mxfDeviceCommBufferWrite()
mxfDeviceCommBufferStatusGet()
mxfDeviceCommBufferReadAsync()
Examples:
ar429_comm_queues.c, ar429_comm_queues.cs, ar429_embedded_comm_queues.c, mil1553_embedded_async_to_1553.c, mil1553_embedded_async_to_1553.cs, mil1553_embedded_update_embedded.c, mil1553_embedded_update_host.c, and mil1553_embedded_update_host.cs.
uint32 mxfDeviceCommBufferReadAsync ( HMXF_BUFFER  buffer,
uint64  maxMsgCount,
uint64  maxBytesCount,
MXF_EMBEDDED_DATAREC hostBuffer,
MXF_ASYNCHRONOUS_CALLBACK  readCompletion,
void *  context 
)
C#
public static extern UInt32 mxfDeviceCommBufferReadAsync(UInt64 buffer, UInt64 maxMsgCount, UInt64 maxBytesCount, IntPtr hostBuffer, MXF_ASYNCHRONOUS_CALLBACK readCompletion, IntPtr context);

Reads asynchronously data records from a communication buffer. The function will return immediately after it has been registered to be executed by another thread. A callback function will be called when the asynchronous function has finished.

A maximum of 1000 asynchronous function calls can be queued.

Parameters
[in]bufferbuffer handle
[in]maxMsgCountnumber maximum of records to read (0 means all messages)
[in]maxBytesCountnumber maximum of bytes to read
[out]hostBufferarray of MXF_EMBEDDED_DATAREC records. The records are packed in the buffer. mxfNextRecordPtrGet() function must be used to navigate from one record to the other in the buffer.
[in]readCompletioncallback function to be called when read process has been completed. Callback function is defined as follow:
1 typedef void (*MXF_ASYNCHRONOUS_CALLBACK)(HMXF_BUFFER bufferHandle, uint32 result, void* context, uint64* output);
[in] bufferHandle: buffer handle.
[in] result: return code of the function.
[in] context: pointer to a value that has been passed for the callback.
[in] output: array of additional information. output[0] contains the number of messages returned in hostBuffer. output[1] contains the number of bytes returned in hostBuffer.
[in]contextpointer to a value that will be passed to the callback handler (optional).
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.0 and later.
See also
mxfDeviceCommBufferRead()
uint32 mxfDeviceCommBufferClear ( HMXF_BUFFER  buffer)
C#
public static extern UInt32 mxfDeviceCommBufferClear(UInt64 buffer);

Clears the data pending in a communication buffer.

Parameters
[in]bufferbuffer handle
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.0 and later.
See also
mxfDeviceCommBufferAlloc()
mxfDeviceCommBufferStatusGet()
uint32 mxfDeviceCommRxBufferAsyncEventInit ( HMXF_BUFFER  buffer,
uint64  almostFull,
void *  context,
MXF_ASYNCEVENT_BUFFER_HANDLER  callback 
)
C#
public static extern UInt32 mxfDeviceCommRxBufferAsyncEventInit(UInt64 buffer, UInt64 almostFull, IntPtr context, MXF_ASYNCEVENT_BUFFER_HANDLER callback);

Sets an async event handler for a Rx communication buffer. When the almost full threshold will be reached, the callback will be called once and will be called again only when the almost full threshold will be reached again.

Parameters
[in]bufferRx communication buffer handle
[in]almostFullalmost full threshold value
[in]contexthandler callback context
[in]callbackRx communication buffer callback handler

The callback handler function is defined as follow:

1 typedef uint32 (*MXF_ASYNCEVENT_BUFFER_HANDLER)(HMXF_BUFFER buffer, void* context);

[in] buffer: buffer handle [in] context: context pointer

Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.1 and later.
See also
mxfDeviceCommRxBufferAsyncEventTerminate()
mxfAsyncEventConditionsSet()
uint32 mxfDeviceCommRxBufferAsyncEventTerminate ( HMXF_BUFFER  buffer)
C#
public static extern UInt32 mxfDeviceCommRxBufferAsyncEventTerminate(UInt64 buffer);

Clears the async event handler for a Rx communication buffer.

Parameters
[in]bufferRx communication buffer handle
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.1 and later.
See also
mxfDeviceCommRxBufferAsyncEventInit()
mxfAsyncEventConditionsSet()
uint32 mxfDeviceCommTxBufferAsyncEventInit ( HMXF_BUFFER  buffer,
uint64  almostEmpty,
void *  context,
MXF_ASYNCEVENT_BUFFER_HANDLER  callback 
)
C#
public static extern UInt32 mxfDeviceCommTxBufferAsyncEventInit(UInt64 buffer, UInt64 almostEmpty, IntPtr context, MXF_ASYNCEVENT_BUFFER_HANDLER callback);

Sets an async event handler for a Tx communication buffer. When the almost empty threshold will be reached, the callback will be called once and will be called again only when the almost empty threshold will be reached again.

Parameters
[in]bufferTx communication buffer handle
[in]almostEmptyalmost empty threshold value
[in]contexthandler callback context
[in]callbackTx communication buffer callback handler

The callback handler function is defined as follow:

1 typedef uint32 (*MXF_ASYNCEVENT_BUFFER_HANDLER)(HMXF_BUFFER buffer, void* context);

[in] buffer: buffer handle [in] context: context pointer

Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.1 and later.
See also
mxfDeviceCommTxBufferAsyncEventTerminate()
mxfAsyncEventConditionsSet()
uint32 mxfDeviceCommTxBufferAsyncEventTerminate ( HMXF_BUFFER  buffer)
C#
public static extern UInt32 mxfDeviceCommTxBufferAsyncEventTerminate(UInt64 buffer);

Clears the async event handler for a Tx communication buffer.

Parameters
[in]bufferTx communication buffer handle
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.1 and later.
See also
mxfDeviceCommTxBufferAsyncEventInit()
mxfAsyncEventConditionsSet()
Updated 10/23/2023