Commit a4306ac8 authored by Pavel Vainerman's avatar Pavel Vainerman

(IOControl): добавил поддержку плат 'Grayhill'

parent 5634d63f
......@@ -58,7 +58,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
string cname = conf->getArgParam("--"+prefix+"-confnode",myname);
cnode = conf->getNode(cname);
if( cnode == NULL )
throw SystemError("Not found conf-node " + cname + " for " + myname);
throw SystemError("Not find conf-node " + cname + " for " + myname);
defCardNum = conf->getArgInt("--"+prefix+"-default-cardnum","-1");
maxCardNum = conf->getArgInt("--"+prefix+"-max-cardnum","10");
......@@ -331,6 +331,7 @@ void IOControl::execute()
{
try
{
if( !noCards )
{
check_testmode();
......@@ -408,10 +409,7 @@ void IOControl::iopoll()
for( PIOMap::iterator it=pmap.begin(); it!=pmap.end(); ++it )
{
if( it->priority > 0 )
{
ioread( &(iomap[it->index]) );
IOBase::processingThreshold((IOBase*)&(iomap[it->index]),shm,force);
}
}
bool prior = false;
......@@ -432,10 +430,7 @@ void IOControl::iopoll()
for( PIOMap::iterator it=pmap.begin(); it!=pmap.end(); ++it )
{
if( it->priority > 1 )
{
ioread( &(iomap[it->index]) );
IOBase::processingThreshold((IOBase*)&(iomap[it->index]),shm,force);
}
}
prior = true;
......@@ -446,10 +441,7 @@ void IOControl::iopoll()
for( PIOMap::iterator it=pmap.begin(); it!=pmap.end(); ++it )
{
if( it->priority > 2 )
{
ioread( &(iomap[it->index]) );
IOBase::processingThreshold((IOBase*)&(iomap[it->index]),shm,force);
}
}
}
// --------------------------------------------------------------------------------
......@@ -507,7 +499,7 @@ void IOControl::ioread( IOInfo* it )
if( it->stype == UniversalIO::AnalogInput )
{
int val = card->getAnalogChannel(it->subdev,it->channel, it->range, it->aref);
/*
if( unideb.debugging(Debug::LEVEL3) )
{
dlog[Debug::LEVEL3] << myname << "(iopoll): read AI "
......@@ -517,7 +509,7 @@ void IOControl::ioread( IOInfo* it )
<< " val=" << val
<< endl;
}
*/
IOBase::processingAsAI( ib, val, shm, force );
}
else if( it->stype == UniversalIO::DigitalInput )
......@@ -749,37 +741,6 @@ bool IOControl::initIOItem( UniXML_iterator& it )
inf.subdev = DefaultSubdev;
}
if( !IOBase::initItem(&inf,it,shm,&unideb,myname,filtersize,filterT) )
return false;
// если вектор уже заполнен
// то увеличиваем его на 30 элементов (с запасом)
// после инициализации делается resize
// под реальное количество
if( maxItem >= iomap.size() )
iomap.resize(maxItem+30);
int prior = it.getIntProp("iopriority");
if( prior > 0 )
{
IOPriority p(prior,maxItem);
pmap.push_back(p);
if( dlog.debugging(Debug::LEVEL3) )
dlog[Debug::LEVEL3] << myname << "(readItem): add to priority list: " <<
it.getProp("name")
<< " priority=" << prior << endl;
}
// значит это пороговый датчик..
if( inf.t_ai != DefaultObjectId )
{
iomap[maxItem++] = inf;
if( dlog.debugging(Debug::LEVEL3) )
dlog[Debug::LEVEL3] << myname << "(readItem): add threshold '" << it.getProp("name")
<< " for '" << conf->oind->getNameById(inf.t_ai) << endl;
return true;
}
inf.channel = it.getIntProp("channel");
if( inf.channel < 0 || inf.channel > 32 )
{
......@@ -788,6 +749,9 @@ bool IOControl::initIOItem( UniXML_iterator& it )
return false;
}
if( !IOBase::initItem(&inf,it,shm,&unideb,myname,filtersize,filterT) )
return false;
inf.lamp = it.getIntProp("lamp");
inf.no_testlamp = it.getIntProp("no_iotestlamp");
inf.enable_testmode = it.getIntProp("enable_testmode");
......@@ -819,6 +783,23 @@ bool IOControl::initIOItem( UniXML_iterator& it )
if( unideb.debugging(Debug::LEVEL3) )
dlog[Debug::LEVEL3] << myname << "(readItem): add: " << inf.stype << " " << inf << endl;
// если вектор уже заполнен
// то увеличиваем его на 10 элементов (с запасом)
// после инициализации делается resize
// под реальное количество
if( maxItem >= iomap.size() )
iomap.resize(maxItem+10);
int prior = it.getIntProp("iopriority");
if( prior > 0 )
{
IOPriority p(prior,maxItem);
pmap.push_back(p);
dlog[Debug::LEVEL3] << myname << "(readItem): add to priority list: " <<
it.getProp("name")
<< " priority=" << prior << endl;
}
iomap[maxItem++] = inf;
return true;
}
......@@ -1173,35 +1154,40 @@ IOControl* IOControl::init_iocontrol( int argc, const char* const* argv,
// -----------------------------------------------------------------------------
void IOControl::help_print( int argc, const char* const* argv )
{
cout << "--prefix-confnode name - Использовать для настройки указанный xml-узел" << endl;
cout << "--prefix-name name - ID процесса. По умолчанию IOController1." << endl;
cout << "--prefix-numcards - Количество кард в/в. По умолчанию 1." << endl;
cout << "--prefix-devX dev - Использовать для card='X' указанный файл comedi-устройства." << endl;
cout << " 'X' не должен быть больше --prefix-numcards" << endl;
cout << "--prefix-devX-subdevX-type name - Настройка типа подустройства для UNIO." << endl ;
cout << "--io-confnode name - Использовать для настройки указанный xml-узел" << endl;
cout << "--io-name name - ID процесса. По умолчанию IOController1." << endl;
cout << "--io-numcards - Количество кард в/в. По умолчанию 1." << endl;
cout << "--iodev0 dev - Использовать для card='0' указанный файл comedi-устройства." << endl;
cout << "--iodev1 dev - Использовать для card='1' указанный файл comedi-устройства." << endl;
cout << "--iodev2 dev - Использовать для card='2' указанный файл comedi-устройства." << endl;
cout << "--iodev3 dev - Использовать для card='3' указанный файл comedi-устройства." << endl;
cout << "--iodevX dev - Использовать для card='X' указанный файл comedi-устройства." << endl;
cout << " 'X' не должен быть больше --io-numcards" << endl;
cout << "--iodevX-subdevX-type name - Настройка типа подустройства для UNIO." << endl ;
cout << " Разрешены: TBI0_24,TBI24_0,TBI16_8" << endl;
cout << "--prefix-default_cardnum - Номер карты по умолчанию. По умолчанию -1." << endl;
cout << "--io-default_cardnum - Номер карты по умолчанию. По умолчанию -1." << endl;
cout << " Если задать, то он будет использоватся для датчиков" << endl;
cout << " у которых не задано поле 'card'." << endl;
cout << "--prefix-test-lamp - Для данного узла в качестве датчика кнопки 'ТестЛамп' использовать указанный датчик." << endl;
cout << "--prefix-conf-field fname - Считывать из конф. файла все датчики с полем fname='1'" << endl;
cout << "--prefix-polltime msec - Пауза между опросом карт. По умолчанию 200 мсек." << endl;
cout << "--prefix-filtersize val - Размерность фильтра для аналоговых входов." << endl;
cout << "--prefix-filterT val - Постоянная времени фильтра." << endl;
cout << "--prefix-s-filter-field - Идентификатор в configure.xml по которому считывается список относящихся к это процессу датчиков" << endl;
cout << "--prefix-s-filter-value - Значение идентификатора по которому считывается список относящихся к это процессу датчиков" << endl;
cout << "--prefix-blink-time msec - Частота мигания, мсек. По умолчанию в configure.xml" << endl;
cout << "--prefix-blink2-time msec - Вторая частота мигания (lmpBLINK2), мсек. По умолчанию в configure.xml" << endl;
cout << "--prefix-blink3-time msec - Вторая частота мигания (lmpBLINK3), мсек. По умолчанию в configure.xml" << endl;
cout << "--prefix-heartbeat-id - Данный процесс связан с указанным аналоговым heartbeat-дачиком." << endl;
cout << "--prefix-heartbeat-max - Максимальное значение heartbeat-счётчика для данного процесса. По умолчанию 10." << endl;
cout << "--prefix-ready-timeout - Время ожидания готовности SM к работе, мсек. (-1 - ждать 'вечно')" << endl;
cout << "--prefix-force - Сохранять значения в SM, независимо от, того менялось ли значение" << endl;
cout << "--prefix-force-out - Обновлять выходы принудительно (не по заказу)" << endl;
cout << "--prefix-skip-init-output - Не инициализировать 'выходы' при старте" << endl;
cout << "--prefix-sm-ready-test-sid - Использовать указанный датчик, для проверки готовности SharedMemory" << endl;
cout << "--io-test-lamp - Для данного узла в качестве датчика кнопки 'ТестЛамп' использовать указанный датчик." << endl;
cout << "--io-conf-field fname - Считывать из конф. файла все датчики с полем fname='1'" << endl;
cout << "--io-polltime msec - Пауза между опросом карт. По умолчанию 200 мсек." << endl;
cout << "--io-filtersize val - Размерность фильтра для аналоговых входов." << endl;
cout << "--io-filterT val - Постоянная времени фильтра." << endl;
cout << "--io-s-filter-field - Идентификатор в configure.xml по которому считывается список относящихся к это процессу датчиков" << endl;
cout << "--io-s-filter-value - Значение идентификатора по которому считывается список относящихся к это процессу датчиков" << endl;
cout << "--io-blink-time msec - Частота мигания, мсек. По умолчанию в configure.xml" << endl;
cout << "--io-blink2-time msec - Вторая частота мигания (lmpBLINK2), мсек. По умолчанию в configure.xml" << endl;
cout << "--io-blink3-time msec - Вторая частота мигания (lmpBLINK3), мсек. По умолчанию в configure.xml" << endl;
cout << "--io-heartbeat-id - Данный процесс связан с указанным аналоговым heartbeat-дачиком." << endl;
cout << "--io-heartbeat-max - Максимальное значение heartbeat-счётчика для данного процесса. По умолчанию 10." << endl;
cout << "--io-ready-timeout - Время ожидания готовности SM к работе, мсек. (-1 - ждать 'вечно')" << endl;
cout << "--io-force - Сохранять значения в SM, независимо от, того менялось ли значение" << endl;
cout << "--io-force-out - Обновлять выходы принудительно (не по заказу)" << endl;
cout << "--io-skip-init-output - Не инициализировать 'выходы' при старте" << endl;
cout << "--io-sm-ready-test-sid - Использовать указанный датчик, для проверки готовности SharedMemory" << endl;
}
// -----------------------------------------------------------------------------
void IOControl::processingMessage( UniSetTypes::VoidMessage* msg )
......@@ -1718,8 +1704,8 @@ void IOControl::buildCardsList()
// для Grayhill конфигурирование не требуется
dlog[Debug::INFO] << myname << "(buildCardsList): card=" << it.getProp("card")
<< "(" << cname << ")"
<< " init subdev" << i << " 'GRAYHILL'" << endl;
continue;
<< " subdev" << i << " is 'GRAYHILL'" << endl;
return;
}
dlog[Debug::INFO] << myname << "(buildCardsList): card=" << it.getProp("card")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment