Forum Discussion

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

example how to use a ISR at a UART?

Can some show me code where a ISR is used?

I want to go to a ISR when i recieved a char or more from a UART.

I can not find example's.

1 Reply

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

    Did you check the isr routine rs_interrupt in drivers/serial/NIOSserial.c?

    /*
     * This is the serial driver's generic interrupt routine
     */
    irqreturn_t rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
    {
        struct NIOS_serial * info = (struct NIOS_serial *) dev_id;
        np_uart *    uart= (np_uart *)(info->port);
        unsigned short stat = uart->np_uartstatus;
        uart->np_uartstatus = 0;  /* clear any error status */
        if (stat & np_uartstatus_rrdy_mask) receive_chars(info, regs, stat);
        if (stat & np_uartstatus_trdy_mask) transmit_chars(info);
        return IRQ_HANDLED;
    }