qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Programmingkid <programmingkidx@gmail.com>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: qemu-devel qemu-devel <qemu-devel@nongnu.org>,
	qemu-ppc <qemu-ppc@nongnu.org>, Gerd Hoffmann <kraxel@redhat.com>,
	Howard Spoelstra <hsp.cat7@gmail.com>
Subject: Re: [PATCH v3] Implement the Screamer sound chip for the mac99 machine type
Date: Sun, 16 Feb 2020 20:16:31 -0500	[thread overview]
Message-ID: <2611424A-CC6C-4C5A-95FE-F005D3ECB147@gmail.com> (raw)
In-Reply-To: <alpine.BSF.2.22.395.2002162243190.98139@zero.eik.bme.hu>


> On Feb 16, 2020, at 4:59 PM, BALATON Zoltan <balaton@eik.bme.hu> wrote:
> 
> On Sun, 16 Feb 2020, Howard Spoelstra wrote:
>> On Sun, Feb 16, 2020 at 5:32 PM John Arbuckle <programmingkidx@gmail.com>
>> wrote:
>>> diff --git a/hw/audio/screamer.c b/hw/audio/screamer.c
>>> new file mode 100644
>>> index 0000000000..ad4aba12eb
>>> --- /dev/null
>>> +++ b/hw/audio/screamer.c
>>> @@ -0,0 +1,983 @@
>>> +/*
>>> + * File: Screamer.c
>>> + * Description: Implement the Screamer sound chip used in Apple
>>> Macintoshes.
>>> + * It works by filling a buffer, then playing the buffer.
>>> + */
> 
> Do you need a copyright and license header here? Especially if this is not all your original work but based on previous code (don't know if it is just saying in case as I know Mark also had some similar patches before but not sure how are those related if at all). If this contains code from somewhere else then license and author of that code may need to be included too.

That is a good question. According to this page https://wiki.qemu.org/License, files that don't have licensing information default under the GNU GPL v2. I'm fine with that.

> 
>>> +/* Called when the CPU writes to the memory addresses assigned to
>>> Screamer */
>>> +static void screamer_mmio_write(void *opaque, hwaddr addr, uint64_t
>>> raw_value,
>>> +                                unsigned size)
>>> +{
>>> +    DPRINTF("screamer_mmio_write() called - size: %d\n", size);
>>> +    ScreamerState *state = opaque;
>>> +    uint32_t value = raw_value & 0xffffffff;
>>> +    addr = addr >> 4;
>>> +
>>> +    switch (addr) {
>>> +    case SOUND_CONTROL_REG:
>>> +        set_sound_control_reg(state, value);
>>> +        break;
>>> +    case CODEC_CONTROL_REG:
>>> +        set_codec_control_reg(state, value);
>>> +        break;
>>> +    case CODEC_STATUS_REG:
>>> +        set_codec_status_reg(state, value);
>>> +        break;
>>> +    case CLIP_COUNT_REG:
>>> +        set_clip_count_reg(state, value);
>>> +        break;
>>> +    case BYTE_SWAP_REG:
>>> +        set_byte_swap_reg(state, value);
>>> +        break;
>>> +    case FRAME_COUNT_REG:
>>> +        set_frame_count_reg(state, value);
>>> +        break;
>>> +    default:
>>> +        DPRINTF("Unknown register write - addr:%llu\tvalue:%d\n", addr,
>>> value);
>>> +    }
>>> +}
>>> 
>>> Hi,
>> 
>> This patch will not compile without errors. Host is Fedora 31.
>> The compiler suggests changing lines 839, 842 and 878 in screamer.c so the
>> DPRINTF arguments use %lu instead of %llu.
>> With that fixed, compiling completes succesfully.
> 
> Replacing with %lu may fix 32bit build but would break 64bit one. Use HWADDR_PRIx format string instead to print hwaddr but others will probably tell to remove DPRINTFs alltogether when they are not needed any more and replace the remaining few useful ones with traces if debugging is still needed. I don't mind DPRINTFs that much at least until things are stable enough but once the code is stable most DPRINTFs may not be needed any more.
> 
> I can't really review the actual patch because I don't know audio in QEMU.
> 
> Regards,
> BALATON Zoltan

Your HWADDR_PRIx suggestion was great. I am making a small patch to test out your suggestion.

Thank you.



  reply	other threads:[~2020-02-17  1:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-16 16:32 [PATCH v3] Implement the Screamer sound chip for the mac99 machine type John Arbuckle
2020-02-16 19:57 ` Howard Spoelstra
2020-02-16 21:59   ` BALATON Zoltan
2020-02-17  1:16     ` Programmingkid [this message]
2020-02-17  1:19   ` Programmingkid
2020-02-17  7:17     ` Howard Spoelstra

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=2611424A-CC6C-4C5A-95FE-F005D3ECB147@gmail.com \
    --to=programmingkidx@gmail.com \
    --cc=balaton@eik.bme.hu \
    --cc=hsp.cat7@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).