summaryrefslogtreecommitdiffstats
path: root/src/progs/base/prog_group.h
blob: f72c783a5357165e910081fd0b70c007db0e7326 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/***************************************************************************
 *   Copyright (C) 2005-2006 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 PROG_GROUP_H
#define PROG_GROUP_H

class TQWidget;
#include "common/common/group.h"
#include "common/port/port.h"
#include "common/common/purl_base.h"
#include "generic_prog.h"
namespace Device { class Data; }
namespace Debugger { class Base; class Specific; class DeviceSpecific; }
namespace Hardware { class Config; }

namespace Programmer
{
class Base;
class Hardware;
class DeviceSpecific;
class ConfigWidget;

enum Property { NoProperty = 0, Programmer = 1, Debugger = 2,
                CanReleaseReset = 4, HasFirmware = 8, CanUploadFirmware = 16,
                NeedDeviceSpecificFirmware = 32, HasSelfTest = 64,
                CanReadMemory = 128, HasConnectedState = 256 };
TQ_DECLARE_FLAGS(Properties, Property)
TQ_DECLARE_OPERATORS_FOR_FLAGS(Properties)

enum TargetPowerMode { TargetPowerModeFromConfig, TargetSelfPowered, TargetExternallyPowered };

enum { Nb_InputFileTypes = 3 };
extern const PURL::FileType INPUT_FILE_TYPE_DATA[Nb_InputFileTypes];

class Group : public ::Group::Base
{
public:
  virtual TQString xmlName() const { return name(); }
  virtual ::Hardware::Config *hardwareConfig() const { return 0; }
  virtual Properties properties() const = 0;
  virtual TQString statusLabel(PortType type) const;
  virtual bool canReadVoltages() const = 0;
  virtual TargetPowerMode targetPowerMode() const = 0;
  bool isDebugger() const { return ( properties() & Debugger ); }
  bool isSoftware() const;
  virtual bool isPortSupported(PortType type) const = 0;
  virtual bool checkConnection(const HardwareDescription &hd) const;
  ::Programmer::Base *createProgrammer(bool targetSelfPowered, const Device::Data *data, const HardwareDescription &hd) const;
  ::Debugger::Base *createDebugger(::Programmer::Base &) const;
  virtual uint maxNbBreakpoints(const Device::Data *) const { return 0; }
  virtual bool isInputFileTypeSupported(PURL::FileType) const { return false; }
  virtual ::Programmer::Base *createBase(const Device::Data *data) const = 0;

protected:
  virtual Hardware *createHardware(::Programmer::Base &base, const HardwareDescription &hd) const = 0;
  virtual DeviceSpecific *createDeviceSpecific(::Programmer::Base &base) const = 0;
  virtual ::Debugger::Base *createDebuggerBase(::Programmer::Base &) const { return 0; }
  virtual ::Debugger::Specific *createDebuggerSpecific(::Debugger::Base &) const { return 0; }
  virtual ::Debugger::DeviceSpecific *createDebuggerDeviceSpecific(::Debugger::Base &base) const = 0;
};

} // namespace

#endif