Now SEEMS!! to be functioning...
http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/laugh.gif
I have noted that the IRQ call is not flushed after the ISR execution...
http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/mad.gif
In order to explain to the community I cut and paste the simple code I have created
for my UART "SERIALE_EXT" peripheral
I hope It will be usefull:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
# include <stdio.h># include "altera_avalon_uart_regs.h"# include "altera_avalon_uart.h"# include "sys/alt_irq.h"# include "system.h"
// Register the istance into the CPU //
ALTERA_AVALON_UART_INSTANCE( SERIALE_EXT, seriale_ext );
void handle_seriale_ext_interrupt (void *context, alt_u32 id);
int _serial_rcv_exception;
// ************************************************************************** //
// ************************************************************************** //
// MAIN Function //
int main (void)
{
// Initialize the IRQ on the UART selected //
ALTERA_AVALON_UART_INIT ( SERIALE_EXT, seriale_ext );
// Recast the _edge_capture pointer to match the alt_irq_register()
// function prototype.
void* serial_rcv_exception_ptr = (void*) &_serial_rcv_exception;
// Register the interrupt handler. //
alt_irq_register(SERIALE_EXT_IRQ, serial_rcv_exception_ptr, handle_seriale_ext_interrupt);
} // END MAIN //
// ************************************************************************** //
// ************************************************************************** //
// UART ISR Handling //
void handle_seriale_ext_interrupt (void *context, alt_u32 id)
{
// Cast context to _edge_capture's type.
// It is important to keep this volatile,
// to avoid compiler optimization issues.
volatile int* serial_rcv_exception_ptr = (volatile int*) context;
// Store the value in the Serial exception register in *context. //
*serial_rcv_exception_ptr = IORD_ALTERA_AVALON_UART_STATUS(SERIALE_EXT_BASE);
// Reset the Serial exception register. //
IOWR_ALTERA_AVALON_UART_STATUS(SERIALE_EXT_BASE, (*serial_rcv_exception_ptr & 0xFF7F));
// Print a simple message on the STDOUT peripheral //
printf("\rISR HAS BEEN\nEXECUTED!!!");
} // END handle_serial_ext_interrupt //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bye,
shadowice