コード例 #1
0
ファイル: bsp.cpp プロジェクト: dizel3d/qpcpp
//............................................................................
void QF::onCleanup(void) {             // restore the original DOS vectors ...
    QF_INT_LOCK(dummy);
    _dos_setvect(TMR_VECTOR, l_dosTmrISR);
    _dos_setvect(KBD_VECTOR, l_dosKbdISR);
    QF_INT_UNLOCK(dummy);

    QS_EXIT();                                                      // exit QS
    _exit(0);                                                   // exit to DOS
}
コード例 #2
0
ファイル: bsp.c プロジェクト: christation/STM32491_CPLR
/*..........................................................................*/
void QF_onCleanup(void) {           /* restore the original DOS vectors ... */
    QF_INT_DISABLE();
    _dos_setvect(TMR_VECTOR, l_dosTmrISR);
    _dos_setvect(KBD_VECTOR, l_dosKbdISR);
    QF_INT_ENABLE();

    QS_EXIT();                                                   /* exit QS */
    _exit(0);                                                /* exit to DOS */
}
コード例 #3
0
ファイル: bsp.c プロジェクト: christation/STM32491_CPLR
/*..........................................................................*/
void QF_onCleanup(void) {
                               /* restore the DOS system clock tick rate... */
    QF_INT_DISABLE();
    outp(0x43, 0x36);                 /* use mode-3 for timer 0 in the 8254 */
    outp(0x40, 0);                             /* load low  byte of timer 0 */
    outp(0x40, 0);                             /* load high byte of timer 0 */
                                   /* restore the original DOS vectors ... */
    _dos_setvect(TMR_VECTOR, l_dosTmrISR);
    _dos_setvect(KBD_VECTOR, l_dosKbdISR);
    QF_INT_ENABLE();

    QS_EXIT();                                                   /* exit QS */
    _exit(0);                                                /* exit to DOS */
}
コード例 #4
0
//............................................................................
void QF::onCleanup(void) {
                                  // restore the DOS system clock tick rate...
    QF_INT_DISABLE();
    outp(0x43, 0x36);                    // use mode-3 for timer 0 in the 8254
    outp(0x40, 0);                                // load low  byte of timer 0
    outp(0x40, 0);                                // load high byte of timer 0
                                       // restore the original DOS vectors ...
    _dos_setvect(TMR_VECTOR, l_dosTmrISR);
    _dos_setvect(KBD_VECTOR, l_dosKbdISR);
    _dos_setvect(SPARE_VECTOR, l_dosSpareISR);
    QF_INT_ENABLE();

    QS_EXIT();                                                      // exit QS
    _exit(0);                                                   // exit to DOS
}
コード例 #5
0
/*..........................................................................*/
int_t QF_run(void) {
    QF_onStartup();                                     /* startup callback */

            /* raise the priority of this (main) thread to tick more timely */
    SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
    l_running = (int_t)1;
    while (l_running) {
        Sleep(l_tickMsec);                    /* wait for the tick interval */
        QF_onClockTick();     /* clock tick callback (must call QF_TICKX()) */
    }
    QF_onCleanup();                                     /* cleanup callback */
    QS_EXIT();                               /* cleanup the QSPY connection */
    //DeleteCriticalSection(&l_win32CritSect);
    return (int_t)0;                                      /* return success */
}
コード例 #6
0
ファイル: qf_port.cpp プロジェクト: alisonjoe/qpcpp
//............................................................................
int16_t QF::run(void) {
    l_running = true;
    onStartup();                                           // startup callback

               // raise the priority of this (main) thread to tick more timely
    SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);

    do {
        Sleep(l_tickMsec);                       // wait for the tick interval
        QF_onClockTick();        // clock tick callback (must call QF_TICKX())
    } while (l_running);
    onCleanup();                                           // cleanup callback
    QS_EXIT();                                  // cleanup the QSPY connection
    //DeleteCriticalSection(&l_win32CritSect);
    return static_cast<int16_t>(0);                          // return success
}
コード例 #7
0
ファイル: qf_port.c プロジェクト: JPLOpenSource/SCA
/*..........................................................................*/
void QF_run(void) {
    l_running = (uint8_t)1;
    QF_onStartup();                                     /* startup callback */
            /* raise the priority of this (main) thread to tick more timely */
    SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);

    QS_OBJ_DICTIONARY(&l_ticker);       /* the QS dictionary for the ticker */

    while (l_running) {
        QF_TICK(&l_ticker);                          /* process a time tick */
        Sleep(l_tickMsec);                    /* wait for the tick interval */
    }
    QF_onCleanup();                                     /* cleanup callback */
    QS_EXIT();                               /* cleanup the QSPY connection */
    DeleteCriticalSection(&QF_win32CritSect_);
}
コード例 #8
0
ファイル: qf_port.c プロジェクト: sesamemucho/qsm_study
int_t QF_run(void) {

    QF_onStartup(); /* application-specific startup callback */

    l_isRunning = true; /* QF is running */

    /* set the ticker thread priority below normal to prevent
    * flooding other threads with time events when the machine
    * is very busy.
    */
    SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);

    while (l_isRunning) {
        Sleep(l_tickMsec); /* wait for the tick interval */
        QF_onClockTick();  /* clock tick callback (must call QF_TICKX()) */
    }
    QF_onCleanup();  /* cleanup callback */
    QS_EXIT();       /* cleanup the QSPY connection */
    //DeleteCriticalSection(&l_win32CritSect);
    //free all "fudged" event pools...
    return (int_t)0; /* return success */
}
コード例 #9
0
ファイル: bsp.c プロジェクト: michaeltandy/qpc
/*..........................................................................*/
uint8_t QS_onStartup(void const *arg) {
    static uint8_t qsBuf[1024];  /* buffer for QS output */
    static uint8_t qsRxBuf[100]; /* buffer for QS receive channel */
    static WSADATA wsaData;
    char hostName[64];
    char const *src;
    char *dst;
    USHORT port = 6601; /* default QSPY server port */
    ULONG ioctl_opt = 1;
    struct sockaddr_in sockAddr;
    struct hostent *server;

    QS_initBuf(qsBuf, sizeof(qsBuf));
    QS_rxInitBuf(qsRxBuf, sizeof(qsRxBuf));

    /* initialize Windows sockets */
    if (WSAStartup(MAKEWORD(2,0), &wsaData) == SOCKET_ERROR) {
        printf("Windows Sockets cannot be initialized.");
        return (uint8_t)0;
    }

    src = (arg != (void const *)0)
          ? (char const *)arg
          : "localhost";
    dst = hostName;
    while ((*src != '\0')
           && (*src != ':')
           && (dst < &hostName[sizeof(hostName)]))
    {
        *dst++ = *src++;
    }
    *dst = '\0';
    if (*src == ':') {
        port = (USHORT)strtoul(src + 1, NULL, 10);
    }

    l_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); /* TCP socket */
    if (l_sock == INVALID_SOCKET){
        printf("Socket cannot be created; error 0x%08X\n",
               WSAGetLastError());
        return (uint8_t)0; /* failure */
    }

    server = gethostbyname(hostName);
    if (server == NULL) {
        printf("QSpy host name %s cannot be resolved; error 0x%08X\n",
               hostName, WSAGetLastError());
        return (uint8_t)0;
    }

    memset(&sockAddr, 0, sizeof(sockAddr));
    sockAddr.sin_family = AF_INET;
    memcpy(&sockAddr.sin_addr, server->h_addr, server->h_length);
    sockAddr.sin_port = htons(port);
    if (connect(l_sock, (struct sockaddr *)&sockAddr, sizeof(sockAddr))
        == SOCKET_ERROR)
    {
        printf("Cannot connect to the QSPY server; error 0x%08X\n",
               WSAGetLastError());
        QS_EXIT();
        return (uint8_t)0; /* failure */
    }

    /* Set the socket to non-blocking mode. */
    if (ioctlsocket(l_sock, FIONBIO, &ioctl_opt) == SOCKET_ERROR) {
        printf("Socket configuration failed.\n"
               "Windows socket error 0x%08X.",
               WSAGetLastError());
        QS_EXIT();
        return (uint8_t)0; /* failure */
    }

    /* set up the QS filters... */
    QS_FILTER_ON(QS_QEP_STATE_ENTRY);
    QS_FILTER_ON(QS_QEP_STATE_EXIT);
    QS_FILTER_ON(QS_QEP_STATE_INIT);
    QS_FILTER_ON(QS_QEP_INIT_TRAN);
    QS_FILTER_ON(QS_QEP_INTERN_TRAN);
    QS_FILTER_ON(QS_QEP_TRAN);
    QS_FILTER_ON(QS_QEP_IGNORED);
    QS_FILTER_ON(QS_QEP_DISPATCH);
    QS_FILTER_ON(QS_QEP_UNHANDLED);

    QS_FILTER_ON(QS_QF_ACTIVE_POST_FIFO);
    QS_FILTER_ON(QS_QF_ACTIVE_POST_LIFO);
    QS_FILTER_ON(QS_QF_PUBLISH);

    QS_FILTER_ON(PLAYER_TRIGGER);
    QS_FILTER_ON(COMMAND_STAT);

    /* return the status of creating the idle thread */
    return (CreateThread(NULL, 1024, &idleThread, (void *)0, 0, NULL)
            != (HANDLE)0) ? (uint8_t)1 : (uint8_t)0;
}
コード例 #10
0
ファイル: bsp.cpp プロジェクト: dongkc/rtu_drv
//............................................................................
void QF::onCleanup(void) {                             // cleanup callback
    QS_EXIT();                                       // perfomr the QS cleanup
}