summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-03-27 08:23:00 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-03-27 08:23:00 +0000
commitee1ab2ee11565d8e02ac1bf0e75400578d60d6c8 (patch)
tree63b7c7f71efc8031fa4a864f51b104341d138a6c /tools
parentea07cd5d7f0d1de6ee512ca247e5531c7eda8fce (diff)
downloadrockbox-ee1ab2ee11565d8e02ac1bf0e75400578d60d6c8.tar.gz
rockbox-ee1ab2ee11565d8e02ac1bf0e75400578d60d6c8.zip
iaudio is not used
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9277 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile4
-rw-r--r--tools/iaudio.c108
2 files changed, 1 insertions, 111 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 60a9a70887..68fcd4b6bc 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -9,7 +9,7 @@
9CFLAGS := -O -ansi -g 9CFLAGS := -O -ansi -g
10LDFLAGS := -g 10LDFLAGS := -g
11 11
12CLEANALL := scramble descramble iriver iaudio sh2d bmp2rb rdf2binary convbdf \ 12CLEANALL := scramble descramble iriver sh2d bmp2rb rdf2binary convbdf \
13 generate_rocklatin mkboot ipod_fw codepages uclpack 13 generate_rocklatin mkboot ipod_fw codepages uclpack
14 14
15all: 15all:
@@ -17,12 +17,10 @@ all:
17 17
18scramble: scramble.o iriver.o 18scramble: scramble.o iriver.o
19descramble: descramble.o iriver.o 19descramble: descramble.o iriver.o
20iaudio: iaudio.o
21 20
22scramble.o: scramble.c iriver.h 21scramble.o: scramble.c iriver.h
23descramble.o: descramble.c iriver.h 22descramble.o: descramble.c iriver.h
24iriver.o: iriver.c iriver.h 23iriver.o: iriver.c iriver.h
25iaudio.o: iaudio.c
26 24
27sh2d: sh2d.c 25sh2d: sh2d.c
28 26
diff --git a/tools/iaudio.c b/tools/iaudio.c
deleted file mode 100644
index 41d718f69b..0000000000
--- a/tools/iaudio.c
+++ /dev/null
@@ -1,108 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Christian Gmeiner
11 *
12 * This particular source code file is licensed under the X11 license. See the
13 * bottom of the COPYING file for details on this license.
14 *
15 ****************************************************************************/
16
17/* This little application updates the checksum of a modifized iAudio x5
18 firmware bin.
19 And this is how it works:
20
21 The byte at offset 0x102b contains the 8-bit sum of all the bytes starting with the one at 0x1030.
22*/
23
24#include <stdio.h>
25#include <stdlib.h>
26#include <string.h>
27
28#define CHECKSUM_BIT 0x102b
29#define CHECKSUM_START 0x1030
30
31void usage(void) {
32
33 printf("usage: iaudio <input file> <output file>\n");
34 printf("\n\nThis tool updates the checksum of an iaudio fw bin\n");
35 exit(1);
36}
37
38int main (int argc, char* argv[]) {
39
40 char byte = '\0';
41 char checksum = '\0';
42 unsigned long length, i;
43 unsigned char* inbuf;
44 char* iname = argv[1];
45 char* oname = argv[2];
46 FILE* pFile;
47
48 if (argc < 2) {
49 usage();
50 }
51
52 /* open file */
53 pFile = fopen(iname, "rb");
54 if (!pFile) {
55 perror(oname);
56 return -1;
57 }
58
59 /* print old checksum */
60 fseek (pFile, CHECKSUM_BIT, SEEK_SET);
61 byte = fgetc(pFile);
62 printf("Old checksum: 0x%02x\n", byte & 0xff);
63
64 /* get file size*/
65 fseek(pFile,0,SEEK_END);
66 length = ftell(pFile);
67 fseek(pFile,0,SEEK_SET);
68
69 /* try to allocate memory */
70 inbuf = malloc(length);
71 if (!inbuf) {
72 printf("out of memory!\n");
73 return -1;
74 }
75
76 /* read file */
77 i = fread(inbuf, 1, length, pFile);
78 if (!i) {
79 perror(iname);
80 return -1;
81 }
82 fclose(pFile);
83
84 /* calculate new checksum */
85 for (i = CHECKSUM_START; i < length; i++) {
86 checksum += inbuf[i];
87 }
88 printf("New checksum: 0x%02x\n", checksum & 0xff);
89
90 /* save new checksum */
91 inbuf[CHECKSUM_BIT] = (unsigned char) checksum;
92
93 /* save inbuf */
94 pFile = fopen(oname,"wb");
95 if (!pFile) {
96 perror(oname);
97 return -1;
98 }
99
100 i = fwrite(inbuf, 1, length, pFile);
101 if (!i) {
102 perror(oname);
103 return -1;
104 }
105 fclose(pFile);
106
107 return 0;
108}