📄 jtagctrl_factory.cpp
字号:
/* * This file is part of Jelie, * (c) 2002 Julien Pilet <julien.pilet@epfl.ch> and * Stephane Magnenat <stephane.magnenat@epfl.ch> * * Jelie is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * * Jelie is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Foobar; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *//*! \file * \brief Find and initialize a working controller * * This is the factory that creates the jtag controller * who are, in fact, the physical jtag interfaces * * \author Julien Pilet <julien.pilet@epfl.ch> * \author Stephane Magnenat <stephane.magnenat@epfl.ch> */#include "jtagctrl_factory.h"#include <string.h>#include <stdio.h>#ifdef HAVE_CONFIG_H#include <config.h>#endif#ifdef USE_JTAG_CONTROL_EZUSB#include "ezusb_jtag.h"#endif#ifdef USE_JTAG_CONTROL_PP#include "pp_jtag.h"#endif#ifdef USE_JTAG_CONTROL_PPNEW#include "jtag_driver.h"#include "jtag_commander.h"#include "altera_jtag.h"#include "jtag_pp_commander.h"#endif // USE_JTAG_CONTROL_PPNEWJTAGControlFactory::JTAGControlFactory(void){#ifdef USE_JTAG_CONTROL_EZUSB controls.push_back(new EzUSBJTAG());#endif#ifdef USE_JTAG_CONTROL_PP controls.push_back(new PPJTAG());#endif#ifdef USE_JTAG_CONTROL_PPNEW JTAG_Driver * driver ; driver = (JTAG_Driver *)new AlteraByteBlasterJTAG(); controls.push_back(new JTAG_ParallelPort_Commander( driver )); #endif // USE_JTAG_CONTROL_PPNEW }JTAGControlFactory::~JTAGControlFactory(void){ for (std::vector<JTAGControl *>::iterator it=controls.begin(); it!=controls.end(); ++it) { assert(*it); delete (*it); } controls.clear();}JTAGControl *JTAGControlFactory::getPrefered(const char *name, int argc, char *argv[]) const{ for (std::vector<JTAGControl *>::const_iterator it=controls.begin(); it!=controls.end(); ++it) { assert(*it); if (strcmp((*it)->getName(), name)==0) { if ((*it)->init(argc, argv)) return (*it); } } return NULL;}JTAGControl *JTAGControlFactory::getAvailable(int argc, char *argv[]) const{ for (std::vector<JTAGControl *>::const_iterator it=controls.begin(); it!=controls.end(); ++it) { assert (*it); if ((*it)->init(argc, argv)) return (*it); } return NULL;}void JTAGControlFactory::dumpList(void) const{ for (std::vector<JTAGControl *>::const_iterator it=controls.begin(); it!=controls.end(); ++it) { assert(*it); printf("%s\n", (*it)->getName()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -