1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006-2007 Dave Chapman
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
35 /* The maximum number of images in a firmware partition - a guess... */
45 struct ipod_directory_t
{
46 enum firmwaretype_t ftype
;
48 uint32_t devOffset
; /* Offset of image relative to one sector into bootpart*/
57 /* A fake partition type - DOS partition tables can't include HFS partitions */
58 #define PARTTYPE_HFS 0xffff
61 uint32_t start
; /* first sector (LBA) */
62 uint32_t size
; /* number of sectors */
70 int sectors_per_track
;
72 struct ipod_directory_t ipod_directory
[MAX_IMAGES
];
75 off_t start
; /* Offset in bytes of firmware partition from start of disk */
76 off_t fwoffset
; /* Offset in bytes of start of firmware images from start of disk */
77 struct partinfo_t pinfo
[4];
83 char* xmlinfo
; /* The XML Device Information (if available) */
85 int ramsize
; /* The amount of RAM in the ipod (if available) */
87 unsigned char* bootloader
;
92 void print_error(char* msg
);
93 int ipod_open(struct ipod_t
* ipod
, int silent
);
94 int ipod_reopen_rw(struct ipod_t
* ipod
);
95 int ipod_close(struct ipod_t
* ipod
);
96 int ipod_seek(struct ipod_t
* ipod
, unsigned long pos
);
97 int ipod_scsi_inquiry(struct ipod_t
* ipod
, int page_code
,
98 unsigned char* buf
, int bufsize
);
99 ssize_t
ipod_read(struct ipod_t
* ipod
, unsigned char* buf
, int nbytes
);
100 ssize_t
ipod_write(struct ipod_t
* ipod
, unsigned char* buf
, int nbytes
);
101 int ipod_alloc_buffer(unsigned char** sectorbuf
, int bufsize
);
103 /* In fat32format.c */
104 int format_partition(struct ipod_t
* ipod
, int partition
);