mirror of https://github.com/m-labs/artiq.git
runtime: support platforms without flash
This commit is contained in:
parent
8fe5c7ac01
commit
050db0b0f5
|
@ -100,6 +100,7 @@ void kloader_start_idle_kernel(void)
|
||||||
log("BUG: attempted to start kernel CPU while already running (idle kernel)");
|
log("BUG: attempted to start kernel CPU while already running (idle kernel)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
|
||||||
len = fs_read("idle_kernel", buffer, sizeof(buffer), NULL);
|
len = fs_read("idle_kernel", buffer, sizeof(buffer), NULL);
|
||||||
if(len <= 0)
|
if(len <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -113,6 +114,7 @@ void kloader_start_idle_kernel(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
start_kernel_cpu((void *)k);
|
start_kernel_cpu((void *)k);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void kloader_stop_kernel(void)
|
void kloader_stop_kernel(void)
|
||||||
|
|
|
@ -61,11 +61,14 @@ static int hex2nib(int c)
|
||||||
static void init_macadr(void)
|
static void init_macadr(void)
|
||||||
{
|
{
|
||||||
static const unsigned char default_macadr[6] = {0x10, 0xe2, 0xd5, 0x32, 0x50, 0x00};
|
static const unsigned char default_macadr[6] = {0x10, 0xe2, 0xd5, 0x32, 0x50, 0x00};
|
||||||
|
#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
|
||||||
char b[32];
|
char b[32];
|
||||||
char fs_macadr[6];
|
char fs_macadr[6];
|
||||||
int i, r, s;
|
int i, r, s;
|
||||||
|
#endif
|
||||||
|
|
||||||
memcpy(macadr, default_macadr, 6);
|
memcpy(macadr, default_macadr, 6);
|
||||||
|
#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
|
||||||
r = fs_read("mac", b, sizeof(b) - 1, NULL);
|
r = fs_read("mac", b, sizeof(b) - 1, NULL);
|
||||||
if(r <= 0)
|
if(r <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -81,21 +84,25 @@ static void init_macadr(void)
|
||||||
if(b[3*i + 2] != ':')
|
if(b[3*i + 2] != ':')
|
||||||
return;
|
return;
|
||||||
memcpy(macadr, fs_macadr, 6);
|
memcpy(macadr, fs_macadr, 6);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fsip_or_default(struct ip4_addr *d, char *key, int i1, int i2, int i3, int i4)
|
static void fsip_or_default(struct ip4_addr *d, char *key, int i1, int i2, int i3, int i4)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
|
||||||
char cp[32];
|
char cp[32];
|
||||||
|
#endif
|
||||||
|
|
||||||
IP4_ADDR(d, i1, i2, i3, i4);
|
IP4_ADDR(d, i1, i2, i3, i4);
|
||||||
|
#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
|
||||||
r = fs_read(key, cp, sizeof(cp) - 1, NULL);
|
r = fs_read(key, cp, sizeof(cp) - 1, NULL);
|
||||||
if(r <= 0)
|
if(r <= 0)
|
||||||
return;
|
return;
|
||||||
cp[r] = 0;
|
cp[r] = 0;
|
||||||
if(!ip4addr_aton(cp, d))
|
if(!ip4addr_aton(cp, d))
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void network_init(void)
|
static void network_init(void)
|
||||||
|
|
Loading…
Reference in New Issue