/******************************************************************************
    fwx1394API.h

    This file contains the wrapper interface for the Fireworks 1394 
    Installable device driver interface (which cannot be accessed directly).

    Copyright (c) 1997 by 3A International, Inc.  All rights Researved.
******************************************************************************/

#ifndef FWX1394API_H
#define FWX1394API_H

#include "fwx1394.h"
#include "fwxError.h"

#ifdef DECLSPEC
#undef DECLSPEC
#endif

#ifdef _EXPORTING
#define DECLSPEC _declspec(dllexport) 
#undef _EXPORTING
#else
#define DECLSPEC _declspec(dllimport)
#endif

//typedef HANDLE          fwxHandle_t; // in "fwx1394.h"

BOOL DECLSPEC fwxInitialize(void);
BOOL DECLSPEC fwxTerminate(void);
fwxHandle_t DECLSPEC fwxOpenDeviceInstance(ULONG ulVendorDeviceId, WORD wInstance=0);
fwxHandle_t DECLSPEC fwxOpenDevice(ULONG ulVendorDeviceId, ULONG ulChipId);
fwxHandle_t DECLSPEC fwxOpenNode(unsigned int NodeId);
BOOL DECLSPEC fwxCloseHandle(fwxHandle_t hDevice);
ULONG DECLSPEC fwxGetLastError(void);
LPCTSTR DECLSPEC fwxGetErrorText(ULONG Error);
BOOL DECLSPEC fwxGetDeviceList(fwxDeviceList_t * pDeviceList);
BOOL DECLSPEC fwxGetAdapterInfo(fwxAdapterInfo_t * pAdapterInfo);
BOOL DECLSPEC fwxGetBusDriverProperties(fwxBusDriverProperties_t * pProperties);
BOOL DECLSPEC fwxGetDeviceProperties(fwxHandle_t hDevice, fwxDeviceProperties_t * pProperties);

BOOL DECLSPEC fwxAllocateAddressRange(fwxAllocateAddressRange_t* pAllocateAddressRange);
BOOL DECLSPEC fwxFreeAddressRange(fwxHandle_t* hHandle);
BOOL DECLSPEC fwxIssueBusReset( void );

BOOL DECLSPEC fwxAllocateSharedMemory(fwxSharedMemory_t* pSharedMemoryRec);
BOOL DECLSPEC fwxFreeSharedMemory(fwxHandle_t* hHandle);

BOOL DECLSPEC fwxReadQuadlet(fwxAsyncRead_t * pAsync, Quadlet * pQuadlet, int speed = 0);
BOOL DECLSPEC fwxReadBlock(fwxAsyncRead_t * pAsync, BYTE * pBlock, int speed = 0);
BOOL DECLSPEC fwxWriteQuadlet(fwxAsyncWrite_t * pAsync, int speed = 0);
BOOL DECLSPEC fwxWriteBlock(fwxAsyncWrite_t * pAsync, int speed = 0);
BOOL DECLSPEC fwxLock(fwxAsyncLock_t * pAsync, BYTE * pBlock, int speed = 0);

BOOL DECLSPEC fwxSendRawBlock(BYTE*  pBlock, unsigned int  nbyte, int speed = 0);
/// New  get asynch notification event and the asynch information
BOOL DECLSPEC fwxGetAsyncNotify( fwxAsyncRcv_t*  pAsyRcv, int flag );

BOOL DECLSPEC fwxAllocateIsoResources(fwxAllocateIsoResources_t * pAllocateIsoResources);
BOOL DECLSPEC fwxFreeIsoResources(fwxFreeIsoResources_t * pFreeIsoResources);
BOOL DECLSPEC fwxAllocateBandwidth(fwxAllocateBandwidth_t * pAllocateBandwidth);
BOOL DECLSPEC fwxFreeBandwidth(fwxFreeBandwidth_t * pFreeBandwidth);
BOOL DECLSPEC fwxAllocateChannel(fwxAllocateChannel_t * pAllocateChannel);
BOOL DECLSPEC fwxFreeChannel(fwxFreeChannel_t * pFreeChannel);
BOOL DECLSPEC fwxIsoReceive(fwxIsoReceive_t * pIsoReceive);
BOOL DECLSPEC fwxIsoTransmit(fwxIsoTransmit_t * pIsoTransmit);
BOOL DECLSPEC fwxIsoStop(fwxIsoStop_t * pIsoStop);
BOOL DECLSPEC fwxReadConfigROM(fwxReadConfigROM_t * pConfigROM, BYTE * Buffer);
BOOL DECLSPEC fwxWriteConfigROM(fwxSaveConfigROM_t * pConfigROM);

fwxHandle_t DECLSPEC fwxGetBusResetEvent();
fwxHandle_t DECLSPEC fwxGetDeviceRemovedEvent();

/*****************************************************************************/
#ifdef _PROFILE
BOOL DECLSPEC fwxGetIsoStatistics(fwxGetIsoStatistics_t * pGetIsoStatistics);
#else
#define fwxGetIsoStatistics(pGetIsoStatistics)  /* null */
#endif /* _PROFILE */


#endif  //  FWX1394API_H 

