locked
Issue about catching Interrupt Event on WinCE 6.0 RRS feed

  • Question

  • We need to write an application to catch Interrupt Event on WinCE 6.0 for receiving data.
    We had already prove the following codes on WinCE 5.0 is workable now.
    Because our WinCE 6.0 move "InterruptInitialize" to Kernel API, we cannot call this function within our application.
    Does any body have any experiences on this kind of IRQ handling issue ?
    How to migrate this program to WinCE 6.0 ?

    HANDLE hCANInterrupt ;    
    HANDLE   hCANInterruptThread ;
    DWORD dwCANSysintr;

    dwCANIrq = 10; //IRQ 10

    BOOL CAN_Interrupt_init()
    {
        hCANInterruptEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
        if( hCANInterruptEvent==NULL)
        {
              return (FALSE);
        }
        dwCANSysintr=dwCANIrq+0x10;
        result = InterruptInitialize((DWORD)(dwCANSysintr),(HANDLE)hCANInterruptEvent, NULL, 0);
        if(!result)
        {
              return (FALSE);
        }
        hCANInterruptThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) CANThread, NULL, 0, NULL);
        if ( hCAN2InterruptThread == NULL )
        {
              return (FALSE);
        }
        return(TRUE);


    DWORD CANThread()
    {
        DWORD dwTimeout ;
        DWORD dwResult;
        dwTimeout = INFINITE;
         while(TRUE)
        {
          dwResult = WaitForSingleObject( hCANInterruptEvent, dwTimeout );
          if(dwResult!=WAIT_OBJECT_0)
              { // Get Event from Encoder
                   return 0;
              }
          AfxMessageBox(_T("Got Event 1!"),NULL,NULL);
          Sleep(10);
          InterruptDone(dwCANSysintr);
        } // while
    }

    Lawrance Yang from AAEON
    Monday, January 19, 2009 6:04 AM

Answers

All replies

  • We need to write an application to catch Interrupt Event on WinCE 6.0 for receiving data.
    We had already prove the following codes on WinCE 5.0 is workable now.
    Because our WinCE 6.0 move "InterruptInitialize" to Kernel API, we cannot call this function within our application.
    Does any body have any experiences on this kind of IRQ handling issue ?
    How to migrate this program to WinCE 6.0 ?

    HANDLE hCANInterrupt ;    
    HANDLE   hCANInterruptThread ;
    DWORD dwCANSysintr;

    dwCANIrq = 10; //IRQ 10

    BOOL CAN_Interrupt_init()
    {
        hCANInterruptEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
        if( hCANInterruptEvent==NULL)
        {
              return (FALSE);
        }
        dwCANSysintr=dwCANIrq+0x10;
        result = InterruptInitialize((DWORD)(dwCANSysintr),(HANDLE)hCANInterruptEvent, NULL, 0);
        if(!result)
        {
              return (FALSE);
        }
        hCANInterruptThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) CANThread, NULL, 0, NULL);
        if ( hCAN2InterruptThread == NULL )
        {
              return (FALSE);
        }
        return(TRUE);


    DWORD CANThread()
    {
        DWORD dwTimeout ;
        DWORD dwResult;
        dwTimeout = INFINITE;
         while(TRUE)
        {
          dwResult = WaitForSingleObject( hCANInterruptEvent, dwTimeout );
          if(dwResult!=WAIT_OBJECT_0)
              { // Get Event from Encoder
                   return 0;
              }
          AfxMessageBox(_T("Got Event 1!"),NULL,NULL);
          Sleep(10);
          InterruptDone(dwCANSysintr);
        } // while
    }


    Lawrance Yang from AAEON
    Monday, January 19, 2009 6:02 AM
  • Monday, January 19, 2009 11:34 AM