/* Initialize networking */ void netx_init(void) { static bool initialized_state = 0; if (initialized_state) { acnlog(LOG_INFO | LOG_NETX,"netx_init: already initialized"); return; } /* don't process twice */ initialized_state = 1; acnlog(LOG_DEBUG|LOG_NETX,"netx_init..."); /* init required sub modules */ nsk_netsocks_init(); OSFifoInit(&netx_fifo); return; }
/******************************************************************** * UserMain Task *******************************************************************/ extern "C" void UserMain( void *pd ) { init(); iprintf("Application: %s\r\nNNDK Revision: %s\r\n",AppName,GetReleaseTag()); // Display informational message iprintf( "Listening for UDP packets on "); ShowIP( EthernetIP ); iprintf( ": %d\r\n", UDP_LISTEN_PORT ); // Create FIFO to store incoming packets and initialize it OS_FIFO UdpListenFifo; OSFifoInit( &UdpListenFifo ); // Register to listen for UDP packets on the specified port number, and // specify the fifo and callback function to use when data is received. RegisterUDPFifoWithNotify( UDP_LISTEN_PORT, &UdpListenFifo, UdpListenCallback ); while ( 1 ) { OSTimeDly( TICKS_PER_SECOND ); } }