##// END OF EJS Templates
Protocol tested with STM32EVAL on correct packets.
kaveh -
r4:beada13e4e26 tip default
parent child
Show More
@@ -1,1 +1,1
1 023b503dbdc52f4214390519c35385722cd31f84 src/lppserial
1 9fddeb704663451094926b8e3b10d18025c8fefb src/lppserial
@@ -1,11 +1,38
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the Uprobe Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 -- Author : Kaveh Mohamadabadi
22 -- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr
23 --------------------------------------------------------------------------------*/
1 #include "mainwindow.h"
24 #include "mainwindow.h"
2 #include <QApplication>
25 #include <QApplication>
26 #include <uprobeprotocol.h>
3
27
4 int main(int argc, char *argv[])
28 int main(int argc, char *argv[])
5 {
29 {
6 QApplication a(argc, argv);
30 QApplication a(argc, argv);
7 MainWindow w;
31 UProbeProtocol proto;
8 w.show();
32 proto.setPortName("/dev/ttyUSB0");
33 proto.setSpeed(38400);
34 proto.open();
35 proto.start();
9
36
10 return a.exec();
37 return a.exec();
11 }
38 }
@@ -1,3 +1,26
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the Uprobe Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 -- Author : Kaveh Mohamadabadi
22 -- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr
23 --------------------------------------------------------------------------------*/
1 #include "mainwindow.h"
24 #include "mainwindow.h"
2 #include "ui_mainwindow.h"
25 #include "ui_mainwindow.h"
3
26
@@ -1,3 +1,26
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the Uprobe Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 -- Author : Kaveh Mohamadabadi
22 -- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr
23 --------------------------------------------------------------------------------*/
1 #ifndef MAINWINDOW_H
24 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
25 #define MAINWINDOW_H
3
26
@@ -1,3 +1,26
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the Uprobe Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 -- Author : Kaveh Mohamadabadi
22 -- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr
23 --------------------------------------------------------------------------------*/
1 #include "ucomport.h"
24 #include "ucomport.h"
2
25
3 UComPort::UComPort()
26 UComPort::UComPort()
@@ -1,3 +1,27
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the Uprobe Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 -- Author : Kaveh Mohamadabadi
22 -- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr
23 --------------------------------------------------------------------------------*/
24
1 #ifndef UCOMPORT_H
25 #ifndef UCOMPORT_H
2 #define UCOMPORT_H
26 #define UCOMPORT_H
3
27
@@ -1,3 +1,26
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the Uprobe Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 -- Author : Kaveh Mohamadabadi
22 -- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr
23 --------------------------------------------------------------------------------*/
1 #include "uprobe.h"
24 #include "uprobe.h"
2
25
3 UProbe::UProbe(QObject *parent) :
26 UProbe::UProbe(QObject *parent) :
@@ -1,3 +1,26
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the Uprobe Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 -- Author : Kaveh Mohamadabadi
22 -- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr
23 --------------------------------------------------------------------------------*/
1 #ifndef UPROBE_H
24 #ifndef UPROBE_H
2 #define UPROBE_H
25 #define UPROBE_H
3
26
@@ -1,7 +1,30
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the Uprobe Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 -- Author : Kaveh Mohamadabadi
22 -- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr
23 --------------------------------------------------------------------------------*/
1 #include "uprobeprotocol.h"
24 #include "uprobeprotocol.h"
2
25
3 UProbeProtocol::UProbeProtocol(QObject *parent) :
26 UProbeProtocol::UProbeProtocol(QObject *parent) :
4 QThread(parent),UComPort()
27 QThread(parent),UComPort(),p_datacount(0),p_index(0)
5 {
28 {
6 moveToThread((QThread*)this);
29 moveToThread((QThread*)this);
7 }
30 }
@@ -32,7 +55,7 void UProbeProtocol::run()
32 {
55 {
33 p_index+=currentPacket->packetSize + 6;
56 p_index+=currentPacket->packetSize + 6;
34 //forward DATA
57 //forward DATA
35
58 emit packetReady(currentPacket);
36 }
59 }
37 }
60 }
38 p_index++;
61 p_index++;
@@ -110,7 +133,7 bool UProbeProtocol::FSM_ExtractHeaderSt
110 currentPacket = new UProbeProtocolPacket();
133 currentPacket = new UProbeProtocolPacket();
111 currentPacket->packetNumber = p_buffer[p_index+2];
134 currentPacket->packetNumber = p_buffer[p_index+2];
112 currentPacket->packetSize = ((unsigned int)p_buffer[p_index+3] + 1)*2;
135 currentPacket->packetSize = ((unsigned int)p_buffer[p_index+3] + 1)*2;
113 currentPacket->channelCount = 0xF & (int)(p_buffer[p_index+4]>>4);
136 currentPacket->channelCount = 0xF & ((int)(p_buffer[p_index+4]>>4) +1);
114 currentPacket->coding = (UProbeProtocol::UProbeProtocolPacket::PacketCoding)(0x3 & (int)(p_buffer[p_index+4]>>2));
137 currentPacket->coding = (UProbeProtocol::UProbeProtocolPacket::PacketCoding)(0x3 & (int)(p_buffer[p_index+4]>>2));
115 currentPacket->resolution = (UProbeProtocol::UProbeProtocolPacket::PacketResolution)(0x3 & (int)(p_buffer[p_index+4]));
138 currentPacket->resolution = (UProbeProtocol::UProbeProtocolPacket::PacketResolution)(0x3 & (int)(p_buffer[p_index+4]));
116 currentPacket->ID = (unsigned int)p_buffer[p_index+5];
139 currentPacket->ID = (unsigned int)p_buffer[p_index+5];
@@ -1,3 +1,26
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the Uprobe Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 -- Author : Kaveh Mohamadabadi
22 -- Mail : kaveh.mohamadabadi@lpp.polytechnique.fr
23 --------------------------------------------------------------------------------*/
1 #ifndef UPROBEPROTOCOL_H
24 #ifndef UPROBEPROTOCOL_H
2 #define UPROBEPROTOCOL_H
25 #define UPROBEPROTOCOL_H
3
26
@@ -21,7 +44,7
21 -------------------------------------------------------------------------------------------
44 -------------------------------------------------------------------------------------------
22
45
23 || Sync (2Bytes) || Header(4 Bytes) || Payload Data (2 to 512 Bytes) || CRC(1 Byte) ||
46 || Sync (2Bytes) || Header(4 Bytes) || Payload Data (2 to 512 Bytes) || CRC(1 Byte) ||
24 || 0xA5 0xF0 || PCPT | (PSZ-1)*2 | SHAPE | ID || [...] || Uses SpaceWire CRC ||
47 || 0xA5 0xF0 || PCPT | (PSZ/2)-1 | SHAPE | ID || [...] || Uses SpaceWire CRC ||
25
48
26
49
27 Shape:
50 Shape:
@@ -124,6 +147,7 public:
124 void run();
147 void run();
125
148
126 signals:
149 signals:
150 void packetReady(UProbeProtocolPacket* currentPacket);
127
151
128 public slots:
152 public slots:
129 void setPortName(const QString& name);
153 void setPortName(const QString& name);
General Comments 0
You need to be logged in to leave comments. Login now