Chapter 12: Cash Drawer Interface 12-21
WaitForSingleObject( g_hHWPortMutex, INFINITE );
if ((m_nOSVersion == OS_WINDOWS_95) || (m_nOSVersion == OS_WINDOWS_CE))
{ // WIN 95 I/O config
//********************************PART A
*************************************
_outpd(m_nIOConf, n_configGPIOReqData); // request communication
with GPIO_BASE
gpioport = (LOWORD(_inpd(m_nIOConf+4)))
& 0x0FFC0; // get GPIO base address
(only 10 bits)
m_nIOPort_select = (WORD)gpioport+uc_gpsel_offset; // GP Sel Base
address from GPIO Base Register
m_nIOPort = (WORD)gpioport+uc_gp_offset; // GPO Base address from GPIO
Base Register
nUsePort = (WORD)gpioport+uc_gpuse_offset;
} //Win95
else // WIN NT I/O Config
{
if (m_bPortDrvr == TRUE) // if Wedge NT driver opened successfully
{
//********************************PART A
*************************************
SetFilePointer( g_hPortDrvr, m_nIOConf, (PLONG)&FileOffset, FILE_BEGIN);
// request communication with GPIOBASE
if ( WriteFile(
g_hPortDrvr, // Handle to device
(LPSTR) &n_configGPIOReqData,
(DWORD) 4, // Length of buffer in bytes
&DataWritten, // bytes written
NULL ) == FALSE ) // NULL means wait till I/O completes.
{
DWORD hr = GetLastError();
result = FALSE;
return result;
}
else
{
SetFilePointer( g_hPortDrvr, (m_nIOConf+4), (PLONG)&FileOffset,
FILE_BEGIN); //TIGER +4
// get GPIO base address
if ( result &&
( ReadFile(