Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Davis <pbd@op.net>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Re: hdsp on big-endian
Date: Wed, 22 May 2002 08:25:23 -0400	[thread overview]
Message-ID: <200205221223.g4MCNPj25743@post2.fast.net> (raw)
In-Reply-To: Your message of "Wed, 22 May 2002 13:21:40 +0200." <s5hu1p0fmwr.wl@alsa2.suse.de>

>anyway...  after looking at the hdsp code again, i found that these
>endian conversions are not necessary at all!
>IIRC, readX/writeX already convert the endianess in itself.  thus, the

absolutely not. readl/writel on most architectures translate to:

	   *addr = val;

>driver doesn't have to do anything in the access functions.
>(i'm not 100% sure about this - please correct me if it's wrong.) 

you're wrong, at least partly :)

the problem is that the HDSP's registers are all little endian. only
audio data is byteswapped by the hardware (if requested). so a BE
system that wants to write 0xfeedface to the HDSP needs to byteswap it
before writing it. Consider:

    LE: wants to write 0xfeedface, memory pattern: [fe][ed][fa][ce]
	      delivers 0xfeedface when using writel
    BE: wants to write 0xfeedface, memory pattern: [ce][fa][ed][fe]
	      thus must swap the bytes before writing them

>of course, if the data is stored in bytes as above, then the bytes
>must be swapped explicitly.  instead, we can use simply u32 arrays
>for the firmware data itself, so that the values can be passed without
>conversion.

right, and therein lies my confusion. Here's what I thought:

PPC (BE) system:
    
    data stored in char array
    not swapped when written to hardware

    => data in char array is laid out for a BE system.

I think I know see the mistake. The point is that the data is in a
char array and therefore is already correctly ordered for any-endian
system. the only thing that would go wrong is if you checked the 32
bit value of any part of the firmware on a BE system: you'd see the
wrong value. But its laid out in the char array the same way it is in
the HDSP memory, and thus it doesn't need swapping on any
architecture, just delivered as-is.

--p




_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

  reply	other threads:[~2002-05-22 12:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-21 17:04 hdsp on big-endian Takashi Iwai
2002-05-21 17:22 ` Paul Davis
2002-05-22 11:21   ` Takashi Iwai
2002-05-22 12:25     ` Paul Davis [this message]
2002-05-22 12:56       ` Takashi Iwai
2002-05-22 13:29         ` Paul Davis
     [not found]         ` <20020522132801.E18131E7CC@Cantor.suse.de>
2002-05-22 13:47           ` Takashi Iwai
2002-05-22 13:56             ` Paul Davis
2002-05-23  9:58               ` Takashi Iwai
2002-05-23 14:20                 ` Paul Davis
2002-05-24 16:34                   ` Takashi Iwai

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=200205221223.g4MCNPj25743@post2.fast.net \
    --to=pbd@op.net \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=tiwai@suse.de \
    /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