mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-23 04:42:27 +02:00
cosmetic fixes
This commit is contained in:
parent
cd27326c16
commit
820eb1b922
@ -87,25 +87,28 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* after upload stage2. must init device */
|
/* after upload stage2. must init device */
|
||||||
int init_cfg()
|
void init_cfg()
|
||||||
{
|
{
|
||||||
if (usb_get_ingenic_cpu(&ingenic_dev) < 3) {
|
if (usb_get_ingenic_cpu(&ingenic_dev) < 3) {
|
||||||
printf("\n Device unboot! Boot it first!");
|
printf("\n XBurst CPU not booted yet, boot it first!\n");
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ingenic_dev.file_buff = &hand;
|
ingenic_dev.file_buff = &hand;
|
||||||
ingenic_dev.file_len = sizeof(hand);
|
ingenic_dev.file_len = sizeof(hand);
|
||||||
if (usb_send_data_to_ingenic(&ingenic_dev) != 1)
|
if (usb_send_data_to_ingenic(&ingenic_dev) != 1)
|
||||||
return -1;
|
goto xout;
|
||||||
|
|
||||||
if (usb_ingenic_configration(&ingenic_dev, DS_hand) != 1)
|
if (usb_ingenic_configration(&ingenic_dev, DS_hand) != 1)
|
||||||
return -1;
|
goto xout;
|
||||||
|
|
||||||
if (usb_read_data_from_ingenic(&ingenic_dev, ret, 8) != 1)
|
if (usb_read_data_from_ingenic(&ingenic_dev, ret, 8) != 1)
|
||||||
return -1;
|
goto xout;
|
||||||
|
|
||||||
return 1;
|
printf("Configuring XBurst CPU succeeded.\n");
|
||||||
|
return;
|
||||||
|
xout:
|
||||||
|
printf("Configuring XBurst CPU failed.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int boot(char *stage1_path, char *stage2_path){
|
int boot(char *stage1_path, char *stage2_path){
|
||||||
@ -134,37 +137,32 @@ int boot(char *stage1_path, char *stage2_path){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
printf("Booted");
|
printf("Already booted.");
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
printf("Unboot");
|
printf("CPU not yet booted, now booting...\n");
|
||||||
printf("\n Now booting device");
|
|
||||||
|
|
||||||
/* now we upload the usb boot stage1 */
|
/* now we upload the boot stage1 */
|
||||||
printf("\n Upload usb boot stage1");
|
printf(" Loading stage1 from '%s'\n", stage1_path);
|
||||||
if (load_file(&ingenic_dev, stage1_path) < 1)
|
if (load_file(&ingenic_dev, stage1_path) < 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (usb_ingenic_upload(&ingenic_dev, 1) < 1)
|
if (usb_ingenic_upload(&ingenic_dev, 1) < 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* now we upload the usb boot stage2 */
|
/* now we upload the boot stage2 */
|
||||||
sleep(1);
|
sleep(1);
|
||||||
printf("\n Upload usb boot stage2");
|
printf(" Loading stage2 from '%s'\n", stage2_path);
|
||||||
if (load_file(&ingenic_dev, stage2_path) < 1)
|
if (load_file(&ingenic_dev, stage2_path) < 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (usb_ingenic_upload(&ingenic_dev, 2) < 1)
|
if (usb_ingenic_upload(&ingenic_dev, 2) < 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
printf("\n Boot success!");
|
printf("Booted successfully!\n");
|
||||||
}
|
}
|
||||||
sleep(1);
|
sleep(1);
|
||||||
printf("\n Now configure Ingenic device");
|
init_cfg();
|
||||||
(init_cfg() == 1)
|
|
||||||
? printf("\n Configure success!")
|
|
||||||
: printf("\n Configure fail!");
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ int hand_init_def(struct hand *hand)
|
|||||||
|
|
||||||
int check_dump_cfg(struct hand *hand)
|
int check_dump_cfg(struct hand *hand)
|
||||||
{
|
{
|
||||||
printf("\n Now checking whether all configure args valid: ");
|
printf("Now checking whether all configure args valid:");
|
||||||
/* check PLL */
|
/* check PLL */
|
||||||
if (hand->fw_args.ext_clk > 27 || hand->fw_args.ext_clk < 12) {
|
if (hand->fw_args.ext_clk > 27 || hand->fw_args.ext_clk < 12) {
|
||||||
printf("\n EXTCLK setting invalid!");
|
printf("\n EXTCLK setting invalid!");
|
||||||
@ -104,8 +104,9 @@ int check_dump_cfg(struct hand *hand)
|
|||||||
printf("\n PAGESIZE or PAGEPERBLOCK setting invalid!");
|
printf("\n PAGESIZE or PAGEPERBLOCK setting invalid!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
printf(" YES\n");
|
||||||
|
|
||||||
printf("\n Current device information:");
|
printf("Current device information:\n");
|
||||||
printf(" CPU is Jz%x",hand->fw_args.cpu_id);
|
printf(" CPU is Jz%x",hand->fw_args.cpu_id);
|
||||||
printf("\n Crystal work at %dMHz, the CCLK up to %dMHz and PMH_CLK up to %dMHz",
|
printf("\n Crystal work at %dMHz, the CCLK up to %dMHz and PMH_CLK up to %dMHz",
|
||||||
hand->fw_args.ext_clk,
|
hand->fw_args.ext_clk,
|
||||||
@ -124,7 +125,6 @@ int check_dump_cfg(struct hand *hand)
|
|||||||
hand->nand_eccpos,
|
hand->nand_eccpos,
|
||||||
hand->nand_bbpage,
|
hand->nand_bbpage,
|
||||||
hand->nand_plane);
|
hand->nand_plane);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,31 +96,31 @@ int usb_ingenic_init(struct ingenic_dev *ingenic_dev)
|
|||||||
num_ingenic = get_ingenic_device(ingenic_dev);
|
num_ingenic = get_ingenic_device(ingenic_dev);
|
||||||
|
|
||||||
if (num_ingenic == 0) {
|
if (num_ingenic == 0) {
|
||||||
fprintf(stderr, "Error - no Ingenic device found\n");
|
fprintf(stderr, "Error - no XBurst device found\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_ingenic > 1) {
|
if (num_ingenic > 1) {
|
||||||
fprintf(stderr, "Error - too many Ingenic devices found: %i\n",
|
fprintf(stderr, "Error - too many XBurst devices found: %i\n",
|
||||||
num_ingenic);
|
num_ingenic);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ingenic_dev->usb_handle = usb_open(ingenic_dev->usb_dev);
|
ingenic_dev->usb_handle = usb_open(ingenic_dev->usb_dev);
|
||||||
if (!ingenic_dev->usb_handle) {
|
if (!ingenic_dev->usb_handle) {
|
||||||
fprintf(stderr, "Error - can't open Ingenic device: %s\n",
|
fprintf(stderr, "Error - can't open XBurst device: %s\n",
|
||||||
usb_strerror());
|
usb_strerror());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_ingenic_interface(ingenic_dev) < 1) {
|
if (get_ingenic_interface(ingenic_dev) < 1) {
|
||||||
fprintf(stderr, "Error - can't find Ingenic interface\n");
|
fprintf(stderr, "Error - can't find XBurst interface\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usb_claim_interface(ingenic_dev->usb_handle, ingenic_dev->interface)
|
if (usb_claim_interface(ingenic_dev->usb_handle, ingenic_dev->interface)
|
||||||
< 0) {
|
< 0) {
|
||||||
fprintf(stderr, "Error - can't claim Ingenic interface: %s\n",
|
fprintf(stderr, "Error - can't claim XBurst interface: %s\n",
|
||||||
usb_strerror());
|
usb_strerror());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -150,12 +150,12 @@ int usb_get_ingenic_cpu(struct ingenic_dev *ingenic_dev)
|
|||||||
|
|
||||||
if (status != sizeof(ingenic_dev->cpu_info_buff) - 1 ) {
|
if (status != sizeof(ingenic_dev->cpu_info_buff) - 1 ) {
|
||||||
fprintf(stderr, "Error - "
|
fprintf(stderr, "Error - "
|
||||||
"can't retrieve Ingenic CPU information: %i\n", status);
|
"can't retrieve XBurst CPU information: %i\n", status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ingenic_dev->cpu_info_buff[8] = '\0';
|
ingenic_dev->cpu_info_buff[8] = '\0';
|
||||||
printf("\n CPU data: "
|
printf(" CPU data: "
|
||||||
"%02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x : %s\n",
|
"%02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x : %s\n",
|
||||||
ingenic_dev->cpu_info_buff[0], ingenic_dev->cpu_info_buff[1],
|
ingenic_dev->cpu_info_buff[0], ingenic_dev->cpu_info_buff[1],
|
||||||
ingenic_dev->cpu_info_buff[2], ingenic_dev->cpu_info_buff[3],
|
ingenic_dev->cpu_info_buff[2], ingenic_dev->cpu_info_buff[3],
|
||||||
@ -283,7 +283,7 @@ int usb_ingenic_upload(struct ingenic_dev *ingenic_dev, int stage)
|
|||||||
int stage_addr = (stage == 1 ? 0x80002000 : stage2_addr);
|
int stage_addr = (stage == 1 ? 0x80002000 : stage2_addr);
|
||||||
|
|
||||||
usb_send_data_address_to_ingenic(ingenic_dev, stage_addr);
|
usb_send_data_address_to_ingenic(ingenic_dev, stage_addr);
|
||||||
printf("\n Download stage %d program and execute at 0x%08x ",
|
printf(" Download stage %d program and execute at 0x%08x\n",
|
||||||
stage, (stage_addr));
|
stage, (stage_addr));
|
||||||
usb_send_data_to_ingenic(ingenic_dev);
|
usb_send_data_to_ingenic(ingenic_dev);
|
||||||
|
|
||||||
|
@ -44,14 +44,14 @@ static struct option opts[] = {
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
printf(" inflash - (C) 2009"
|
|
||||||
"\n Ingenic Tools Software!"
|
|
||||||
"\n This program is Free Software and has ABSOLUTELY NO WARRANTY\n");
|
|
||||||
|
|
||||||
int command = 0;
|
int command = 0;
|
||||||
char *cptr;
|
char *cptr;
|
||||||
char com_buf[256];
|
char com_buf[256] = {0};
|
||||||
memset(com_buf, 0, 256);
|
|
||||||
|
printf("\n inflash - Ingenic XBurst USB Boot Utility"
|
||||||
|
"\n (c) 2009 Ingenic Semiconductor Inc., Xiangfu Liu, Marek Lindner, Wolfgang Spraul"
|
||||||
|
"\n This program is Free Software and comes with ABSOLUTELY NO WARRANTY."
|
||||||
|
"\n\n");
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
int c, option_index = 0;
|
int c, option_index = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user