I am working on a new board that has a TM4C1294NCPDT TivaC CPU and the application will need three TCP/IP sockets to send and receive data asynchronously. I will be using CCS 6.01 with TI RTOS and I am evaluating the integrated NDK (TI’s TCP/IP stack) so I am at the beginning of the learning curve on the NDK.
I want some advice on how to implement / integrate the sockets with the RTOS. I would like to use the sockets in blocking mode so there is no polling and wasting CPU cycles etc. In some of the bigger operating systems where resources are less limited, I would use two tasks for each socket. With two tasks for each TCP/IP socket, one task would receive TCP/IP data and the other task will send the TCP/IP data Lets call the tasks rcvTask_port1() sendTask_port2() for now.
The rcvTask_port1() task would block on the recv() and will only receive data and or messages from the TCP/IP socket and handle the data or message.
The sendTask_port1(). task would block on the mailbox message and will wake up and send any data over TCP/IP. Other tasks in the system would send a mailbox message to this task if they need to send data over the socket.
With this model, each socket would have two tasks that block till there is work to do so there is no polling. This assumes that the TCP/IP stack is "re entrant" or thread safe since the messages being received and sent are asynchronous. If my assumption is not true and the stack is not thread safe, the software may work but randomly crash or do other odd things if this design is used.
I have NDK version 2_23_01_01, TI-RTOS version 2_01_00_06, and CCS 6.0.1.00040.
I have been reading the two documents found in the folder
\tirtos_tivac_2_01_00_03\products\ndk_2_23_01_01\docs
I have only seen real simple examples of the NDK using sockets like the tcpEcho example provided with some of the TivaC boards. Would using two tasks for each sockets be the recommend approach for the NDK stack or is there a better way this should be implemented?
Thanks,
Doug