From 8f1d3c944b509874be07a1f12387de37adf12626 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 22 Jan 2003 18:47:35 +0000 Subject: Ludovic Lange's patch to make the ROLO feature work on the FM Recorder. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3151 a1c6a512-1295-4272-9138-f99709370657 --- firmware/config-fmrecorder.h | 9 +++++++++ firmware/config-player.h | 9 +++++++++ firmware/config-recorder.h | 9 +++++++++ firmware/rolo.c | 8 ++++---- 4 files changed, 31 insertions(+), 4 deletions(-) (limited to 'firmware') diff --git a/firmware/config-fmrecorder.h b/firmware/config-fmrecorder.h index 584b1d5d54..a760c39907 100644 --- a/firmware/config-fmrecorder.h +++ b/firmware/config-fmrecorder.h @@ -30,3 +30,12 @@ /* Define this if you control power on PBDR (instead of PADR) */ #define HAVE_POWEROFF_ON_PBDR + +/* Offset ( in the firmware file's header ) to the file length */ +#define FIRMWARE_OFFSET_FILE_LENGTH 20 + +/* Offset ( in the firmware file's header ) to the file CRC */ +#define FIRMWARE_OFFSET_FILE_CRC 6 + +/* Offset ( in the firmware file's header ) to the real data */ +#define FIRMWARE_OFFSET_FILE_DATA 24 diff --git a/firmware/config-player.h b/firmware/config-player.h index 8b4efcc7b4..d9a713d368 100644 --- a/firmware/config-player.h +++ b/firmware/config-player.h @@ -22,3 +22,12 @@ /* Define this if you control power on PADR (instead of PBDR) */ #define HAVE_POWEROFF_ON_PADR + +/* Offset ( in the firmware file's header ) to the file length */ +#define FIRMWARE_OFFSET_FILE_LENGTH 0 + +/* Offset ( in the firmware file's header ) to the file CRC */ +#define FIRMWARE_OFFSET_FILE_CRC 4 + +/* Offset ( in the firmware file's header ) to the real data */ +#define FIRMWARE_OFFSET_FILE_DATA 6 diff --git a/firmware/config-recorder.h b/firmware/config-recorder.h index 7f7c5e2683..33e40b7790 100644 --- a/firmware/config-recorder.h +++ b/firmware/config-recorder.h @@ -27,3 +27,12 @@ /* Define this if you control power on PBDR (instead of PADR) */ #define HAVE_POWEROFF_ON_PBDR + +/* Offset ( in the firmware file's header ) to the file length */ +#define FIRMWARE_OFFSET_FILE_LENGTH 0 + +/* Offset ( in the firmware file's header ) to the file CRC */ +#define FIRMWARE_OFFSET_FILE_CRC 4 + +/* Offset ( in the firmware file's header ) to the real data */ +#define FIRMWARE_OFFSET_FILE_DATA 6 diff --git a/firmware/rolo.c b/firmware/rolo.c index 92c8cc4003..f8aad52546 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c @@ -68,8 +68,8 @@ int rolo_load(char* filename) } /* Read file length from header and compare to real file length */ - length=lseek(fd,0,SEEK_END)-6; - lseek(fd, 0, SEEK_SET); + length=lseek(fd,0,SEEK_END)-FIRMWARE_OFFSET_FILE_DATA; + lseek(fd, FIRMWARE_OFFSET_FILE_LENGTH, SEEK_SET); if(read(fd, &file_length, 4) != 4) { rolo_error("Error Reading File Length"); return -1; @@ -80,12 +80,12 @@ int rolo_load(char* filename) } /* Read and save checksum */ - lseek(fd, 4, SEEK_SET); + lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET); if (read(fd, &file_checksum, 2) != 2) { rolo_error("Error Reading checksum"); return -1; } - lseek(fd, 6, SEEK_SET); + lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET); /* verify that file can be read and descrambled */ if ((&mp3buf[0] + (2*length)+4) >= &mp3end) { -- cgit v1.2.3