From 7597779cae112d54578ceeb2dadd2a8d5f7a81cc Mon Sep 17 00:00:00 2001 From: Xiangfu Liu Date: Mon, 7 Mar 2011 11:11:38 +0800 Subject: [PATCH] remove duplicate code --- usbboot/src/cmd.c | 1 + usbboot/src/command_line.h | 1 - usbboot/src/ingenic_request.h | 16 ++++++++++++++++ usbboot/src/ingenic_usb.c | 1 + usbboot/src/ingenic_usb.h | 12 ------------ usbboot/xburst_include/target/nandflash.h | 7 ------- usbboot/xburst_include/target/usb_boot.h | 15 --------------- usbboot/xburst_stage2/Makefile | 5 ++--- usbboot/xburst_stage2/main.c | 2 +- usbboot/xburst_stage2/udc.c | 5 +++-- 10 files changed, 24 insertions(+), 41 deletions(-) create mode 100644 usbboot/src/ingenic_request.h diff --git a/usbboot/src/cmd.c b/usbboot/src/cmd.c index daf17a9..a75279e 100644 --- a/usbboot/src/cmd.c +++ b/usbboot/src/cmd.c @@ -29,6 +29,7 @@ #include "cmd.h" #include "ingenic_cfg.h" #include "ingenic_usb.h" +#include "ingenic_request.h" #include "usb_boot_defines.h" extern int com_argc; diff --git a/usbboot/src/command_line.h b/usbboot/src/command_line.h index b53438e..f5be524 100644 --- a/usbboot/src/command_line.h +++ b/usbboot/src/command_line.h @@ -19,7 +19,6 @@ #ifndef __COMMAND_LINE_H__ #define __COMMAND_LINE_H__ -int command_input(char *buf); int command_handle(char *buf); #endif /* __COMMAND_LINE_H__ */ diff --git a/usbboot/src/ingenic_request.h b/usbboot/src/ingenic_request.h new file mode 100644 index 0000000..8103913 --- /dev/null +++ b/usbboot/src/ingenic_request.h @@ -0,0 +1,16 @@ +#ifndef __INGENIC_REQUEST_H__ +#define __INGENIC_REQUEST_H__ + +#define VR_GET_CPU_INFO (0x00) +#define VR_SET_DATA_ADDRESS (0x01) +#define VR_SET_DATA_LENGTH (0x02) +#define VR_FLUSH_CACHES (0x03) +#define VR_PROGRAM_START1 (0x04) +#define VR_PROGRAM_START2 (0x05) +#define VR_NOR_OPS (0x06) +#define VR_NAND_OPS (0x07) +#define VR_SDRAM_OPS (0x08) +#define VR_CONFIGRATION (0x09) +#define VR_RESET (0x0a) + +#endif diff --git a/usbboot/src/ingenic_usb.c b/usbboot/src/ingenic_usb.c index b01d4d7..36db64a 100644 --- a/usbboot/src/ingenic_usb.c +++ b/usbboot/src/ingenic_usb.c @@ -22,6 +22,7 @@ #include #include "usb_boot_defines.h" #include "ingenic_usb.h" +#include "ingenic_request.h" extern unsigned int total_size; diff --git a/usbboot/src/ingenic_usb.h b/usbboot/src/ingenic_usb.h index 881500e..5a1c4b1 100644 --- a/usbboot/src/ingenic_usb.h +++ b/usbboot/src/ingenic_usb.h @@ -25,18 +25,6 @@ #define INGENIC_OUT_ENDPOINT 0x01 #define INGENIC_IN_ENDPOINT 0x81 -#define VR_GET_CPU_INFO 0x00 -#define VR_SET_DATA_ADDRESS 0x01 -#define VR_SET_DATA_LENGTH 0x02 -#define VR_FLUSH_CACHES 0x03 -#define VR_PROGRAM_START1 0x04 -#define VR_PROGRAM_START2 0x05 -#define VR_NOR_OPS 0x06 -#define VR_NAND_OPS 0x07 -#define VR_SDRAM_OPS 0x08 -#define VR_CONFIGRATION 0x09 -#define VR_RESET 0x0a - #define JZ4740V1 1 #define JZ4750V1 2 #define JZ4760V1 3 diff --git a/usbboot/xburst_include/target/nandflash.h b/usbboot/xburst_include/target/nandflash.h index e9da53f..7cc6772 100644 --- a/usbboot/xburst_include/target/nandflash.h +++ b/usbboot/xburst_include/target/nandflash.h @@ -31,7 +31,6 @@ int nand_init_4740(int bus_width, int row_cycle, int page_size, int page_per_blo int,int,int,int); int nand_fini_4740(void); u32 nand_program_4740(void *context, int spage, int pages, int option); -//int nand_program_oob_4740(void *context, int spage, int pages, void (*notify)(int)); u32 nand_erase_4740(int blk_num, int sblk, int force); u32 nand_read_4740(void *buf, u32 startpage, u32 pagenum,int option); u32 nand_read_oob_4740(void *buf, u32 startpage, u32 pagenum); @@ -42,21 +41,15 @@ void nand_disable_4740(u32 csn); /* Jz4760 nandflash interface */ unsigned int nand_query_4760(u8 *); -//int nand_init_4760(int bus_width, int row_cycle, int page_size, int page_per_block, -// int,int,int,int); - int nand_init_4760(int bus_width, int row_cycle, int page_size, int page_per_block, int bch_bit, int ecc_pos, int bad_pos, int bad_page, int force); - int nand_fini_4760(void); u32 nand_program_4760(void *context, int spage, int pages, int option); -//int nand_program_oob_4740(void *context, int spage, int pages, void (*notify)(int)); u32 nand_erase_4760(int blk_num, int sblk, int force); u32 nand_read_4760(void *buf, u32 startpage, u32 pagenum,int option); u32 nand_read_oob_4760(void *buf, u32 startpage, u32 pagenum); u32 nand_read_raw_4760(void *buf, u32 startpage, u32 pagenum,int); u32 nand_mark_bad_4760(int bad); - void nand_enable_4760(u32 csn); void nand_disable_4760(u32 csn); diff --git a/usbboot/xburst_include/target/usb_boot.h b/usbboot/xburst_include/target/usb_boot.h index 991b33e..3505d0e 100644 --- a/usbboot/xburst_include/target/usb_boot.h +++ b/usbboot/xburst_include/target/usb_boot.h @@ -32,19 +32,4 @@ enum UDC_STATE BULK_OUT }; -enum USB_JZ4740_REQUEST /* add for USB_BOOT */ -{ - VR_GET_CUP_INFO = 0, - VR_SET_DATA_ADDERSS, - VR_SET_DATA_LENGTH, - VR_FLUSH_CACHES, - VR_PROGRAM_START1, - VR_PROGRAM_START2, - VR_NOR_OPS, - VR_NAND_OPS, - VR_SDRAM_OPS, - VR_CONFIGRATION, - VR_RESET -}; - #endif /* __USB_BOOT_H__ */ diff --git a/usbboot/xburst_stage2/Makefile b/usbboot/xburst_stage2/Makefile index bb5fef1..fc6ddd2 100644 --- a/usbboot/xburst_stage2/Makefile +++ b/usbboot/xburst_stage2/Makefile @@ -8,8 +8,7 @@ # 2 of the License, or (at your option) any later version. # -INFLASH_SRC_PATH = ../src -XBURST_INCLUDE_PATH = ../xburst_include +XBURST_INCLUDE_PATH = -I../xburst_include -I../src ifeq ($(CROSS_COMPILE),) $(error CROSS_COMPILE variable not set, should point to .../mipsel-openwrt-linux-) @@ -31,7 +30,7 @@ DEBUG_CFLAGS = -g -Wa,-a=$(basename $@).lst # is to disable this optimization right now. CFLAGS = -mips32 -O2 -fno-exceptions -fno-zero-initialized-in-bss \ -ffunction-sections -fomit-frame-pointer -msoft-float -G 0 -fpie \ - -I$(XBURST_INCLUDE_PATH) -I$(INFLASH_SRC_PATH) -D$(DEVICE) + $(XBURST_INCLUDE_PATH) -D$(DEVICE) LDFLAGS = -nostdlib -T target.ld $(CFLAGS) OBJS = main.o udc.o cache.o serial.o boothandler.o nandflash_4740.o nandflash_4760.o diff --git a/usbboot/xburst_stage2/main.c b/usbboot/xburst_stage2/main.c index 63e899b..5ba59d5 100644 --- a/usbboot/xburst_stage2/main.c +++ b/usbboot/xburst_stage2/main.c @@ -21,7 +21,7 @@ extern void usb_main(); extern unsigned int UART_BASE; struct fw_args *fw_args; -unsigned int start_addr,got_start,got_end; +unsigned int start_addr, got_start, got_end; void c_main(void) { diff --git a/usbboot/xburst_stage2/udc.c b/usbboot/xburst_stage2/udc.c index b0f8568..1d4c9e8 100644 --- a/usbboot/xburst_stage2/udc.c +++ b/usbboot/xburst_stage2/udc.c @@ -20,6 +20,7 @@ #include "usb/udc.h" #include "target/usb_boot.h" #include "target/xburst_types.h" +#include "ingenic_request.h" #if defined(NANONOTE) #include "target/jz4740.h" @@ -382,10 +383,10 @@ void usbHandleVendorReq(u8 *buf) int ret_state; USB_DeviceRequest *dreq = (USB_DeviceRequest *)buf; switch (dreq->bRequest) { - case VR_GET_CUP_INFO: + case VR_GET_CPU_INFO: ret_state = GET_CUP_INFO_Handle(); break; - case VR_SET_DATA_ADDERSS: + case VR_SET_DATA_ADDRESS: ret_state = SET_DATA_ADDERSS_Handle(buf); break; case VR_SET_DATA_LENGTH: