static ce_bin __attribute__ ((aligned (32))) g_bin;
static ce_net __attribute__ ((aligned (32))) g_net;
-static IPaddr_t server_ip;
+static struct in_addr server_ip;
static void ce_init_bin(ce_bin *bin, unsigned char *dataBuffer)
{
snprintf(std_drv_glb->deviceId, sizeof(std_drv_glb->deviceId),
"Triton%02X", eth_get_dev()->enetaddr[5]);
- NetCopyIP(&std_drv_glb->kitl.ipAddress, &NetOurIP);
- std_drv_glb->kitl.ipMask = getenv_IPaddr("netmask");
- std_drv_glb->kitl.ipRoute = getenv_IPaddr("gatewayip");
+ net_copy_ip(&std_drv_glb->kitl.ipAddress, &net_ip);
+ std_drv_glb->kitl.ipMask = getenv_ip("netmask").s_addr;
+ std_drv_glb->kitl.ipRoute = getenv_ip("gatewayip").s_addr;
if (mtdparts) {
strncpy(std_drv_glb->mtdparts, mtdparts, max_len);
}
}
-static void ce_prepare_run_bin(ce_bin *bin)
+static void ce_init_drv_globals(void)
{
struct ce_magic *ce_magic = (void *)CONFIG_SYS_SDRAM_BASE + 0x160;
ce_std_driver_globals *std_drv_glb = &ce_magic->drv_glb;
- /* Clear os RAM area (if needed) */
- if (bin->edbgConfig.flags & EDBG_FL_CLEANBOOT) {
- debug("cleaning memory from %p to %p\n",
- bin->eRamStart, bin->eRamStart + bin->eRamLen);
-
- printf("Preparing clean boot ... ");
- memset(bin->eRamStart, 0, bin->eRamLen);
- printf("ok\n");
- }
-
debug("Copying CE MAGIC from %p to %p..%p\n",
&ce_magic_template, ce_magic,
(void *)ce_magic + sizeof(*ce_magic) - 1);
strlen(std_drv_glb->mtdparts) + 1;
ce_dump_block(ce_magic, offsetof(struct ce_magic, drv_glb) +
ce_magic->size);
+}
+
+static void ce_prepare_run_bin(ce_bin *bin)
+{
+ /* Clear os RAM area (if needed) */
+ if (bin->edbgConfig.flags & EDBG_FL_CLEANBOOT) {
+ debug("cleaning memory from %p to %p\n",
+ bin->eRamStart, bin->eRamStart + bin->eRamLen);
+
+ printf("Preparing clean boot ... ");
+ memset(bin->eRamStart, 0, bin->eRamLen);
+ printf("ok\n");
+ }
+
+ ce_init_drv_globals();
/*
* Make sure, all the above makes it into SDRAM because
size_t image_size;
if (argc > 1) {
+ if (strcmp(argv[1], "-i") == 0) {
+ ce_init_drv_globals();
+ return CMD_RET_SUCCESS;
+ }
addr = (void *)simple_strtoul(argv[1], NULL, 16);
image_size = INT_MAX; /* actually we do not know the image size */
} else if (getenv("fileaddr") != NULL) {
bootce, 2, 0, do_bootce,
"Boot a Windows CE image from RAM",
"[addr]\n"
- "\taddr\t\tboot image from address addr (default ${fileaddr})"
+ "\taddr\t\tboot image from address addr (default ${fileaddr})\n"
+ "or\n"
+ "\t-i\t\tinitialize the WinCE globals data structure (before loading a .nb0 image)"
);
+#ifdef CONFIG_CMD_NAND
static int ce_nand_load(ce_bin *bin, loff_t *offset, void *buf, size_t max_len)
{
int ret;
"\toff\t\t- flash offset (hex)\n"
"\tpartition\t- partition name"
);
+#endif
static int ce_send_write_ack(ce_net *net)
{
// Some diag output
if (net->verbose) {
printf("Locked Down download link, IP: %pI4\n",
- &NetServerIP);
+ &net_server_ip);
printf("Sending BOOTME request [%d] to %pI4\n",
- net->seqNum, &NetServerIP);
+ net->seqNum, &net_server_ip);
}
// Lock down EShell download link
/* Some diag output */
if (net->verbose) {
printf("Locked Down EDBG service link, IP: %pI4\n",
- &NetServerIP);
+ &net_server_ip);
}
/* Lock down EDBG link */
}
/* IP address from active config */
- NetCopyIP(&data->ipAddr, &NetOurIP);
+ net_copy_ip(&data->ipAddr, &net_ip);
// Device name string (NULL terminated). Should include
// platform and number based on Ether address (e.g. Odo42, CEPCLS2346, etc)
return 0;
}
-#define UINT_MAX ~0UL
-
static inline int ce_download_file(ce_net *net, ulong timeout)
{
ulong start = get_timer_masked();
int ret = 1;
int i;
- server_ip = 0;
+ server_ip.s_addr = 0;
for (i = 1; i < argc; i++){
if (*argv[i] != '-')
timeout = simple_strtoul(argv[i],
NULL, 0);
if (timeout >= UINT_MAX / CONFIG_SYS_HZ) {
- printf("Timeout value %lu out of range (max.: %lu)\n",
+ printf("Timeout value %lu out of range (max.: %u)\n",
timeout, UINT_MAX / CONFIG_SYS_HZ - 1);
return CMD_RET_USAGE;
}