...
Listing - Ethernet Device Configuration shows a sample Ethernet configuration structure for Ethernet devices.
Ethernet PHY Configuration
Listing - Ethernet PHY Configuration shows a typical Ethernet PHY configuration structure.
Wireless Device Configuration
Loopback Configuration
Configuring the loopback interface requires only a memory configuration, as described in µC/TCP-IP Network Interface Configuration.
Listing 5-9 shows a sample configuration structure for the loopback interface.Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
const NET_DEV_CFG_ETHER NetDev_Cfg_Dev1_0 = {
/* Structure member: */
NET_IF_MEM_TYPE_MAIN, /* .RxBufPoolType */ (1)
1518u, /* .RxBufLargeSize */
10u, /* .RxBufLargeNbr */
4u, /* .RxBufAlignOctets */
0u, /* .RxBufIxOffset */
NET_IF_MEM_TYPE_MAIN, /* .TxBufPoolType */
1606u, /* .TxBufLargeSize */
4u, /* .TxBufLargeNbr */
64u, /* .TxBufSmallSize */
4u, /* .TxBufSmallNbr */
4u, /* .TxBufAlignOctets */
0u, /* .TxBufIxOffset */
0x00000000u, /* .MemAddr */
0u, /* .MemSize */
NET_DEV_CFG_FLAG_NONE, /* .Flag */
6u, /* .RxDescNbr */ (2)
6u, /* .TxDescNbr */ (3)
0x40028000u, /* .BaseAddr */ (4)
0u, /* .DataBusSizeNbrBits */ (5)
"00:50:C2:25:61:00", /* .HW_AddrStr */ (6)
}; |
Panel | ||
---|---|---|
| ||
|
Ethernet PHY Configuration
Listing - Ethernet PHY Configuration shows a typical Ethernet PHY configuration structure.
Panel | ||||
---|---|---|---|---|
| ||||
|
Panel | ||
---|---|---|
| ||
|
Wireless Device Configuration
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
const NET_DEV_CFG_WIFI NetDev_Cfg_WiFi_0 = {
/* Structure member: */
NET_IF_MEM_TYPE_MAIN, /* .RxBufPoolType */ (1)
1518u, /* .RxBufLargeSize */
9u, /* .RxBufLargeNbr */
16u, /* .RxBufAlignOctets */
0u, /* .RxBufIxOffset */
NET_IF_MEM_TYPE_MAIN, /* .TxBufPoolType */
1606u, /* .TxBufLargeSize */
4u, /* .TxBufLargeNbr */
64u, /* .TxBufSmallSize */
2u, /* .TxBufSmallNbr */
16u, /* .TxBufAlignOctets */
0u, /* .TxBufIxOffset */
0x00000000u, /* .MemAddr */
0u, /* .MemSize */
NET_DEV_CFG_FLAG_NONE, /* .Flag */
NET_DEV_BAND_DUAL, /* .Band */ (2)
25000000L, /* .SPI_ClkFreq */ (3)
NET_DEV_SPI_CLK_POL_INACTIVE_HIGH, /* .SPI_ClkPol */ (4)
NET_DEV_SPI_CLK_PHASE_FALLING_EDGE, /* .SPI_ClkPhase */ (5)
NET_DEV_SPI_XFER_UNIT_LEN_8_BITS, /* .SPI_XferUnitLen */ (6)
NET_DEV_SPI_XFER_SHIFT_DIR_FIRST_MSB, /* .SPI_XferShiftDir */ (7)
"00:50:C2:25:60:02", /* .HW_AddrStr */ (8)
}; |
Panel | ||
---|---|---|
| ||
|
Loopback Configuration
Configuring the loopback interface requires only a memory configuration, as described in µC/TCP-IP Network Interface Configuration.
Listing 5-9 shows a sample configuration structure for the loopback interface.
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
const NET_IF_CFG_LOOPBACK NetIF_Cfg_Loopback = {
NET_IF_MEM_TYPE_MAIN, (1)
1518, (2)
10, (3)
4, (4)
0, (5)
NET_IF_MEM_TYPE_MAIN, (6)
1594, (7)
5, (8)
64, (9)
5, (10)
4, (11)
0, (12)
0x00000000, (13)
0, (14)
NET_DEV_CFG_FLAG_NONE (15)
}; |
Panel | ||
---|---|---|
| ||
|
Adding a Loopback Interface
Basically, to enable and add the loopback interface you only have to enable the loopback interface within the network configuration See Network Interfaces Configuration.
Network Queues Configuration
The device configuration will directly impact the Network Task Queues Configuration.
The µC/TCP-IP stack includes two queues. The first one is the Rx queue and is used to store the Rx buffer that have been filled and are ready to be process. The second queue is the Tx deallocation and is used to store the Tx buffers that are ready to be deallocate.
The size of the Rx queue should reflects the total number of DMA receive descriptors configured for all the interfaces. If the devices are not DMA-based, it should reflects the maximum number of packets that can be acknowledged and signaled during a single receive interrupt even for all interfaces.
The size of the Tx queue should be defined as the total number of small and large transmit buffers declared for all interfaces.
Please refer to section Task Queue Configuration for more details.