1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-26 01:10:18 +02:00

modify the read data function and send length function

This commit is contained in:
xiangfu 2009-05-08 16:14:14 +00:00
parent 7085493d7c
commit 72dd61a7c7
2 changed files with 13 additions and 7 deletions

View File

@ -362,10 +362,16 @@ int nand_erase(struct nand_in_t *nand_in)
nand_in->dev, i);
usb_send_data_address_to_ingenic(&ingenic_dev, start_blk);
ingenic_dev.file_len = blk_num;
usb_send_data_to_ingenic(&ingenic_dev);
usb_send_data_length_to_ingenic(&ingenic_dev, blk_num);
unsigned short temp = ((i << 4) & 0xff0) + NAND_ERASE;
usb_ingenic_nand_ops(&ingenic_dev, temp);
if (usb_get_ingenic_cpu(&ingenic_dev) < 3) {
printf("\n---debug----------------");
return -1;
}
ingenic_dev.file_buff = ret;
ingenic_dev.file_len = 8;
usb_read_data_from_ingenic(&ingenic_dev);
@ -456,10 +462,10 @@ int nand_program_file(struct nand_in_t *nand_in,
printf("\n No.%d Programming...",k+1);
nand_in->length = code_len; /* code length,not page number! */
nand_in->buf = code_buf;
if ( nand_program_check(nand_in, &n_out, &start_page) == -1)
if (nand_program_check(nand_in, &n_out, &start_page) == -1)
return -1;
if ( start_page - nand_in->start > hand.nand_ppb )
if (start_page - nand_in->start > hand.nand_ppb)
printf("\n Skip a old bad block !");
nand_in->start = start_page;
#if 0

View File

@ -199,8 +199,8 @@ int usb_send_data_length_to_ingenic(struct ingenic_dev *ingenic_dev, int len)
status = usb_control_msg(ingenic_dev->usb_handle,
/* bmRequestType */ USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
/* bRequest */ VR_SET_DATA_LENGTH,
/* wValue */ 0,
/* wIndex */ len,
/* wValue */ STAGE_ADDR_MSB(len),
/* wIndex */ STAGE_ADDR_LSB(len),
/* Data */ 0,
/* wLength */ 0,
USB_TIMEOUT);
@ -251,7 +251,7 @@ int usb_read_data_from_ingenic(struct ingenic_dev *ingenic_dev)
{
int status;
status = usb_bulk_read(ingenic_dev->usb_handle,
/* endpoint */ INGENIC_IN_ENDPOINT,
/* endpoint */ INGENIC_IN_ENDPOINT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
/* bulk data */ ingenic_dev->file_buff,
/* bulk data length */ ingenic_dev->file_len,
USB_TIMEOUT);