On 21 March 2017 at 17:50, Peter Maydell <peter.mayd...@linaro.org> wrote:
> On 21 March 2017 at 16:47, Jiahuan Zhang <jiahuanzhan...@gmail.com> 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. This works to read small data, smaller than 16 bytes. > > >> * whether pl011_can_receive is returning true even with > >> 16 bytes in the fifo (hard to see how, given the code) > >> * whether the fifo actually has fewer bytes in it because > >> the guest is reading them > > > > > > No, because the guest application does't get any data. > > ...so if the guest isn't getting any data that suggests it's > the guest code's bug (ie it is not actually reading out of > the FIFO). > 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. > > thanks > -- PMM >