-
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit for external bus peripheral
- Loading branch information
Showing
4 changed files
with
183 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "ioexternalbus.h" | ||
#include "ui_ioexternalbus.h" | ||
|
||
#include <QPainter> | ||
#include <QPen> | ||
|
||
#include "STLExtras.h" | ||
#include "ioregistry.h" | ||
|
||
namespace Ripes { | ||
|
||
IOExternalBus::IOExternalBus(QWidget* parent) : IOBase(IOType::EXTERNALBUS, parent), m_ui(new Ui::IOExternalBus) { | ||
m_ui->setupUi(this); | ||
} | ||
|
||
IOExternalBus::~IOExternalBus() { | ||
unregister(); | ||
delete m_ui; | ||
}; | ||
|
||
unsigned IOExternalBus::byteSize() const { | ||
return 1024; | ||
} | ||
|
||
QString IOExternalBus::description() const { | ||
return "An external bus is a memory mapped bus handled through network transactions. The peripheral connects to an " | ||
"IP address denoting a peripheral server - for more details, refer to the Ripes wiki."; | ||
} | ||
|
||
VInt IOExternalBus::ioRead(AInt offset, unsigned size) { | ||
return 0; | ||
} | ||
void IOExternalBus::ioWrite(AInt offset, VInt value, unsigned size) {} | ||
|
||
void IOExternalBus::parameterChanged(unsigned paramId) {} | ||
|
||
} // namespace Ripes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pragma once | ||
|
||
#include <QPen> | ||
#include <QVariant> | ||
#include <QWidget> | ||
|
||
#include "iobase.h" | ||
|
||
namespace Ripes { | ||
|
||
namespace Ui { | ||
class IOExternalBus; | ||
} | ||
|
||
/// @todo: should the bus be discoverable? i.e. implement a protocol for external bus to provide info on symbols and | ||
/// registers exposed by its peripherals, which will be made available in Ripes. This will also dynamically adjust the | ||
/// "byteSize" return value. | ||
|
||
class IOExternalBus : public IOBase { | ||
Q_OBJECT | ||
|
||
public: | ||
IOExternalBus(QWidget* parent); | ||
~IOExternalBus() override; | ||
|
||
virtual unsigned byteSize() const override; | ||
virtual QString description() const override; | ||
virtual QString baseName() const override { return "External bus"; } | ||
|
||
virtual const std::vector<RegDesc>& registers() const override { return m_regDescs; }; | ||
virtual const std::vector<IOSymbol>* extraSymbols() const override { return &m_extraSymbols; } | ||
|
||
/** | ||
* Hardware read/write functions | ||
*/ | ||
virtual VInt ioRead(AInt offset, unsigned size) override; | ||
virtual void ioWrite(AInt offset, VInt value, unsigned size) override; | ||
|
||
protected: | ||
virtual void parameterChanged(unsigned) override; | ||
|
||
private: | ||
void updateAddress(); | ||
Ui::IOExternalBus* m_ui = nullptr; | ||
|
||
std::vector<RegDesc> m_regDescs; | ||
std::vector<IOSymbol> m_extraSymbols; | ||
}; | ||
} // namespace Ripes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>Ripes::IOExternalBus</class> | ||
<widget class="QWidget" name="Ripes::IOExternalBus"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>149</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<widget class="QLabel" name="label"> | ||
<property name="text"> | ||
<string>Address:</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLineEdit" name="address"/> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="connectButton"> | ||
<property name="text"> | ||
<string>Connect</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<layout class="QGridLayout" name="gridLayout_3"> | ||
<item row="1" column="0"> | ||
<widget class="QLabel" name="label_3"> | ||
<property name="text"> | ||
<string>Server:</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="label_2"> | ||
<property name="text"> | ||
<string>Status:</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="1"> | ||
<widget class="QLineEdit" name="status"> | ||
<property name="readOnly"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="1"> | ||
<widget class="QLineEdit" name="server"> | ||
<property name="readOnly"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<spacer name="verticalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Vertical</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>20</width> | ||
<height>40</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters