summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2008-08-30 13:09:31 -0500
committerMike Isely <isely@pobox.com>2008-08-30 13:09:31 -0500
commit1072381235b9397551ff19c608a25b47ef5c7994 (patch)
treed01189f98d2824d669509e02e755608bde693c59
parentfe9b8beb1f13deceb3f0b1f38e1704ee33e31a91 (diff)
downloadmediapointer-dvb-s2-1072381235b9397551ff19c608a25b47ef5c7994.tar.gz
mediapointer-dvb-s2-1072381235b9397551ff19c608a25b47ef5c7994.tar.bz2
pvrusb2: Add comment elaborating on direct use of swab32()
From: Mike Isely <isely@pobox.com> Priority: normal Signed-off-by: Mike Isely <isely@pobox.com>
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 881610b60..70ed24e9a 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -1323,6 +1323,17 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw)
if (bcnt > FIRMWARE_CHUNK_SIZE) bcnt = FIRMWARE_CHUNK_SIZE;
memcpy(fw_ptr, fw_entry->data + fw_done, bcnt);
/* Usbsnoop log shows that we must swap bytes... */
+ /* Some background info: The data being swapped here is a
+ firmware image destined for the mpeg encoder chip that
+ lives at the other end of a USB endpoint. The encoder
+ chip always talks in 32 bit chunks and its storage is
+ organized into 32 bit words. However from the file
+ system to the encoder chip everything is purely a byte
+ stream. The firmware file's contents are always 32 bit
+ swapped from what the encoder expects. Thus the need
+ always exists to swap the bytes regardless of the endian
+ type of the host processor and therefore swab32() makes
+ the most sense. */
for (icnt = 0; icnt < bcnt/4 ; icnt++)
((u32 *)fw_ptr)[icnt] = swab32(((u32 *)fw_ptr)[icnt]);