1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
/****************************************************************************
HalRegister.cpp
Description: Lynx Application Programming Interface Header File
Created: David A. Hoatson, September 2000
Copyright 2000 Lynx Studio Technology, Inc.
This software contains the valuable TRADE SECRETS and CONFIDENTIAL INFORMATION
of Lynx Studio Technology, Inc. The software is protected under copyright
laws as an unpublished work of Lynx Studio Technology, Inc. Notice is
for informational purposes only and does not imply publication. The user
of this software may make copies of the software for use with products
manufactured by Lynx Studio Technology, Inc. or under license from
Lynx Studio Technology, Inc. and for no other use.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
PURPOSE.
Environment:
4 spaces per tab
Revision History
When Who Description
--------- --- ------------------------------------------------------------
****************************************************************************/
#include <StdAfx.h>
#include "HalRegister.h"
#include "HalAdapter.h"
/////////////////////////////////////////////////////////////////////////////
CHalRegister::CHalRegister ()
/////////////////////////////////////////////////////////////////////////////
{
m_pHalAdapter = NULL;
m_pAddress = NULL;
m_ulValue = 0;
}
/////////////////////////////////////////////////////////////////////////////
CHalRegister::CHalRegister (PHALADAPTER pHalAdapter, PULONG pAddress,
ULONG ulType, ULONG ulValue)
/////////////////////////////////////////////////////////////////////////////
{
Init (pHalAdapter, pAddress, ulType, ulValue);
}
/////////////////////////////////////////////////////////////////////////////
CHalRegister::~CHalRegister ()
/////////////////////////////////////////////////////////////////////////////
{
}
/////////////////////////////////////////////////////////////////////////////
void
CHalRegister::Init (PHALADAPTER pHalAdapter, PULONG pAddress, ULONG ulType,
ULONG ulValue)
/////////////////////////////////////////////////////////////////////////////
{
m_pHalAdapter = pHalAdapter;
m_pAddress = pAddress;
m_ulType = ulType;
m_ulValue = ulValue;
// DAH 06/26/2002 These next two lines were commented out.
//if( m_ulType != REG_READONLY )
// WRITE_REGISTER_ULONG( m_pAddress, m_ulValue );
}
/////////////////////////////////////////////////////////////////////////////
ULONG
CHalRegister::Read ()
/////////////////////////////////////////////////////////////////////////////
{
#ifdef DEBUG
if (!m_pAddress)
{
cmn_err (CE_WARN, "CHalRegister::Read called with m_pAddress NULL!\n");
return (0);
}
#endif
if (m_ulType != REG_WRITEONLY)
m_ulValue = READ_REGISTER_ULONG (m_pAddress);
return (m_ulValue);
}
/////////////////////////////////////////////////////////////////////////////
void
CHalRegister::Write (ULONG ulValue)
/////////////////////////////////////////////////////////////////////////////
{
#ifdef DEBUG
if (!m_pAddress)
{
cmn_err (CE_WARN, "CHalRegister::Read called with m_pAddress NULL!\n");
return;
}
#endif
m_ulValue = ulValue;
if (m_ulType != REG_READONLY)
WRITE_REGISTER_ULONG (m_pAddress, m_ulValue);
}
/////////////////////////////////////////////////////////////////////////////
void
CHalRegister::Write (ULONG ulValue, ULONG ulMask)
/////////////////////////////////////////////////////////////////////////////
{
CLR (m_ulValue, ulMask);
SET (m_ulValue, (ulValue & ulMask));
Write (m_ulValue);
}
/////////////////////////////////////////////////////////////////////////////
void
CHalRegister::BitSet (ULONG ulBitMask, BOOLEAN bValue)
/////////////////////////////////////////////////////////////////////////////
{
CLR (m_ulValue, ulBitMask); // clear position(s)
if (bValue)
SET (m_ulValue, ulBitMask); // if SET then set position(s)
Write (m_ulValue);
}
|