OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [orpmon/] [services/] [net.c] - Diff between revs 828 and 833

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 828 Rev 833
Line 121... Line 121...
                int     i;
                int     i;
 
 
                /*
                /*
                 *      Setup packet buffers, aligned correctly.
                 *      Setup packet buffers, aligned correctly.
                 */
                 */
printf("%s - %s: %d\n", __FILE__, __FUNCTION__, __LINE__);
 
printf("   NetTxPacket %.8lx\n", (unsigned long)NetTxPacket);
 
                NetTxPacket = &PktBuf[0] + (PKTALIGN - 1);
                NetTxPacket = &PktBuf[0] + (PKTALIGN - 1);
                NetTxPacket -= (unsigned long)NetTxPacket % PKTALIGN;
                NetTxPacket -= (unsigned long)NetTxPacket % PKTALIGN;
                for (i = 0; i < PKTBUFSRX; i++) {
                for (i = 0; i < PKTBUFSRX; i++) {
                        NetRxPackets[i] = NetTxPacket + (i+1)*PKTSIZE_ALIGN;
                        NetRxPackets[i] = NetTxPacket + (i+1)*PKTSIZE_ALIGN;
                }
                }
Line 134... Line 132...
 
 
        eth_halt();
        eth_halt();
        eth_init(NetReceive);
        eth_init(NetReceive);
 
 
restart:
restart:
 
 
        NetCopyEther(NetOurEther, global.eth_add);
        NetCopyEther(NetOurEther, global.eth_add);
 
 
        NetState = NETLOOP_CONTINUE;
        NetState = NETLOOP_CONTINUE;
 
 
        /*
        /*
Line 146... Line 145...
         *      packets and timer events.
         *      packets and timer events.
         */
         */
 
 
        if (protocol == TFTP) {                 /* TFTP */
        if (protocol == TFTP) {                 /* TFTP */
                NetOurIP        = global.ip;
                NetOurIP        = global.ip;
printf("%s - %s: %d\n", __FILE__, __FUNCTION__, __LINE__);
 
printf("   global.srv_ip = %.8lx\n", global.srv_ip);
 
                NetServerIP     = global.srv_ip;
                NetServerIP     = global.srv_ip;
                NetOurGatewayIP = global.gw_ip;
                NetOurGatewayIP = global.gw_ip;
                NetOurSubnetMask= global.mask;
                NetOurSubnetMask= global.mask;
 
 
                if (net_check_prereq (protocol) != 0) {
                if (net_check_prereq (protocol) != 0) {
Line 211... Line 208...
//              WATCHDOG_RESET();
//              WATCHDOG_RESET();
                /*
                /*
                 *      Check the ethernet for a new packet.  The ethernet
                 *      Check the ethernet for a new packet.  The ethernet
                 *      receive routine will process it.
                 *      receive routine will process it.
                 */
                 */
printf("%s - %s: %d\n", __FILE__, __FUNCTION__, __LINE__);
 
                        eth_rx();
                        eth_rx();
 
 
                /*
                /*
                 *      Abort if ctrl-c was pressed.
                 *      Abort if ctrl-c was pressed.
                 */
                 */
printf("%s - %s: %d\n", __FILE__, __FUNCTION__, __LINE__);
 
                if (ctrlc()) {
                if (ctrlc()) {
                    eth_halt();
                    eth_halt();
                        printf("\nAbort\n");
                        printf("\nAbort\n");
                        return 0;
                        return 0;
                }
                }
Line 229... Line 224...
 
 
                /*
                /*
                 *      Check for a timeout, and run the timeout handler
                 *      Check for a timeout, and run the timeout handler
                 *      if we have one.
                 *      if we have one.
                 */
                 */
printf("%s - %s: %d\n", __FILE__, __FUNCTION__, __LINE__);
 
                if (timeHandler && (get_timer(0) > timeValue)) {
                if (timeHandler && (get_timer(0) > timeValue)) {
                        thand_f *x;
                        thand_f *x;
 
 
printf("%s - %s: %d\n", __FILE__, __FUNCTION__, __LINE__);
 
                        x = timeHandler;
                        x = timeHandler;
                        timeHandler = (thand_f *)0;
                        timeHandler = (thand_f *)0;
                        (*x)();
                        (*x)();
                }
                }
 
 
 
 
                switch (NetState) {
                switch (NetState) {
 
 
                case NETLOOP_RESTART:
                case NETLOOP_RESTART:
printf("%s - %s: %d\n", __FILE__, __FUNCTION__, __LINE__);
 
                        goto restart;
                        goto restart;
 
 
                case NETLOOP_SUCCESS:
                case NETLOOP_SUCCESS:
printf("%s - %s: %d\n", __FILE__, __FUNCTION__, __LINE__);
 
                        if (NetBootFileXferSize > 0) {
                        if (NetBootFileXferSize > 0) {
                                printf("Bytes transferred = %ld (%lx hex)\n",
                                printf("Bytes transferred = %ld (%lx hex)\n",
                                        NetBootFileXferSize,
                                        NetBootFileXferSize,
                                        NetBootFileXferSize);
                                        NetBootFileXferSize);
                        }
                        }
                        eth_halt();
                        eth_halt();
                        return NetBootFileXferSize;
                        return NetBootFileXferSize;
 
 
                case NETLOOP_FAIL:
                case NETLOOP_FAIL:
printf("%s - %s: %d\n", __FILE__, __FUNCTION__, __LINE__);
 
                        return 0;
                        return 0;
                }
                }
        }
        }
#endif
#endif
}
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.