亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pc.c

?? 這是利用RTOS去實現機械系統
?? C
?? 第 1 頁 / 共 2 頁
字號:
    
    PC_VectSet(VECT_DOS_CHAIN, PC_TickISR);                /* Store MS-DOS's tick to chain             */
    
    setjmp(PC_JumpBuf);                                    /* Capture where we are in DOS              */
    if (PC_ExitFlag == TRUE) {                             /* See if we are exiting back to DOS        */
        OS_ENTER_CRITICAL();
        PC_SetTickRate(18);                                /* Restore tick rate to 18.2 Hz             */
        OS_EXIT_CRITICAL();
        PC_VectSet(VECT_TICK, PC_TickISR);                 /* Restore DOS's tick vector                */
        PC_DispClrScr(DISP_FGND_WHITE + DISP_BGND_BLACK);  /* Clear the display                        */
        exit(0);                                           /* Return to DOS                            */
    }
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                       ELAPSED TIME INITIALIZATION
*
* Description : This function initialize the elapsed time module by determining how long the START and
*               STOP functions take to execute.  In other words, this function calibrates this module
*               to account for the processing time of the START and STOP functions.
*
* Arguments   : None.
*
* Returns     : None.
*********************************************************************************************************
*/
void PC_ElapsedInit(void)
{
    PC_ElapsedOverhead = 0;
    PC_ElapsedStart();
    PC_ElapsedOverhead = PC_ElapsedStop();
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                         INITIALIZE PC'S TIMER #2
*
* Description : This function initialize the PC's Timer #2 to be used to measure the time between events.
*               Timer #2 will be running when the function returns.
*
* Arguments   : None.
*
* Returns     : None.
*********************************************************************************************************
*/
void PC_ElapsedStart(void)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    
    INT8U      data;


    OS_ENTER_CRITICAL();
    data  = (INT8U)inp(0x61);                              /* Disable timer #2                         */
    data &= 0xFE;
    outp(0x61, data);
    outp(TICK_T0_8254_CWR,  TICK_T0_8254_CTR2_MODE0);      /* Program timer #2 for Mode 0              */
    outp(TICK_T0_8254_CTR2, 0xFF);
    outp(TICK_T0_8254_CTR2, 0xFF);
    data |= 0x01;                                          /* Start the timer                          */
    outp(0x61, data);
    OS_EXIT_CRITICAL();
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                 STOP THE PC'S TIMER #2 AND GET ELAPSED TIME
*
* Description : This function stops the PC's Timer #2, obtains the elapsed counts from when it was
*               started and converts the elapsed counts to micro-seconds.
*
* Arguments   : None.
*
* Returns     : The number of micro-seconds since the timer was last started.
*
* Notes       : - The returned time accounts for the processing time of the START and STOP functions.
*               - 54926 represents 54926S-16 or, 0.838097 which is used to convert timer counts to
*                 micro-seconds.  The clock source for the PC's timer #2 is 1.19318 MHz (or 0.838097 uS)
*********************************************************************************************************
*/
INT16U PC_ElapsedStop(void)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    
    INT8U      data;
    INT8U      low;
    INT8U      high;
    INT16U     cnts;


    OS_ENTER_CRITICAL();
    data  = (INT8U)inp(0x61);                                    /* Disable the timer                  */
    data &= 0xFE;
    outp(0x61, data);
    outp(TICK_T0_8254_CWR, TICK_T0_8254_CTR2_LATCH);             /* Latch the timer value              */
    low  = inp(TICK_T0_8254_CTR2);
    high = inp(TICK_T0_8254_CTR2);
    cnts = (INT16U)0xFFFF - (((INT16U)high << 8) + (INT16U)low); /* Compute time it took for operation */
    OS_EXIT_CRITICAL();
    return ((INT16U)((INT32U)cnts * 54926L >> 16) - PC_ElapsedOverhead);
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                       GET THE CURRENT DATE AND TIME
*
* Description: This function obtains the current date and time from the PC.
*
* Arguments  : s     is a pointer to where the ASCII string of the current date and time will be stored.
*                    You must allocate at least 21 bytes (includes the NUL) of storage in the return 
*                    string.  The date and time will be formatted as follows:
*
*                        "YYYY-MM-DD  HH:MM:SS"
*
* Returns    : none
*********************************************************************************************************
*/
void PC_GetDateTime (char *s)
{
    struct time now;
    struct date today;


    gettime(&now);
    getdate(&today);
    sprintf(s, "%04d-%02d-%02d  %02d:%02d:%02d",
               today.da_year,
               today.da_mon,
               today.da_day,
               now.ti_hour,
               now.ti_min,
               now.ti_sec);
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                        CHECK AND GET KEYBOARD KEY
*
* Description: This function checks to see if a key has been pressed at the keyboard and returns TRUE if
*              so.  Also, if a key is pressed, the key is read and copied where the argument is pointing
*              to.
*
* Arguments  : c     is a pointer to where the read key will be stored.
*
* Returns    : TRUE  if a key was pressed
*              FALSE otherwise
*********************************************************************************************************
*/
BOOLEAN PC_GetKey (INT16S *c)
{
    if (kbhit()) {                                         /* See if a key has been pressed            */
        *c = (INT16S)getch();                              /* Get key pressed                          */
        return (TRUE);
    } else {
        *c = 0x00;                                         /* No key pressed                           */
        return (FALSE);
    }
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                      SET THE PC'S TICK FREQUENCY
*
* Description: This function is called to change the tick rate of a PC.
*
* Arguments  : freq      is the desired frequency of the ticker (in Hz)
*
* Returns    : none
*
* Notes      : 1) The magic number 2386360 is actually twice the input frequency of the 8254 chip which
*                 is always 1.193180 MHz.
*              2) The equation computes the counts needed to load into the 8254.  The strange equation
*                 is actually used to round the number using integer arithmetic.  This is equivalent to
*                 the floating point equation:
*
*                             1193180.0 Hz
*                     count = ------------ + 0.5
*                                 freq
*********************************************************************************************************
*/
void PC_SetTickRate (INT16U freq)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    
    INT16U     count;


    if (freq == 18) {                            /* See if we need to restore the DOS frequency        */
        count = 0;
    } else if (freq > 0) {                        
                                                 /* Compute 8254 counts for desired frequency and ...  */
                                                 /* ... round to nearest count                         */
        count = (INT16U)(((INT32U)2386360L / freq + 1) >> 1); 
    } else {
        count = 0;
    }
    OS_ENTER_CRITICAL();
    outp(TICK_T0_8254_CWR,  TICK_T0_8254_CTR0_MODE3); /* Load the 8254 with desired frequency          */  
    outp(TICK_T0_8254_CTR0, count & 0xFF);            /* Low  byte                                     */
    outp(TICK_T0_8254_CTR0, (count >> 8) & 0xFF);     /* High byte                                     */
    OS_EXIT_CRITICAL();
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                        OBTAIN INTERRUPT VECTOR
*
* Description: This function reads the pointer stored at the specified vector.
*
* Arguments  : vect  is the desired interrupt vector number, a number between 0 and 255.
*
* Returns    : The address of the Interrupt handler stored at the desired vector location.
*********************************************************************************************************
*/
void *PC_VectGet (INT8U vect)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    
    INT16U    *pvect;
    INT16U     off;
    INT16U     seg;
    
    
    pvect = (INT16U *)MK_FP(0x0000, vect * 4);        /* Point into IVT at desired vector location     */
    OS_ENTER_CRITICAL();
    off   = *pvect++;                                 /* Obtain the vector's OFFSET                    */
    seg   = *pvect;                                   /* Obtain the vector's SEGMENT                   */
    OS_EXIT_CRITICAL();
    return (MK_FP(seg, off));
}

/*
*********************************************************************************************************
*                                        INSTALL INTERRUPT VECTOR
*
* Description: This function sets an interrupt vector in the interrupt vector table.
*
* Arguments  : vect  is the desired interrupt vector number, a number between 0 and 255.
*              isr   is a pointer to a function to execute when the interrupt or exception occurs.
*
* Returns    : none
*********************************************************************************************************
*/
void PC_VectSet (INT8U vect, void (*isr)(void))
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    
    INT16U    *pvect;
    
    
    pvect    = (INT16U *)MK_FP(0x0000, vect * 4);     /* Point into IVT at desired vector location     */
    OS_ENTER_CRITICAL();
    *pvect++ = (INT16U)FP_OFF(isr);                   /* Store ISR offset                              */
    *pvect   = (INT16U)FP_SEG(isr);                   /* Store ISR segment                             */
    OS_EXIT_CRITICAL();
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线观看一区不卡| av在线这里只有精品| 亚洲色图视频网| 久久久久国产精品厨房| 久久精品夜色噜噜亚洲a∨| 久久人人爽爽爽人久久久| 久久免费看少妇高潮| 久久久91精品国产一区二区三区| 精品乱码亚洲一区二区不卡| 精品盗摄一区二区三区| 久久久久久久综合| 中文字幕精品一区二区精品绿巨人| 久久久久国产免费免费| 欧美国产一区视频在线观看| 日本一区二区三区久久久久久久久不| 国产欧美1区2区3区| 中文字幕日韩欧美一区二区三区| 综合久久久久久| 婷婷丁香激情综合| 国产在线观看一区二区| 国产成人欧美日韩在线电影| 99久久久免费精品国产一区二区| 日本精品视频一区二区| 69久久夜色精品国产69蝌蚪网| 日韩一区二区三区在线视频| 国产欧美日韩不卡免费| 亚洲一区二区欧美激情| 国产精品自产自拍| 欧美在线影院一区二区| 精品国产乱码久久久久久夜甘婷婷 | 成人久久18免费网站麻豆| 99久久er热在这里只有精品15| 欧美在线观看你懂的| 91精品午夜视频| 亚洲天堂免费在线观看视频| 秋霞电影网一区二区| 成人精品免费看| 7777精品伊人久久久大香线蕉的| 国产情人综合久久777777| 亚洲第一会所有码转帖| 国产91对白在线观看九色| 欧美综合一区二区三区| 亚洲国产高清在线| 七七婷婷婷婷精品国产| 99精品在线观看视频| 日韩欧美在线观看一区二区三区| 亚洲女爱视频在线| 久久成人免费网站| 欧美午夜电影在线播放| 国产女人aaa级久久久级| 水野朝阳av一区二区三区| 成人av在线影院| 精品1区2区在线观看| 爽好久久久欧美精品| 91色.com| 中文字幕亚洲一区二区va在线| 免费观看在线综合| 欧美三级电影在线观看| 日韩美女精品在线| 懂色中文一区二区在线播放| 欧美成人aa大片| 日本欧美加勒比视频| 精品视频在线免费看| 亚洲人成在线播放网站岛国| www.日韩精品| 国产精品三级久久久久三级| 国产精品夜夜嗨| 久久女同精品一区二区| 欧美a一区二区| 欧美一卡2卡3卡4卡| 日韩精品免费专区| 欧美高清dvd| 日韩电影在线观看一区| 欧美精品自拍偷拍动漫精品| 亚洲成人精品一区二区| 欧美日韩成人在线一区| 亚洲成人动漫在线观看| 欧美精品丝袜中出| 日本网站在线观看一区二区三区 | 精品国产麻豆免费人成网站| 免费在线观看一区| 精品欧美久久久| 麻豆中文一区二区| 欧美一区二区精美| 国产一区二区久久| 国产欧美一区视频| 99久久婷婷国产综合精品| 亚洲欧美一区二区三区久本道91| 欧美中文字幕一区二区三区| 亚洲成a天堂v人片| 日韩一级片在线播放| 国产精品夜夜嗨| 亚洲免费在线看| 欧美一区二区三区视频在线| 精品一区二区三区在线视频| 久久久久久久电影| 99国产精品久久久| 日本不卡一区二区三区高清视频| 精品免费日韩av| av资源网一区| 免费xxxx性欧美18vr| 久久精品一区二区三区av| 色欧美日韩亚洲| 日韩成人dvd| 亚洲欧洲av色图| 91精品国产一区二区三区| 国产99精品视频| 天天综合日日夜夜精品| 久久日韩粉嫩一区二区三区| 色婷婷激情一区二区三区| 日韩在线观看一区二区| 国产精品国产三级国产普通话三级| 色婷婷久久久综合中文字幕| 精品一区二区三区视频在线观看| 国产欧美精品在线观看| 91精品国产综合久久久蜜臀粉嫩| 国产91精品一区二区麻豆网站| 亚洲成av人综合在线观看| 国产欧美一区二区精品久导航| 色拍拍在线精品视频8848| 久久99精品久久久久久动态图 | 国产精品自拍毛片| 亚洲成人免费av| 亚洲日本在线a| 久久欧美中文字幕| 日韩亚洲欧美在线观看| 91福利精品第一导航| 成人丝袜18视频在线观看| 日本aⅴ亚洲精品中文乱码| 亚洲色图制服诱惑| 久久久精品黄色| 日韩美女在线视频| 这里只有精品免费| 91成人在线精品| 成人18视频在线播放| 加勒比av一区二区| 蜜臀av一区二区三区| 天天做天天摸天天爽国产一区 | 久久综合视频网| 91精品国产色综合久久| 在线视频你懂得一区二区三区| 成人精品视频一区| 国产91精品免费| 国产成人av在线影院| 国产综合久久久久久鬼色 | 福利一区在线观看| 国精产品一区一区三区mba视频| 蜜桃精品在线观看| 青青草原综合久久大伊人精品 | 国产精品热久久久久夜色精品三区 | 精品对白一区国产伦| 日韩精品一区二区三区视频播放 | 国产中文一区二区三区| 久久精品免费看| 蜜臀av一区二区| 国产美女精品在线| 国产综合成人久久大片91| 国产一区二区三区精品欧美日韩一区二区三区 | 99国产欧美另类久久久精品| 成人午夜电影小说| 91亚洲精品乱码久久久久久蜜桃 | 日韩欧美精品三级| 精品国产精品网麻豆系列 | 日本高清不卡一区| 91国偷自产一区二区三区观看| 色哟哟欧美精品| 6080午夜不卡| www国产精品av| 中文字幕亚洲欧美在线不卡| 亚洲精品日韩综合观看成人91| 亚洲成人动漫精品| 精品在线视频一区| 97精品久久久午夜一区二区三区| 色吧成人激情小说| 日韩精品中文字幕在线不卡尤物| 久久久久久久av麻豆果冻| 18涩涩午夜精品.www| 亚洲一区二区三区四区在线免费观看 | 欧美色综合影院| 日韩一区二区在线看片| 国产拍欧美日韩视频二区| 亚洲欧美日韩久久| 久久精品久久精品| 不卡视频在线看| 91精品国产美女浴室洗澡无遮挡| 精品国产一区二区三区四区四 | 欧美一区国产二区| 国产精品三级视频| 天天免费综合色| 国产不卡视频一区二区三区| 欧美视频一区在线| 久久无码av三级| 午夜精品免费在线| 国产suv精品一区二区6| 欧美精品在线一区二区| 国产欧美日韩中文久久| 青娱乐精品视频在线| 欧亚一区二区三区| 国产嫩草影院久久久久| 麻豆国产欧美一区二区三区|