Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

SGDMA descriptor list questions

Altera_Forum
Honored Contributor II
1,096 Views

I want to build a descriptor linked list to transfer data form memory to TSE MAC.If I build one descriptor there's no problem.If I build more than one descriptors no data was transfered.Is there anybody tell me why? 

this is the code: 

alt_avalon_sgdma_register_callback(pM_Context->mac_mi.tx_sgdma, 

&sgdma_transmit_callback_function, 

( ALTERA_AVALON_SGDMA_CONTROL_IE_GLOBAL_MSK |ALTERA_AVALON_SGDMA_CONTROL_IE_CHAIN_COMPLETED_MSK) 

pM_Context); 

 

for(i=0;i<ASYNC_TRANS_DESC_MAX;i++)//|| 

printf("config descrip \n"); 

p_write = pM_Context->Frame_List.Pbuffer[pM_Context->Frame_List.rear]+pM_Context->Frame_List.offset; 

pM_Context->Frame_List.offset += pM_Context->Frame_List.packetsize; 

pM_Context->Frame_List.framesubnum++; 

//packet_length = pM_Context->Frame_List.packetsize; 

alt_avalon_sgdma_construct_mem_to_stream_desc(&pM_Context->Current_desc[i], // descriptor 

&pM_Context->Current_desc[i+1], // next descriptor 

(alt_u32 *)p_write, // read buffer location 

(pM_Context->Frame_List.packetsize), // length of the buffer 

0, // reads are not from a fixed location 

1, // start of packet is enabled for the Avalon-ST interfaces 

1, // end of packet is enabled for the Avalon-ST interfaces, 

0); // there is only one channel 

 

 

 

alt_avalon_sgdma_do_async_transfer(pM_Context->mac_mi.tx_sgdma, 

pM_Context->Current_desc);
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
407 Views

for(tse_ptr->chain_loop = 0; tse_ptr->chain_loop < ALTERA_TSE_SGDMA_RX_DESC_CHAIN_SIZE; tse_ptr->chain_loop++) 

{  

tse_ptr->pkt_array[tse_ptr->chain_loop] = pk_alloc(ALTERA_TSE_PKT_INIT_LEN+4); 

 

if (!tse_ptr->pkt_array[tse_ptr->chain_loop]) /* couldn't get a free buffer for rx */ 

dprintf("[tse_sgdma_read_init] Fatal error: No free packet buffers for RX\n"); 

tse_ptr->netp->n_mib->ifInDiscards++; 

 

return ENP_NOBUFFER; 

 

// ensure bit-31 of tse_ptr->pkt_array[tse_ptr->chain_loop]->nb_buff is clear before passing 

// to SGDMA Driver 

uncached_packet_payload = (alt_u32 *)alt_remap_cached ((volatile void*) tse_ptr->pkt_array[tse_ptr->chain_loop]->nb_buff, 4); 

 

alt_avalon_sgdma_construct_stream_to_mem_desc( 

(alt_sgdma_descriptor *) &tse_ptr->desc[tse_ptr->chain_loop+ALTERA_TSE_FIRST_RX_SGDMA_DESC_OFST], // descriptor I want to work with 

(alt_sgdma_descriptor *) &tse_ptr->desc[tse_ptr->chain_loop+ALTERA_TSE_SECOND_RX_SGDMA_DESC_OFST], // pointer to "next" 

uncached_packet_payload, // tse_ptr->pkt_array[tse_ptr->chain_loop]->nb_buff, // starting write_address 

0, // read until EOP 

0); // don't write to constant address 

 

 

I find the code in the TSE MAC IP.
0 Kudos
Altera_Forum
Honored Contributor II
407 Views

I'm trying the same thing... have you come to a solution?

0 Kudos
Reply