// =============================================
// prvdrv_dynamic.c - support for PRVDRV driver
// =============================================
// (c) Copyright 2000
// The Parvus Corporation
// 396 Ironwood Drive
// Salt Lake City, UT 84115
// Tel:      (801) 483-1533
// Fax:      (801) 483-1523
// Web:      www.parvus.com
// Email:    parvus@parvus.com
// ---------------------------------------------
//   Revision History:
// ---------------------------------------------
//
//   10/15/2000 CG - V1.00.00 release
//	 10/22/2000 CG - Add RemoveAllShadow() function
//
// ---------------------------------------------

// -----------
// Includes
// -----------

#include <windows.h>
#include "prvdrv_dynamic.h"

// ----------
// Local Data
// ----------
static HINSTANCE hLib;

// -----------------
// Support Functions
// -----------------

void prvdrv_DllLoad(void)
{
	hLib = LoadLibrary("prvdrv.dll");

	prvdrv_CardRanges	= (PRVDRV_RANGES*	(*)(void))				GetProcAddress(hLib, "prvdrv_CardRanges");
	prvdrv_Close		= (void				(*)(void))				GetProcAddress(hLib, "prvdrv_Close");
	prvdrv_ErrorString	= (char*			(*)(void))				GetProcAddress(hLib, "prvdrv_ErrorString");
	prvdrv_Open			= (PRVDRV_RESULT	(*)(void))				GetProcAddress(hLib, "prvdrv_Open");
	prvdrv_Read			= (unsigned int		(*)(PRVDRV_ACCESSTYPE mde, PRVDRV_WORDSIZE sze, unsigned int rnge, unsigned int offset))
																	GetProcAddress(hLib, "prvdrv_Read");
	prvdrv_ReadShadow	= (unsigned int		(*)(PRVDRV_ACCESSTYPE mde, PRVDRV_WORDSIZE sze, unsigned int rnge, unsigned int offset))
																	GetProcAddress(hLib, "prvdrv_ReadShadow");

	prvdrv_RemoveAllShadow=(void			(*)(void))				GetProcAddress(hLib, "prvdrv_RemoveAllShadow");

	prvdrv_Write		= (void				(*)(PRVDRV_ACCESSTYPE mde, PRVDRV_WORDSIZE sze, unsigned int rnge, unsigned int offset, unsigned int val))
																    GetProcAddress(hLib, "prvdrv_Write");

	prvdrv_ClearBit		= (void				(*)(PRVDRV_ACCESSTYPE mde, PRVDRV_WORDSIZE sze, unsigned int rnge, unsigned int offset, unsigned int bit))
																    GetProcAddress(hLib, "prvdrv_ClearBit");

	prvdrv_GetBit		= (void				(*)(PRVDRV_ACCESSTYPE mde, PRVDRV_WORDSIZE sze, unsigned int rnge, unsigned int offset, unsigned int bit))
																    GetProcAddress(hLib, "prvdrv_GetBit");

	prvdrv_SetBit		= (void				(*)(PRVDRV_ACCESSTYPE mde, PRVDRV_WORDSIZE sze, unsigned int rnge, unsigned int offset, unsigned int bit))
																    GetProcAddress(hLib, "prvdrv_SetBit");

	prvdrv_SetShadow	= (void				(*)(PRVDRV_ACCESSTYPE mde, PRVDRV_WORDSIZE sze, unsigned int rnge, unsigned int offset, unsigned int items))
																    GetProcAddress(hLib, "prvdrv_SetShadow");

	prvdrv_ToggleBit	= (void				(*)(PRVDRV_ACCESSTYPE mde, PRVDRV_WORDSIZE sze, unsigned int rnge, unsigned int offset, unsigned int bit))
																    GetProcAddress(hLib, "prvdrv_ToggleBit");

	prvdrv_ReadBlock	= (void				(*)( // Write an item to a Range
				PRVDRV_ACCESSTYPE mde,			// mode PRVDRV_IO, PRVDRV_MEM
				PRVDRV_WORDSIZE   sze,			// size PRVDRV_BYTE, etc
				unsigned int	  rnge,			// range index for I/O or MEM, 0,1,2 etc
				unsigned int	  offset,		// offset from base for read
				void*			  pblk,			// pointer to block to write back to
				unsigned int	  len))			// number of items to write
						  GetProcAddress(hLib, "prvdrv_ReadBlock");

	prvdrv_WriteBlock	= (void				(*)( // Write an item to a Range
				PRVDRV_ACCESSTYPE mde,			// mode PRVDRV_IO, PRVDRV_MEM
				PRVDRV_WORDSIZE   sze,			// size PRVDRV_BYTE, etc
				unsigned int	  rnge,			// range index for I/O or MEM, 0,1,2 etc
				unsigned int	  offset,		// offset from base for read
				void*			  pblk,			// pointer to block to write back to
				unsigned int	  len))			// number of items to write
						  GetProcAddress(hLib, "prvdrv_WriteBlock");

}

void prvdrv_DllClose(void)
{
}
