@@ -55,14 +55,22 void UARTPollingThread::run() | |||
|
55 | 55 | { |
|
56 | 56 | unsigned int status_reg,data; |
|
57 | 57 | char ch; |
|
58 | int cnt=0; | |
|
58 | 59 | QString printdata=""; |
|
59 | 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 | 63 | plugin->parent->Read(&data,1,this->plugin->baseAddress()+APB_UART_FIFO_DEBUG_REG); |
|
62 | 64 | ch = (char)(0xff & data); |
|
63 | 65 | printdata+=ch; |
|
64 | 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; | |
|
71 | } | |
|
65 | 72 | } |
|
73 | timeout = 100; | |
|
66 | 74 | if(printdata!="") |
|
67 | 75 | emit apbUartTextReceived(printdata); |
|
68 | 76 | } |
@@ -99,6 +107,10 void UARTPollingThread::run() | |||
|
99 | 107 | SocExplorerEngine::message(this->plugin,QString("Read %1 bytes on uart").arg(read),3); |
|
100 | 108 | ch[read]='\0'; |
|
101 | 109 | } |
|
110 | else | |
|
111 | { | |
|
112 | timeout = 100; | |
|
113 | } | |
|
102 | 114 | } |
|
103 | 115 | uartMutex->unlock(); |
|
104 | 116 | if(read>=1) |
@@ -106,8 +118,8 void UARTPollingThread::run() | |||
|
106 | 118 | SocExplorerEngine::message(this->plugin,QString("Received %1 char(s) from APBUART").arg(read),3); |
|
107 | 119 | emit this->apbUartTextReceived(QString(ch)); |
|
108 | 120 | } |
|
109 | msleep(timeout); | |
|
110 | 121 | } |
|
122 | msleep(timeout); | |
|
111 | 123 | } |
|
112 | 124 | } |
|
113 | 125 |
@@ -236,7 +236,7 unsigned int ahbuartplugin::Read(unsigne | |||
|
236 | 236 | timeout.start(); |
|
237 | 237 | unsigned int read=0; |
|
238 | 238 | unsigned int cnt=count; |
|
239 |
unsigned int nextUpdateTrig=0,updateStep= |
|
|
239 | unsigned int nextUpdateTrig=0,updateStep=1024; | |
|
240 | 240 | SocExplorerEngine::message(this,QString("Read ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2); |
|
241 | 241 | if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL)) |
|
242 | 242 | { |
@@ -342,7 +342,7 unsigned int ahbuartplugin::Write(unsign | |||
|
342 | 342 | QTime timeout; |
|
343 | 343 | timeout.start(); |
|
344 | 344 | unsigned int writen=0; |
|
345 |
unsigned int nextUpdateTrig=0,updateStep= |
|
|
345 | unsigned int nextUpdateTrig=0,updateStep=1024; | |
|
346 | 346 | SocExplorerEngine::message(this,QString("Write ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2); |
|
347 | 347 | if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL)) |
|
348 | 348 | { |
@@ -28,15 +28,26 ahbUartPluginUI::ahbUartPluginUI(QWidget | |||
|
28 | 28 | { |
|
29 | 29 | ui->setupUi(this); |
|
30 | 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 | 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 | 43 | this->writtenBytes = 0; |
|
34 | 44 | this->readBytes = 0; |
|
35 | 45 | } |
|
36 | 46 | |
|
37 | 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 | 53 | void ahbUartPluginUI::setConnected(bool connected) |
@@ -59,7 +70,7 ahbUartPluginUI::~ahbUartPluginUI() | |||
|
59 | 70 | void ahbUartPluginUI::setconfig(QString PortName, int baudrate) |
|
60 | 71 | { |
|
61 | 72 | this->ui->PortName->setText(PortName); |
|
62 |
this->ui-> |
|
|
73 | this->ui->portSpeed->setText(QString::number(baudrate)); | |
|
63 | 74 | } |
|
64 | 75 | |
|
65 | 76 | void ahbUartPluginUI::addWritenBytes(int count) |
@@ -58,6 +58,7 private: | |||
|
58 | 58 | int writtenBytes; |
|
59 | 59 | int readBytes; |
|
60 | 60 | Ui::ahbUartPluginUI *ui; |
|
61 | QCompleter* portSpeedCompleter; | |
|
61 | 62 | }; |
|
62 | 63 | |
|
63 | 64 | #endif // AHBUARTPLUGINUI_H |
@@ -6,8 +6,8 | |||
|
6 | 6 | <rect> |
|
7 | 7 | <x>0</x> |
|
8 | 8 | <y>0</y> |
|
9 |
<width> |
|
|
10 |
<height>1 |
|
|
9 | <width>884</width> | |
|
10 | <height>221</height> | |
|
11 | 11 | </rect> |
|
12 | 12 | </property> |
|
13 | 13 | <property name="windowTitle"> |
@@ -57,25 +57,6 | |||
|
57 | 57 | </layout> |
|
58 | 58 | </widget> |
|
59 | 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 | 60 | <item row="1" column="0"> |
|
80 | 61 | <widget class="QLabel" name="label_2"> |
|
81 | 62 | <property name="text"> |
@@ -100,22 +81,6 | |||
|
100 | 81 | <item row="0" column="1"> |
|
101 | 82 | <widget class="QLineEdit" name="PortName"/> |
|
102 | 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 | 84 | <item row="3" column="0"> |
|
120 | 85 | <spacer name="verticalSpacer"> |
|
121 | 86 | <property name="orientation"> |
@@ -136,6 +101,16 | |||
|
136 | 101 | </property> |
|
137 | 102 | </widget> |
|
138 | 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 | 114 | </layout> |
|
140 | 115 | </widget> |
|
141 | 116 | <resources/> |
@@ -88,6 +88,7 void dsu3plugin::openFile(QString fileNa | |||
|
88 | 88 | |
|
89 | 89 | bool dsu3plugin::configureTarget() |
|
90 | 90 | { |
|
91 | int detectedMctrlr=-1; | |
|
91 | 92 | if(parent==NULL) |
|
92 | 93 | return false; |
|
93 | 94 | unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0); |
@@ -100,6 +101,7 bool dsu3plugin::configureTarget() | |||
|
100 | 101 | if(MCTRLBASEADDRESS != (unsigned int)-1) |
|
101 | 102 | { |
|
102 | 103 | SocExplorerEngine::message(this,QString("Found %1 @%2").arg(acceptedMemctrlr[i].name).arg(MCTRLBASEADDRESS,8,16),1); |
|
104 | detectedMctrlr=i; | |
|
103 | 105 | break; |
|
104 | 106 | } |
|
105 | 107 | } |
@@ -124,19 +126,27 bool dsu3plugin::configureTarget() | |||
|
124 | 126 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x000004C); |
|
125 | 127 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x400040); |
|
126 | 128 | |
|
127 | ||
|
128 | ||
|
129 | WriteRegs(uIntlist()<<0x2FF<<0xE60<<0,(unsigned int)MCTRLBASEADDRESS); | |
|
129 | // {0x04,0x0f,"MCTRL"}, | |
|
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 | { | |
|
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 | 147 | WriteRegs(uIntlist()<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060); |
|
133 | 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 | 150 | memSet(DSUBASEADDRESS+0x300000,0,1567); |
|
141 | 151 | WriteRegs(uIntlist()<<0<<0xF30000E0<<0x00000002<<0x40000000<<0x40000000<<0x40000004<<0x1000000,(unsigned int)DSUBASEADDRESS+0x400000); |
|
142 | 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