void netboot() { int size; unsigned int cmdline_adr, initrdstart_adr, initrdend_adr; unsigned int ip; unsigned char *macadr = (unsigned char *)FLASH_OFFSET_MAC_ADDRESS; printf("I: Booting from network...\n"); printf("I: MAC : %02x:%02x:%02x:%02x:%02x:%02x\n", macadr[0], macadr[1], macadr[2], macadr[3], macadr[4], macadr[5]); printf("I: Local IP : %d.%d.%d.%d\n", LOCALIP1, LOCALIP2, LOCALIP3, LOCALIP4); printf("I: Remote IP: %d.%d.%d.%d\n", REMOTEIP1, REMOTEIP2, REMOTEIP3, REMOTEIP4); ip = IPTOINT(REMOTEIP1, REMOTEIP2, REMOTEIP3, REMOTEIP4); microudp_start(macadr, IPTOINT(LOCALIP1, LOCALIP2, LOCALIP3, LOCALIP4)); if(tftp_get_v(ip, "boot.bin", (void *)SDRAM_BASE) <= 0) { printf("E: Network boot failed\n"); return; } cmdline_adr = SDRAM_BASE+0x1000000; size = tftp_get_v(ip, "cmdline.txt", (void *)cmdline_adr); if(size <= 0) { printf("I: No command line parameters found\n"); cmdline_adr = 0; } else *((char *)(cmdline_adr+size)) = 0x00; initrdstart_adr = SDRAM_BASE+0x1002000; size = tftp_get_v(ip, "initrd.bin", (void *)initrdstart_adr); if(size <= 0) { printf("I: No initial ramdisk found\n"); initrdstart_adr = 0; initrdend_adr = 0; } else initrdend_adr = initrdstart_adr + size - 1; printf("I: Booting...\n"); boot(cmdline_adr, initrdstart_adr, initrdend_adr, rescue, SDRAM_BASE); }
void netboot(void) { int size; unsigned int cmdline_adr, initrdstart_adr, initrdend_adr; unsigned int ip; printf("Booting from network...\n"); printf("Local IP : %d.%d.%d.%d\n", LOCALIP1, LOCALIP2, LOCALIP3, LOCALIP4); printf("Remote IP: %d.%d.%d.%d\n", REMOTEIP1, REMOTEIP2, REMOTEIP3, REMOTEIP4); ip = IPTOINT(REMOTEIP1, REMOTEIP2, REMOTEIP3, REMOTEIP4); microudp_start(macadr, IPTOINT(LOCALIP1, LOCALIP2, LOCALIP3, LOCALIP4)); if(tftp_get_v(ip, "boot.bin", (void *)SDRAM_BASE) <= 0) { printf("Network boot failed\n"); return; } cmdline_adr = SDRAM_BASE+0x1000000; size = tftp_get_v(ip, "cmdline.txt", (void *)cmdline_adr); if(size <= 0) { printf("No command line parameters found\n"); cmdline_adr = 0; } else *((char *)(cmdline_adr+size)) = 0x00; initrdstart_adr = SDRAM_BASE+0x1002000; size = tftp_get_v(ip, "initrd.bin", (void *)initrdstart_adr); if(size <= 0) { printf("No initial ramdisk found\n"); initrdstart_adr = 0; initrdend_adr = 0; } else initrdend_adr = initrdstart_adr + size; boot(cmdline_adr, initrdstart_adr, initrdend_adr, SDRAM_BASE); }
static void capture_raw(void) { unsigned char *macadr = (unsigned char *)FLASH_OFFSET_MAC_ADDRESS; static char capture_buf[2*1024*1024] __attribute__((aligned(16))); unsigned int ip; int i; for(i=0;i<sizeof(capture_buf);i++) capture_buf[i] = 0xde; dvisampler0_dma_base_write((unsigned int)capture_buf); dvisampler0_dma_length_write(sizeof(capture_buf)); dvisampler0_dma_shoot_write(1); printf("waiting for DMA..."); while(dvisampler0_dma_busy_read()); printf("done\n"); printf("TFTP transfer...\n"); ip = IPTOINT(REMOTEIP1, REMOTEIP2, REMOTEIP3, REMOTEIP4); microudp_start(macadr, IPTOINT(LOCALIP1, LOCALIP2, LOCALIP3, LOCALIP4)); tftp_put(ip, "raw_dvi", capture_buf, sizeof(capture_buf)); printf("done\n"); }