summaryrefslogtreecommitdiffstats
path: root/src/progs/psp/base/psp_prog.h
blob: 131548f57f4a092398c6c3650dec877ca7fb4c29 (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
/***************************************************************************
 *   Copyright (C) 2006 Nicolas Hadacek <[email protected]>                  *
 *                                                                         *
 *   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 PSP_PROG_H
#define PSP_PROG_H

#include "common/global/global.h"
#include "psp.h"

namespace Psp
{
//-----------------------------------------------------------------------------
class Base : public Programmer::PicBase
{
TQ_OBJECT
  
public:
  Base(const Programmer::Group &group, const Pic::Data *data)
    : Programmer::PicBase(group, data, "psp_programmer_base") {}
  virtual bool readFirmwareVersion();
  virtual bool setTarget() { return hardware().setTarget(); }

protected:
  Hardware &hardware() { return static_cast<Hardware &>(*_hardware); }
  virtual VersionData firmwareVersion(Programmer::FirmwareVersionType type) const { return (type==Programmer::FirmwareVersionType::Min ? VersionData(4, 30, 3) : VersionData()); }
};

//-----------------------------------------------------------------------------
class Group : public ::Programmer::PicGroup
{
public:
  virtual TQString name() const { return "psp"; }
  virtual TQString label() const { return i18n("Picstart Plus"); }
  virtual TQString xmlName() const { return "psp"; }
  virtual ::Programmer::Properties properties() const;
  virtual ::Programmer::TargetPowerMode targetPowerMode() const { return ::Programmer::TargetExternallyPowered; }
  virtual bool isPortSupported(PortType type) const { return ( type==PortType::Serial ); }
  virtual bool canReadVoltage(Pic::VoltageType type) const { return ( type==Pic::TargetVdd || type==Pic::TargetVpp ); }

protected:
  virtual void initSupported();
  virtual ::Programmer::Base *createBase(const Device::Data *data) const { return new ::Psp::Base(*this, static_cast<const Pic::Data *>(data)); }
  virtual ::Programmer::Hardware *createHardware(::Programmer::Base &base, const ::Programmer::HardwareDescription &hd) const;
  virtual ::Programmer::DeviceSpecific *createDeviceSpecific(::Programmer::Base &base) const;
};

} // namespace

#endif