Hi, I downloaded the latest LWIP. It somewhat works in that I have to start two cmd shells and send ping requests from both so that the second will "unbuffer" the first. I tried replacing the err_t tse_mac_raw_send(struct netif *netif, struct pbuf *pkt) with yours above, but the compiler complains that
ALT_LINK_ERROR("alt_remap_uncached() is not available because Nios II Gen2 cores with data caches don't support mixing cacheable and uncacheable data on the same line.");
From alt_remap_uncached.c
I tried putting it back to use
ActualData = (void*)(((alt_u32)data)); which does compile but does not actually reply to the ping.
below is the tse_mac_raw_send() found in the latest lwip lwip_tse_mac.c
I am not sure if this is causing the issue, it seems like the packet is coming in and getting buffered until the next packet arrives that is why having 2 ping running makes everything appear to work.
Does this make sense? I may be completely wrong, any help is appreciated.
err_t tse_mac_raw_send_orig (struct netif *netif, struct pbuf *pkt)
{
int tx_length;
unsigned len;
struct pbuf *p;
alt_u32 *data;
tse_mac_trans_info *mi;
lwip_tse_info *tse_ptr;
struct ethernetif *ethernetif;
alt_u32 *ActualData;
/* Intermediate buffers used for temporary copy of frames that cannot be directrly DMA'ed*/
char buf2[1560];
ethernetif = netif->state;
tse_ptr = ethernetif->tse_info;
mi = &tse_ptr->mi;
for(p = pkt; p != NULL; p = p->next)
{
data = p->payload;
len = p->len;
// just in case we have an unaligned buffer, this should never occur
if(((unsigned long)data & 0x03) != 0)
{
/*
* Copy data to temporary buffer <buf2>. This is done because of alignment
* issues. The SGDMA cannot copy the data directly from (data + ETH_PAD_SIZE)
* because it needs a 32-bit aligned address space.
*/
memcpy(buf2,data,len);
data = (alt_u32 *)buf2;
}
// uncache the ethernet frame
ActualData = (void*)(((alt_u32)data));
/* Write data to Tx FIFO using the DMA */
alt_avalon_sgdma_construct_mem_to_stream_desc(
(alt_sgdma_descriptor *) &tse_ptr->desc[ALTERA_TSE_FIRST_TX_SGDMA_DESC_OFST], // descriptor I want to work with
(alt_sgdma_descriptor *) &tse_ptr->desc[ALTERA_TSE_SECOND_TX_SGDMA_DESC_OFST],// pointer to "next"
(alt_u32*)ActualData, // starting read address
(len), // # bytes
0, // don't read from constant address
p == pkt, // generate sop
p->next == NULL, // generate endofpacket signal
0); // atlantic channel (don't know/don't care: set to 0)
tx_length = tse_mac_sTxWrite(mi,&tse_ptr->desc[ALTERA_TSE_FIRST_TX_SGDMA_DESC_OFST]);
if (tx_length != p->len)
dprintf(("failed to send all bytes, send %d out of %d\r\n", tx_length, p->len));
ethernetif->bytes_sent += tx_length;
}
LINK_STATS_INC(link.xmit);
return ERR_OK;
}