mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-01 18:31:54 +02:00
add nand_ops function
This commit is contained in:
parent
acc365174f
commit
fac0cd77ea
@ -19,9 +19,6 @@
|
|||||||
* Boston, MA 02110-1301, USA
|
* Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ingenic_usb.h"
|
|
||||||
#include "usb_boot_defines.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -33,6 +30,8 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
#include "ingenic_cfg.h"
|
#include "ingenic_cfg.h"
|
||||||
|
#include "ingenic_usb.h"
|
||||||
|
#include "usb_boot_defines.h"
|
||||||
|
|
||||||
extern int com_argc;
|
extern int com_argc;
|
||||||
extern char com_argv[MAX_ARGC][MAX_COMMAND_LENGTH];
|
extern char com_argv[MAX_ARGC][MAX_COMMAND_LENGTH];
|
||||||
@ -202,8 +201,9 @@ int nand_erase(struct nand_in_t *nand_in)
|
|||||||
printf("\n Erasing No.%d device No.%d flash......",
|
printf("\n Erasing No.%d device No.%d flash......",
|
||||||
nand_in->dev, i);
|
nand_in->dev, i);
|
||||||
|
|
||||||
JZ4740_USB_SET_DATA_ADDRESS(start_blk, hDevice);
|
usb_send_data_address_to_ingenic(&ingenic_dev, start_blk);
|
||||||
JZ4740_USB_SET_DATA_LENGTH(blk_num, hDevice);
|
ingenic_dev->file_len = blk_num;
|
||||||
|
usb_send_data_to_ingenic(&ingenic_dev);
|
||||||
unsigned short temp = ((i << 4) & 0xff0) + NAND_ERASE;
|
unsigned short temp = ((i << 4) & 0xff0) + NAND_ERASE;
|
||||||
JZ4740_USB_NAND_OPS(temp,hDevice);
|
JZ4740_USB_NAND_OPS(temp,hDevice);
|
||||||
ReadFile(hDevice, ret, 8, &nRead, NULL);
|
ReadFile(hDevice, ret, 8, &nRead, NULL);
|
||||||
|
@ -300,3 +300,23 @@ void usb_ingenic_cleanup(struct ingenic_dev *ingenic_dev)
|
|||||||
if (ingenic_dev->usb_handle)
|
if (ingenic_dev->usb_handle)
|
||||||
usb_close(ingenic_dev->usb_handle);
|
usb_close(ingenic_dev->usb_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int usb_ingenic_nand_ops(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_NAND_OPS,
|
||||||
|
/* wValue */ ops & 0xffff,
|
||||||
|
/* wIndex */ 0,
|
||||||
|
/* Data */ 0,
|
||||||
|
/* wLength */ 0,
|
||||||
|
USB_TIMEOUT);
|
||||||
|
|
||||||
|
if (status != 0) {
|
||||||
|
fprintf(stderr, "Error - can't set Ingenic device nand ops: %i\n", status);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
@ -64,5 +64,9 @@ int usb_ingenic_init(struct ingenic_dev *ingenic_dev);
|
|||||||
int usb_get_ingenic_cpu(struct ingenic_dev *ingenic_dev);
|
int usb_get_ingenic_cpu(struct ingenic_dev *ingenic_dev);
|
||||||
int usb_ingenic_upload(struct ingenic_dev *ingenic_dev, int stage);
|
int usb_ingenic_upload(struct ingenic_dev *ingenic_dev, int stage);
|
||||||
void usb_ingenic_cleanup(struct ingenic_dev *ingenic_dev);
|
void usb_ingenic_cleanup(struct ingenic_dev *ingenic_dev);
|
||||||
|
int usb_send_data_address_to_ingenic(struct ingenic_dev *ingenic_dev,
|
||||||
|
unsigned int stage_addr);
|
||||||
|
int usb_send_data_to_ingenic(struct ingenic_dev *ingenic_dev);
|
||||||
|
|
||||||
#endif /* __INGENIC_USB_H__ */
|
#endif /* __INGENIC_USB_H__ */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user