00001 #ifndef UPP_H
00002 #define UPP_H
00003 #include <Base/BaseDebug.h>
00004 #include <vector>
00005
00006 namespace Spr {
00007
00008
00009
00010 class SPR_DLL DRUpp{
00011 public:
00012 class SPR_DLL UppFunc
00013 {
00014 public:
00015
00016 enum { FRS = 0x00, INS = 0x10, UDS = 0x20, GTS = 0x30,
00017 FRC = 0x40, INC = 0x50, PWC = 0x60, OSC = 0x70,
00018 FFC = 0x80, TPC = 0x98, GTC = 0xA0, CTO = 0xB0,
00019 SIT = 0xC0, SOT = 0xD0, SPO = 0xE0, NOP = 0xF0};
00020
00021 enum {};
00022
00023 enum {};
00024 enum {IDLEN = 20};
00025
00026 char id[IDLEN+1];
00027
00028
00029 int cmd, ar, br, ioa, iob, ioc, iod;
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 UppFunc(int aCmd = NOP, int anAr = 0, int anBr = 0,
00041 int anIoa = 0, int anIob = 0, int anIoc = 0, int anIod = 0, char* anId = "");
00042 bool operator ==(const UppFunc& f) const;
00043 bool operator <(const UppFunc& f) const;
00044 bool operator >(const UppFunc& f) const;
00045 bool operator !=(const UppFunc& f) const;
00046 };
00047 protected:
00048
00049 enum {PORT1 = 0x3, PORT2 = 0x2, UDR_BASE=0x40};
00050
00051 bool bInitalized;
00052
00053
00054 static int FNR[17];
00055
00056 void SetFunc();
00057
00058
00059 std::vector<UppFunc> func;
00060 public:
00061
00062 DRUpp();
00063
00064 virtual bool Init();
00065
00066 virtual void Out(unsigned a, unsigned v)=0;
00067
00068 virtual int In(unsigned a)=0;
00069
00070 bool Run();
00071
00072
00073 void Run(bool b);
00074
00075 void Add(const UppFunc& f);
00076
00077 void Del(char* id);
00078
00079 void Del(int id);
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090 void PortOwner(unsigned owner = 0xFFFF);
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 void PortDir(unsigned dir = 0x0000);
00101
00102 unsigned short PioRead();
00103
00104 void PioWrite(unsigned short d);
00105
00106
00107
00108 void UdrWrite(unsigned no,unsigned short v);
00109
00110
00111
00112 unsigned short UdrRead(unsigned no);
00113 };
00114 }
00115 #endif