fdhwlib
2.0.25
|
00001 /*************************************************************************** 00002 BaseRegisteritem.h - description 00003 ------------------- 00004 begin : Fr May 6 2008 00005 copyright : (C) 2008 by 00006 email : 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef _HW4_BASEREGISTERITEM_H_INCLUDED 00019 #define _HW4_BASEREGISTERITEM_H_INCLUDED 00020 00021 00022 00023 00024 namespace hw4 { 00025 00026 class BaseRegister; 00027 00028 00034 class BaseRegisterItem { 00035 public: 00036 00038 BaseRegisterItem(BaseRegister *reg, const char *name=0, unsigned long low=0, unsigned long len=32); 00039 00041 BaseRegisterItem(BaseRegisterItem *group, const char *name, unsigned long low, unsigned long len); 00042 00043 virtual ~BaseRegisterItem(); 00044 00046 virtual unsigned long read(int elem = 0); 00047 00049 virtual void write(unsigned long data); 00050 00052 virtual void write(int elem, unsigned long data); 00053 00055 virtual unsigned long getCache(int elem = 0); 00056 00059 virtual bool isEnabled(int elem = 0); 00060 00063 virtual bool isDisabled(int elem = 0); 00064 00067 virtual bool isActive(int elem = 0); 00068 00071 virtual bool isInactive(int elem = 0); 00072 00075 virtual void setCache(unsigned long data); 00076 00079 virtual void setCache(int elem, unsigned long data); 00080 00082 virtual unsigned long get(unsigned long data); 00083 00085 const char *getName(); 00086 00088 BaseRegisterItem *getGroup(); 00089 00090 int getLowBit(); 00091 00092 int getLength(); 00093 00094 int getByteShift(); 00095 00096 unsigned long getMask(); 00097 00098 private: 00099 00101 const char *name; 00102 00104 unsigned long low; 00105 00111 unsigned long byteShift; 00112 00114 unsigned long mask; 00115 00117 unsigned long len; 00118 00119 00121 BaseRegister *reg; 00122 00127 BaseRegisterItem *group; 00128 }; 00129 00130 } // namespace hw4 00131 00132 #endif // _HW4_BASEREGISTERITEM_H_INCLUDED