Measurement Computing ADLIB WIN User Manual

Page 26

Advertising
background image

Chapter 6 Memory Buffer Allocation

6-2

long lErrorFlags

The Error Flags specify the condition that has stopped a buffer from
successfully completing. Although an error may be reported, this does not
indicate the BUFFER_FULL flag is not set. This would be the case if an error
was detected and enough samples were available to fill the buffer to capacity.
One or more of these flags may also be set together. If any of these flags have
set, checking the current hardware error conditions will usually reveal the actual
condition that caused the acquisition runtime error. This flag can be set to any
of the four following conditions as defined in the ADLIB include file.

BUFFER_STOPPED = 1

An error occurred and the buffer(s) are no longer being serviced.

BUFFER_OVERRUN = 2

An error occurred when attempting to place the next sample
beyond the bounds of the buffer.

BUFFER_UNDERRUN = 4

An error occurred and the buffer is incomplete.

BUFFER_NEXTBUSY = 8

When attempting to access the next buffer, the current state of
the dwDoneFlag indicated the buffer was not yet available for
use. To release control of a buffer call the function
AL_ClearBufferDoneFlag(LHLD, lBufferNum)

The Buffer structure is defined as follows in ADLIB include file.

C\C++ adlib.h file

typedef struct tagDATABUFFER
{
DWORD

dwBufferType;


DWORD

dwBufferSize; .

/* Size of each buffer in samples. */


WORD huge * hpwBufferLinear; .

/* App linear buffer address. */


LPVOID

lpvDataBuffPhysical;

/* Physical address for DMA buffer. Set to NULL when */

/* non DMA transfer mode. This address should not be */

/* used by a user App. */


DWORD

dwBufferWrite;

/* Number of data samples in the buffer. */

DWORD

dwBufferRead;

/* Number of data samples obtained from the buffer. */


WORD huge * hpwTrigPoint;

/* App linear address of the trigger point. */

WORD huge * hpwTrigPointStart;

/* App linear starting address of the pre-trigger data. */

DWORD

dwDoneFlag;

/* Buffer complete flag */

DWORD

dwStatusFlags;

/* Current status */


long

lErrorFlags;

/* Buffer errors */


DWORD

dwBuffNum;

/* Buffer number */

}DATABUFFER;
typedef DATABUFFER FAR * LPBUFFERSTRUCT;

In addition to the above structure that provides pointers to the data, a status structure is available. This
structure was originally created to provided support in Visual Basic, but can also be used in the C\C++
ADLIB API. See the ADLIB function AL_GetBufferStatus for details.

typedef struct tagDATABUFFSTAT
{

Advertising