void uos_init (void) { /* Configure 16 Mbyte of external Flash memory at nCS3. */ MC_CSCON3 = MC_CSCON_WS (4); /* Wait states */ /* Выделяем место для динамической памяти */ extern unsigned __bss_end[]; #ifdef ELVEES_DATA_SDRAM /* Динамическая память в SDRAM */ if (((unsigned) __bss_end & 0xF0000000) == 0x80000000) mem_init (&pool, (unsigned) __bss_end, 0x82000000); else mem_init (&pool, (unsigned) __bss_end, 0xa2000000); #else /* Динамическая память в CRAM */ extern unsigned _estack[]; mem_init (&pool, (unsigned) __bss_end, (unsigned) _estack - 256); #endif timer_init (&timer, KHZ, 1); const unsigned char my_macaddr[] = { 0, 9, 0x94, 0xf1, 0xf2, 0xf3 }; eth_init (ð, "eth0", 80, &pool, 0, my_macaddr); eth_set_promisc (ð, 1, 1); if (local_loop) eth_set_loop (ð, local_loop); task_create (main_test, 0, "test", 5, stack_test, sizeof (stack_test)); }
void board_net_postinit(void) { /* Try to initialize networking so Vitesse PHYs work for user * programs. */ eth_init(gd->bd); }
int main(int i, char **c) { char buffer[64]; int sdr_ok; irq_setmask(0); irq_setie(1); uart_init(); puts("\nMiSoC BIOS\n" "(c) Copyright 2007-2016 M-Labs Limited\n" "Built "__DATE__" "__TIME__"\n"); crcbios(); #ifdef CSR_ETHMAC_BASE eth_init(); #endif #ifdef CSR_DFII_BASE sdr_ok = sdrinit(); #else sdr_ok = 1; #endif if(sdr_ok) boot_sequence(); else printf("Memory initialization failed\n"); while(1) { putsnonl("\e[1mBIOS>\e[0m "); readstr(buffer, 64); do_command(buffer); } return 0; }
int main(int argc, char **argv) { FILE *file; Hubyte mac[6]; mac[0] = 0x00; mac[1] = 0xE0; mac[2] = 0x18; mac[3] = 0xE4; mac[4] = 0xB2; mac[5] = 0x74; eth_init( mac ); setup_ncurses(); num_packets = 0; num_bytes = 0; res_total = 0; res_number = 0; res_max = 0; res_min = 0; file = open_file( argv[1] ); log_data( file ); close_ncurses(); eth_destroy(); return 0; }
int main(int argc, char **argv, char **env) { float speed; #ifndef WITH_SERIAL_PTY set_conio_terminal_mode(); #endif Verilated::commandArgs(argc, argv); dut = new Vdut; Verilated::traceEverOn(true); tfp = new VerilatedVcdC; dut->trace(tfp, 99); tfp->open("dut.vcd"); struct sim s; sim_init(&s); #ifdef WITH_SERIAL_PTY console_init(&s); console_open(&s); #endif #ifdef WITH_ETH eth_init(&s, "/dev/net/tap0", "tap0"); // XXX get this from /tmp/simethernet eth_open(&s); #endif s.run = true; while(s.run) { sim_tick(&s); if(SYS_CLK) { #ifdef WITH_SERIAL if(console_service(&s) != 0) s.run = false; #endif #ifdef WITH_ETH ethernet_service(&s); #endif } } s.end = clock(); speed = (s.tick/2)/((s.end-s.start)/CLOCKS_PER_SEC); printf("average speed: %3.3f MHz\n\r", speed/1000000); tfp->close(); #ifdef WITH_SERIAL_PTY console_close(&s); #endif #ifdef WITH_ETH eth_close(&s); #endif exit(0); }
int main(void) { cpu_init(); /* Initialize UART connected to Galileo Gen2 FTDI header */ quarkX1000_uart_init(QUARK_X1000_UART_1); clock_init(); rtimer_init(); printf("Starting Contiki\n"); ENABLE_IRQ(); process_init(); procinit_init(); ctimer_init(); autostart_start(autostart_processes); eth_init(); while(1) { process_run(); } return 0; }
int main(int argc, char *argv[]) { if(argc != 3) { printf("%d", argc); printf("\nUsage: go 0x50000000 LoadAdress FileName\n\n"); return -1; } hport = htons(69); eport = htons(4321); eth_init(); irq_disable(); GPNCON |= 2 << 14; EINT0CON0 |= 1 << 12; EINT0MASK &= ~(1 << 7);//设置网卡中断 irq_request(INT_EINT1, do_net); irq_enable(); tftp_down((void *)atoi(argv[1]), argv[2]); return 0; }
void tcpipinit() { prog_name= "kernel TCP/IP"; mu_init(&mu_generic); mu_lock(&mu_generic); tcpip_dirinit(); sr_init_cap_names(); sr_set_cap_name(ETH_DEV0, "eth"); sr_set_cap_name(IP_DEV0, "ip"); sr_set_cap_name(TCP_DEV0, "tcp"); sr_set_cap_name(UDP_DEV0, "udp"); #if 0 sr_enable_linger_right(); #endif bf_init(); clck_init(); sr_init(); eth_init(); arp_init(); ip_init(); tcp_init(); udp_init(); add_default_gws(); mu_unlock(&mu_generic); tcpip_chmod(); }
int board_late_init(void) { DECLARE_GLOBAL_DATA_PTR; /* Fix Ethernet Initialization Bug when starting Linux from U-Boot */ eth_init(gd->bd); return 0; }
int board_late_init(void) { DECLARE_GLOBAL_DATA_PTR; #if defined(CONFIG_CMD_NET) eth_init(gd->bd); #endif return 0; }
int platform_init() { // Set the clocking to run from PLL #if defined( FORLM3S9B92 ) || defined( FORLM3S9D92 ) MAP_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); #else MAP_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); #endif // Setup PIO pios_init(); // Setup SSIs spis_init(); // Setup UARTs uarts_init(); // Setup timers timers_init(); // Setup PWMs pwms_init(); #ifdef BUILD_ADC // Setup ADCs adcs_init(); #endif #ifdef BUILD_CAN // Setup CANs cans_init(); #endif // Setup system timer cmn_systimer_set_base_freq( MAP_SysCtlClockGet() ); cmn_systimer_set_interrupt_freq( SYSTICKHZ ); // Setup ethernet (TCP/IP) eth_init(); // Common platform initialization code cmn_platform_init(); // Virtual timers // If the ethernet controller is used the timer is already initialized, so skip this sequence #if VTMR_NUM_TIMERS > 0 && !defined( BUILD_UIP ) // Configure SysTick for a periodic interrupt. MAP_SysTickPeriodSet( MAP_SysCtlClockGet() / SYSTICKHZ ); MAP_SysTickEnable(); MAP_SysTickIntEnable(); MAP_IntMasterEnable(); #endif // All done return PLATFORM_OK; }
void reset_phy(void) { /* * Initialize ethernet HW addresses prior to starting Linux, * needed for nfsroot. * TODO: We need to investigate if that is really necessary. */ eth_init(gd->bd); }
void reset_phy(void) { #ifdef CONFIG_MACB /* * Initialize ethernet HW addr prior to starting Linux, * needed for nfsroot */ eth_init(); #endif }
int dev_open_net(void *cookie) { if (!dev_valid_net(cookie)) return API_ENODEV; if (eth_init(gd->bd) < 0) return API_EIO; return 0; }
void reset_phy(void) { #ifdef CONFIG_DRIVER_DM9000 /* * Initialize ethernet HW addr prior to starting Linux, * needed for nfsroot */ eth_init(gd->bd); #endif }
/*---------------------------------------------------------------------------*/ PROCESS_THREAD(ethernet_process, ev, data) { PROCESS_POLLHANDLER(eth_poll()); PROCESS_BEGIN(); eth_init(); PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_EXIT); PROCESS_END(); }
int board_late_init(void) { #if defined(CONFIG_CMD_NET) eth_init(gd->bd); eth_halt(); #endif /* Protect U-Boot, kernel & ramdisk memory addresses */ run_command("protect on 10000000 1041ffff", 0); return 0; }
static void nc_send_packet(const char *buf, int len) { #ifdef CONFIG_DM_ETH struct udevice *eth; #else struct eth_device *eth; #endif int inited = 0; uchar *pkt; uchar *ether; struct in_addr ip; debug_cond(DEBUG_DEV_PKT, "output: \"%*.*s\"\n", len, len, buf); eth = eth_get_dev(); if (eth == NULL) return; if (!memcmp(nc_ether, net_null_ethaddr, 6)) { if (eth_is_active(eth)) return; /* inside net loop */ output_packet = buf; output_packet_len = len; input_recursion = 1; net_loop(NETCONS); /* wait for arp reply and send packet */ input_recursion = 0; output_packet_len = 0; return; } if (!eth_is_active(eth)) { if (eth_is_on_demand_init()) { if (eth_init() < 0) return; eth_set_last_protocol(NETCONS); } else { eth_init_state_only(); } inited = 1; } pkt = (uchar *)net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE; memcpy(pkt, buf, len); ether = nc_ether; ip = nc_ip; net_send_udp_packet(ether, ip, nc_out_port, nc_in_port, len); if (inited) { if (eth_is_on_demand_init()) eth_halt(); else eth_halt_state_only(); } }
int main(void) { eth_init(); GPNCON |= 2 << 14; EINT0CON0 |= 0x01 << 12; EINT0MASK &= ~(1 << 7); irq_request(1, do_recv); return 0; }
int net_start_again(void) { char *nretry; int retry_forever = 0; unsigned long retrycnt = 0; int ret; nretry = getenv("netretry"); if (nretry) { if (!strcmp(nretry, "yes")) retry_forever = 1; else if (!strcmp(nretry, "no")) retrycnt = 0; else if (!strcmp(nretry, "once")) retrycnt = 1; else retrycnt = simple_strtoul(nretry, NULL, 0); } else { retrycnt = 0; retry_forever = 0; } if ((!retry_forever) && (net_try_count >= retrycnt)) { eth_halt(); net_set_state(NETLOOP_FAIL); /* * We don't provide a way for the protocol to return an error, * but this is almost always the reason. */ return -ETIMEDOUT; } net_try_count++; eth_halt(); #if !defined(CONFIG_NET_DO_NOT_TRY_ANOTHER) eth_try_another(!net_restarted); #endif ret = eth_init(); if (net_restart_wrap) { net_restart_wrap = 0; if (net_dev_exists) { net_set_timeout_handler(10000UL, start_again_timeout_handler); net_set_udp_handler(NULL); } else { net_set_state(NETLOOP_FAIL); } } else { net_set_state(NETLOOP_RESTART); } return ret; }
void ethernet_on() { ethernet_off(); //turn off for a proper reset delay(10*DELAY_MS_UNITS); // set_digital_input(ETH_POWER_EN_PIN, true, false, false); // write_pin(ETH_POWER_EN_PIN, true); delay(10*DELAY_MS_UNITS); write_pin(ETH_NRST_PIN, true); delay(10*DELAY_MS_UNITS); eth_init(); lan_init(); }
int main(void) { eth_init(); char buf[20] = {0x11, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x10, 0x12}; while(1){ eth_send(buf, 12); delay(); } return 0; }
PRIVATE void nw_init() { mq_init(); qp_init(); bf_init(); clck_init(); sr_init(); eth_init(); arp_init(); psip_init(); ip_init(); tcp_init(); udp_init(); }
int main() { const char *httprequest = "POST / HTTP/1.1\r\nContent-Length: 49\r\nAuthorization: Basic \r\n\r\n{\"params\": [], \"method\": \"getwork\", \"id\": \"json\"}"; printf("Hello from Nios II!\n"); if(!eth_init()) { fprintf(stderr, "Ethernet initialization failed.\n"); return -1; } SOCKET sock = 0; if (socket(sock, 1234)) { fprintf(stderr, "Failed to create a socket for outbound connections.\n"); return -1; } if (connect(sock, 74, 95, 106, 214, 8332)) { fprintf(stderr, "Failed to connect to Mining Pool.\n"); return -1; } //uint16_t buf_len = 0; uint8_t conn_state = 0; while(1) { if(established(sock) == 1) { if(conn_state == 0) { send(sock, (const uint8_t *)httprequest, strlen(httprequest)); conn_state = 1; read_getwork(sock); } //buf_len = recv(sock, buf, 32); /*if(buf_len > 0) { send(sock, buf, buf_len); }*/ //send(sock, "Hello World", 12); //disconnect(sock); } } return 0; }
void uos_init (void) { /* Configure 16 Mbyte of external Flash memory at nCS3. */ MC_CSCON3 = MC_CSCON_WS (4); /* Wait states */ mem_init (&pool, SDRAM_START, SDRAM_START + SDRAM_SIZE); puts (&debug, "\nTesting Ethernet.\n"); printf (&debug, "Free %u bytes\n", mem_available (&pool)); const unsigned char my_macaddr[] = { 0, 9, 0x94, 0xf1, 0xf2, 0xf3 }; eth_init (ð, "eth0", 80, &pool, 0, my_macaddr); task_create (poll_eth, 0, "poll", 1, stack_poll, sizeof (stack_poll)); }
void target_init(void) { uint8_t* mac_addr = gen_mac_address(); stm32_debug_init(); eth_init(mac_addr, PHY_LAN8742A); #if WITH_LIB_MINIP minip_set_macaddr(mac_addr); uint32_t ip_addr = IPV4(192, 168, 0, 98); uint32_t ip_mask = IPV4(255, 255, 255, 0); uint32_t ip_gateway = IPV4_NONE; minip_init(stm32_eth_send_minip_pkt, NULL, ip_addr, ip_mask, ip_gateway); #endif }
static int tx6x_devices_init(void) { if (!of_machine_is_compatible("karo,imx6dl-tx6dl") && !of_machine_is_compatible("karo,imx6q-tx6q")) return 0; barebox_set_hostname("tx6u"); eth_init(); setup_pmic_voltages(); imx6_bbu_nand_register_handler("nand", BBU_HANDLER_FLAG_DEFAULT); return 0; }
PRIVATE void nw_init() { #if DEBUG & 256 { where(); printf("starting mq_init()\n"); } #endif mq_init(); #if DEBUG & 256 { where(); printf("starting bf_init()\n"); } #endif bf_init(); #if DEBUG & 256 { where(); printf("starting clck_init()\n"); } #endif clck_init(); #if DEBUG & 256 { where(); printf("starting sr_init()\n"); } #endif sr_init(); #if DEBUG & 256 { where(); printf("starting eth_init()\n"); } #endif eth_init(); #if DEBUG & 256 { where(); printf("starting arp_init()\n"); } #endif #if ENABLE_ARP arp_init(); #endif #if DEBUG & 256 { where(); printf("starting ip_init()\n"); } #endif #if ENABLE_IP ip_init(); #endif #if DEBUG & 256 { where(); printf("starting tcp_init()\n"); } #endif #if ENABLE_TCP tcp_init(); #endif #if DEBUG & 256 { where(); printf("starting udp_init()\n"); } #endif #if ENABLE_UDP udp_init(); #endif }
void uos_init(void) { /* Используем только внутреннюю память. * Оставляем 256 байтов для задачи "idle". */ extern unsigned __hi_data_end[], _hstack[]; mem_init(&pool, (unsigned) __hi_data_end, (unsigned) _hstack ); timer_init(&timer, KHZ, 1); const unsigned char my_macaddr[] = { 0, 9, 0x94, 0xf1, 0xf2, 0xf3 }; eth_init(ð, "eth0", 80, &pool, 0, my_macaddr); task_create(test_task, 0, "test", 5, stack_test, sizeof(stack_test)); task_create(console_task, 0, "console", 10, stack_console, sizeof(stack_console)); task_create(local_idle, 0, "local idle", 11, stack_local_idle, sizeof(stack_local_idle)); }
int main( int argc, char *argv[] ) { Hubyte src[6]; src[0] = 0x00; src[1] = 0xE0; src[2] = 0x18; src[3] = 0xE4; src[4] = 0xB2; src[5] = 0x74; eth_init( src ); run( argv[1], argv[2] ); eth_destroy(); return 0; }