diff options
author | Dave Chapman <dave@dchapman.com> | 2007-02-04 11:42:11 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2007-02-04 11:42:11 +0000 |
commit | 31aa4524dad1a55ecf1311ae3c89b03b1e0f43ae (patch) | |
tree | 1af822cbaa7cc219e8fb24e7015a3c187bd554c3 /tools/ipodpatcher/ipodio.h | |
parent | 7c9f4e3a3af5721f75d8a3bff9539dd91e3d2c08 (diff) | |
download | rockbox-31aa4524dad1a55ecf1311ae3c89b03b1e0f43ae.tar.gz rockbox-31aa4524dad1a55ecf1311ae3c89b03b1e0f43ae.zip |
Mainly internal changes to create a struct ipod_t instead of passing lots of parameters to all the functions. Also adds (untested) 3G support, plus a --write-firmware-bin option (requested by IPL people to write a kernel directly to the firmware partition).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12190 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/ipodpatcher/ipodio.h')
-rw-r--r-- | tools/ipodpatcher/ipodio.h | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/tools/ipodpatcher/ipodio.h b/tools/ipodpatcher/ipodio.h index 585ca90e16..ba2b2e9bf9 100644 --- a/tools/ipodpatcher/ipodio.h +++ b/tools/ipodpatcher/ipodio.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef __IPODIO_H | 20 | #ifndef __IPODIO_H |
21 | #define __IPODIO_H | 21 | #define __IPODIO_H |
22 | 22 | ||
23 | #include <stdint.h> | ||
24 | |||
23 | #ifdef __WIN32__ | 25 | #ifdef __WIN32__ |
24 | #include <windows.h> | 26 | #include <windows.h> |
25 | #else | 27 | #else |
@@ -27,13 +29,56 @@ | |||
27 | #define O_BINARY 0 | 29 | #define O_BINARY 0 |
28 | #endif | 30 | #endif |
29 | 31 | ||
32 | /* The maximum number of images in a firmware partition - a guess... */ | ||
33 | #define MAX_IMAGES 10 | ||
34 | |||
35 | enum firmwaretype_t { | ||
36 | FTYPE_OSOS = 0, | ||
37 | FTYPE_RSRC, | ||
38 | FTYPE_AUPD, | ||
39 | FTYPE_HIBE | ||
40 | }; | ||
41 | |||
42 | struct ipod_directory_t { | ||
43 | enum firmwaretype_t ftype; | ||
44 | int id; | ||
45 | uint32_t devOffset; /* Offset of image relative to one sector into bootpart*/ | ||
46 | uint32_t len; | ||
47 | uint32_t addr; | ||
48 | uint32_t entryOffset; | ||
49 | uint32_t chksum; | ||
50 | uint32_t vers; | ||
51 | uint32_t loadAddr; | ||
52 | }; | ||
53 | |||
54 | struct partinfo_t { | ||
55 | unsigned long start; /* first sector (LBA) */ | ||
56 | unsigned long size; /* number of sectors */ | ||
57 | unsigned char type; | ||
58 | }; | ||
59 | |||
60 | struct ipod_t { | ||
61 | HANDLE dh; | ||
62 | char diskname[4096]; | ||
63 | int sector_size; | ||
64 | struct ipod_directory_t ipod_directory[MAX_IMAGES]; | ||
65 | int nimages; | ||
66 | off_t diroffset; | ||
67 | off_t start; /* Offset in bytes of firmware partition from start of disk */ | ||
68 | off_t fwoffset; /* Offset in bytes of start of firmware images from start of disk */ | ||
69 | struct partinfo_t pinfo[4]; | ||
70 | int modelnum; | ||
71 | char* modelname; | ||
72 | char* modelstr; | ||
73 | }; | ||
74 | |||
30 | void print_error(char* msg); | 75 | void print_error(char* msg); |
31 | int ipod_open(HANDLE* dh, char* diskname, int* sector_size, int silent); | 76 | int ipod_open(struct ipod_t* ipod, int silent); |
32 | int ipod_reopen_rw(HANDLE* dh, char* diskname); | 77 | int ipod_reopen_rw(struct ipod_t* ipod); |
33 | int ipod_close(HANDLE dh); | 78 | int ipod_close(struct ipod_t* ipod); |
34 | int ipod_seek(HANDLE dh, unsigned long pos); | 79 | int ipod_seek(struct ipod_t* ipod, unsigned long pos); |
35 | int ipod_read(HANDLE dh, unsigned char* buf, int nbytes); | 80 | int ipod_read(struct ipod_t* ipod, unsigned char* buf, int nbytes); |
36 | int ipod_write(HANDLE dh, unsigned char* buf, int nbytes); | 81 | int ipod_write(struct ipod_t* ipod, unsigned char* buf, int nbytes); |
37 | int ipod_alloc_buffer(unsigned char** sectorbuf, int bufsize); | 82 | int ipod_alloc_buffer(unsigned char** sectorbuf, int bufsize); |
38 | 83 | ||
39 | #endif | 84 | #endif |