Alexandru Nan

How to Install New Hardware Intrerrupts in MQX

Discussion created by Alexandru Nan on Feb 13, 2012
Latest reply on Sep 11, 2013 by pritam bansod

I try to make a DMA UART transfer and it works ok. But the problem is in the program i try to put an Intrerrupt for DMA Complete but it doesn't work the interrupt, when I check with the debugger the status for registers them looks ok. Then i tryed to make a button interrupt without MQX GIPIO driver only hardware interrupt. But this to don't work.

 

The function int_install_isr it's returning the value for ISR ok, i don't receive a NULL pointer.

THis matter drive me crazy !!

Then I try to build my interrupt configuration based on isr.c example from MQX examples.

 

This is the code for ISR

void sw2_isr(pointer user_isr_ptr){   MY_ISR_STRUCT_PTR  isr_ptr;   isr_ptr = (MY_ISR_STRUCT_PTR)user_isr_ptr;   /* Chain to the previous notifier */   (*isr_ptr->OLD_ISR)(isr_ptr->OLD_ISR_DATA);   printf("SW2 ISR\n");   PORTE_ISFR=0xFFFFFFFF; //Clear Flags on Port E ISR Flag Register}//ANd DMA ISR CODEvoid dma5_isr(pointer data){  if(DMA_ES_REG(DMA_BASE_PTR)&DMA_ES_VLD_MASK == 1)  printf("Eroarre"); else  printf("Intrerupere"); DMA_CERQ=DMA_CERQ_CERQ(5); DMA_CINT=DMA_CINT_CINT(5);
}

 And This is the code for the task and initialization of the isr's functions

 

void uart5_dma_task(uint_32 data){  //Local Variables MY_ISR_STRUCT_PTR  isr_ptr; MQX_FILE_PTR port_file_sw1; int *isr; uint8_t uint8_dma_channel=5; char c,i=0; enable_dma_clocks(); gpio_init_isr_porte();      /* port_file_sw1=fopen("gpio:input",(char *)&SW1);   if(port_file_sw1!=NULL)   {printf("IRQ  1 SET\n");    _io_ioctl(port_file_sw1,GPIO_IOCTL_SET_IRQ_FUNCTION,(char *)irq_sw1);}*/    //Enable DMA Channel 5 with UART5-RX (12) intrerrupt surce. enable_dmamux(uint8_dma_channel,UART5_DMA_RX_DMAMUX); uart5_dma_init(UART5_BASE_PTR,BSP_BUS_CLOCK_KHZ,UART5_BAUD_RATE);    isr_ptr = _mem_alloc_zero((_mem_size)sizeof(MY_ISR_STRUCT));    isr_ptr->OLD_ISR_DATA =_int_get_isr_data(INT_PORTE);    isr_ptr->OLD_ISR=_int_get_isr(INT_PORTE);    if(!_int_install_isr(INT_PORTE, sw2_isr, isr_ptr))     printf("Esuare Instalare ISR\n");    isr_ptr->OLD_ISR=_int_get_isr(DMA5_ISR_VECTOR);    if(!_int_install_isr(DMA5_ISR_VECTOR,dma5_isr,isr_ptr))     printf("Esuare Instalare DMA5 ISR\n"); printf("ISR NEINITIALIZAT=0x%x\n",isr); isr=(int *)_int_get_isr(DMA5_ISR_VECTOR); printf("ISR pentru DMA5 =0x%x\n",isr); isr=(int *)_int_get_isr(UART5_RX_TX_ISR_VECTOR); printf("ISR pentru UART5 =0x%x\n",isr); uart_putchar(UART5_BASE_PTR,'c'); dma_config_start(uint8_dma_channel); _int_enable(); while(1) {   }}

 And the header and defines are here used in the uart5_dma_task :

#define UART5_RX_TX_ISR_VECTOR 71#define DMA5_ISR_VECTOR 21#define PORTE_ISR_VECTOR 107#define UART5_DMA_RX_DMAMUX 12#define UART5_DMA_TX_DMAMUX 13#define BUFFER_LENGHT 100#define SW_1 (GPIO_PORT_A | GPIO_PIN19)#define SW_2 (GPIO_PORT_E | GPIO_PIN26)void uart5_dma_init(UART_MemMapPtr uartch, int sysclk, int baud);extern void uart5_dma_task(uint_32 data);extern void isr_dma5( void );extern void uart_isr( UART_MemMapPtr base );extern void sw2_isr(pointer);

 

Outcomes