Jz4740 Tools:

* update Makefile
 * add README
 * update svn properties
 * fix small mistakes


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17926 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Maurus Cuelenaere 2008-07-03 12:17:56 +00:00
parent ab498e547b
commit 6fd40a57b8
7 changed files with 138 additions and 17 deletions

42
utils/jz4740_tools/HXFmerge.c Executable file → Normal file
View file

@ -1,6 +1,23 @@
/*
Made by Maurus Cuelenaere
*/
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2008 by Maurus Cuelenaere
*
* 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; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
@ -42,8 +59,8 @@ static unsigned int le2int(unsigned char* buf)
#define MIN(a, b) (a > b ? b : a)
static char* replace(char* str)
{
char tmp[255];
memcpy(tmp, str, MIN(strlen(str), 255);
static char tmp[255];
memcpy(tmp, str, MIN(strlen(str), 255));
char *ptr = tmp;
while(*ptr != 0)
{
@ -156,19 +173,32 @@ static void merge_hxf(const char* indir, FILE* outfile, const char* add)
if(strlen(add)>0)
{
#ifdef _DIRENT_HAVE_D_NAMLEN
WRITE(int2le(dirs->d_namlen+strlen(add)), 4);
#else
WRITE(int2le(strlen(dirs->d_name)+strlen(add)), 4);
#endif
#ifndef _WIN32
WRITE(replace(add), strlen(add)-1);
WRITE(replace(&add), strlen(add)-1);
#else
WRITE(add, strlen(add)-1);
#endif
WRITE(PATH_SEPARATOR, 1);
#ifdef _DIRENT_HAVE_D_NAMLEN
WRITE(dirs->d_name, dirs->d_namlen);
#else
WRITE(dirs->d_name, strlen(dirs->d_name));
#endif
}
else
{
#ifdef _DIRENT_HAVE_D_NAMLEN
WRITE(int2le(dirs->d_namlen), 4);
WRITE(dirs->d_name, dirs->d_namlen);
#else
WRITE(int2le(strlen(dirs->d_name)), 4);
WRITE(dirs->d_name, strlen(dirs->d_name));
#endif
}
WRITE(int2le(filesize), 4);
if(filesize>0)

23
utils/jz4740_tools/HXFreplace.c Executable file → Normal file
View file

@ -1,6 +1,23 @@
/*
Made by Maurus Cuelenaere
*/
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2008 by Maurus Cuelenaere
*
* 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; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>

25
utils/jz4740_tools/HXFsplit.c Executable file → Normal file
View file

@ -1,6 +1,23 @@
/*
Made by Maurus Cuelenaere
*/
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2008 by Maurus Cuelenaere
*
* 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; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
@ -43,7 +60,7 @@ static char* basepath(char* path)
#else
*ptr2 = 0x2F;
#endif
*ptr2++;
ptr2++;
*ptr2 = 0;
return (char*)tmp;
}

27
utils/jz4740_tools/Makefile Executable file → Normal file
View file

@ -1,9 +1,30 @@
WIN_DRIVERS_LIBUSB_DIR = D:\Program Files\LibUSB-Win32
WIN_DRIVERS_LIBUSB_DIR = C:\Program Files\LibUSB-Win32
WIN_LIBUSB_INCLUDE_DIR = "$(WIN_DRIVERS_LIBUSB_DIR)\include"
WIN_LIBUSB_LIB_DIR = "$(WIN_DRIVERS_LIBUSB_DIR)\lib\gcc"
linux: usbtool HXFmerge HXFreplace HXFsplit
win: usbtool_win HXFmerge_win HXFsplit_win HXFreplace_win
usbtool:
gcc -Wall -o usbtool jz4740_usbtool.c -lusb
usbtool_win:
gcc -Wall -o usbtool.exe jz4740_usbtool.c -lusb -I $(WIN_LIBUSB_INCLUDE_DIR) -L $(WIN_LIBUSB_LIB_DIR)
usbtoolwin:
gcc -Wall -o usbtool.exe jz4740_usbtool.c -lusb -I $(WIN_LIBUSB_INCLUDE_DIR) -L $(WIN_LIBUSB_LIB_DIR)
HXFmerge:
gcc -Wall -o HXFmerge HXFmerge.c
HXFreplace:
gcc -Wall -o HXFreplace HXFreplace.c
HXFsplit:
gcc -Wall -o HXFsplit HXFsplit.c
HXFmerge_win:
gcc -Wall -o HXFmerge.exe HXFmerge.c
HXFreplace_win:
gcc -Wall -o HXFreplace.exe HXFreplace.c
HXFsplit_win:
gcc -Wall -o HXFsplit.exe HXFsplit.c
clean-linux:
rm HXFmerge HXFreplace HXFsplit usbtool
clean-win:
del HXFmerge.exe HXFreplace.exe HXFsplit.exe usbtool.exe

36
utils/jz4740_tools/README Normal file
View file

@ -0,0 +1,36 @@
*******************************************************************************
Jz4740 USB tools
Made by Maurus Cuelenaere for Rockbox
Copyright (C) 2008
*******************************************************************************
When you're on Linux, just type "make linux" to compile all the utilities (make
sure you have libusb-dev installed).
For cleaning: "make clean-linux"
When you're on Windows, install MingW32 and LibUSB-Win32 and edit "Makefile" to
make sure "WIN_DRIVERS_LIBUSB_DIR" is set correctly.
For cleaning: "make clean-win"
That's all!
***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* 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; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************

0
utils/jz4740_tools/jz4740.h Executable file → Normal file
View file

2
utils/jz4740_tools/jz4740_usbtool.c Executable file → Normal file
View file

@ -199,7 +199,7 @@ int upload_app(usb_dev_handle* dh, int address, unsigned char* p, int len, bool
free(tmp_buf);
fprintf(stderr, "[INFO] Booting device [STAGE%d]...", (stage2 ? 2 : 1));
SEND_COMMAND((stage2 ? VR_PROGRAM_START2 : VR_PROGRAM_START1), (address+(stage2 ? 8 : 0)) );
SEND_COMMAND((stage2 ? VR_PROGRAM_START2 : VR_PROGRAM_START1), address );
fprintf(stderr, " Done!\n");
return 0;