#ifndef NDTSCOMMONHALERRORS_H
#define NDTSCOMMONHALERRORS_H

#ifdef __cplusplus
extern "C" {
#endif

#include "NDTSCommonHALConstants.h"

typedef enum
{
	NDTS_HAL_OK														= 0x00050000,

	NDTS_HAL_GetHALInfo_MissingHAL									= 0x00050100,
	
	NDTS_HAL_GetCardInternalIndex_MissingCard						= 0x00050200,

	NDTS_HAL_EnumerateHALs_InsufficientHALInputBufferSize			= 0x00050300,

	NDTS_HAL_InitialiseHAL_MissingFunctionPointers					= 0x00050400,

	NDTS_HAL_RegisterBoard_DifferentCardTypeAlreadyAssignedToHAL	= 0x00050500,
	NDTS_HAL_RegisterBoard_CardTypeAlreadyAssignedToDifferentHAL	= 0x00050501,

	NDTS_HAL_InitialiseCardType_NoAvailableHALs						= 0x00050600,
	NDTS_HAL_InitialiseCardType_NotInitialised						= 0x00050601,

	NDTS_HAL_GetBoardIDs_FindDeviceFail								= 0x00050700,
	NDTS_HAL_GetBoardIDs_OpenDeviceFail								= 0x00050701,
	NDTS_HAL_GetBoardIDs_CloseDeviceFail							= 0x00050802,
	NDTS_HAL_GetBoardIDs_InsufficientInputBoardIDBufferSize			= 0x00050803,
	NDTS_HAL_GetBoardIDs_InsufficientInternalBoardStateBufferSize	= 0x00050805,

	NDTS_HAL_InitialiseHAL_HALIsNotAvailable						= 0x00050900,
	NDTS_HAL_InitialiseHAL_CannotFindDLL							= 0x00050901,
	NDTS_HAL_InitialiseHAL_CannotFindDLLFunctionPointer				= 0x00050902,

	NDTS_HAL_AddBoard_HALIsNotInitialised							= 0x00050a00,
	NDTS_HAL_AddBoard_FindDeviceFail								= 0x00050a01,
	NDTS_HAL_AddBoard_OpenDeviceFail								= 0x00050a02,
	NDTS_HAL_AddBoard_CloseDeviceFail								= 0x00050a03,
	NDTS_HAL_AddBoard_SerialEepromPresentFail						= 0x00050a04,
	NDTS_HAL_AddBoard_CardNotFound									= 0x00050a05,
	NDTS_HAL_AddBoard_BarMapFail									= 0x00050a06,
	NDTS_HAL_AddBoard_GetCommonBufferPropertiesFail					= 0x00050a07,
	NDTS_HAL_AddBoard_CommonBufferMapFail							= 0x00050a08,

	NDTS_HAL_RemoveBoard_BarUnmapFail								= 0x00050b00,
	NDTS_HAL_RemoveBoard_CloseDeviceFail							= 0x00050b01,

	NDTS_HAL_OpenDMAChannel_DMABlockChannelOpenFail					= 0x00050c00,

	NDTS_HAL_CloseDMAChannel_DMABlockChannelCloseFail				= 0x00050d00,

	NDTS_HAL_PerformDMARead_DMABlockTransferFail					= 0x00050e00,
	NDTS_HAL_PerformDMARead_DMAChannelNotOpen						= 0x00050e01,

	NDTS_HAL_PerformDMAWrite_DMABlockTransferFail					= 0x00050f00,
	NDTS_HAL_PerformDMAWrite_DMAChannelNotOpen						= 0x00050f01,

	NDTS_HAL_CheckCardIndexState_HALIsNotInitialised				= 0x00051000,
	NDTS_HAL_CheckCardIndexState_InvalidCardIndex					= 0x00051001,
	NDTS_HAL_CheckCardIndexState_MissingState						= 0x00051002,

	NDTS_HAL_WriteSecondaryDeviceID_NonNDTSCard						= 0x00051100,
	NDTS_HAL_WriteSecondaryDeviceID_DeviceOpenFail					= 0x00051101,
	NDTS_HAL_WriteSecondaryDeviceID_IDWriteFail						= 0x00051102,
	NDTS_HAL_WriteSecondaryDeviceID_DeviceCloseFail					= 0x00051103,
	
	NDTS_HAL_LastError
} NDTS_HAL_ReturnCode ;


void NDTS_HAL_HandleHALError(NDTS_HAL_ReturnCode errorCode) ;
NDTSHAL_API const char * CALL_CONV NDTS_HAL_GetCodeString(int errorCode) ;

#ifdef __cplusplus
}
#endif

#endif
