Problem With The ISR of AD Card - VxWorks

This is a discussion on Problem With The ISR of AD Card - VxWorks ; I have written a ISR of AD card ,but the problem is when I take off the AD card from pc104, and run the following Program ,the ISR still will run,and read out data 65280! I really don't know why! ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Problem With The ISR of AD Card

  1. Problem With The ISR of AD Card

    I have written a ISR of AD card ,but the problem is when I take off
    the AD card from pc104, and run the following Program ,the ISR still
    will run,and read out data 65280! I really don't know why! Do you help
    me solve this question?

    #include "vxWorks.h"
    #include "strLib.h"
    #include "sysLib.h"
    #include "ioLib.h"
    #include "stdio.h"
    #include "stdlib.h"
    #include "intLib.h"
    #include "logLib.h"
    #include


    #ifndef BYTE
    #define BYTE unsigned char
    #endif

    UCHAR RecvDataLSB;
    UCHAR RecvDataMSB;

    int Data;
    int i;
    int base=0x300; //base address of AD card is 0x300
    int irqNum=0x09; //the int level is 9


    void adISR(void);
    STATUS ISRinstall(void);




    STATUS AdTest(void) //the main function ,add the ISR and initial
    the AD card.
    { //
    sysOutByte(base+2,0x77);
    sysOutByte(base+9,0x0);
    sysOutByte(base+10,0x21);
    sysOutByte(base+11,0x08);
    if(ISRinstall()!=OK) // add the ISR
    {
    printf("the ISR install failed!\n");
    return(ERROR);
    }
    sysIntEnablePIC(irqNum); // open the int number of 8259A
    }


    STATUS ISRinstall(void) //this function is used to add the ISR
    {
    UINT32 uiIntVec;
    BYTE irqNum;
    uiIntVec=(UINT32)(INUM_TO_IVEC(irqNum+0x20));
    if(intConnect((VOIDFUNCPTR*)uiIntVec,(VOIDFUNCPTR) adISR,0)!=OK)
    return(ERROR);
    else
    return(OK);
    }


    void adISR(void) // THE ISR
    {
    sysBusIntAck(irqNum);
    RecvDataLSB=sysInByte(base+0);
    RecvDataMSB=sysInByte(base+1);
    Data=(int)RecvDataMSB*255+(int)RecvDataLSB;
    logMsg("the Recv Data:%d\n",Data,2,3,4,5,6);
    sysOutByte(base+8,1);
    }


  2. Re: Problem With The ISR of AD Card

    ycoco.Dong@gmail.com wrote:
    > I have written a ISR of AD card ,but the problem is when I take off
    > the AD card from pc104, and run the following Program ,the ISR still
    > will run,and read out data 65280! I really don't know why! Do you help
    > me solve this question?
    >
    > #include "vxWorks.h"
    > #include "strLib.h"
    > #include "sysLib.h"
    > #include "ioLib.h"
    > #include "stdio.h"
    > #include "stdlib.h"
    > #include "intLib.h"
    > #include "logLib.h"
    > #include
    >
    >
    > #ifndef BYTE
    > #define BYTE unsigned char
    > #endif
    >
    > UCHAR RecvDataLSB;
    > UCHAR RecvDataMSB;
    >
    > int Data;
    > int i;
    > int base=0x300; //base address of AD card is 0x300
    > int irqNum=0x09; //the int level is 9
    >
    >
    > void adISR(void);
    > STATUS ISRinstall(void);
    >
    >
    >
    >
    > STATUS AdTest(void) //the main function ,add the ISR and initial
    > the AD card.
    > { //
    > sysOutByte(base+2,0x77);
    > sysOutByte(base+9,0x0);
    > sysOutByte(base+10,0x21);
    > sysOutByte(base+11,0x08);
    > if(ISRinstall()!=OK) // add the ISR
    > {
    > printf("the ISR install failed!\n");
    > return(ERROR);
    > }
    > sysIntEnablePIC(irqNum); // open the int number of 8259A
    > }
    >
    >
    > STATUS ISRinstall(void) //this function is used to add the ISR
    > {
    > UINT32 uiIntVec;
    > BYTE irqNum;
    > uiIntVec=(UINT32)(INUM_TO_IVEC(irqNum+0x20));
    > if(intConnect((VOIDFUNCPTR*)uiIntVec,(VOIDFUNCPTR) adISR,0)!=OK)
    > return(ERROR);
    > else
    > return(OK);
    > }
    >
    >
    > void adISR(void) // THE ISR
    > {
    > sysBusIntAck(irqNum);
    > RecvDataLSB=sysInByte(base+0);
    > RecvDataMSB=sysInByte(base+1);
    > Data=(int)RecvDataMSB*255+(int)RecvDataLSB;
    > logMsg("the Recv Data:%d\n",Data,2,3,4,5,6);
    > sysOutByte(base+8,1);
    > }
    >


    When the card is removed, the interrupt signal is still high (or low) so
    that the interrupt controller think that there is always an interrupt.
    You should add a detection test of the AD card and then only enable the
    interrupt if available.


+ Reply to Thread