DR_ApListBuffers

DR_ApListBuffers — lists blocks defined to the driver.

Syntax

#include <cogent.h>
int DR_ApListBuffers(int  card_id,
 int  max_bufs,
 int*  num_bufs,
 unsigned short*  size,
 char**  error);

Arguments

card_id

The card ID of the requested block of data.

max_bufs

The maximum number of buffers to be listed.

num_bufs

If not NULL, the address of the variable to return the actual number of buffers associated with the specified card.

size

If not NULL, a pointer to an array at least max_bufs long, that will be filled with the size (in bytes) of each of the num_bufs blocks.

error

The address of a string pointer. In case of error (non-zero return), the string pointer is set to the corresponding error description string. The error string is contained in a static buffer and remains valid only until the next API call. The parameter may be NULL if no error string is required.

Returns

The integer value 0 if the function was successful, otherwise one of the following error codes:

DR_API_IPC_ERRORS
DR_API_STATUS_ERRORS
DR_ERR_CARD_INVALID
DR_ERR_BLK_INVALID
DR_ERR_BLK_NOT_FOUND
DR_ERR_NO_USER_OBJECT

Description

This function provides a list of the blocks currently defined to the driver. This information may then be used to get further block attribute information and read or write the blocks.

Example

int             i, num_blks, result;
unsigned short  buf_size[4];
char            *error_str;

num_blks = 0;
if (!(result = DR_ApListBuffers (0, 4, &num_blks, buf_size,
                                 &error_str)))
{
  printf ("   Device 0 has %d buffers with sizes ", num_blks);
        for (i=0; i<num_blks; i++)
              printf ("%d%s", buf_size[i],
                      ((i+1==num_blks)?".":", "));
        printf ("\n");
}
else
        printf ("     Error@ListBuffers (%d,%s)\n",
                result, error_str);
}