Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

Can anybody help me?

Hi All,

I am testing DMA in my project, but when compiling the c kode, i get some Errors i dont understand.

error: `ALT_IRQ_NOT_CONNECTED' undeclared (first use in this function)[system_description/alt_sys_init.c]

the file alt_dev.h contains a line:# define ALT_IRQ_NOT_CONNECTED (-1)

Can anybody help me?

my c kode is shown below:

# include "ALTERA_AVALON_PIO_REGS.H"# include <stdio.h># include <stddef.h># include <stdlib.h># include "system.h"# include <alt_dev.h># include "alt_types.h"# include "sys/alt_dma.h"

/* Global DMA "transaction finished" flag */

volatile int rx_done = 0;

static volatile long sour[100];

volatile long *pram2= (long*)RAM2_BASE;

unsigned int offset;

int rc;

static void dma_done (void* handle, void* data)

{

rx_done++;

}

static int MemDMATest(unsigned int memory_base, unsigned int nBytes)

{

alt_dma_txchan txchan;

alt_dma_rxchan rxchan;

/* Create the transmit channel */

if ((txchan = alt_dma_txchan_open("/dev/dma_0")) == NULL)

{

//printf ("Failed to open transmit channel\n");

exit (1);

}

/* Create the receive channel */

if ((rxchan = alt_dma_rxchan_open("/dev/dma_0")) == NULL)

{

//printf ("Failed to open receive channel\n");

exit (1);

}

//* Use DMA to transfer from write buffer to memory under test */

/* Post the transmit request */

if ((rc = alt_dma_txchan_send (txchan, (void*) sour, sizeof(sour) x sizeof(long) , NULL, NULL)) < 0)

{

// printf ("Failed to post transmit request, reason = %i\n", rc);

exit (1);

}

/* Post the receive request */

if ((rc = alt_dma_rxchan_prepare (rxchan,(void*)pram2 , sizeof(sour) x sizeof(long), dma_done, NULL)) < 0)

{

//printf ("Failed to post read request, reason = %i\n", rc);

exit (1);

}

/* Wait for transfer to complete */

while (!rx_done);

rx_done = 0;

/* Use DMA to read data back into read buffer from memory under test */

/* Post the transmit request */

if ((rc = alt_dma_txchan_send (txchan,(void*)pram2 , sizeof(sour) x sizeof(long), NULL, NULL)) < 0)

{

// printf ("Failed to post transmit request, reason = %i\n", rc);

exit (1);

}

/* Post the receive request */

if ((rc = alt_dma_rxchan_prepare (rxchan, (void*) sour, sizeof(sour) x sizeof(long), dma_done, NULL)) < 0)

{

// printf ("Failed to post read request, reason = %i\n", rc);

exit (1);

}

/* Wait for transfer to complete */

while (!rx_done);

rx_done = 0;

}

int main(void)

{

MemDMATest(memory_base, nBytes);

}

return (0);

}

SEMIR

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    This probably means that you didn&#39;t connect up the IRQ to one of your peripherals when you ran SOPC builder. Have a look in system.h to find out which one.

    If this doesn&#39;t help then please post your system.h here.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    It looks like you were close to answering your own question. The file altera_avalon_dma.h is missing the line:

    # include "sys/alt_dev.h"

    if you add that in, the error will go away.

    Alternatively, you will find that this problem will also disapear if you include either a JTAG_UART or UART in your design (since these drivers will include the missing header for you).