From fd33d30eaf1d0c4f84d835172c845e7c4b15033e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 1 Jan 2008 09:09:43 -0200 Subject: Avoid needing to run perl script on machines with 64-bit int From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/xc3028-firmware/extract_head.h | 21 +++++++++++---------- v4l2-apps/util/xc3028-firmware/firmware-tool.c | 15 +++++++++++---- 2 files changed, 22 insertions(+), 14 deletions(-) (limited to 'v4l2-apps/util') diff --git a/v4l2-apps/util/xc3028-firmware/extract_head.h b/v4l2-apps/util/xc3028-firmware/extract_head.h index 0bc0d19f9..373ac78ba 100644 --- a/v4l2-apps/util/xc3028-firmware/extract_head.h +++ b/v4l2-apps/util/xc3028-firmware/extract_head.h @@ -60,17 +60,18 @@ char *extract_header = "#!/usr/bin/perl\n" " syswrite(OUTFILE, chr($l0).chr($l1).chr($l2).chr($l3));\n" "}\n" "\n" - "sub write_le64($)\n" + "sub write_le64($$)\n" "{\n" - " my $val = shift;\n" - " my $l7 = ($val >> 56) & 0xff;\n" - " my $l6 = ($val >> 48) & 0xff;\n" - " my $l5 = ($val >> 40) & 0xff;\n" - " my $l4 = ($val >> 32) & 0xff;\n" - " my $l3 = ($val >> 24) & 0xff;\n" - " my $l2 = ($val >> 16) & 0xff;\n" - " my $l1 = ($val >> 8) & 0xff;\n" - " my $l0 = $val & 0xff;\n" + " my $msb_val = shift;\n" + " my $lsb_val = shift;\n" + " my $l7 = ($msb_val >> 24) & 0xff;\n" + " my $l6 = ($msb_val >> 16) & 0xff;\n" + " my $l5 = ($msb_val >> 8) & 0xff;\n" + " my $l4 = $msb_val & 0xff;\n\n" + " my $l3 = ($lsb_val >> 24) & 0xff;\n" + " my $l2 = ($lsb_val >> 16) & 0xff;\n" + " my $l1 = ($lsb_val >> 8) & 0xff;\n" + " my $l0 = $lsb_val & 0xff;\n" "\n" " syswrite(OUTFILE,\n" " chr($l0).chr($l1).chr($l2).chr($l3).\n" diff --git a/v4l2-apps/util/xc3028-firmware/firmware-tool.c b/v4l2-apps/util/xc3028-firmware/firmware-tool.c index b48495aa4..28ae70bb2 100644 --- a/v4l2-apps/util/xc3028-firmware/firmware-tool.c +++ b/v4l2-apps/util/xc3028-firmware/firmware-tool.c @@ -3,6 +3,10 @@ Copyright (C) 2007 Michel Ludwig + Copyright (C) 2007, 2008 Mauro Carvalho Chehab + - Improve --list command + - Add --seek command + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 @@ -799,12 +803,15 @@ void seek_firmware(struct firmware *f, char *seek_file, char *write_file) { list_firmware_desc(fp, &f->desc[i]); fprintf(fp, "\t#\n\n"); - fprintf(fp, "\twrite_le32(%d);\n", f->desc[i].type); - fprintf(fp, "\twrite_le64(%Ld);\n", f->desc[i].id); + fprintf(fp, "\twrite_le32(0x%08x);\t\t\t# Type\n", + f->desc[i].type); + fprintf(fp, "\twrite_le64(0x%08Lx, 0x%08Lx);\t# ID\n", + f->desc[i].id>>32, f->desc[i].id & 0xffffffff); if (f->desc[i].type & HAS_IF) - fprintf(fp, "\twrite_le16(%d);\n", + fprintf(fp, "\twrite_le16(%d);\t\t\t# IF\n", f->desc[i].int_freq); - fprintf(fp, "\twrite_le32(%d);\n", f->desc[i].size); + fprintf(fp, "\twrite_le32(%d);\t\t\t# Size\n", + f->desc[i].size); while (hunk) { if (hunk->data) { -- cgit v1.2.3