This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Writing Code to Interface to the EMAC driver Generated by HALCoGen

Other Parts Discussed in Thread: HALCOGEN

Does anyone know if there is a document that describes how to interface an IP stack to the EMAC device driver generated by HALCoGen? I'm trying to interface the FreeRTOS+UDP network stack to the device driver for an RM46 - the device driver is generated by HALCoGen. I reviewed the section in the Technical Reference Manual, but there is nothing in there about the driver generated by HALCoGen. I suppose I could look at what is done in the LwIP stack. Thanks in advance for your help.

Ray

  • Ray,

    There is a wiki page that describes with example how to use Halcogen and lwIP.

    Here is the link.

    You will find at the end of the page 2 links to download the demo code.

    Please let me know if this is useful.

  • Jean-Marc,

    I'm aware of the LwIP Wiki page, but there is no document describing the interface to the HALCoGen emac device driver (emac.c). I'm trying to integrate a "thread aware" IP stack designed to run under FreeROTS and I need specific information on how the device driver manages DMA buffers that can be used to implement a "zero copy" version of the IP stack. The IP stack itself manages buffer descriptors and buffers as most stacks do, but I'm assuming I can send received data directly to the IP stack by passing a DMA buffer pointer - not copying the data to a network stack buffer. Are you aware of any documentation that can help me? Ideally, I'd like to share DMA buffers between the network stack and the device driver to make things as efficient as possible.

    Thanks,

    Ray

  • Ray,

    I will have to ask some other people to see if we have any additional document to help you.

    Thanks.

  • Jean-Marc,

    Have you gotten a response from the HALCoGen developers? I'm considering implementing a simpler interface to the emac device driver by not sharing DMA buffers with the network stack for the short term. I'd like, however, to get any documentation if it can be made available. Obviously I could reverse engineer the interface from the HALCoGen source code, but I'd like to avoid any behavioral issues that I might not be aware of.

    Thanks,

    Ray

  • Hi Ray,

    There is no formal document for creating an interface with the driver for an IP stack. However, as Jean-Marc mentioned, you could look at the lwIP demo's implementation, though I'd add that large parts of the "port" part of the code were created a while ago, and much of that code is now part of the driver.

    Coming specifically to DMA buffers, you could look at the EMACReceive, EMACTransmit and EMACDMAInit APIs, to see how the driver deals with buffer descriptors and how it uses the EMAC RAM. I'm not entirely sure if this is what you're looking for, but if you could come back with any queries that you might have.

    On a side note, if you've allocated DMA buffers from the start, it should be possible to share them between the network stack and the driver. Right now, a large byte array is statically allocated in the driver( based on how many packets the application wants to support) and receive descriptors to this are initialized in EMACDMAInit. You could use the same code to initialize any buffers that you've allocated in your case.

    Hope this helps. Let me know if you have any queries.


    Thanks and Regards,

    Chaitanya