From: "andrzej zaborowski" <balrogg@gmail.com>
To: qemu-devel@nongnu.org
Cc: Dmitry Baryshkov <dbaryshkov@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] tosa: basic lcd support
Date: Sun, 2 Nov 2008 17:09:04 +0100 [thread overview]
Message-ID: <fb249edb0811020809w7e9646bm92ec6a57861bcb3e@mail.gmail.com> (raw)
In-Reply-To: <1225631790-15735-4-git-send-email-dbaryshkov@gmail.com>
2008/11/2 Dmitry Baryshkov <dbaryshkov@gmail.com>:
> Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
> ---
> hw/tosa.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 74 insertions(+), 0 deletions(-)
>
> diff --git a/hw/tosa.c b/hw/tosa.c
> index e629044..cb0e1da 100644
> --- a/hw/tosa.c
> +++ b/hw/tosa.c
> @@ -17,6 +17,7 @@
> #include "pcmcia.h"
> #include "block.h"
> #include "boards.h"
> +#include "i2c.h"
>
> #define TOSA_RAM 0x04000000
> #define TOSA_ROM 0x00800000
> @@ -38,6 +39,11 @@
> #define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2)
> #define TOSA_GPIO_WLAN_LED (TOSA_SCOOP_JC_GPIO_BASE + 7)
>
> +#define DAC_BASE 0x4e
> +#define DAC_CH1 0
> +#define DAC_CH2 1
> +
> +
> static void tosa_microdrive_attach(struct pxa2xx_state_s *cpu)
> {
> struct pcmcia_card_s *md;
> @@ -104,6 +110,72 @@ static void tosa_gpio_setup(struct pxa2xx_state_s *cpu,
> scoop_gpio_out_set(scp1, TOSA_GPIO_WLAN_LED, outsignals[3]);
> }
>
> +static uint32_t tosa_ssp_read(void *opaque) {
> + return 0;
> +}
> +
> +static void tosa_ssp_write(void *opaque, uint32_t value)
> +{
> + fprintf(stderr, "TG: %d %02x\n", value >> 5, value & 0x1f);
> +}
> +
> +struct tosa_dac_i2c {
> + i2c_slave i2c;
> + int len;
> + char buf[3];
> +};
> +
> +static int tosa_dac_send(i2c_slave *i2c, uint8_t data)
> +{
> + struct tosa_dac_i2c *s = (struct tosa_dac_i2c *)i2c;
> + s->buf[s->len] = data;
> + if (s->len ++ > 2) {
> +#ifdef VERBOSE
> + fprintf(stderr, "%s: message too long (%i bytes)\n", __FUNCTION__, s->len);
> +#endif
> + return 1;
> + }
> +
> + if (s->len == 2) {
> + fprintf(stderr, "dac: channel %d value 0x%02x\n",
> + s->buf[0], s->buf[1]);
> + }
> +
> + return 0;
> +}
> +
> +static void tosa_dac_event(i2c_slave *i2c, enum i2c_event event)
> +{
> + struct tosa_dac_i2c *s = (struct tosa_dac_i2c *)i2c;
> + s->len = 0;
> + switch (event) {
> + case I2C_START_SEND:
> + break;
> + case I2C_FINISH:
> +#ifdef VERBOSE
> + if (s->len < 2)
> + printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->len);
> + if (s->len > 2)
> + printf("%s: message too long\n", __FUNCTION__);
> +#endif
> + break;
> + default:
> + break;
> + }
> +}
> +
> +static void tosa_tg_init(struct pxa2xx_state_s *cpu)
> +{
> + struct i2c_bus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
> + struct i2c_slave *dac = i2c_slave_init(bus, 0, sizeof(struct tosa_dac_i2c));
> + dac->send = tosa_dac_send;
> + dac->event = tosa_dac_event;
You should set also .recv to not leave the kernel a possibility to
crash qemu. Other than this, looks okay, but does this code help
emulation in anyway? I suppose the kernel wants to see some i2c
device present?
Cheers
next prev parent reply other threads:[~2008-11-02 16:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-02 13:16 [Qemu-devel] [PATCH] scoop: GPRR reports the state of GPIO lines Dmitry Baryshkov
2008-11-02 13:16 ` [Qemu-devel] [PATCH] tc6393xb: initial support for nand Dmitry Baryshkov
2008-11-02 13:16 ` [Qemu-devel] [PATCH] tosa: support leds Dmitry Baryshkov
2008-11-02 13:16 ` [Qemu-devel] [PATCH] tosa: basic lcd support Dmitry Baryshkov
2008-11-02 13:16 ` [Qemu-devel] [PATCH] tosa: provide correct IRQ to tc6393xb init Dmitry Baryshkov
2008-11-02 13:16 ` [Qemu-devel] [PATCH] tosa: disable pxafb as it's not used on tosa Dmitry Baryshkov
2008-11-02 13:16 ` [Qemu-devel] [PATCH] tc6393xb: non-accelerated FB support Dmitry Baryshkov
2008-11-02 16:31 ` andrzej zaborowski
2008-11-02 17:36 ` Dmitry Baryshkov
2008-11-02 19:40 ` Dmitry Baryshkov
2008-11-03 23:46 ` andrzej zaborowski
2008-11-04 3:14 ` Dmitry
2008-11-02 16:09 ` andrzej zaborowski [this message]
2008-11-02 17:19 ` [Qemu-devel] [PATCH] tosa: basic lcd support Dmitry Baryshkov
2008-11-04 9:14 ` andrzej zaborowski
2008-11-02 14:45 ` [Qemu-devel] Re: [PATCH] scoop: GPRR reports the state of GPIO lines Dmitry Baryshkov
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=fb249edb0811020809w7e9646bm92ec6a57861bcb3e@mail.gmail.com \
--to=balrogg@gmail.com \
--cc=dbaryshkov@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).