Skip to main content
Visitor II
January 30, 2008
Question

MAC DMA to EMI?

  • January 30, 2008
  • 5 replies
  • 1145 views
Posted on January 30, 2008 at 04:34

MAC DMA to EMI?

    This topic has been closed for replies.

    5 replies

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:49

    Is it possible to DMA from the MAC directly to memory attached

    via EMI? I can't find anywhere in the documentation that

    explicitly states if this is possible or not. I know that

    the general purpose DMA can do it but what about the DMA

    assigned to the ethernet MAC?

    Thanks in Advance,

    Victor

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:49

    Nobody knows?? Bummer. The 96k of SRAM is not a huge

    amount of memory and maintaining TCP connections with

    3 concurrent hosts will mean we need way more than

    the STR9 has which is why we are hanging memory

    off of the EMI for network buffering.

    So far the only way I can see to implement this is

    to have TX/RX buffers in SRAM and then move

    the data to external mem. It would be great though

    if the MAC could transfer it to external memory

    without processor intervention.

    Any ideas?

    Victor Valencia

    Element Labs

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:49

    That is essentially what we do (but in reverse):

    * external device writes to asynchronous FIFO part

    * STR912 DMA via EMI to SRAM (in 1k chunks)

    * then use ENET library ENET_TxPkt( void * ppkt, u16 size )

    which I've modified to have multiple ENET descriptors (note: search for other threads regarding this)

    void ENET_TxDscrInit(void)

    {

    u32 currIndex; // index to the current descriptor

    u32 nextIndex = 0; // index to the start of the next descriptor in the

    // chain

    u8 * pNextBuffer; // pointer to the RX next buffer in memeory

    ENET_DMADSCRBase * pCurrentDescr;

    ENET_DMADSCRBase * pNextDescr;

    for ( currIndex = 0; currIndex < NUM_TX_BUFFERS; ++currIndex )

    {

    if ( (++nextIndex) == NUM_TX_BUFFERS ) // for the last descriptor

    nextIndex = 0; // loop back to the first buffer.

    pCurrentDescr = &dmaTxDscrBase[ currIndex ];

    pNextDescr = &dmaTxDscrBase[ nextIndex ];

    pNextBuffer = (u8*)(TxBuff + (currIndex * EMAC_MAX_PACKET_SIZE));

    /* Initialize ENET status and control */

    pCurrentDescr->dmaStatCntl = 0;

    /* ENET Start Address */

    pCurrentDescr->dmaAddr = (u32)pNextBuffer;

    /* Next Descriptor Address */

    pCurrentDescr->dmaNext = (u32)pNextDescr | DMA_DSCR_NXT_NPOL_EN;

    /* Setting the VALID bit */

    pCurrentDescr->dmaPackStatus = 0;//DMA_DSCR_TX_STATUS_VALID_MSK;

    }

    TxDscrIndex = 0;

    /* Tx next set to Tx decriptor base */

    ENET_DMA->TXNDAR = (u32)&(dmaTxDscrBase);

    /* Enable next enable */

    ENET_DMA->TXNDAR |= DMA_DSCR_NXT_NPOL_EN;

    }

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:49

    Thanks for the response. I think that our situation is

    not quite the same in that you are using the general

    purpose DMA engine to transfer from EMI. I want to

    transfer from SRAM to EMI using the MAC-DMA channel. Maybe it will

    work anyway. I don't know.

    Victor

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:49

    Unless i am mistaken on what you are trying todo - internal SRAM to external memory is just a memory to memory transfer.

    The fact that you are using emi does not matter - it is a memory mapped device.

    Cheers

    Spen