Confused with emNet driver layer

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Confused with emNet driver layer

    Hello,
    I have read the UM07001 emNet User Guide & Reference Manual and source code including BSP_IP.c and IP_Config_K66_ETH.c.
    I learn that there are several port functions:
    • An user could define an structure IP_HW_DRIVER which including pointer pointing to init, send, receive functions and so on.
    • An user could define an structure BSP_IP_API which including pointer pointing to init, install ISR and so on.
    • An user could implement an function IP_X_Config, which calls the function IP_AddEtherInterface with the parameter IP_HW_DRIVER and IP_BSP_SetAPI with the parameter BSP_IP_API
    • Besides, there are several ISR implemented in the BSP_IP.c including ENET_Receive_IRQHandler, ENET_Transmit_IRQHandler and so on.
    I'm confused with the relation of IP_HW_DRIVER and BSP_IP_API and call relation from up to down layer.
    And I'm confused the data transmit process. Where is it recevied or sent? The functions inside the IP_HW_DRIVER or IRQHandler?
    Could you help to give more details?

    Thanks.
  • Hello SilentDawn,

    I will try to answer this in short as you are basically not under a valid SUA due to not having a license and you only use (parts of) an eval package.

    1. IP_Init() which is the main init function to call will call IP_X_Config() and afterwards the init callback of the driver.
    2. The driver calls the BSP_IP_API callbacks (that have been hooked in during IP_X_Config()) as necessary to handle non-generic hardware layer stuff like installing an ISR callback from inside the driver.
    3. When a packet is sent by the stack, the ENET_Transmit_IRQHandler[b] signals the end of the transmit and calls the registered ISR handler callback. This triggers another send if there is more to send.
    4. When a packet is received, the ENET_Receive_IRQHandler calls the same registered ISR handler callback (flags of what exactly happened are evaluated by the internal callback in the driver).
    5. For each packet received, the pfGetPacketSize() and pfReceivePacket() of IP_HW_DRIVER are called.
    Hope this gives you a first idea of how things are working together.

    Best regards,
    Oliver