mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-12-23 22:25:30 +02:00
change the sturct name
This commit is contained in:
parent
e7a23fd7b6
commit
132b7afd9c
@ -38,10 +38,10 @@ extern int com_argc;
|
|||||||
extern char com_argv[MAX_ARGC][MAX_COMMAND_LENGTH];
|
extern char com_argv[MAX_ARGC][MAX_COMMAND_LENGTH];
|
||||||
|
|
||||||
struct ingenic_dev ingenic_dev;
|
struct ingenic_dev ingenic_dev;
|
||||||
struct hand_t hand;
|
struct hand hand;
|
||||||
|
|
||||||
static struct nand_in_t nand_in;
|
static struct nand_in nand_in;
|
||||||
static struct nand_out_t nand_out;
|
static struct nand_out nand_out;
|
||||||
unsigned int total_size;
|
unsigned int total_size;
|
||||||
unsigned char code_buf[4 * 512 * 1024];
|
unsigned char code_buf[4 * 512 * 1024];
|
||||||
unsigned char check_buf[4 * 512 * 1024];
|
unsigned char check_buf[4 * 512 * 1024];
|
||||||
@ -100,7 +100,7 @@ static int load_file(struct ingenic_dev *ingenic_dev, const char *file_path)
|
|||||||
|
|
||||||
/* write args to code */
|
/* write args to code */
|
||||||
memcpy(ingenic_dev->file_buff + 8, &hand.fw_args,
|
memcpy(ingenic_dev->file_buff + 8, &hand.fw_args,
|
||||||
sizeof(struct fw_args_t));
|
sizeof(struct fw_args));
|
||||||
|
|
||||||
res = 1;
|
res = 1;
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ int error_check(unsigned char *org,unsigned char * obj,unsigned int size)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nand_markbad(struct nand_in_t *nand_in)
|
int nand_markbad(struct nand_in *nand_in)
|
||||||
{
|
{
|
||||||
if (usb_get_ingenic_cpu(&ingenic_dev) < 3) {
|
if (usb_get_ingenic_cpu(&ingenic_dev) < 3) {
|
||||||
printf("\n Device unboot! Boot it first!");
|
printf("\n Device unboot! Boot it first!");
|
||||||
@ -231,8 +231,8 @@ int nand_markbad(struct nand_in_t *nand_in)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nand_program_check(struct nand_in_t *nand_in,
|
int nand_program_check(struct nand_in *nand_in,
|
||||||
struct nand_out_t *nand_out,
|
struct nand_out *nand_out,
|
||||||
unsigned int *start_page)
|
unsigned int *start_page)
|
||||||
{
|
{
|
||||||
unsigned int i,page_num,cur_page;
|
unsigned int i,page_num,cur_page;
|
||||||
@ -340,7 +340,7 @@ int nand_program_check(struct nand_in_t *nand_in,
|
|||||||
} else {
|
} else {
|
||||||
/* (nand_out->status)[i] = 0; */
|
/* (nand_out->status)[i] = 0; */
|
||||||
printf(" fail!");
|
printf(" fail!");
|
||||||
struct nand_in_t bad;
|
struct nand_in bad;
|
||||||
cur_page = (ret[3] << 24) |
|
cur_page = (ret[3] << 24) |
|
||||||
(ret[2] << 16) |
|
(ret[2] << 16) |
|
||||||
(ret[1] << 8) |
|
(ret[1] << 8) |
|
||||||
@ -356,7 +356,7 @@ int nand_program_check(struct nand_in_t *nand_in,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nand_erase(struct nand_in_t *nand_in)
|
int nand_erase(struct nand_in *nand_in)
|
||||||
{
|
{
|
||||||
unsigned int start_blk, blk_num, end_block;
|
unsigned int start_blk, blk_num, end_block;
|
||||||
int i;
|
int i;
|
||||||
@ -408,8 +408,8 @@ int nand_erase(struct nand_in_t *nand_in)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nand_program_file(struct nand_in_t *nand_in,
|
int nand_program_file(struct nand_in *nand_in,
|
||||||
struct nand_out_t *nand_out,
|
struct nand_out *nand_out,
|
||||||
char *fname)
|
char *fname)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -417,8 +417,8 @@ int nand_program_file(struct nand_in_t *nand_in,
|
|||||||
unsigned int start_page = 0, page_num, code_len, offset, transfer_size;
|
unsigned int start_page = 0, page_num, code_len, offset, transfer_size;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
unsigned char status_buf[32];
|
unsigned char status_buf[32];
|
||||||
struct nand_in_t n_in;
|
struct nand_in n_in;
|
||||||
struct nand_out_t n_out;
|
struct nand_out n_out;
|
||||||
|
|
||||||
#ifdef CONFIG_NAND_OUT
|
#ifdef CONFIG_NAND_OUT
|
||||||
/* nand_out->status = (unsigned char *)malloc(nand_in->max_chip * sizeof(unsigned char)); */
|
/* nand_out->status = (unsigned char *)malloc(nand_in->max_chip * sizeof(unsigned char)); */
|
||||||
@ -527,8 +527,8 @@ int nand_program_file(struct nand_in_t *nand_in,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nand_program_file_planes(struct nand_in_t *nand_in,
|
int nand_program_file_planes(struct nand_in *nand_in,
|
||||||
struct nand_out_t *nand_out,
|
struct nand_out *nand_out,
|
||||||
char *fname)
|
char *fname)
|
||||||
{
|
{
|
||||||
printf(" \n not implement yet !");
|
printf(" \n not implement yet !");
|
||||||
|
@ -49,7 +49,7 @@ static volatile unsigned char *cmdport = (volatile unsigned char *)0xb8008000;
|
|||||||
|
|
||||||
static int bus = 8, row = 2, pagesize = 2048, oobsize = 64, ppb = 128;
|
static int bus = 8, row = 2, pagesize = 2048, oobsize = 64, ppb = 128;
|
||||||
static int bad_block_pos,bad_block_page,force_erase,ecc_pos,wp_pin;
|
static int bad_block_pos,bad_block_page,force_erase,ecc_pos,wp_pin;
|
||||||
extern struct hand_t Hand;
|
extern struct hand Hand;
|
||||||
//static u8 data_buf[2048] = {0};
|
//static u8 data_buf[2048] = {0};
|
||||||
static u8 oob_buf[256] = {0};
|
static u8 oob_buf[256] = {0};
|
||||||
extern u16 handshake_PKT[4];
|
extern u16 handshake_PKT[4];
|
||||||
|
@ -39,7 +39,7 @@ static int oobecc = 0; /* Whether the oob data of the binary contains
|
|||||||
static int bad_block_page = 127; /* Specify the page number of badblock flag inside a block */
|
static int bad_block_page = 127; /* Specify the page number of badblock flag inside a block */
|
||||||
static u32 bad_block_pos = 0; /* Specify the badblock flag offset inside the oob */
|
static u32 bad_block_pos = 0; /* Specify the badblock flag offset inside the oob */
|
||||||
static u8 oob_buf[256] = {0};
|
static u8 oob_buf[256] = {0};
|
||||||
extern struct hand_t Hand;
|
extern struct hand Hand;
|
||||||
extern u16 handshake_PKT[4];
|
extern u16 handshake_PKT[4];
|
||||||
|
|
||||||
static inline void __nand_sync(void)
|
static inline void __nand_sync(void)
|
||||||
|
@ -22,7 +22,7 @@ u32 (*nand_mark_bad) (int bad);
|
|||||||
void (*nand_enable) (unsigned int csn);
|
void (*nand_enable) (unsigned int csn);
|
||||||
void (*nand_disable) (unsigned int csn);
|
void (*nand_disable) (unsigned int csn);
|
||||||
|
|
||||||
struct hand_t Hand,*Hand_p;
|
struct hand Hand,*Hand_p;
|
||||||
extern u32 Bulk_out_buf[BULK_OUT_BUF_SIZE];
|
extern u32 Bulk_out_buf[BULK_OUT_BUF_SIZE];
|
||||||
extern u32 Bulk_in_buf[BULK_IN_BUF_SIZE];
|
extern u32 Bulk_in_buf[BULK_IN_BUF_SIZE];
|
||||||
extern u16 handshake_PKT[4];
|
extern u16 handshake_PKT[4];
|
||||||
@ -48,9 +48,9 @@ void dump_data(unsigned int *p, int size)
|
|||||||
|
|
||||||
void config_hand()
|
void config_hand()
|
||||||
{
|
{
|
||||||
struct hand_t *hand_p;
|
struct hand *hand_p;
|
||||||
hand_p=(struct hand_t *)Bulk_out_buf;
|
hand_p=(struct hand *)Bulk_out_buf;
|
||||||
memcpy(&Hand, (unsigned char *)Bulk_out_buf, sizeof(struct hand_t));
|
memcpy(&Hand, (unsigned char *)Bulk_out_buf, sizeof(struct hand));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
Hand.nand_bw=hand_p->nand_bw;
|
Hand.nand_bw=hand_p->nand_bw;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
extern unsigned int total_size;
|
extern unsigned int total_size;
|
||||||
|
|
||||||
int hand_init_def(struct hand_t *hand)
|
int hand_init_def(struct hand *hand)
|
||||||
{
|
{
|
||||||
/* nand flash info */
|
/* nand flash info */
|
||||||
/* hand.nand_start=0; */ /* important !!!! */
|
/* hand.nand_start=0; */ /* important !!!! */
|
||||||
@ -55,7 +55,7 @@ int hand_init_def(struct hand_t *hand)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int check_dump_cfg(struct hand_t *hand)
|
int check_dump_cfg(struct hand *hand)
|
||||||
{
|
{
|
||||||
printf("\n Now checking whether all configure args valid: ");
|
printf("\n Now checking whether all configure args valid: ");
|
||||||
/* check PLL */
|
/* check PLL */
|
||||||
@ -131,7 +131,7 @@ int check_dump_cfg(struct hand_t *hand)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int parse_configure(struct hand_t *hand, char * file_path)
|
int parse_configure(struct hand *hand, char * file_path)
|
||||||
{
|
{
|
||||||
hand_init_def(hand);
|
hand_init_def(hand);
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
#define CONFIG_FILE_PATH "usb_boot.cfg"
|
#define CONFIG_FILE_PATH "usb_boot.cfg"
|
||||||
|
|
||||||
int hand_init_def(struct hand_t *hand);
|
int hand_init_def(struct hand *hand);
|
||||||
int check_dump_cfg(struct hand_t *hand);
|
int check_dump_cfg(struct hand *hand);
|
||||||
int parse_configure(struct hand_t *hand, char * file_path);
|
int parse_configure(struct hand *hand, char * file_path);
|
||||||
|
|
||||||
#endif /*__INGENIC_CFG_H__ */
|
#endif /*__INGENIC_CFG_H__ */
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "ingenic_cfg.h"
|
#include "ingenic_cfg.h"
|
||||||
|
|
||||||
extern struct ingenic_dev ingenic_dev;
|
extern struct ingenic_dev ingenic_dev;
|
||||||
extern struct hand_t hand;
|
extern struct hand hand;
|
||||||
|
|
||||||
static void help(void)
|
static void help(void)
|
||||||
{
|
{
|
||||||
@ -62,7 +62,7 @@ int main(int argc, char **argv)
|
|||||||
char com_buf[256];
|
char com_buf[256];
|
||||||
memset(com_buf, 0, 256);
|
memset(com_buf, 0, 256);
|
||||||
|
|
||||||
while (1) {
|
while(1) {
|
||||||
int c, option_index = 0;
|
int c, option_index = 0;
|
||||||
c = getopt_long(argc, argv, "hvc:", opts,
|
c = getopt_long(argc, argv, "hvc:", opts,
|
||||||
&option_index);
|
&option_index);
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#define CODE_SIZE ( 4 * 1024 * 1024 )
|
#define CODE_SIZE ( 4 * 1024 * 1024 )
|
||||||
/* #define START_ADDR ( 0x80000000 + SDRAM_SIZE - CODE_SIZE ) */
|
/* #define START_ADDR ( 0x80000000 + SDRAM_SIZE - CODE_SIZE ) */
|
||||||
|
|
||||||
#define NAND_MAX_BLK_NUM 10000000 /* ((Hand.nand_pn / Hand.nand_ppb) + 1) */
|
#define NAND_MAX_BLK_NUM 10000000 /*((Hand.nand_pn / Hand.nand_ppb) + 1)*/
|
||||||
#define NAND_MAX_PAGE_NUM 1073740824 /*Hand.nand_pn */
|
#define NAND_MAX_PAGE_NUM 1073740824 /*Hand.nand_pn */
|
||||||
#define NAND_SECTION_NUM 23
|
#define NAND_SECTION_NUM 23
|
||||||
#define MAX_TRANSFER_SIZE 0x100000
|
#define MAX_TRANSFER_SIZE 0x100000
|
||||||
@ -92,7 +92,7 @@ enum DATA_STRUCTURE_OB {
|
|||||||
DS_hand
|
DS_hand
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fw_args_t {
|
struct fw_args {
|
||||||
/* CPU ID */
|
/* CPU ID */
|
||||||
unsigned int cpu_id;
|
unsigned int cpu_id;
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ struct fw_args_t {
|
|||||||
/* unsigned char align2; */
|
/* unsigned char align2; */
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
struct hand_t {
|
struct hand {
|
||||||
|
|
||||||
/* nand flash info */
|
/* nand flash info */
|
||||||
int pt; /* cpu type */
|
int pt; /* cpu type */
|
||||||
@ -141,10 +141,10 @@ struct hand_t {
|
|||||||
unsigned int nand_wppin;
|
unsigned int nand_wppin;
|
||||||
unsigned int nand_bpc; /* block number per chip */
|
unsigned int nand_bpc; /* block number per chip */
|
||||||
|
|
||||||
struct fw_args_t fw_args;
|
struct fw_args fw_args;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
struct nand_in_t {
|
struct nand_in {
|
||||||
unsigned char dev;
|
unsigned char dev;
|
||||||
unsigned char max_chip;
|
unsigned char max_chip;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
@ -156,11 +156,11 @@ struct nand_in_t {
|
|||||||
int (* check) (unsigned char *,unsigned char *,unsigned int);
|
int (* check) (unsigned char *,unsigned char *,unsigned int);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nand_out_t {
|
struct nand_out {
|
||||||
unsigned char *status;
|
unsigned char *status;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sdram_in_t {
|
struct sdram_in {
|
||||||
unsigned char dev;
|
unsigned char dev;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
unsigned int start;
|
unsigned int start;
|
||||||
|
Loading…
Reference in New Issue
Block a user