mirror of
https://github.com/xboot/xfel.git
synced 2024-11-27 03:33:28 +08:00
[main]add type for ddr command interface
This commit is contained in:
parent
298a80bc1d
commit
a9acea8d71
@ -15,7 +15,7 @@ static int chip_jtag(struct xfel_ctx_t * ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int chip_ddr(struct xfel_ctx_t * ctx)
|
||||
static int chip_ddr(struct xfel_ctx_t * ctx, const char * type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ static int chip_jtag(struct xfel_ctx_t * ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int chip_ddr(struct xfel_ctx_t * ctx)
|
||||
static int chip_ddr(struct xfel_ctx_t * ctx, const char * type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ static int chip_jtag(struct xfel_ctx_t * ctx)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int chip_ddr(struct xfel_ctx_t * ctx)
|
||||
static int chip_ddr(struct xfel_ctx_t * ctx, const char * type)
|
||||
{
|
||||
static const uint8_t dram_bin[] = {
|
||||
0x02, 0x00, 0x00, 0xea, 0x00, 0x72, 0x02, 0x00, 0x00, 0x20, 0x02, 0x00,
|
||||
|
4
fel.c
4
fel.c
@ -329,10 +329,10 @@ int fel_chip_jtag(struct xfel_ctx_t * ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fel_chip_ddr(struct xfel_ctx_t * ctx)
|
||||
int fel_chip_ddr(struct xfel_ctx_t * ctx, const char * type)
|
||||
{
|
||||
if(ctx && ctx->chip && ctx->chip->ddr)
|
||||
return ctx->chip->ddr(ctx);
|
||||
return ctx->chip->ddr(ctx, type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
4
fel.h
4
fel.h
@ -34,7 +34,7 @@ struct chip_t {
|
||||
int (*reset)(struct xfel_ctx_t * ctx);
|
||||
int (*sid)(struct xfel_ctx_t * ctx, uint32_t * sid);
|
||||
int (*jtag)(struct xfel_ctx_t * ctx);
|
||||
int (*ddr)(struct xfel_ctx_t * ctx);
|
||||
int (*ddr)(struct xfel_ctx_t * ctx, const char * type);
|
||||
};
|
||||
|
||||
#define R32(reg) fel_read32(ctx, reg)
|
||||
@ -50,7 +50,7 @@ void fel_write(struct xfel_ctx_t * ctx, uint32_t addr, void * buf, size_t len, i
|
||||
int fel_chip_reset(struct xfel_ctx_t * ctx);
|
||||
int fel_chip_sid(struct xfel_ctx_t * ctx, uint32_t * sid);
|
||||
int fel_chip_jtag(struct xfel_ctx_t * ctx);
|
||||
int fel_chip_ddr(struct xfel_ctx_t * ctx);
|
||||
int fel_chip_ddr(struct xfel_ctx_t * ctx, const char * type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
6
main.c
6
main.c
@ -92,7 +92,7 @@ static void usage(void)
|
||||
printf(" xfel reset - Reset device using watchdog\r\n");
|
||||
printf(" xfel sid - Output 128-bits SID information\r\n");
|
||||
printf(" xfel jtag - Enable JTAG debug\r\n");
|
||||
printf(" xfel ddr - Initial DDR controller\r\n");
|
||||
printf(" xfel ddr [type] - Initial DDR controller with optional type\r\n");
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
@ -269,7 +269,9 @@ int main(int argc, char * argv[])
|
||||
}
|
||||
else if(!strcmp(argv[1], "ddr"))
|
||||
{
|
||||
if(!fel_chip_ddr(&ctx))
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
if(!fel_chip_ddr(&ctx, (argc == 1) ? argv[0] : NULL))
|
||||
printf("The chip don't support '%s' command\r\n", argv[1]);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user