The library caller could call Poll() first, then call Read(), and the expectation is the char won't be lost. SBI doesn't have a poll call itself, so best you could do is read and stash. So you have to stash it globally. And read must use the stashed char, if it exists, before requesting more data from SBI. At that point, reading is easy to treat as continued polling - just to keep the code simple.
A ________________________________ От: Gerd Hoffmann <kra...@redhat.com> Отправлено: Wednesday, March 1, 2023 2:13:32 AM Кому: devel@edk2.groups.io <devel@edk2.groups.io>; Warkentin, Andrei <andrei.warken...@intel.com> Копия: Daniel Schaefer <g...@danielschaefer.me>; Sunil V L <suni...@ventanamicro.com> Тема: Re: [edk2-devel] [edk2 2/2] MdePkg: add BaseSerialPortLibRiscVSbi Hi, > + while ((Index < NumberOfBytes) && SerialPortPoll ()) { > + Buffer[Index++] = (UINT8)mLastGetChar; > + mLastGetChar = -1; > + } Why do you use a global variable to pass the character? SerialPortPoll could just return it directly ... take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#100586): https://edk2.groups.io/g/devel/message/100586 Mute This Topic: https://groups.io/mt/97309875/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-