qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Geert Martin Ijewski <gm.ijewski@web.de>
To: John Bradley <flypie1@yahoo.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: John Bradley <flypie@rocketmail.com>,
	Laurent Vivier <lvivier@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>,
	Alistair Francis <alistair.francis@xilinx.com>
Subject: Re: [Qemu-devel] Changes to Broadcom(BCM) files and Raspberry Pi files. Addition of PanelEmu
Date: Tue, 16 May 2017 10:55:16 +0200	[thread overview]
Message-ID: <79d5c7a2-c5be-a4b3-3cc3-85c3e572d062@web.de> (raw)
In-Reply-To: <757990479.60759.1494722527715@mail.yahoo.com>

Am 14.05.2017 um 02:42 schrieb John Bradley via Qemu-devel:
>>From 7f74f048f135d9c9c230a9e90f72451c841c6d35 Mon Sep 17 00:00:00 2001
> From: John Bradley <flypie@rocketmail.com>
> Date: Sat, 13 May 2017 23:07:47 +0100
> Subject: [PATCH] Changes to Broadcom(BCM) files and Raspberry Pi files.
> Addition of PanelEmu
>
> The files add the ability to attach, via TCP, a panel emulator
> The include a unification of several PD Raspberry PI additions
> A modification to dev-network to all circle SDK WWW client to work
> The DummyPanel is not included but available at
> https://github.com/flypie/GDummyPanel.git
>
> Signed-off-by: John Bradley <flypie@rocketmail.com>
> ---
> [ ... snip ... ]
> diff --git a/util/PanelEmu.c b/util/PanelEmu.c
> new file mode 100644
> index 0000000000..59c87d2747
> --- /dev/null
> +++ b/util/PanelEmu.c
> @@ -0,0 +1,293 @@
> +/*
> + * Emulation for Rasp PI GPIO via Server connected to via Socket
> + *
> + */
> +#include "qemu/osdep.h"
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <memory.h>
> +#include <errno.h>
> +#include <string.h>
> +#include <sys/types.h>
> +#ifdef __MINGW32__
I think that should be #ifdef _WIN32.
Maybe in the far future QEMU could also be compiled with Visual Studio 
or any other windows compiler
> +#include <winsock2.h>
> +#else
> +#include <sys/socket.h>
> +#include <arpa/inet.h>
> +#include <netinet/in.h>
> +#endif
> +
> +
> +#include "qemu/PanelEmu.h"
> +
> +typedef enum
> +{
> +    MACHINEDESC = 0,
> +    PINSTOPANEL = 1,
> +    READREQ = 2,
> +    PINCOUNT = 3,
> +    ENABLEMAP = 4,
> +    INPUTMAP = 5,
> +    OUTPUTMAP = 6,
> +    PINSTOQEMU = 7
> +} PacketType;
> +
> +#define MAXPACKET   255
> +
> +#define PACKETLEN   0  //Includes Packet Length
> +#define PACKETTYPE  1
> +
> +typedef struct
> +{
> +    unsigned short int Data[MAXPACKET];
> +} CommandPacket;

Why not something like
typedef struct
{
     uint8_t len;
     uint8_t type;
     union {
         struct {
             uint8_t cnt;
         } pinCount;
         struct {
             uint16_t pin0to15;
             uint16_t pin16to31;
             uint16_t pin32to47;
             uint16_t pin48to63;
         } dataUpdate;
         /* todo: other packet types */
     };
} CommandPacket;
> [ ... snip ... ]
> +/* Set a pin to a specified value */
> +void senddatatopanel(panel_connection_t* h, uint64_t pin, bool val)
> +{
> +    CommandPacket Pkt;
> +
> +    Pkt.Data[PACKETLEN] = (char *) &Pkt.Data[6 + 1]-(char *) &Pkt.Data[0];
what's the use of this pointer aritmethic instead of just 6?

Geert

  parent reply	other threads:[~2017-05-16  8:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <757990479.60759.1494722527715.ref@mail.yahoo.com>
2017-05-14  0:42 ` [Qemu-devel] Changes to Broadcom(BCM) files and Raspberry Pi files. Addition of PanelEmu John Bradley
2017-05-15 16:46   ` Alistair Francis
2017-05-15 17:50     ` John Bradley
2017-05-15 23:20       ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-05-16  0:01         ` John Bradley
2017-05-16  8:55           ` Geert Martin Ijewski
2017-05-16 13:53             ` John Bradley
2017-05-16  8:55   ` Geert Martin Ijewski [this message]
2017-05-16 13:51     ` [Qemu-devel] " John Bradley

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=79d5c7a2-c5be-a4b3-3cc3-85c3e572d062@web.de \
    --to=gm.ijewski@web.de \
    --cc=alistair.francis@xilinx.com \
    --cc=armbru@redhat.com \
    --cc=flypie1@yahoo.com \
    --cc=flypie@rocketmail.com \
    --cc=lvivier@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --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).