]> rtime.felk.cvut.cz Git - mf6xx.git/commitdiff
First version of graphical Qt interface to Qemu MF624 hardware. Only DOUT works.
authorRostislav Lisovy <lisovy@gmail.com>
Fri, 8 Apr 2011 20:47:42 +0000 (22:47 +0200)
committerRostislav Lisovy <lisovy@gmail.com>
Fri, 8 Apr 2011 20:47:42 +0000 (22:47 +0200)
src/qemu/mf624_interface/untitled/main.cpp [new file with mode: 0644]
src/qemu/mf624_interface/untitled/mainwindow.cpp [new file with mode: 0644]
src/qemu/mf624_interface/untitled/mainwindow.h [new file with mode: 0644]
src/qemu/mf624_interface/untitled/mainwindow.ui [new file with mode: 0644]
src/qemu/mf624_interface/untitled/mf624_io_status.h [new file with mode: 0644]
src/qemu/mf624_interface/untitled/socket_thread.cpp [new file with mode: 0644]
src/qemu/mf624_interface/untitled/socket_thread.h [new file with mode: 0644]
src/qemu/mf624_interface/untitled/untitled.pro [new file with mode: 0644]

diff --git a/src/qemu/mf624_interface/untitled/main.cpp b/src/qemu/mf624_interface/untitled/main.cpp
new file mode 100644 (file)
index 0000000..d0cee8d
--- /dev/null
@@ -0,0 +1,22 @@
+#include <QtGui/QApplication>
+#include "mainwindow.h"
+#include "mf624_io_status.h"
+
+mf624_io_status_t mf624_io_status;
+
+int main(int argc, char *argv[])
+{      
+       mf624_io_status.DIN = 0;
+       mf624_io_status.DOUT = 0;
+       mf624_io_status.DA0 = 0;
+       mf624_io_status.DA1 = 0;
+       mf624_io_status.AD0 = 0;
+       mf624_io_status.AD1 = 0;
+
+
+       QApplication a(argc, argv);
+       MainWindow w;
+       w.show();
+
+       return a.exec();
+}
diff --git a/src/qemu/mf624_interface/untitled/mainwindow.cpp b/src/qemu/mf624_interface/untitled/mainwindow.cpp
new file mode 100644 (file)
index 0000000..84bd612
--- /dev/null
@@ -0,0 +1,84 @@
+#include <stdio.h>
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include "socket_thread.h"
+#include "mf624_io_status.h"
+extern mf624_io_status_t mf624_io_status;
+
+
+MainWindow::MainWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::MainWindow)
+{
+       ui->setupUi(this);
+       // Set fixed size for window
+       this->setFixedSize(this->width(), this->height());
+
+       // create new thread (on heap) and start it
+       s_thread = new socket_thread(this);
+       s_thread->start(); // after this, thread's run() method starts
+
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}
+
+
+void MainWindow::din_set(int bit, int val)
+{
+       if(val == 0) {
+               mf624_io_status.DIN &= ~(1 << bit);
+       }
+       else if (val == 2) {
+               mf624_io_status.DIN |= (1 << bit);
+       }
+
+       s_thread->socket_send("DIN=%d\n", mf624_io_status.DIN);
+}
+
+void MainWindow::on_checkBox_stateChanged(int arg1)
+{
+       din_set(0, arg1);
+}
+
+void MainWindow::on_checkBox_2_stateChanged(int arg1)
+{
+       din_set(1, arg1);
+}
+
+void MainWindow::on_checkBox_3_stateChanged(int arg1)
+{
+       din_set(2, arg1);
+}
+
+void MainWindow::on_checkBox_4_stateChanged(int arg1)
+{
+       din_set(3, arg1);
+}
+
+void MainWindow::on_checkBox_5_stateChanged(int arg1)
+{
+       din_set(4, arg1);
+}
+
+void MainWindow::on_checkBox_6_stateChanged(int arg1)
+{
+       din_set(5, arg1);
+}
+
+void MainWindow::on_checkBox_7_stateChanged(int arg1)
+{
+       din_set(6, arg1);
+}
+
+void MainWindow::on_checkBox_8_stateChanged(int arg1)
+{
+       din_set(7, arg1);
+}
+
+void MainWindow::on_horizontalSlider_valueChanged(int value)
+{
+       s_thread->socket_send("ADC0=%d\n", value);
+}
diff --git a/src/qemu/mf624_interface/untitled/mainwindow.h b/src/qemu/mf624_interface/untitled/mainwindow.h
new file mode 100644 (file)
index 0000000..504063e
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include "socket_thread.h"
+
+
+namespace Ui {
+    class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+       explicit MainWindow(QWidget *parent = 0);
+       ~MainWindow();
+       Ui::MainWindow *ui;
+
+private slots:
+       void on_checkBox_stateChanged(int arg1);
+       void on_checkBox_2_stateChanged(int arg1);
+       void on_checkBox_3_stateChanged(int arg1);
+       void on_checkBox_4_stateChanged(int arg1);
+       void on_checkBox_5_stateChanged(int arg1);
+       void on_checkBox_6_stateChanged(int arg1);
+       void on_checkBox_7_stateChanged(int arg1);
+       void on_checkBox_8_stateChanged(int arg1);
+
+
+       void on_horizontalSlider_valueChanged(int value);
+
+private:
+       int DIN; //DIN register
+
+       void din_set(int bit, int val);
+       socket_thread *s_thread;
+};
+
+#endif // MAINWINDOW_H
diff --git a/src/qemu/mf624_interface/untitled/mainwindow.ui b/src/qemu/mf624_interface/untitled/mainwindow.ui
new file mode 100644 (file)
index 0000000..7ab00d1
--- /dev/null
@@ -0,0 +1,815 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>612</width>
+    <height>585</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralWidget">
+   <widget class="QLabel" name="label">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>10</y>
+      <width>421</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="font">
+     <font>
+      <pointsize>14</pointsize>
+      <weight>75</weight>
+      <bold>true</bold>
+     </font>
+    </property>
+    <property name="text">
+     <string>Humusoft MF624 DAQ input/output interface</string>
+    </property>
+   </widget>
+   <widget class="QGroupBox" name="groupBox">
+    <property name="geometry">
+     <rect>
+      <x>11</x>
+      <y>41</y>
+      <width>591</width>
+      <height>70</height>
+     </rect>
+    </property>
+    <property name="sizePolicy">
+     <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+      <horstretch>0</horstretch>
+      <verstretch>0</verstretch>
+     </sizepolicy>
+    </property>
+    <property name="maximumSize">
+     <size>
+      <width>16777213</width>
+      <height>70</height>
+     </size>
+    </property>
+    <property name="title">
+     <string>DIN</string>
+    </property>
+    <widget class="QWidget" name="horizontalLayoutWidget">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>30</y>
+       <width>574</width>
+       <height>31</height>
+      </rect>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QCheckBox" name="checkBox_8">
+        <property name="text">
+         <string>7</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_7">
+        <property name="text">
+         <string>6</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_6">
+        <property name="text">
+         <string>5</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_5">
+        <property name="text">
+         <string>4</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_4">
+        <property name="text">
+         <string>3</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_3">
+        <property name="text">
+         <string>2</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_2">
+        <property name="text">
+         <string>1</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox">
+        <property name="text">
+         <string>0</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </widget>
+   <widget class="QGroupBox" name="groupBox_2">
+    <property name="geometry">
+     <rect>
+      <x>11</x>
+      <y>115</y>
+      <width>591</width>
+      <height>70</height>
+     </rect>
+    </property>
+    <property name="sizePolicy">
+     <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+      <horstretch>0</horstretch>
+      <verstretch>0</verstretch>
+     </sizepolicy>
+    </property>
+    <property name="maximumSize">
+     <size>
+      <width>16777215</width>
+      <height>70</height>
+     </size>
+    </property>
+    <property name="title">
+     <string>DOUT</string>
+    </property>
+    <widget class="QWidget" name="horizontalLayoutWidget_2">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>40</y>
+       <width>571</width>
+       <height>24</height>
+      </rect>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_2">
+      <item>
+       <widget class="QCheckBox" name="checkBox_16">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="text">
+         <string>7</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_15">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="text">
+         <string>6</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_14">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="text">
+         <string>5</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_13">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="text">
+         <string>4</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_12">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="text">
+         <string>3</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_11">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="text">
+         <string>2</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_10">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="text">
+         <string>1</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBox_9">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="text">
+         <string>0</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </widget>
+   <widget class="QGroupBox" name="groupBox_3">
+    <property name="geometry">
+     <rect>
+      <x>11</x>
+      <y>189</y>
+      <width>281</width>
+      <height>331</height>
+     </rect>
+    </property>
+    <property name="title">
+     <string>ADC</string>
+    </property>
+    <widget class="QWidget" name="layoutWidget">
+     <property name="geometry">
+      <rect>
+       <x>20</x>
+       <y>30</y>
+       <width>241</width>
+       <height>286</height>
+      </rect>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_3">
+        <item>
+         <widget class="QSlider" name="horizontalSlider">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+          <property name="singleStep">
+           <number>1</number>
+          </property>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="spinBox">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_5">
+        <item>
+         <widget class="QSlider" name="horizontalSlider_2">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="spinBox_2">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_6">
+        <item>
+         <widget class="QSlider" name="horizontalSlider_3">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="spinBox_3">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_7">
+        <item>
+         <widget class="QSlider" name="horizontalSlider_4">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="spinBox_4">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_8">
+        <item>
+         <widget class="QSlider" name="horizontalSlider_5">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="spinBox_5">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_9">
+        <item>
+         <widget class="QSlider" name="horizontalSlider_6">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="spinBox_6">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_10">
+        <item>
+         <widget class="QSlider" name="horizontalSlider_7">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="spinBox_7">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_11">
+        <item>
+         <widget class="QSlider" name="horizontalSlider_8">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="spinBox_8">
+          <property name="minimum">
+           <number>-100</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </widget>
+   <widget class="QGroupBox" name="groupBox_4">
+    <property name="geometry">
+     <rect>
+      <x>300</x>
+      <y>190</y>
+      <width>301</width>
+      <height>331</height>
+     </rect>
+    </property>
+    <property name="title">
+     <string>DAC</string>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menuBar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>612</width>
+     <height>28</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QToolBar" name="mainToolBar">
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+  </widget>
+  <widget class="QStatusBar" name="statusBar"/>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>horizontalSlider</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>spinBox</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>437</x>
+     <y>341</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>554</x>
+     <y>341</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>horizontalSlider_2</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>spinBox_2</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>113</x>
+     <y>348</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>234</x>
+     <y>348</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>horizontalSlider_3</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>spinBox_3</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>113</x>
+     <y>384</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>234</x>
+     <y>384</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>horizontalSlider_4</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>spinBox_4</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>113</x>
+     <y>420</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>234</x>
+     <y>420</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>horizontalSlider_5</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>spinBox_5</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>113</x>
+     <y>456</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>234</x>
+     <y>456</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>horizontalSlider_6</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>spinBox_6</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>113</x>
+     <y>492</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>234</x>
+     <y>492</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>horizontalSlider_7</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>spinBox_7</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>113</x>
+     <y>528</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>234</x>
+     <y>528</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>horizontalSlider_8</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>spinBox_8</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>113</x>
+     <y>564</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>180</x>
+     <y>569</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spinBox</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>horizontalSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>234</x>
+     <y>312</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>113</x>
+     <y>312</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spinBox_2</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>horizontalSlider_2</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>234</x>
+     <y>348</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>113</x>
+     <y>348</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spinBox_3</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>horizontalSlider_3</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>234</x>
+     <y>384</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>113</x>
+     <y>384</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spinBox_4</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>horizontalSlider_4</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>234</x>
+     <y>420</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>113</x>
+     <y>420</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spinBox_5</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>horizontalSlider_5</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>234</x>
+     <y>456</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>113</x>
+     <y>456</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spinBox_6</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>horizontalSlider_6</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>234</x>
+     <y>492</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>113</x>
+     <y>492</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spinBox_7</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>horizontalSlider_7</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>234</x>
+     <y>528</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>113</x>
+     <y>528</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spinBox_8</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>horizontalSlider_8</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>180</x>
+     <y>569</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>113</x>
+     <y>564</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/qemu/mf624_interface/untitled/mf624_io_status.h b/src/qemu/mf624_interface/untitled/mf624_io_status.h
new file mode 100644 (file)
index 0000000..76406a6
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef MF624_IO_STATUS_H
+#define MF624_IO_STATUS_H
+
+
+typedef struct {
+       unsigned int DIN;
+       unsigned int DOUT;
+       int DA0;
+       int DA1;
+       int AD0;
+       int AD1;
+} mf624_io_status_t;
+
+#endif // MF624_IO_STATUS_H
diff --git a/src/qemu/mf624_interface/untitled/socket_thread.cpp b/src/qemu/mf624_interface/untitled/socket_thread.cpp
new file mode 100644 (file)
index 0000000..2815523
--- /dev/null
@@ -0,0 +1,136 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <stdio.h>
+#include "socket_thread.h"
+#include "mf624_io_status.h"
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+extern mf624_io_status_t mf624_io_status;
+
+
+socket_thread::socket_thread(QObject *parent)
+: QThread(parent)
+{
+
+}
+
+void socket_thread::socket_send(const char* str, int val)
+{
+       int n;
+       char buffer[256];
+       sprintf(buffer, str, val);
+
+       n = ::write(sockfd, buffer, strlen(buffer));
+       if (n < 0) {
+               perror("write()");
+       }
+       printf(str, val);
+}
+
+
+void socket_thread::run()
+{
+#define STRING_BUFF_SIZE       256
+       qDebug() << "Executing in new independant thread, GUI is NOT blocked";
+
+       int portno;
+       int n;
+       int status;
+       struct sockaddr_in serv_addr;
+       struct hostent *server;
+       char read_buffer[STRING_BUFF_SIZE];
+       char reg[STRING_BUFF_SIZE+1];
+       int val;
+       char buffer[256];
+
+       //if (argc < 3) {
+       //   fprintf(stderr,"usage %s hostname port\n", argv[0]);
+       //   exit(0);
+       //}
+       //portno = atoi(argv[2]);
+       portno = atoi("55555");
+
+       sockfd = ::socket(AF_INET, SOCK_STREAM, 0);
+       if (sockfd < 0) {
+               perror("socket()");
+               exit(0);
+       }
+
+       //server = gethostbyname(argv[1]);
+       server = ::gethostbyname("127.0.0.1");
+       if (server == NULL) {
+               perror("gethostbyname()");
+               exit(0);
+       }
+
+       memset((char *) &serv_addr, '\0', sizeof(serv_addr));
+       serv_addr.sin_family = AF_INET;
+       bcopy((char *)server->h_addr,
+            (char *)&serv_addr.sin_addr.s_addr,
+            server->h_length);
+
+       serv_addr.sin_port = htons(portno);
+       if (::connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) {
+               perror("connect()");
+       }
+
+
+       memset(buffer, '\0', 256);
+       while(1) {
+               n = read(sockfd, buffer, 255);
+               if (n < 0) {
+                       perror("read()");
+               }
+
+               status = sscanf(buffer, "%[A-Z]=%u", reg, &val);
+               if (status == 2) {
+                       if(!strcmp(reg, "DOUT")) {
+                               mf624_io_status.DOUT = val;
+                       }
+               }
+
+               ((MainWindow*) parent())->ui->checkBox_9->setChecked(false);
+               ((MainWindow*) parent())->ui->checkBox_10->setChecked(false);
+               ((MainWindow*) parent())->ui->checkBox_11->setChecked(false);
+               ((MainWindow*) parent())->ui->checkBox_12->setChecked(false);
+               ((MainWindow*) parent())->ui->checkBox_13->setChecked(false);
+               ((MainWindow*) parent())->ui->checkBox_14->setChecked(false);
+               ((MainWindow*) parent())->ui->checkBox_15->setChecked(false);
+               ((MainWindow*) parent())->ui->checkBox_16->setChecked(false);
+               if (mf624_io_status.DOUT & (1 << 0)) {
+                       ((MainWindow*) parent())->ui->checkBox_9->setChecked(true);
+               }
+               if (mf624_io_status.DOUT & (1 << 1)) {
+                       ((MainWindow*) parent())->ui->checkBox_10->setChecked(true);
+               }
+               if (mf624_io_status.DOUT & (1 << 2)) {
+                       ((MainWindow*) parent())->ui->checkBox_11->setChecked(true);
+               }
+               if (mf624_io_status.DOUT & (1 << 3)) {
+                       ((MainWindow*) parent())->ui->checkBox_12->setChecked(true);
+               }
+               if (mf624_io_status.DOUT & (1 << 4)) {
+                       ((MainWindow*) parent())->ui->checkBox_13->setChecked(true);
+               }
+               if (mf624_io_status.DOUT & (1 << 5)) {
+                       ((MainWindow*) parent())->ui->checkBox_14->setChecked(true);
+               }
+               if (mf624_io_status.DOUT & (1 << 6)) {
+                       ((MainWindow*) parent())->ui->checkBox_15->setChecked(true);
+               }
+               if (mf624_io_status.DOUT & (1 << 7)) {
+                       ((MainWindow*) parent())->ui->checkBox_16->setChecked(true);
+               }
+
+               //printf("%s\n", buffer);
+       }
+       //close(sockfd);
+
+       exec();
+}
+
diff --git a/src/qemu/mf624_interface/untitled/socket_thread.h b/src/qemu/mf624_interface/untitled/socket_thread.h
new file mode 100644 (file)
index 0000000..1ff0dd6
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef SOCKET_THREAD_H
+#define SOCKET_THREAD_H
+
+#include <QtGui>
+
+class socket_thread : public QThread
+{
+       Q_OBJECT
+       int sockfd; //Socket to server
+
+public:
+       socket_thread(QObject *parent);
+       void run(); // this is virtual method, we must implement it in our subclass of QThread
+       void socket_send(const char* str, int val);
+};
+
+#endif // SOCKET_THREAD_H
diff --git a/src/qemu/mf624_interface/untitled/untitled.pro b/src/qemu/mf624_interface/untitled/untitled.pro
new file mode 100644 (file)
index 0000000..fa5e863
--- /dev/null
@@ -0,0 +1,22 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2011-04-07T12:06:20
+#
+#-------------------------------------------------
+
+#LIBS     = -lsocket
+QT       += core gui
+
+TARGET = untitled
+TEMPLATE = app
+
+
+SOURCES += main.cpp\
+        mainwindow.cpp \
+    socket_thread.cpp
+
+HEADERS  += mainwindow.h \
+    socket_thread.h \
+    mf624_io_status.h
+
+FORMS    += mainwindow.ui