diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 18:42:24 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 18:42:24 +0000 |
commit | f508189682b6fba62e08feeb1596f682bad5fff9 (patch) | |
tree | 28aeb0e6c19386c385c1ce5edf8a92c1bca15281 /src/progs/bootloader | |
download | piklab-f508189682b6fba62e08feeb1596f682bad5fff9.tar.gz piklab-f508189682b6fba62e08feeb1596f682bad5fff9.zip |
Added KDE3 version of PikLab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1095639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/progs/bootloader')
-rw-r--r-- | src/progs/bootloader/Makefile.am | 3 | ||||
-rw-r--r-- | src/progs/bootloader/base/Makefile.am | 5 | ||||
-rw-r--r-- | src/progs/bootloader/base/base.pro | 6 | ||||
-rw-r--r-- | src/progs/bootloader/base/bootloader.cpp | 9 | ||||
-rw-r--r-- | src/progs/bootloader/base/bootloader.h | 42 | ||||
-rw-r--r-- | src/progs/bootloader/base/bootloader_prog.cpp | 25 | ||||
-rw-r--r-- | src/progs/bootloader/base/bootloader_prog.h | 37 | ||||
-rw-r--r-- | src/progs/bootloader/bootloader.pro | 2 | ||||
-rw-r--r-- | src/progs/bootloader/gui/Makefile.am | 6 | ||||
-rw-r--r-- | src/progs/bootloader/gui/bootloader_ui.cpp | 9 | ||||
-rw-r--r-- | src/progs/bootloader/gui/bootloader_ui.h | 30 |
11 files changed, 174 insertions, 0 deletions
diff --git a/src/progs/bootloader/Makefile.am b/src/progs/bootloader/Makefile.am new file mode 100644 index 0000000..490a53d --- /dev/null +++ b/src/progs/bootloader/Makefile.am @@ -0,0 +1,3 @@ +INCLUDES = -I$(top_srcdir)/src $(all_includes) +METASOURCES = AUTO +SUBDIRS = base gui diff --git a/src/progs/bootloader/base/Makefile.am b/src/progs/bootloader/base/Makefile.am new file mode 100644 index 0000000..7c7230d --- /dev/null +++ b/src/progs/bootloader/base/Makefile.am @@ -0,0 +1,5 @@ +INCLUDES = -I$(top_srcdir)/src $(all_includes) +METASOURCES = AUTO + +noinst_LTLIBRARIES = libbootloader.la +libbootloader_la_SOURCES = bootloader_prog.cpp bootloader.cpp diff --git a/src/progs/bootloader/base/base.pro b/src/progs/bootloader/base/base.pro new file mode 100644 index 0000000..f53b730 --- /dev/null +++ b/src/progs/bootloader/base/base.pro @@ -0,0 +1,6 @@ +STOPDIR = ../../../.. +include($${STOPDIR}/lib.pro) + +TARGET = bootloader +HEADERS += bootloader.h bootloader_prog.h +SOURCES += bootloader.cpp bootloader_prog.cpp diff --git a/src/progs/bootloader/base/bootloader.cpp b/src/progs/bootloader/base/bootloader.cpp new file mode 100644 index 0000000..a45a23f --- /dev/null +++ b/src/progs/bootloader/base/bootloader.cpp @@ -0,0 +1,9 @@ +/*************************************************************************** + * Copyright (C) 2007 Nicolas Hadacek <hadacek@kde.org> * + * * + * This program 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. * + ***************************************************************************/ +#include "bootloader.h" diff --git a/src/progs/bootloader/base/bootloader.h b/src/progs/bootloader/base/bootloader.h new file mode 100644 index 0000000..08a0730 --- /dev/null +++ b/src/progs/bootloader/base/bootloader.h @@ -0,0 +1,42 @@ +/*************************************************************************** + * Copyright (C) 2007 Nicolas Hadacek <hadacek@kde.org> * + * * + * This program 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. * + ***************************************************************************/ +#ifndef BOOTLOADER_H +#define BOOTLOADER_H + +#include "devices/pic/prog/pic_prog.h" + +namespace Bootloader +{ +//----------------------------------------------------------------------------- +class Hardware : public ::Programmer::PicHardware +{ +public: + Hardware(::Programmer::Base &base, Port::Base *port) : ::Programmer::PicHardware(base, port, QString::null) {} + virtual bool write(Pic::MemoryRangeType type, const Device::Array &data) = 0; + virtual bool read(Pic::MemoryRangeType type, Device::Array &data, const ::Programmer::VerifyData *vdata) = 0; + virtual bool internalConnectHardware() = 0; + virtual bool openPort() { return _port->open(); } +}; + +//----------------------------------------------------------------------------- +class DeviceSpecific : public ::Programmer::PicDeviceSpecific +{ +public: + DeviceSpecific(::Programmer::Base &base) : ::Programmer::PicDeviceSpecific(base) {} + Hardware &hardware() { return static_cast<Hardware &>(*_base.hardware()); } + virtual bool setPowerOff() { return false; } + virtual bool setPowerOn() { return false; } + virtual bool setTargetPowerOn(bool) { return true; } + virtual bool doRead(Pic::MemoryRangeType type, Device::Array &data, const ::Programmer::VerifyData *vdata) { return hardware().read(type, data, vdata); } + virtual bool doWrite(Pic::MemoryRangeType type, const Device::Array &data, bool) { return hardware().write(type, data); } +}; + +} // namespace + +#endif diff --git a/src/progs/bootloader/base/bootloader_prog.cpp b/src/progs/bootloader/base/bootloader_prog.cpp new file mode 100644 index 0000000..61167f8 --- /dev/null +++ b/src/progs/bootloader/base/bootloader_prog.cpp @@ -0,0 +1,25 @@ +/*************************************************************************** + * Copyright (C) 2007 Nicolas Hadacek <hadacek@kde.org> * + * * + * This program 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. * + ***************************************************************************/ +#include "bootloader_prog.h" + +#include "progs/base/prog_config.h" + +//----------------------------------------------------------------------------- +Bootloader::ProgrammerBase::ProgrammerBase(const Programmer::Group &group, const Pic::Data *data, const char *name) + : Programmer::PicBase(group, data, name) +{} + +//----------------------------------------------------------------------------- +bool Bootloader::Group::checkConnection(const ::Programmer::HardwareDescription &hd) const +{ + ::Programmer::Base *base = createProgrammer(false, 0, hd); + bool ok = static_cast<Hardware *>(base->hardware())->openPort(); + delete base; + return ok; +} diff --git a/src/progs/bootloader/base/bootloader_prog.h b/src/progs/bootloader/base/bootloader_prog.h new file mode 100644 index 0000000..7b9749e --- /dev/null +++ b/src/progs/bootloader/base/bootloader_prog.h @@ -0,0 +1,37 @@ +/*************************************************************************** + * Copyright (C) 2007 Nicolas Hadacek <hadacek@kde.org> * + * * + * This program 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. * + ***************************************************************************/ +#ifndef BOOTLOADER_PROG_H +#define BOOTLOADER_PROG_H + +#include "common/global/generic_config.h" +#include "bootloader.h" + +namespace Bootloader +{ +//----------------------------------------------------------------------------- +class ProgrammerBase : public Programmer::PicBase +{ +Q_OBJECT +public: + ProgrammerBase(const Programmer::Group &group, const Pic::Data *data, const char *name); + +protected: + Hardware &hardware() { return static_cast<Hardware &>(*_hardware); } +}; + +//----------------------------------------------------------------------------- +class Group : public ::Programmer::PicGroup +{ +public: + virtual bool checkConnection(const ::Programmer::HardwareDescription &hd) const; +}; + +} // namespace + +#endif diff --git a/src/progs/bootloader/bootloader.pro b/src/progs/bootloader/bootloader.pro new file mode 100644 index 0000000..fe430fe --- /dev/null +++ b/src/progs/bootloader/bootloader.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = base diff --git a/src/progs/bootloader/gui/Makefile.am b/src/progs/bootloader/gui/Makefile.am new file mode 100644 index 0000000..d52b42b --- /dev/null +++ b/src/progs/bootloader/gui/Makefile.am @@ -0,0 +1,6 @@ +INCLUDES = -I$(top_srcdir)/src $(all_includes) +METASOURCES = AUTO + +noinst_LTLIBRARIES = libbootloaderui.la +libbootloaderui_la_LDFLAGS = $(all_libraries) +libbootloaderui_la_SOURCES = bootloader_ui.cpp diff --git a/src/progs/bootloader/gui/bootloader_ui.cpp b/src/progs/bootloader/gui/bootloader_ui.cpp new file mode 100644 index 0000000..df8595f --- /dev/null +++ b/src/progs/bootloader/gui/bootloader_ui.cpp @@ -0,0 +1,9 @@ +/*************************************************************************** + * Copyright (C) 2007 Nicolas Hadacek <hadacek@kde.org> * + * * + * This program 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. * + ***************************************************************************/ +#include "bootloader_ui.h" diff --git a/src/progs/bootloader/gui/bootloader_ui.h b/src/progs/bootloader/gui/bootloader_ui.h new file mode 100644 index 0000000..386c412 --- /dev/null +++ b/src/progs/bootloader/gui/bootloader_ui.h @@ -0,0 +1,30 @@ +/*************************************************************************** + * Copyright (C) 2007 Nicolas Hadacek <hadacek@kde.org> * + * * + * This program 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. * + ***************************************************************************/ +#ifndef BOOTLOADER_UI_H +#define BOOTLOADER_UI_H + +#include <qcheckbox.h> + +#include "progs/gui/prog_group_ui.h" +#include "progs/gui/prog_config_widget.h" + +namespace Bootloader +{ + +//---------------------------------------------------------------------------- +class GroupUI : public ::Programmer::GroupUI +{ +public: + virtual bool hasAdvancedDialog() const { return false; } + virtual ::Programmer::AdvancedDialog *createAdvancedDialog(::Programmer::Base &, QWidget *) const { return 0; } +}; + +} // namespace + +#endif |