qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Guest application reading from pl011 without device dri


From: Jiahuan Zhang
Subject: Re: [Qemu-devel] Guest application reading from pl011 without device driver
Date: Tue, 21 Mar 2017 18:48:37 +0100

But what I met is that, when the receiving data is small, no data is
knocking the door of the fifo by ReadFile (), then pl011_read can starts.
When the data is large, after the fifo is full, there are still data
requesting to get into the fifo. Then the device is busy with
pl011_can_receive.

The guest program is as follows.

While (*UART_FR & PL011_RXFE); //wait until fifo not empty
for (i=0;i <16;i++){
data [i] = (unsigned char) *UART_DR; //read from the data register.
}

Best,
Huan

2017年3月21日 18:17,"Peter Maydell" <address@hidden>写道:

On 21 March 2017 at 16:59, Jiahuan Zhang <address@hidden> wrote:
>
>
> On 21 March 2017 at 17:50, Peter Maydell <address@hidden> wrote:
>>
>> On 21 March 2017 at 16:47, Jiahuan Zhang <address@hidden>
wrote:
>> > The actual situation is, pl011_can_receive is returning false, the fifo
>> > is
>> > full,   pl011_read does't start.
>> > At this moment, only pl011_can_recieve is keeping returning 0.
>>
>> OK, so the incoming data has filled up the FIFO, and the UART
>> is now sitting waiting for the guest to read the data...
>
>
> Yes. And I think the guest reading can start when the fifo is nonempty.
> In the guest program, I first check the flag register, once the fifo is
> nonempty,
> then move on to read from the data register.

Which flag are you testing?

> What I found is pl011 expects to read all the data into fifo,
> though pl011_can_receive returns false.
> Only when all the data is read, pl011_read can start.

This doesn't make sense. If our pl011 didn't allow reads
of data before the FIFO was full then you'd see small
data not working, but large data working.

In any case our pl011_read implementation will happily
return you any data it has as long as the fifo is not
completely empty, and even if the guest buggily reads
from an empty FIFO it will return you the last character
read (this is how the h/w works, IIRC).

(This would be much easier if you actually said what your
guest code did, rather than requiring me to guess.)

thanks
-- PMM


reply via email to

[Prev in Thread] Current Thread [Next in Thread]