By Date: <-- -->
By Thread: <-- -->

[PATCH] USB: add zr364xx V4L2 driver



On 2/15/07, Trent Piepho <xyzzy (at) speakeasy.org> wrote:
On Wed, 14 Feb 2007, Alan wrote:
> > > My comment is not very good, in fact on some cameras I need to swap the bytes
> > > to have correct JPEG data (so this is not an endianness issue I think).
> > > Maybe there is a macro to swap bytes in a buffer? I cannot find it.
> >
> > Sorry, there's a swab32, but no swab16. I misremembered.
>
> Its just called "swab" for 16bit values and is a gcc builtin/string
> function.

The C library function swab() isn't usable in the kernel, as it's not part
of the kernel's C lib.

Gcc doesn't have a builtin swab/bswap16 yet, maybe it will someday:
http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00496.html

The kernel does have swab64, swab32, and yes, swab16 macros!  They're all
defined in the same place in asm/byteorder.h.  There are architecture
optimized versions for some cases, but not for x86 and swab16 as gcc
supposedly does ok (or does it? *).

There are three versions of the swabXX functions, a normal one, one that
takes a pointer to the data, and one that swaps the data in-place.  The
more specialized versions might be faster in some cases.  I don't see any
version of that swaps an array of data, like C-lib swab(), which be a lot
more useful that swab16 vs swab16p vs swab16s, IMHO.


Additionally we have some bswap* functions in dvb-apps, if it helps in some way

http://linuxtv.org/hg/dvb-apps?f=15989fca7c14;file=lib/libucsi/endianops.h;style=gitweb


Manu

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request (at) redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list