Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

This figure shows a simplified task model of µC/TCP-IP when packets are received from the device.

Error rendering macro 'panel' : com.atlassian.renderer.v2.macro.basic.validator.MacroParameterValidationException: Border style is not a valid CSS2 border-style value
  1. A packet is sent on the network and the device recognizes its address as the destination for the packet. The device then generates an interrupt and the BSP global ISR handler is called for non-vectored interrupt controllers. Either the global ISR handler or the vectored interrupt controller calls the Net BSP device specific ISR handler, which in turn indirectly calls the device ISR handler using a predefined Net IF function call. The device ISR handler determines that the interrupt comes from a packet reception (as opposed to the completion of a transmission).

  2. Instead of processing the received packet directly from the ISR, it was decided to pass the responsibility to a task. The Rx ISR therefore simply “signals” the Receive task by posting the interface number to the Receive task queue. Note that further Rx interrupts are generally disabled while processing the interrupt within the device ISR handler.

  3. The Receive task does nothing until a signal is received from the Rx ISR.

  4. When a signal is received from an Ethernet device, the Receive task wakes up and extracts the packet from the hardware and places it in a receive buffer. For DMA based devices, the receive descriptor buffer pointer is updated to point to a new data area and the pointer to the receive packet is passed to higher layers for processing.

  5. µC/TCP-IP maintains three types of device buffers: small transmit, large transmit, and large receive. For a common Ethernet configuration, a small transmit buffer typically holds up to 256 bytes of data, a large transmit buffer up to 1500 bytes of data, and a large receive buffer 1500 bytes of data. Note that the large transmit buffer size is generally specified within the device configuration as 1594 or 1614 bytes (see Chapter 9, “Buffer Management” for a precise definition). The additional space is used to hold additional protocol header data. These sizes as well as the quantity of these buffers are configurable for each interface during either compile time or run time.

    Buffers are shared resources and any access to those or any other µC/TCP-IP data structures is guarded by the binary semaphore that guards the data. This means that the Receive task will need to acquire the semaphore before it can receive a buffer from the pool.

  6. The Receive task gets a buffer from the buffer pool. The packet is removed from the device and placed in the buffer for further processing. For DMA, the acquired buffer pointer replaces the descriptor buffer pointer that received the current frame. The pointer to the received frame is passed to higher layers for further processing.

  7. The Receive task examines received data via the appropriate link layer protocol and determines whether the packet is destined for the ARP or IP layer, and passes the buffer to the appropriate layer for further processing. Note that the Receive task brings the data all the way up to the application layer and therefore the appropriate µC/TCP-IP functions operate within the context of the Receive task.

  8. When the packet is processed, the lock is released and the Receive task waits for the next packet to be received.


  • No labels