public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrei Warkentin" <andrei.warkentin@intel.com>
To: Gerd Hoffmann <kraxel@redhat.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Daniel Schaefer <git@danielschaefer.me>,
	Sunil V L <sunilvl@ventanamicro.com>
Subject: Re: [edk2-devel] [edk2 2/2] MdePkg: add BaseSerialPortLibRiscVSbi
Date: Wed, 1 Mar 2023 08:50:38 +0000	[thread overview]
Message-ID: <PH8PR11MB68563E2FBD725A773B6ABF6583AD9@PH8PR11MB6856.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230301081332.lzb5v7enjfillnfb@sirius.home.kraxel.org>

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

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 <kraxel@redhat.com>
Отправлено: Wednesday, March 1, 2023 2:13:32 AM
Кому: devel@edk2.groups.io <devel@edk2.groups.io>; Warkentin, Andrei <andrei.warkentin@intel.com>
Копия: Daniel Schaefer <git@danielschaefer.me>; Sunil V L <sunilvl@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


[-- Attachment #2: Type: text/html, Size: 1901 bytes --]

  reply	other threads:[~2023-03-01  8:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01  7:43 [edk2 0/2] RISC-V SBI-backed SerialLib Andrei Warkentin
2023-03-01  7:43 ` [edk2 1/2] MdePkg: BaseRiscVSbiLib: make more useful to consumers Andrei Warkentin
2023-03-01  7:43 ` [edk2 2/2] MdePkg: add BaseSerialPortLibRiscVSbi Andrei Warkentin
2023-03-01  8:13   ` [edk2-devel] " Gerd Hoffmann
2023-03-01  8:50     ` Andrei Warkentin [this message]
2023-03-01  9:07       ` Gerd Hoffmann
2023-03-01 16:55         ` Michael D Kinney
2023-03-01 17:26           ` Andrei Warkentin
2023-03-01 17:51             ` Michael D Kinney
2023-03-01 17:56               ` Andrei Warkentin
2023-03-02 10:34                 ` Sunil V L
2023-03-02 13:32                   ` Andrei Warkentin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH8PR11MB68563E2FBD725A773B6ABF6583AD9@PH8PR11MB6856.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox