##// END OF EJS Templates
dsu3plugin now support SRCTRLE_0WS and SRCTRLE_1WS....
jeandet -
r49:a5ab5a38b3a9 default
parent child
Show More
@@ -55,14 +55,22 void UARTPollingThread::run()
55 {
55 {
56 unsigned int status_reg,data;
56 unsigned int status_reg,data;
57 char ch;
57 char ch;
58 int cnt=0;
58 QString printdata="";
59 QString printdata="";
59 plugin->parent->Read(&status_reg,1,this->plugin->baseAddress()+APB_UART_STATUS_REG);
60 plugin->parent->Read(&status_reg,1,this->plugin->baseAddress()+APB_UART_STATUS_REG);
60 while ((status_reg & 4)==0) {
61 while ((status_reg & 4)==0)
62 {
61 plugin->parent->Read(&data,1,this->plugin->baseAddress()+APB_UART_FIFO_DEBUG_REG);
63 plugin->parent->Read(&data,1,this->plugin->baseAddress()+APB_UART_FIFO_DEBUG_REG);
62 ch = (char)(0xff & data);
64 ch = (char)(0xff & data);
63 printdata+=ch;
65 printdata+=ch;
64 plugin->parent->Read(&status_reg,1,this->plugin->baseAddress()+APB_UART_STATUS_REG);
66 plugin->parent->Read(&status_reg,1,this->plugin->baseAddress()+APB_UART_STATUS_REG);
67 cnt++;
68 if(Q_UNLIKELY(cnt>100))
69 {
70 break;
65 }
71 }
72 }
73 timeout = 100;
66 if(printdata!="")
74 if(printdata!="")
67 emit apbUartTextReceived(printdata);
75 emit apbUartTextReceived(printdata);
68 }
76 }
@@ -99,6 +107,10 void UARTPollingThread::run()
99 SocExplorerEngine::message(this->plugin,QString("Read %1 bytes on uart").arg(read),3);
107 SocExplorerEngine::message(this->plugin,QString("Read %1 bytes on uart").arg(read),3);
100 ch[read]='\0';
108 ch[read]='\0';
101 }
109 }
110 else
111 {
112 timeout = 100;
113 }
102 }
114 }
103 uartMutex->unlock();
115 uartMutex->unlock();
104 if(read>=1)
116 if(read>=1)
@@ -106,10 +118,10 void UARTPollingThread::run()
106 SocExplorerEngine::message(this->plugin,QString("Received %1 char(s) from APBUART").arg(read),3);
118 SocExplorerEngine::message(this->plugin,QString("Received %1 char(s) from APBUART").arg(read),3);
107 emit this->apbUartTextReceived(QString(ch));
119 emit this->apbUartTextReceived(QString(ch));
108 }
120 }
121 }
109 msleep(timeout);
122 msleep(timeout);
110 }
123 }
111 }
124 }
112 }
113
125
114 void UARTPollingThread::sendChar(char c)
126 void UARTPollingThread::sendChar(char c)
115 {
127 {
@@ -236,7 +236,7 unsigned int ahbuartplugin::Read(unsigne
236 timeout.start();
236 timeout.start();
237 unsigned int read=0;
237 unsigned int read=0;
238 unsigned int cnt=count;
238 unsigned int cnt=count;
239 unsigned int nextUpdateTrig=0,updateStep=512;
239 unsigned int nextUpdateTrig=0,updateStep=1024;
240 SocExplorerEngine::message(this,QString("Read ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2);
240 SocExplorerEngine::message(this,QString("Read ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2);
241 if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL))
241 if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL))
242 {
242 {
@@ -342,7 +342,7 unsigned int ahbuartplugin::Write(unsign
342 QTime timeout;
342 QTime timeout;
343 timeout.start();
343 timeout.start();
344 unsigned int writen=0;
344 unsigned int writen=0;
345 unsigned int nextUpdateTrig=0,updateStep=512;
345 unsigned int nextUpdateTrig=0,updateStep=1024;
346 SocExplorerEngine::message(this,QString("Write ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2);
346 SocExplorerEngine::message(this,QString("Write ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2);
347 if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL))
347 if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL))
348 {
348 {
@@ -28,15 +28,26 ahbUartPluginUI::ahbUartPluginUI(QWidget
28 {
28 {
29 ui->setupUi(this);
29 ui->setupUi(this);
30 connect(ui->OpenPort,SIGNAL(clicked()),this,SLOT(connectPort()));
30 connect(ui->OpenPort,SIGNAL(clicked()),this,SLOT(connectPort()));
31 connect(ui->PortspeedSlider,SIGNAL(valueChanged(int)),ui->baurateLCD,SLOT(display(int)));
31 // connect(ui->PortspeedSlider,SIGNAL(valueChanged(int)),ui->baurateLCD,SLOT(display(int)));
32 connect(ui->rescanPorts,SIGNAL(clicked()),this,SIGNAL(rescanPorts()));
32 connect(ui->rescanPorts,SIGNAL(clicked()),this,SIGNAL(rescanPorts()));
33 QStringList allowedSpeeds;
34 allowedSpeeds<<"0"<<"50"<<"75"<<"110"<<"134"<<"150"<<
35 "200"<<"300"<<"600"<<"1200"<<"1800"<<"2400"<<
36 "4800"<<"9600"<<"19200"<<"38400"<<"57600"<<
37 "115200"<<"230400"<<"460800"<<"500000"<<"576000"<<
38 "921600"<<"1000000"<<"1152000"<<"1500000"<<"2000000"<<
39 "2500000"<<"3000000"<<"3500000"<<"4000000";
40
41 portSpeedCompleter = new QCompleter(allowedSpeeds);
42 this->ui->portSpeed->setCompleter(portSpeedCompleter);
33 this->writtenBytes = 0;
43 this->writtenBytes = 0;
34 this->readBytes = 0;
44 this->readBytes = 0;
35 }
45 }
36
46
37 void ahbUartPluginUI::connectPort()
47 void ahbUartPluginUI::connectPort()
38 {
48 {
39 emit this->connectPortsig(ui->PortName->text(),ui->PortspeedSlider->value());
49 int baudrate = ui->portSpeed->text().toInt();
50 emit this->connectPortsig(ui->PortName->text(),baudrate);
40 }
51 }
41
52
42 void ahbUartPluginUI::setConnected(bool connected)
53 void ahbUartPluginUI::setConnected(bool connected)
@@ -59,7 +70,7 ahbUartPluginUI::~ahbUartPluginUI()
59 void ahbUartPluginUI::setconfig(QString PortName, int baudrate)
70 void ahbUartPluginUI::setconfig(QString PortName, int baudrate)
60 {
71 {
61 this->ui->PortName->setText(PortName);
72 this->ui->PortName->setText(PortName);
62 this->ui->PortspeedSlider->setValue(baudrate);
73 this->ui->portSpeed->setText(QString::number(baudrate));
63 }
74 }
64
75
65 void ahbUartPluginUI::addWritenBytes(int count)
76 void ahbUartPluginUI::addWritenBytes(int count)
@@ -58,6 +58,7 private:
58 int writtenBytes;
58 int writtenBytes;
59 int readBytes;
59 int readBytes;
60 Ui::ahbUartPluginUI *ui;
60 Ui::ahbUartPluginUI *ui;
61 QCompleter* portSpeedCompleter;
61 };
62 };
62
63
63 #endif // AHBUARTPLUGINUI_H
64 #endif // AHBUARTPLUGINUI_H
@@ -6,8 +6,8
6 <rect>
6 <rect>
7 <x>0</x>
7 <x>0</x>
8 <y>0</y>
8 <y>0</y>
9 <width>768</width>
9 <width>884</width>
10 <height>196</height>
10 <height>221</height>
11 </rect>
11 </rect>
12 </property>
12 </property>
13 <property name="windowTitle">
13 <property name="windowTitle">
@@ -57,25 +57,6
57 </layout>
57 </layout>
58 </widget>
58 </widget>
59 </item>
59 </item>
60 <item row="1" column="1">
61 <widget class="QSlider" name="PortspeedSlider">
62 <property name="maximum">
63 <number>3000000</number>
64 </property>
65 <property name="singleStep">
66 <number>9600</number>
67 </property>
68 <property name="pageStep">
69 <number>1</number>
70 </property>
71 <property name="value">
72 <number>921600</number>
73 </property>
74 <property name="orientation">
75 <enum>Qt::Horizontal</enum>
76 </property>
77 </widget>
78 </item>
79 <item row="1" column="0">
60 <item row="1" column="0">
80 <widget class="QLabel" name="label_2">
61 <widget class="QLabel" name="label_2">
81 <property name="text">
62 <property name="text">
@@ -100,22 +81,6
100 <item row="0" column="1">
81 <item row="0" column="1">
101 <widget class="QLineEdit" name="PortName"/>
82 <widget class="QLineEdit" name="PortName"/>
102 </item>
83 </item>
103 <item row="1" column="2">
104 <widget class="QLCDNumber" name="baurateLCD">
105 <property name="font">
106 <font>
107 <weight>75</weight>
108 <bold>true</bold>
109 </font>
110 </property>
111 <property name="digitCount">
112 <number>7</number>
113 </property>
114 <property name="segmentStyle">
115 <enum>QLCDNumber::Flat</enum>
116 </property>
117 </widget>
118 </item>
119 <item row="3" column="0">
84 <item row="3" column="0">
120 <spacer name="verticalSpacer">
85 <spacer name="verticalSpacer">
121 <property name="orientation">
86 <property name="orientation">
@@ -136,6 +101,16
136 </property>
101 </property>
137 </widget>
102 </widget>
138 </item>
103 </item>
104 <item row="1" column="1" colspan="2">
105 <widget class="QLineEdit" name="portSpeed">
106 <property name="inputMask">
107 <string>00000000</string>
108 </property>
109 <property name="text">
110 <string>115200</string>
111 </property>
112 </widget>
113 </item>
139 </layout>
114 </layout>
140 </widget>
115 </widget>
141 <resources/>
116 <resources/>
@@ -88,6 +88,7 void dsu3plugin::openFile(QString fileNa
88
88
89 bool dsu3plugin::configureTarget()
89 bool dsu3plugin::configureTarget()
90 {
90 {
91 int detectedMctrlr=-1;
91 if(parent==NULL)
92 if(parent==NULL)
92 return false;
93 return false;
93 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
94 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
@@ -100,6 +101,7 bool dsu3plugin::configureTarget()
100 if(MCTRLBASEADDRESS != (unsigned int)-1)
101 if(MCTRLBASEADDRESS != (unsigned int)-1)
101 {
102 {
102 SocExplorerEngine::message(this,QString("Found %1 @%2").arg(acceptedMemctrlr[i].name).arg(MCTRLBASEADDRESS,8,16),1);
103 SocExplorerEngine::message(this,QString("Found %1 @%2").arg(acceptedMemctrlr[i].name).arg(MCTRLBASEADDRESS,8,16),1);
104 detectedMctrlr=i;
103 break;
105 break;
104 }
106 }
105 }
107 }
@@ -124,19 +126,27 bool dsu3plugin::configureTarget()
124 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x000004C);
126 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x000004C);
125 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x400040);
127 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x400040);
126
128
127
129 // {0x04,0x0f,"MCTRL"},
128
130 // {0x01,0x51,"FTSRCTRL"},
131 // {0x20,0x01,"SRCTRLE_0WS" },
132 // {0x20,0x02,"SRCTRLE_1WS" }
133 if(QString(acceptedMemctrlr[detectedMctrlr].name)=="MCTRL" || QString(acceptedMemctrlr[detectedMctrlr].name)=="FTSRCTRL" )
134 {
129 WriteRegs(uIntlist()<<0x2FF<<0xE60<<0,(unsigned int)MCTRLBASEADDRESS);
135 WriteRegs(uIntlist()<<0x2FF<<0xE60<<0,(unsigned int)MCTRLBASEADDRESS);
136 }
137 if(QString(acceptedMemctrlr[detectedMctrlr].name)=="SRCTRLE_0WS" || QString(acceptedMemctrlr[detectedMctrlr].name)=="SRCTRLE_1WS" )
138 {
139 //let's perform a mem Wash
140 unsigned int val = ReadReg(MCTRLBASEADDRESS);
141 val |=1<<31;
142 WriteRegs(uIntlist()<<val,(unsigned int)MCTRLBASEADDRESS);
143 usleep(1000*1000);
144 }
130
145
131
146
132 WriteRegs(uIntlist()<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060);
147 WriteRegs(uIntlist()<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060);
133 WriteRegs(uIntlist()<<0x0000FFFF,(unsigned int)DSUBASEADDRESS+0x24);
148 WriteRegs(uIntlist()<<0x0000FFFF,(unsigned int)DSUBASEADDRESS+0x24);
134
149
135 unsigned int buff=0;
136 // for(int i=0;i<1567;i++)
137 // {
138 // parent->Write(&buff,(unsigned int)1,DSUBASEADDRESS+0x300000+(4*i));
139 // }
140 memSet(DSUBASEADDRESS+0x300000,0,1567);
150 memSet(DSUBASEADDRESS+0x300000,0,1567);
141 WriteRegs(uIntlist()<<0<<0xF30000E0<<0x00000002<<0x40000000<<0x40000000<<0x40000004<<0x1000000,(unsigned int)DSUBASEADDRESS+0x400000);
151 WriteRegs(uIntlist()<<0<<0xF30000E0<<0x00000002<<0x40000000<<0x40000000<<0x40000004<<0x1000000,(unsigned int)DSUBASEADDRESS+0x400000);
142 WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0x403ffff0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x300020);
152 WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0x403ffff0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x300020);
General Comments 0
You need to be logged in to leave comments. Login now