mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-22 23:14:38 +02:00
delete repeat code
This commit is contained in:
parent
470a2548f7
commit
e7a23fd7b6
@ -110,6 +110,7 @@ out:
|
||||
return res;
|
||||
}
|
||||
|
||||
/* after upload stage2. must init device */
|
||||
int init_cfg()
|
||||
{
|
||||
if (usb_get_ingenic_cpu(&ingenic_dev) < 3) {
|
||||
@ -526,6 +527,14 @@ int nand_program_file(struct nand_in_t *nand_in,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int nand_program_file_planes(struct nand_in_t *nand_in,
|
||||
struct nand_out_t *nand_out,
|
||||
char *fname)
|
||||
{
|
||||
printf(" \n not implement yet !");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int init_nand_in(void)
|
||||
{
|
||||
nand_in.buf = code_buf;
|
||||
@ -574,9 +583,9 @@ int nand_prog(void)
|
||||
printf("%s", help);
|
||||
|
||||
if (hand.nand_plane > 1)
|
||||
;/* nand_program_file_planes(&nand_in,&nand_out, image_file); */
|
||||
nand_program_file_planes(&nand_in, &nand_out, image_file);
|
||||
else
|
||||
nand_program_file(&nand_in,&nand_out, image_file);
|
||||
nand_program_file(&nand_in, &nand_out, image_file);
|
||||
|
||||
#ifdef CONFIG_NAND_OUT
|
||||
printf("\n Flash check result:");
|
||||
@ -584,16 +593,7 @@ int nand_prog(void)
|
||||
printf(" %d", (nand_out.status)[i]);
|
||||
#endif
|
||||
|
||||
printf("\n nprog %d %s %d %d %d", nand_in.start,
|
||||
image_file,
|
||||
nand_in.dev,
|
||||
(nand_in.cs_map)[atoi(com_argv[4])],
|
||||
nand_in.option);
|
||||
|
||||
printf("\n not implement yet!! just test");
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
int nand_query(void)
|
||||
|
@ -32,13 +32,19 @@ LIBDIR :=
|
||||
|
||||
#SOURCES += $(wildcard $(USBBOOTDIR)/usb_boot/*.c)
|
||||
|
||||
SOURCES := ./usb_boot/main.c ./usb_boot/udc.c ./usb_boot/cache.c ./usb_boot/serial.c ./usb_boot/boothandler.c
|
||||
SOURCES := ./usb_boot/main.c \
|
||||
./usb_boot/udc.c \
|
||||
./usb_boot/cache.c \
|
||||
./usb_boot/serial.c \
|
||||
./usb_boot/boothandler.c
|
||||
SOURCES += $(wildcard $(USBBOOTDIR)/nandflash/*.c)
|
||||
SOURCES += $(wildcard $(USBBOOTDIR)/usb_boot/*.S)
|
||||
|
||||
HEADS := $(SOCDIR)/head.S
|
||||
|
||||
CFLAGS += -I$(SOCDIR)/include -I$(USBBOOTDIR)/usb_boot -I$(USBBOOTDIR)/nandflash -I$(USBBOOTDIR)/include
|
||||
CFLAGS += -I$(SOCDIR)/include -I$(USBBOOTDIR)/usb_boot \
|
||||
-I$(USBBOOTDIR)/nandflash -I$(USBBOOTDIR)/include \
|
||||
-I..
|
||||
|
||||
OBJS := $(addsuffix .o , $(basename $(notdir $(SOURCES))))
|
||||
HEADO := $(addsuffix .o , $(basename $(notdir $(HEADS))))
|
||||
@ -46,7 +52,8 @@ HEADO := $(addsuffix .o , $(basename $(notdir $(HEADS))))
|
||||
TARGET := usb_boot
|
||||
APP := $(TARGET).elf
|
||||
|
||||
VPATH := $(ARCHDIR) $(SOCDIR) $(OSDIR) $(USBBOOTDIR)/usb_boot $(USBBOOTDIR)/norflash $(USBBOOTDIR)/nandflash
|
||||
VPATH := $(ARCHDIR) $(SOCDIR) $(OSDIR) $(USBBOOTDIR)/usb_boot \
|
||||
$(USBBOOTDIR)/norflash $(USBBOOTDIR)/nandflash
|
||||
|
||||
all: $(APP)
|
||||
$(OBJCOPY) -O binary $(APP) $(TARGET).bin
|
||||
|
@ -1,56 +0,0 @@
|
||||
#ifndef __HAND_H__
|
||||
#define __HAND_H__
|
||||
|
||||
struct fw_args_t {
|
||||
/* CPU ID */
|
||||
unsigned int cpu_id;
|
||||
|
||||
/* PLL args */
|
||||
unsigned char ext_clk;
|
||||
unsigned char cpu_speed;
|
||||
unsigned char phm_div;
|
||||
unsigned char use_uart;
|
||||
unsigned int boudrate;
|
||||
|
||||
/* SDRAM args */
|
||||
unsigned char bus_width;
|
||||
unsigned char bank_num;
|
||||
unsigned char row_addr;
|
||||
unsigned char col_addr;
|
||||
unsigned char is_mobile;
|
||||
unsigned char is_busshare;
|
||||
|
||||
/* debug args */
|
||||
unsigned char debug_ops;
|
||||
unsigned char pin_num;
|
||||
unsigned int start;
|
||||
unsigned int size;
|
||||
|
||||
/* for align */
|
||||
/* unsigned char align1; */
|
||||
/* unsigned char align2; */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct hand_t {
|
||||
|
||||
/* nand flash info */
|
||||
int pt; /* cpu type */
|
||||
unsigned int nand_bw; /* bus width */
|
||||
unsigned int nand_rc; /* row cycle */
|
||||
unsigned int nand_ps; /* page size */
|
||||
unsigned int nand_ppb; /* page number per block */
|
||||
unsigned int nand_force_erase;
|
||||
unsigned int nand_pn; /* page number in total */
|
||||
unsigned int nand_os; /* oob size */
|
||||
unsigned int nand_eccpos;
|
||||
unsigned int nand_bbpage;
|
||||
unsigned int nand_bbpos;
|
||||
unsigned int nand_plane;
|
||||
unsigned int nand_bchbit;
|
||||
unsigned int nand_wppin;
|
||||
unsigned int nand_bpc; /* block number per chip */
|
||||
|
||||
struct fw_args_t fw_args;
|
||||
} __attribute__((packed));
|
||||
|
||||
#endif /* __HAND_H__ */
|
@ -1,11 +1,29 @@
|
||||
#ifndef __USB_BOOT_H
|
||||
#define __USB_BOOT_H
|
||||
/*
|
||||
* "Ingenic flash tool" - flash the Ingenic CPU via USB
|
||||
*
|
||||
* (C) Copyright 2009
|
||||
* Author: Xiangfu Liu <xiangfu.z@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
//#define dprintf(x...)
|
||||
//printf(x);
|
||||
#ifndef __USB_BOOT_H__
|
||||
#define __USB_BOOT_H__
|
||||
|
||||
#define BULK_OUT_BUF_SIZE 0x21000 //buffer size :
|
||||
#define BULK_IN_BUF_SIZE 0x21000 // too
|
||||
#define BULK_OUT_BUF_SIZE 0x21000
|
||||
#define BULK_IN_BUF_SIZE 0x21000
|
||||
|
||||
enum UDC_STATE
|
||||
{
|
||||
@ -14,7 +32,7 @@ enum UDC_STATE
|
||||
BULK_OUT
|
||||
};
|
||||
|
||||
enum USB_JZ4740_REQUEST //add for USB_BOOT
|
||||
enum USB_JZ4740_REQUEST /* add for USB_BOOT */
|
||||
{
|
||||
VR_GET_CUP_INFO = 0,
|
||||
VR_SET_DATA_ADDERSS,
|
||||
@ -28,71 +46,4 @@ enum USB_JZ4740_REQUEST //add for USB_BOOT
|
||||
VR_CONFIGRATION
|
||||
};
|
||||
|
||||
enum NOR_OPS_TYPE
|
||||
{
|
||||
NOR_INIT = 0,
|
||||
NOR_QUERY,
|
||||
NOR_WRITE,
|
||||
NOR_ERASE_CHIP,
|
||||
NOR_ERASE_SECTOR
|
||||
};
|
||||
|
||||
enum NOR_FLASH_TYPE
|
||||
{
|
||||
NOR_AM29 = 0,
|
||||
NOR_SST28,
|
||||
NOR_SST39x16,
|
||||
NOR_SST39x8
|
||||
};
|
||||
|
||||
enum NAND_OPS_TYPE
|
||||
{
|
||||
NAND_QUERY = 0,
|
||||
NAND_INIT,
|
||||
NAND_MARK_BAD,
|
||||
NAND_READ_OOB,
|
||||
NAND_READ_RAW,
|
||||
NAND_ERASE,
|
||||
NAND_READ,
|
||||
NAND_PROGRAM,
|
||||
NAND_READ_TO_RAM
|
||||
};
|
||||
|
||||
enum SDRAM_OPS_TYPE
|
||||
{
|
||||
SDRAM_LOAD,
|
||||
|
||||
};
|
||||
|
||||
enum DATA_STRUCTURE_OB
|
||||
{
|
||||
DS_flash_info ,
|
||||
DS_hand
|
||||
};
|
||||
|
||||
|
||||
/*typedef enum _USB_BOOT_STATUS
|
||||
{
|
||||
USB_NO_ERR =0 ,
|
||||
GET_CPU_INFO_ERR,
|
||||
SET_DATA_ADDRESS_ERR,
|
||||
SET_DATA_LENGTH_ERR,
|
||||
FLUSH_CAHCES_ERR,
|
||||
PROGRAM_START1_ERR,
|
||||
PROGRAM_START2_ERR,
|
||||
NOR_OPS_ERR,
|
||||
NAND_OPS_ERR,
|
||||
NOR_FLASHTYPE_ERR,
|
||||
OPS_NOTSUPPORT_ERR
|
||||
}USB_BOOT_STATUS;*/
|
||||
|
||||
enum OPTION
|
||||
{
|
||||
OOB_ECC,
|
||||
OOB_NO_ECC,
|
||||
NO_OOB,
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __USB_BOOT_H__ */
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "nandflash.h"
|
||||
#include "jz4740.h"
|
||||
#include "usb_boot.h"
|
||||
#include "hand.h"
|
||||
#include "usb_boot_defines.h"
|
||||
|
||||
#define __nand_enable() (REG_EMC_NFCSR |= EMC_NFCSR_NFE1 | EMC_NFCSR_NFCE1)
|
||||
#define __nand_disable() (REG_EMC_NFCSR &= ~(EMC_NFCSR_NFCE1))
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "jz4750.h"
|
||||
#include "nandflash.h"
|
||||
#include "usb_boot.h"
|
||||
#include "hand.h"
|
||||
#include "usb_boot_defines.h"
|
||||
|
||||
#define dprintf(n...)
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "usb.h"
|
||||
#include "error.h"
|
||||
#include "usb_boot.h"
|
||||
#include "hand.h"
|
||||
#include "usb_boot_defines.h"
|
||||
#include "nandflash.h"
|
||||
#include "udc.h"
|
||||
#define dprintf(x) serial_puts(x)
|
||||
|
@ -1,8 +1,7 @@
|
||||
/* special main file!
|
||||
* do not edit!
|
||||
*/
|
||||
//#include "jz4740.h"
|
||||
#include "hand.h"
|
||||
#include "usb_boot_defines.h"
|
||||
|
||||
extern void usb_main();
|
||||
unsigned int start_addr,got_start,got_end;
|
||||
|
Loading…
Reference in New Issue
Block a user