DR_ApReadBlock

DR_ApReadBlock — reads a block.

Syntax

#include <cogent.h>
int DR_ApReadBlock(int  card_id,
 int  buf_id,
 unsigned short  offset,
 unsigned short  size,
 void*  data,
 char**  error);

Arguments

card_id

The card ID of the requested block of data.

buf_id

The buffer ID of the requested block of data.

offset

The starting (byte) address of the requested block of data into the specified card buffer.

size

The number of bytes to be read.

data

The address of memory area, at least size byes long, to receive data.

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_ERR_CARD_INVALID
DR_ERR_BLK_INVALID
DR_ERR_BLK_OFS_INVALID
DR_ERR_BLK_SIZE_INVALID
DR_ERR_CMD_INVALID

Description

This function reads the specified block.

Example

char    data[1024];
int     result, i;
char    *error_str;

printf ("   Reading output block\n");
if (result = DR_ApReadBlock (0, 0, 0, 64, data, &error_str))
      printf ("     Error@ReadBlock (%d,%s)\n",
              result, error_str);
else
{
        dump_data (6, data, 8, 16);
}