qemu-stable
[Top][All Lists]
Advanced

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

Re: [PATCH qemu 1/2] hw/at24c : modify at24c to support 1 byte address m


From: Sittisak Sinprem
Subject: Re: [PATCH qemu 1/2] hw/at24c : modify at24c to support 1 byte address mode
Date: Thu, 16 Feb 2023 15:47:18 +0700

Hi Philippe,

the EEPROM size less than or equal to 256 , such as 24c02
use only 1 byte to mention the memory (0 - 255) (0x00 - 0xff)

 write byte
  [ Start sAddr/W ] -> [ mem Addr ] -> [ mem data ] -> [ Stop ]

 read byte
  [ Start sAddr/W ] -> [ mem Addr ]
    -> [ reStart sAddr/R] -> [ mem data ]-> [ Stop ]

---------------------------------------------------------------
Meanwhile, in EEPROM size more 256 , such as 24c64 has size 8192 bytes (0x2000)
use 2 bytes for pointing the memory (0x0000 - 0x2000 )

 write byte
  [ Start sAddr/W ] -> [ 1st mem Addr ] -> [ 2nd mem Addr ]
   -> [ Mem Data ] -> [ Stop ]

  read byte
  [ Start sAddr/W ] -> [ 1st mem Addr ] -> [ 2nd mem Addr ]
   -> [ reStart sAddr/R] -> [ mem data ]-> [ Stop ]

On Thu, Feb 16, 2023 at 3:25 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
On 10/2/23 07:20, ~ssinprem wrote:
> From: Sittisak Sinprem <ssinprem@celestca.com>
>
> ---
>   hw/nvram/eeprom_at24c.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c
> index 2d4d8b952f..693212b661 100644
> --- a/hw/nvram/eeprom_at24c.c
> +++ b/hw/nvram/eeprom_at24c.c
> @@ -87,7 +87,7 @@ uint8_t at24c_eeprom_recv(I2CSlave *s)
>       EEPROMState *ee = AT24C_EE(s);
>       uint8_t ret;
>   
> -    if (ee->haveaddr == 1) {
> +    if (ee->rsize > 256 && ee->haveaddr == 1) {
>           return 0xff;
>       }

What represents this '256' magic value? Please add a definition.

reply via email to

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