4.5. Network Interface
4.5.1. Module Files
4.5.1.1. Portable
src/os/freertos/freertos-plus/freertos-plus-tcp/source/portable/NetworkInterface/tms570lc435/NetworkInterface.csrc/os/freertos/freertos-plus/freertos-plus-tcp/source/include/NetworkInterface.h
4.5.2. Description
The NetworkInterface module serves as the hardware abstraction layer between the FreeRTOS+TCP networking stack and the TI TMS570 EMAC hardware. It manages:
Hardware initialization of the EMAC and PHY
Transmission of Ethernet frames from the TCP stack to the hardware
Reception of Ethernet frames from the hardware to the TCP stack
Memory management for network buffers
PHY link status monitoring
4.5.2.1. Connecting to the application
Figure Fig. 4.4 shows the connection of the FreeRTOS-Plus-TCP stack with the rest of the software.
Fig. 4.4 Connection of the FreeRTOS-Plus-TCP stack with the software
The application is connected via berkley sockets to the TCP/IP stack. It offers funktions like:
Create sockets: Establish communication endpoints for sending and receiving data.
Send and receive data: Transmit data to other devices or receive data from them.
Establish and manage TCP connections: Connect to servers, listen for incoming connections, and accept connections from clients.
The Event queue handles messages and requests to the IP-Task. This is especially relevant for the Receive Task. This is also used to inform the application of Network events.
The Network Interface is the connecting element to the hardware drivers and responsible for the buffer management.
The Receive Task: This task works as deferred interrupt handler that is waiting for incoming network traffic.
4.5.2.2. Integration with FreeRTOS+TCP Stack
The Network Interface module integrates with the FreeRTOS+TCP stack by
implementing the required network interface callback functions.
These functions are registered through the NIC_FillInterfaceDescriptor
function which populates a NetworkInterface_t structure that is then added to
the TCP stack via FreeRTOS_AddNetworkInterface.
4.5.2.3. Memory Management
The module manages two separate memory pools:
EMAC Buffers: Managed internally by the EMAC driver for hardware operations.
FreeRTOS Buffers: Static array nic_networkBuffers allocated specifically for FreeRTOS network buffer descriptors.
4.5.2.4. Limitations
Currently supports only single-packet messages (no fragmentation)
Uses statically allocated buffers
Supports only one network interface instance