Specifications

The system hardware must include an Ethernet interface with interrupts enabled.
The BSP must be based on MicroC/OS-II.
The MicroC/OS-II RTOS must be configured to have the following settings:
TimeManagement / OSTimeTickHook must be enabled.
Maximum Number of Tasks must be four or less.
The system clock timer must be set to point to an appropriate timer device.
The NicheStack TCP/IP Stack Tasks
The NicheStack TCP/IP Stack, in its standard Nios II configuration, consists of two fundamental tasks.
Each of these tasks consumes a MicroC/OS-II thread resource, along with some memory for the thread's
stack. In addition to the tasks your program creates, the following tasks run continuously:
The NicheStack main task, tk_netmain()—After initialization, this task sleeps until a new packet is
available for processing. Packets are received by an interrupt service routine (ISR). When the ISR
receives a packet, it places it in the receive queue, and wakes up the main task.
The NicheStack tick task, tk_nettick()—This task wakes up periodically to monitor for time-out
conditions.
These tasks are started when the initialization process succeeds in the netmain() function.
Note:
You can modify the task priority and stack sizes using #define statements in the configuration file
ipport.h. You can create additional system tasks by enabling other options in the NicheStack
TCP/IP Stack by editing ipport.h.
Related Information
netmain() on page 11-5
Initializing the Stack
Before you initialize the stack, start the MicroC/OS-II scheduler by calling OSStart() from main().
Perform stack initialization in a high priority task, to ensure that your code does not attempt further
initialization until the RTOS is running and I/O drivers are available.
To initialize the stack, call the functions alt_iniche_init() and netmain(). Global variable
iniche_net_ready is set true when stack initialization is complete.
Note:
Ensure that your code does not use the sockets interface before iniche_net_ready is set to true.
Related Information
iniche_net_ready on page 11-5
For more information and example, call alt_iniche_init() and netmain() from the highest priority
task, and wait for iniche_net_ready before allowing other tasks to run.
alt_iniche_init()
alt_iniche_init() initializes the stack for use with the MicroC/OS-II operating system.
The prototype for alt_iniche_init() is:
void alt_iniche_init(void)
When used this way, alt_iniche_init() returns nothing and has no parameters.
11-4
The NicheStack TCP/IP Stack Tasks
NII5V2
2015.05.14
Altera Corporation
Ethernet and the NicheStack TCP/IP Stack - Nios II Edition
Send Feedback