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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? pc.c

?? 陳向群老師主講的嵌入式操作系統(tǒng)實驗作業(yè)之經(jīng)典生產(chǎn)者消費者程序
?? 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();
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品99久久久| 91亚洲男人天堂| 亚洲美女屁股眼交| 日韩免费一区二区三区在线播放| 9i看片成人免费高清| 蜜乳av一区二区三区| 一区二区三区中文字幕精品精品 | 99久久er热在这里只有精品66| 91麻豆产精品久久久久久| 美女视频黄频大全不卡视频在线播放| 最新欧美精品一区二区三区| 欧美成人伊人久久综合网| 欧洲精品视频在线观看| 波多野结衣视频一区| 国产在线一区二区综合免费视频| 婷婷成人综合网| 夜夜操天天操亚洲| 亚洲色图欧洲色图婷婷| 欧美国产精品v| 2020国产成人综合网| 91精品一区二区三区久久久久久| 欧美在线观看一区| 一本一本大道香蕉久在线精品 | 免费成人av在线| 亚洲成人午夜电影| 亚洲黄网站在线观看| 亚洲女同ⅹxx女同tv| 欧美高清在线一区二区| 国产喂奶挤奶一区二区三区 | 国产精品家庭影院| 日本一区二区视频在线观看| 日韩一二三四区| 欧美老女人在线| 欧美色图激情小说| 欧美自拍偷拍午夜视频| 欧美亚洲一区三区| 欧美日韩一区不卡| 欧美日韩亚洲国产综合| 精品视频在线免费| 51精品秘密在线观看| 欧美日产国产精品| 欧美精品 国产精品| 欧美精品第一页| 日韩欧美一二三| xvideos.蜜桃一区二区| 久久久久久综合| 国产精品丝袜一区| 亚洲美女在线国产| 亚洲.国产.中文慕字在线| 亚洲一二三区在线观看| 丝袜美腿亚洲色图| 美女网站色91| 国产91精品欧美| 91小视频在线观看| 欧美日本一道本在线视频| 国产精品一区二区无线| 福利91精品一区二区三区| 久久久久久麻豆| 国产精品嫩草影院av蜜臀| 综合亚洲深深色噜噜狠狠网站| 中文字幕一区免费在线观看| 一区二区三区日本| 婷婷亚洲久悠悠色悠在线播放 | 欧美激情综合五月色丁香小说| 国产精品三级在线观看| 有坂深雪av一区二区精品| 午夜国产精品一区| 国产乱码精品一区二区三| 波多野结衣在线一区| 欧美日韩1区2区| 久久精品在这里| 亚洲在线视频一区| 精品在线观看视频| 91丨九色丨蝌蚪丨老版| 日韩一区二区在线看| 国产欧美日韩在线| 午夜视频在线观看一区二区三区| 麻豆精品一二三| 91麻豆免费在线观看| 日韩欧美aaaaaa| 白白色 亚洲乱淫| 欧美日韩一区小说| 国产欧美一区二区精品性色超碰| 亚洲综合一区在线| 国产资源在线一区| 欧美在线看片a免费观看| 久久久美女毛片| 午夜a成v人精品| 波波电影院一区二区三区| 51久久夜色精品国产麻豆| 亚洲三级在线免费| 国内精品免费在线观看| 精品视频一区三区九区| 中文子幕无线码一区tr| 日本成人在线一区| 色婷婷国产精品| 国产欧美精品一区| 青草av.久久免费一区| 91麻豆国产香蕉久久精品| 26uuu色噜噜精品一区| 亚洲成人动漫在线免费观看| 成人av在线播放网址| 337p粉嫩大胆噜噜噜噜噜91av| 亚洲一区二区三区四区五区黄| 粉嫩蜜臀av国产精品网站| 欧美变态tickle挠乳网站| 亚洲一区二区三区不卡国产欧美| 国产成人a级片| 日韩网站在线看片你懂的| 亚洲一区二区在线观看视频| 成人高清视频免费观看| 久久精品这里都是精品| 日本麻豆一区二区三区视频| 色偷偷久久一区二区三区| 国产精品久久久爽爽爽麻豆色哟哟| 麻豆专区一区二区三区四区五区| 欧美午夜寂寞影院| 亚洲激情五月婷婷| 91麻豆免费在线观看| 国产精品伦一区| 成人一级片在线观看| 国产欧美综合在线| 国产精品一区免费在线观看| 欧美va亚洲va| 久久99精品国产91久久来源| 777奇米四色成人影色区| 天天操天天色综合| 欧美日韩高清影院| 天堂一区二区在线免费观看| 欧美三级电影网| 午夜精品视频一区| 欧美日韩国产片| 日韩精品1区2区3区| 制服丝袜av成人在线看| 日韩国产欧美在线观看| 欧美一区二区三区四区久久| 日韩在线a电影| 6080国产精品一区二区| 麻豆精品视频在线观看| 日韩欧美另类在线| 精品一区二区三区影院在线午夜| 日韩一区二区三区av| 精品中文字幕一区二区小辣椒 | 亚洲妇女屁股眼交7| 精品视频色一区| 日本亚洲最大的色成网站www| 欧美一级久久久| 黄网站免费久久| 国产精品久久午夜夜伦鲁鲁| 91欧美激情一区二区三区成人| 一区二区三区中文字幕| 欧美美女直播网站| 蜜臀av在线播放一区二区三区| 精品欧美一区二区久久| 国产成人免费视频网站高清观看视频| 欧美国产一区视频在线观看| 91视频免费播放| 亚洲一级二级在线| 日韩一级精品视频在线观看| 国产老肥熟一区二区三区| 成人免费在线视频观看| 精品视频全国免费看| 精品在线播放午夜| 国产精品激情偷乱一区二区∴| 在线免费观看不卡av| 强制捆绑调教一区二区| 中文字幕第一区综合| 欧美制服丝袜第一页| 美女视频黄a大片欧美| 中文字幕巨乱亚洲| 欧美亚日韩国产aⅴ精品中极品| 麻豆精品视频在线观看视频| 国产精品乱码久久久久久| 欧美日韩精品福利| 国产二区国产一区在线观看| 亚洲狠狠丁香婷婷综合久久久| 欧美一区二区久久| www.日韩精品| 麻豆国产欧美一区二区三区| 国产精品国产自产拍高清av| 777亚洲妇女| 成人黄色一级视频| 日韩av在线发布| 最好看的中文字幕久久| 日韩精品资源二区在线| 一本一本大道香蕉久在线精品| 奇米影视一区二区三区小说| 日韩一区中文字幕| 欧美va亚洲va香蕉在线| 91国产视频在线观看| 国产精品中文欧美| 性做久久久久久免费观看 | 日韩1区2区3区| 国产精品三级av| 欧美va在线播放| 欧美亚男人的天堂| thepron国产精品| 麻豆免费精品视频| 亚洲成在线观看| 久久久久久久久99精品|