Skip to content
Snippets Groups Projects
Commit 4d95eda7 authored by Torsten Merz's avatar Torsten Merz
Browse files

fixed FIFO buffer clearing issue in serial driver

parent 3115d884
Branches
No related tags found
No related merge requests found
...@@ -144,24 +144,28 @@ void readCom_(int *ioRegionId, comRStruct *comRead, int numberOfBytes, RTIME t) ...@@ -144,24 +144,28 @@ void readCom_(int *ioRegionId, comRStruct *comRead, int numberOfBytes, RTIME t)
{ {
outb(0x03,regionList[*ioRegionId].start+UART_16550_FCR); outb(0x03,regionList[*ioRegionId].start+UART_16550_FCR);
inb(regionList[*ioRegionId].start + UART_16550_LSR); inb(regionList[*ioRegionId].start + UART_16550_LSR);
inb(regionList[*ioRegionId].start + UART_16550_RXB);
comRead->com_irbp=comRead->com_arbp; comRead->com_irbp=comRead->com_arbp;
comRead->comStat=0; comRead->comStat=0;
comRead->clearFifo=2; comRead->clearFifo=2;
//printf("[readCom_] FIFO cleared %04x\n",regionList[*ioRegionId].start); // cSta=inb(regionList[*ioRegionId].start + UART_16550_LSR);
//rt_printf("[readCom_] FIFO cleared %04x %02x\n",regionList[*ioRegionId].start,cSta);
} }
com_irbp=comRead->com_irbp; com_irbp=comRead->com_irbp;
cSta = inb(regionList[*ioRegionId].start + UART_16550_LSR); i = 0;
//cSta=DATA_READY; // worst case while (i < numberOfBytes) {
//rt_printf("%02x ",cSta);
if ((cSta & 0x9E) != 0) { cSta = inb(regionList[*ioRegionId].start + UART_16550_LSR);
//if (regionList[*ioRegionId].start==0x238) rt_printf("@@@%02x ",cSta); if ((cSta & 0x9E) != 0) {
// comRead->comStat=cSta & 0x9E; //if (regionList[*ioRegionId].start==0x3E8) rt_printf("@@@%02x ",cSta);
comRead->comStat=cSta & 0x1E; comRead->comStat=cSta & 0x1E;
outb(0x03, regionList[*ioRegionId].start + UART_16550_FCR); outb(0x03, regionList[*ioRegionId].start + UART_16550_FCR);
inb(regionList[*ioRegionId].start + UART_16550_LSR);
inb(regionList[*ioRegionId].start + UART_16550_RXB);
com_irbp=comRead->com_arbp; com_irbp=comRead->com_arbp;
} }
i = 0; if ((cSta & DATA_READY)==0) break; // comment for worst case timing test
while ((cSta & DATA_READY) && i < numberOfBytes) {
comRead->comTime[com_irbp]=t; comRead->comTime[com_irbp]=t;
#ifndef _NRT #ifndef _NRT
#if (IO_TIMING) #if (IO_TIMING)
...@@ -178,8 +182,8 @@ if (t2-t1>maxIoTime) maxIoTime=t2-t1; ...@@ -178,8 +182,8 @@ if (t2-t1>maxIoTime) maxIoTime=t2-t1;
//debug read //debug read
//if (regionList[*ioRegionId].start==0x3f8) //if (regionList[*ioRegionId].start==0x2f8)
//rt_printf("r%02X ",cData); //rt_printf("r%02X_%d ",cData,com_irbp);
//rt_printf("r%02X_%d ",cData,GETTIME_MS); //rt_printf("r%02X_%d ",cData,GETTIME_MS);
comRead->comReadBuf[com_irbp]=cData; comRead->comReadBuf[com_irbp]=cData;
com_irbp++; com_irbp++;
...@@ -189,14 +193,6 @@ if (t2-t1>maxIoTime) maxIoTime=t2-t1; ...@@ -189,14 +193,6 @@ if (t2-t1>maxIoTime) maxIoTime=t2-t1;
//rt_printf("%d %d\n",com_irbp,comRead->com_arbp); //rt_printf("%d %d\n",com_irbp,comRead->com_arbp);
comRead->comStat = 0xFF; comRead->comStat = 0xFF;
} }
cSta = inb(regionList[*ioRegionId].start + UART_16550_LSR);
if ((cSta & 0x9E) != 0) {
//if (regionList[*ioRegionId].start==0x3E8) rt_printf("@@@%02x ",cSta);
comRead->comStat=cSta & 0x9E;
comRead->comStat=cSta & 0x1E;
outb(0x03, regionList[*ioRegionId].start + UART_16550_FCR);
com_irbp=comRead->com_arbp;
}
i++; i++;
//cSta=DATA_READY; // worst case //cSta=DATA_READY; // worst case
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment