Can someone tell me what's wrong with this?  It (or its equivalent) used
to work under the 0.6 version of RTLinux.  The symptom is that
intr_hndlr() never gets called.

A little background:  The 8255 board is a ComputerBoards DIO-24.  Its C0
pin is tied to the IREN pin to enable/disable the IRQ which I have on to
IRQ 3 (since I don't plan to use the ttyS1 port).

I'd appreciate any help.  It has me stumped!  Please reply directly.  I am
not subscribed to the mailing list.

Thanks, Ken


--------------------------------------------------------------------------
#include <rtl.h>
#include <rtl_fifo.h>
#include <asm/io.h>
#include "common.h"

unsigned int i3count = 0;
int put_errcnt = 0;

#define DIO_BASE        0x300
#define DIO_PORT(X)     (DIO_BASE + (X))
#define DIO_CTRL        (DIO_PORT(3))

#define ENA_DIO_IRQ     (outb(0, DIO_PORT(2)))
#define DIS_DIO_IRQ     (outb(1, DIO_PORT(2)))

unsigned int intr_hndlr(unsigned int irq, struct pt_regs *regs)
{
    /* this is the interrupt handler */

    ++i3count;                  /* count the interrupt */
    if (rtf_put(FIFO_NO, &i3count, sizeof(i3count)) != sizeof(i3count))
        ++put_errcnt;
    rtl_hard_enable_irq(3);     /* must re-enable handler */

    return 0;
}

int init_module(void)
{
    int e;

    outb_p(0x98, DIO_CTRL);     /* set 8255 mode */
    DIS_DIO_IRQ;
    
    if ((e = rtf_create(FIFO_NO, 1000)) != 0) return e;
    if ((e = rtl_request_irq(3, intr_hndlr)) != 0) {
        rtf_destroy(FIFO_NO);
        return e;
    }

    ENA_DIO_IRQ;
    rtl_hard_enable_irq (3);    /* and then in RTLinux */

    return 0;
}

void cleanup_module(void)
{
    rtl_hard_disable_irq(3);    /* disable interrupt in RTlinux */
    DIS_DIO_IRQ;
    rtl_free_irq(3);

    rtf_destroy(FIFO_NO);
    rtl_printf("i3count=%d, put_errcnt=%d\n", i3count, put_errcnt);
}

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to