1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2025-04-21 12:27:27 +03:00

add new command: reset, then we can reboot device after reflash

This commit is contained in:
Xiangfu Liu
2011-03-02 10:42:35 +08:00
parent aa59c6a7ec
commit ff3182da41
8 changed files with 54 additions and 11 deletions

View File

@@ -962,3 +962,11 @@ close:
out:
return res;
}
int device_reset(int ops)
{
if (usb_ingenic_reset(&ingenic_dev, ops) < 1)
return -1;
return 1;
}

View File

@@ -33,5 +33,6 @@ int nand_erase(struct nand_in *nand_in);
int debug_memory(int obj, unsigned int start, unsigned int size);
int debug_gpio(int obj, unsigned char ops, unsigned char pin);
int debug_go(void);
int device_reset(int ops);
#endif /* __CMD_H__ */

View File

@@ -204,6 +204,8 @@ int command_handle(char *buf)
debug_go();
else if (!strcmp("memtest", com_argv[0]))
handle_memtest();
else if (!strcmp("reset", com_argv[0]))
device_reset(0);
else if (!strcmp("help", com_argv[0]))
handle_help();
else if (!strcmp("exit", com_argv[0]))

View File

@@ -406,3 +406,24 @@ int usb_ingenic_sdram_ops(struct ingenic_dev *ingenic_dev, int ops)
return 1;
}
int usb_ingenic_reset(struct ingenic_dev *ingenic_dev, int ops)
{
int status;
status = usb_control_msg(ingenic_dev->usb_handle,
/* bmRequestType */ USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
/* bRequest */ VR_RESET,
/* wValue */ ops,
/* wIndex */ 0,
/* Data */ 0,
/* wLength */ 0,
USB_TIMEOUT);
if (status != 0) {
fprintf(stderr, "Error - "
"reset XBurst device: %i\n", status);
return -1;
}
return 1;
}

View File

@@ -35,7 +35,7 @@
#define VR_NAND_OPS 0x07
#define VR_SDRAM_OPS 0x08
#define VR_CONFIGRATION 0x09
#define VR_GET_NUM 0x0a
#define VR_RESET 0x0a
#define JZ4740V1 1
#define JZ4750V1 2
@@ -77,5 +77,6 @@ int usb_send_data_length_to_ingenic(struct ingenic_dev *ingenic_dev,
int len);
int usb_ingenic_nand_ops(struct ingenic_dev *ingenic_dev, int ops);
int usb_read_data_from_ingenic(struct ingenic_dev *ingenic_dev,unsigned char *buff, unsigned int len);
int usb_ingenic_reset(struct ingenic_dev *ingenic_dev, int ops);
#endif /* __INGENIC_USB_H__ */