DR_ApWriteBlock

DR_ApWriteBlock — writes data to a block.

Syntax

#include <cogent.h>
int DR_ApWriteBlock(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 written.

data

The address of memory area, at least size byes long, containing the 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 writes data to the specified block.

Example

/* continued from example in DR_ApReadBlock */	
printf ("   Write Block Bit Cycle:\n", 1);
data[32] = 0;
for (i=0; i<=8 && result==0; i++)
{
        if (data[32] == 0)
              data[32] = 1;
        else
              data[32] *= 2;
        printf ("\r      %4X ", data[32]);
        fflush (stdout);
        if (result = DR_ApWriteBlock (0, 0, 0, 64, data,
                                      &error_str))
        printf ("     Error@WriteBlock (%d,%s)\n",
                result, error_str);
        delay (250);
}
printf ("\n");