diff options
author | Mike Isely <isely@pobox.com> | 2008-08-30 14:09:31 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:57 -0400 |
commit | 5f33df1443cd53283279d017b45ed1b1bc66f622 (patch) | |
tree | 49a4fc26ff01fd0a9e5834a07f043c52fbad153c | |
parent | 83512e207479d0bdb83ee1e000a306af9e6e870e (diff) |
V4L/DVB (8893): pvrusb2: Add comment elaborating on direct use of swab32()
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 7fa903ad26bb..c8dedbab6e39 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -1313,6 +1313,17 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) | |||
1313 | if (bcnt > FIRMWARE_CHUNK_SIZE) bcnt = FIRMWARE_CHUNK_SIZE; | 1313 | if (bcnt > FIRMWARE_CHUNK_SIZE) bcnt = FIRMWARE_CHUNK_SIZE; |
1314 | memcpy(fw_ptr, fw_entry->data + fw_done, bcnt); | 1314 | memcpy(fw_ptr, fw_entry->data + fw_done, bcnt); |
1315 | /* Usbsnoop log shows that we must swap bytes... */ | 1315 | /* Usbsnoop log shows that we must swap bytes... */ |
1316 | /* Some background info: The data being swapped here is a | ||
1317 | firmware image destined for the mpeg encoder chip that | ||
1318 | lives at the other end of a USB endpoint. The encoder | ||
1319 | chip always talks in 32 bit chunks and its storage is | ||
1320 | organized into 32 bit words. However from the file | ||
1321 | system to the encoder chip everything is purely a byte | ||
1322 | stream. The firmware file's contents are always 32 bit | ||
1323 | swapped from what the encoder expects. Thus the need | ||
1324 | always exists to swap the bytes regardless of the endian | ||
1325 | type of the host processor and therefore swab32() makes | ||
1326 | the most sense. */ | ||
1316 | for (icnt = 0; icnt < bcnt/4 ; icnt++) | 1327 | for (icnt = 0; icnt < bcnt/4 ; icnt++) |
1317 | ((u32 *)fw_ptr)[icnt] = swab32(((u32 *)fw_ptr)[icnt]); | 1328 | ((u32 *)fw_ptr)[icnt] = swab32(((u32 *)fw_ptr)[icnt]); |
1318 | 1329 | ||