Specifications
1–20 Chapter 1: Using the NicheStack TCP/IP Stack
Nios II Simple Socket Server Overview
Using the NicheStack TCP/IP Stack - Nios II Edition Tutorial June 2011 Altera Corporation
Inter-Task Communication Resources
The following global handles (or pointers) create and manipulate your MicroC/OS-II
inter-task communication resources. All the resources begin with
SSS
, indicating a
public resource provided by the Nios II Simple Socket Server that is shared between
software modules. The
SSSCreateOSDataStructs
function, invoked from
SSSInitialTask()
declares and creates these resources in
niosII_simple_socket_server.c.
■ SSSLEDCommandQ
SSSLEDCommandQ
is a MicroC/OS-II message queue that sends commands from the
simple socket server task to the Altera development board LED control task,
LEDManagementTask()
.
■ SSSLEDFreqMailbox
SSSLEDFreqMailbox
is the handle to the MicroC/OS-II LED pulse rate mailbox.
The mailbox passes an LED blink rate between the LED control task, named
LEDManagementTask()
, and the LED task responsible for blinking the development
board LED, named
LEDBlinkTask()
. The
LEDManagementTask()
passes the pulse
rate in response to a command sent from
SSSNiosIISimpleSocketServerTask()
when the “blink the LED” command comes over the TCP/IP socket.
NicheStack TCP/IP Stack Initialization
As described in the “NicheStack TCP/IP Stack Tasks” and “Initializing the Stack”
sections of the Ethernet and the NicheStack TCP/IP Stack – Nios II Edition chapter of the
Nios II Software Developer's Handbook, the NicheStack TCP/IP Stack must be initialized
from the Nios II Simple Socket Server application code by calling the following
NicheStack functions:
■
alt_iniche_init()
, called from
SSSInitialTask()
in iniche_init.c
■
netmain()
, called from
SSSInitialTask()
in iniche_init.c
You must provide three NicheStack functions ,
get_mac_addr()
,
get_board_mac_addr()
and
get_ip_addr()
. For this tutorial, these functions are
available in iniche_init.c.
1 If
get_board_mac_addr()
is unable to find valid MAC address, refer to your board's
user guide for instructions on restoring the MAC address, or hard code the MAC
address in the
get_mac_addr()
function.
An initialization task named
SSSInitialTask()
calls the
alt_iniche_init()
and
netmain()
initialization functions in the proper sequence, and then waits until the
NicheStack TCP/IP Stack becomes fully operational (by waiting for the global
variable
iniche_net_ready
to be set to TRUE) before creating the application level
task
SSSNiosIISimpleSocketServerTask()
.
SSSNiosIISimpleSocketServerTask()
is defined in niosII_simple_socket_server.c
and created with priority
SSS_NIOS_II_SIMPLE_SOCKET_SERVER_TASK_PRIORITY
.
1 You can use the task
SSSInitialTask()
in your own MicroC/OS-II and NicheStack
TCP/IP Stack networking application.