00001 #include "fec.hh"
00002 #include <feeserver/fee_servt.hh>
00003 #include <iostream>
00004 #include <cerrno>
00005
00006
00007 Fec::Fec(unsigned short addr, FeeServer::Main& m, RcuCE::Rcu& r)
00008 : RcuCE::Fec(addr, m, r),
00009 _csr0(0),
00010 _csr1(0),
00011 _t1(0),
00012 _flash_i(0),
00013 _al_dig_i(0),
00014 _al_ana_i(0),
00015 _va_rec_ip(0),
00016 _t2(0),
00017 _va_sup_ip(0),
00018 _va_rec_im(0),
00019 _va_sup_im(0),
00020 _gtl_u(0),
00021 _t3(0),
00022 _t1_sens(0),
00023 _t2_sens(0),
00024 _al_dig_u(0),
00025 _al_ana_u(0),
00026 _t4(0),
00027 _va_rec_up(0),
00028 _va_sup_up(0),
00029 _va_sup_um(0),
00030 _va_rec_um(0)
00031 {
00032 _csr1 = AddService<int,FeeServer::IntTrait>("CSR1", 0x12);
00033 _t1 = AddService<int,FeeServer::IntTrait>("T1", 0x6);
00034 _flash_i = AddService<int,FeeServer::IntTrait>("FLASH_I", 0x7);
00035 _al_dig_i = AddService<int,FeeServer::IntTrait>("AL_DIG_I", 0x8);
00036 _al_ana_i = AddService<int,FeeServer::IntTrait>("AL_ANA_I", 0x9);
00037 _va_rec_ip = AddService<int,FeeServer::IntTrait>("VA_REC_IP", 0xA);
00038 _t2 = AddService<int,FeeServer::IntTrait>("T2", 0x32);
00039 _va_sup_ip = AddService<int,FeeServer::IntTrait>("VA_SUP_IP", 0x33);
00040 _va_rec_im = AddService<int,FeeServer::IntTrait>("VA_REC_IM", 0x34);
00041 _va_sup_im = AddService<int,FeeServer::IntTrait>("VA_SUP_IM", 0x35);
00042 _gtl_u = AddService<int,FeeServer::IntTrait>("GTL_U", 0x36);
00043 _t3 = AddService<int,FeeServer::IntTrait>("T3", 0x3C);
00044 _t1_sens = AddService<int,FeeServer::IntTrait>("T1_SENS", 0x3D);
00045 _t2_sens = AddService<int,FeeServer::IntTrait>("T2_SENS", 0x3E);
00046 _al_dig_u = AddService<int,FeeServer::IntTrait>("AL_DIG_U", 0x3F);
00047 _al_ana_u = AddService<int,FeeServer::IntTrait>("AL_ANA_U", 0x40);
00048 _t4 = AddService<int,FeeServer::IntTrait>("T4", 0x46);
00049 _va_rec_up = AddService<int,FeeServer::IntTrait>("VA_REC_UP", 0x47);
00050 _va_sup_up = AddService<int,FeeServer::IntTrait>("VA_SUP_UP", 0x48);
00051 _va_sup_um = AddService<int,FeeServer::IntTrait>("VA_SUP_UM", 0x49);
00052 _va_rec_um = AddService<int,FeeServer::IntTrait>("VA_REC_UM", 0x4A);
00053 }
00054
00055 Fec::~Fec()
00056 {
00057 std::cout << "Removing FEC " << int(_address) << std::endl;
00058 }
00059
00060 int
00061 Fec::UpdateAll()
00062 {
00063 int ret = RcuCE::Fec::UpdateAll();
00064 #if 0
00065 std::vector<FeeServer::IntService*> l;
00066
00067 return ret;
00068 l.push_back(static_cast<FeeServer::IntService*>(_csr1->FeeService()));
00069 l.push_back(static_cast<FeeServer::IntService*>(_t1->FeeService()));
00070 l.push_back(static_cast<FeeServer::IntService*>(_flash_i->FeeService()));
00071 l.push_back(static_cast<FeeServer::IntService*>(_al_dig_i->FeeService()));
00072 l.push_back(static_cast<FeeServer::IntService*>(_al_ana_i->FeeService()));
00073 l.push_back(static_cast<FeeServer::IntService*>(_va_rec_ip->FeeService()));
00074 l.push_back(static_cast<FeeServer::IntService*>(_t2->FeeService()));
00075 l.push_back(static_cast<FeeServer::IntService*>(_va_sup_ip->FeeService()));
00076 l.push_back(static_cast<FeeServer::IntService*>(_va_rec_im->FeeService()));
00077 l.push_back(static_cast<FeeServer::IntService*>(_va_sup_im->FeeService()));
00078 l.push_back(static_cast<FeeServer::IntService*>(_gtl_u->FeeService()));
00079 l.push_back(static_cast<FeeServer::IntService*>(_t3->FeeService()));
00080 l.push_back(static_cast<FeeServer::IntService*>(_t1_sens->FeeService()));
00081 l.push_back(static_cast<FeeServer::IntService*>(_t2_sens->FeeService()));
00082 l.push_back(static_cast<FeeServer::IntService*>(_al_dig_u->FeeService()));
00083 l.push_back(static_cast<FeeServer::IntService*>(_al_ana_u->FeeService()));
00084 l.push_back(static_cast<FeeServer::IntService*>(_t4->FeeService()));
00085 l.push_back(static_cast<FeeServer::IntService*>(_va_rec_up->FeeService()));
00086 l.push_back(static_cast<FeeServer::IntService*>(_va_sup_up->FeeService()));
00087 l.push_back(static_cast<FeeServer::IntService*>(_va_sup_um->FeeService()));
00088 l.push_back(static_cast<FeeServer::IntService*>(_va_rec_um->FeeService()));
00089 std::cout << int(_address) << ": " << std::hex << std::setfill('0');
00090 size_t cnt = 0;
00091 for (std::vector<FeeServer::IntService*>::iterator i = l.begin();
00092 i != l.end(); ++i) {
00093 if (cnt % 3 == 0) std::cout << std::endl << " " << std::flush;
00094 std::cout << (*i)->Name() << ": " << std::setw(3) << (*i)->Value() <<"\t";
00095 cnt++;
00096 }
00097 std::cout << std::setfill(' ') << std::dec << std::endl;
00098 #endif
00099 return ret;
00100 }
00101
00102
00103 FecFactory::FecFactory(FeeServer::Main& m, RcuCE::Rcu& r)
00104 : RcuCE::FecFactory(m,r)
00105 {}
00106 RcuCE::Fec*
00107 FecFactory::MakeFec(unsigned char addr)
00108 {
00109 std::cout << "Making FEC 0x" << std::setfill('0')
00110 << std::hex << int(addr) << std::setfill(' ')
00111 << std::dec << std::endl;
00112 return new Fec(addr, _main, _rcu);
00113 }
00114
00115
00116
00117
00118