qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Blue Swirl" <blauwirbel@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] SM501 emulation for R2D-SH4
Date: Sun, 2 Nov 2008 08:52:45 +0200	[thread overview]
Message-ID: <f43fc5580811012352k67091dd3oe56c42a150fe4398@mail.gmail.com> (raw)
In-Reply-To: <490D0C8F.9010601@juno.dti.ne.jp>

On 11/2/08, Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp> wrote:
> Hi, all!
>
>  This patch adds minimum emulation of SM501 multifunction device,
>  whose main feature is 2D graphics.  It is one of the peripheral
>  of R2D, the SH4 evaluation board.  We can see TUX printed on the
>  QEMU console.

>  +#define UART_RX_OFFSET  0x00
>  +#define UART_TX_OFFSET  0x00
>  +#define UART_IER_OFFSET 0x04
>  +#define UART_IIR_OFFSET 0x08
>  +#define UART_FCR_OFFSET 0x08
>  +#define UART_LCR_OFFSET 0x0C
>  +#define UART_MCR_OFFSET 0x10
>  +#define UART_LSR_OFFSET 0x14
>  +#define UART_MSR_OFFSET 0x18
>  +#define UART_SCR_OFFSET 0x1C

Looks like standard 16550-like UART. Maybe you could use the version
in serial.c and map that to this location?

>  +/* taken from "linux/drivers/mfd/sm501.c" */
>  +static uint32_t sm501_mem_local_size[] = {

"const"?

>  +    if (SM501_DC + SM501_DC_PANEL_PALETTE <= offset
>  +       && offset < SM501_DC + SM501_DC_VIDEO_PALETTE) {
>  +       offset -= SM501_DC + SM501_DC_PANEL_PALETTE;
>  +       /* TODO : consider BYTE/WORD access */
>  +       /* TODO : consider endian */
>  +       ret = *(uint32_t*)&s->dc_panel_palette[offset];
>  +    } else if (SM501_DC + SM501_DC_VIDEO_PALETTE <= offset
>  +              && offset < SM501_DC + SM501_DC_CRT_PALETTE) {
>  +       offset -= SM501_DC + SM501_DC_VIDEO_PALETTE;
>  +       /* TODO : consider BYTE/WORD access */
>  +       /* TODO : consider endian */
>  +       ret = *(uint32_t*)&s->dc_video_palette[offset];
>  +    } else if (SM501_DC + SM501_DC_CRT_PALETTE <= offset
>  +              && offset < SM501_DC + SM501_DC_CRT_PALETTE + 0x400) {
>  +       offset -= SM501_DC + SM501_DC_CRT_PALETTE;
>  +       /* TODO : consider BYTE/WORD access */
>  +       /* TODO : consider endian */
>  +       ret = *(uint32_t*)&s->dc_crt_palette[offset];
>  +    } else {

The above should be cleaner and faster if you registered different
access routines for each area.

>  +static uint32_t sm501_lm_read(void *opaque, target_phys_addr_t addr)
>  +{
>  +    SM501State * s = (SM501State *)opaque;
>  +    uint32_t offset = addr - s->base;
>  +    return *(uint32_t*)&s->local_mem[offset];
>  +}

It would be much faster to register normal RAM for this area and check
for updated pages asynchronously using VGA_DIRTY_FLAG (see vga.c or
tcx.c).

>  +    /* allocate local memory */
>  +    s->local_mem = qemu_mallocz(get_local_mem_size(s));

The display buffer should be allocated using machine definition .ram_require.

  parent reply	other threads:[~2008-11-02  6:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-02  2:12 [Qemu-devel] [PATCH] SM501 emulation for R2D-SH4 Shin-ichiro KAWASAKI
2008-11-02  3:27 ` andrzej zaborowski
2008-11-04 14:31   ` Shin-ichiro KAWASAKI
2008-11-02  6:52 ` Blue Swirl [this message]
2008-11-04 15:10   ` Shin-ichiro KAWASAKI
2008-11-04 19:11     ` Blue Swirl
2008-11-05 17:09       ` [Qemu-devel] [PATCH] [RESEND] " Shin-ichiro KAWASAKI
2008-11-05 18:25         ` Blue Swirl
2008-11-05 20:13           ` andrzej zaborowski
2008-11-05 20:26             ` Blue Swirl
2008-11-04 15:27   ` [Qemu-devel] When should I use qemu_ram_alloc(), and how? takasi-y
2008-11-04 19:14     ` [Qemu-devel] " Blue Swirl
2008-11-04 19:32       ` Anthony Liguori
2008-11-05 13:29       ` takasi-y

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-all 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=f43fc5580811012352k67091dd3oe56c42a150fe4398@mail.gmail.com \
    --to=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).