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

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

?? xsac97ctrl.c

?? 嵌入式系統關于串口傳輸、觸摸屏、定時器、控制器、中斷處理、音頻控制等實驗代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
*  4.  Perform the first (dummy) read from the processor memory location that is
*      mapped to the target Codec's target register.  Discard the resulting data
*  5.  Continuously check the AC '97 Controller's Global Status Register until
*      the SDONE bit is set.  Use software timeout logic.
*  6.  If the Read Completion Status bit is set or the software timeout has 
*      occurred, there is a timeout.
*      a)  Declare an error status 
*      b)  Skip to step 8 in this procedure.
*  7.  If there was no timeout, the read operation was successful.
*      a)  Read the CAR until it is verified that no codec I/O accesses are
*          currently in progress.  This also claims the next codec I/O
*          transaction for this operation.  It leaves an indication for the 
*          next SW read or write I/O operation.  This will prevent ambiguity.
*          (We shouldn't actually have to loop here because the SDONE bit 
*           indicator ought to be set at the same time as the CAR indicator
*           clears.  But we loop anyway, just in case.)
*      b)  Perform the second read to obtain the register contents reported by
*          the codec.
*      c)  Report the data obtained from the codec.
*  8.  Restore previous interrupt state. 
*  9.  Report success or error status.
*  
*  Note that this operation does not wait for the second read operation to
*   complete.  Any remaining wait is done in the beginning of the next access.
* 
*  Note also that there is a possible optimization in this processor for reads 
*   of a modem's GPIO bits that are reported to the controller in time slot 12.
*   It would be to skip the timeout logic and the second read cycle because the
*   local values are constantly updated from the values reported in TS 12.
*  
*  Once the link is acquired, perform the double read under interrupt 
*   protection.  This is necessary to make it an atomic operation.  Even
*   if link acquisition continued for @@@
*  
*******************************************************************************
*/

UINT32 XsAc97CtrlReadCodecReg (XsAc97CtrlCodecModemIdT  ac97DeviceId, 
                               AC97MixerRegisterIdT     targetRegister, 
                               UINT32*                  mixerRegValueP)
{
    UINT32    status ;
    INT       badParamNum  = 0; // Which param had error.  Assume no errors.
    INT       timeoutLoc   = 0; // What point had a timeout.  Assume no errors.
    BOOL      gotLink;
    VUINT32   readFinishedStatus;
    UINT32    irqIntState;
    UINT32    rcsErrTmp;
    INT       minorIterations;
    INT       retries   =   0;  
    XsAc97CtrlStatsT* codeStatsP;
    VUINT32*  mixerRegsAccessP;

    status = Ac97CheckRegId (targetRegister);

    if (status)
    {
        badParamNum = 2;
    }
    else    // register ID OK, set register access pointer to codec access base
    {
        switch (ac97DeviceId)
        {
            case XS_AC97CTRL_CM_ID_PRI_CODEC:
                mixerRegsAccessP  = &XsAc97CtrlRegsP->
                                            XsAC97CtrlMixerRegsPrimaryAud[0];
                codeStatsP = &XsAc97CtrlContext.statistics[ac97DeviceId];
                break;
            default:
                status      = ERR_T_ILLPARAM;
                badParamNum = 1;
                break;
        }
        // Point to specified register within area mapped to target codec regs
        mixerRegsAccessP += (targetRegister / XS_AC97CTRL_MIXER_REGS_PER_WORD);

    } // else (register ID OK)

    if (!status)
    {
        // Some statistics.  Only valid invocations are interesting.
        irqIntState = XsIcDisableInterruptsIrq();
        codeStatsP->readCodecNumInvocations++;     
        XsIcRestoreInterruptsIrq (irqIntState);

        do
        {
            status = ERR_NONE;      // Clear for possible retry
            // Protect entire operation for simplicity.  Very small extra
            //  execution time penalty.
            irqIntState = XsIcDisableInterruptsIrq();

            // Lock the ACLINK
            minorIterations = 0; 
            do
            {
                gotLink = XsAc97CtrlLockAcLink();
                if (!gotLink)    // 1 usec is a long time.  Skip delay if possible.
                {
                    DM_WaitUs(1);
                }
            }
            // Wait while time remaining and ACLINK not available
            while (   (minorIterations++ < XS_AC97CTRL_CAIP_TIMEOUT_1USECS) 
                    && !gotLink );


            if (!gotLink)                           // Didn't get the ACLINK
            {
                status = ERR_T_NOT_AVAIL;      
            }
            else  // We got the link.  Perform the read operations.
            {
                // First, clear old read status indications.
                (void) XsAc97CtrlClearStatus (XS_AC97CTRL_STAT_SDONE); 
                (void) XsAc97CtrlClearStatus (XS_AC97CTRL_STAT_RCS_ERR); 

                *mixerRegValueP = *mixerRegsAccessP; // This is THE DUMMY READ.

                // Wait for read I/O with codec to complete before doing real read.
                minorIterations = 0;
                do
                {
                    DM_WaitUs(1);
                    readFinishedStatus = 
                        XsAc97CtrlGetStatus (XS_AC97CTRL_STAT_SDONE);
                }
                // Wait while time remaining and read I/O still incomplete
                // SDONE bit is high when done.
                while (   (minorIterations++ < XS_AC97CTRL_READ_TIMEOUT_1USECS)
                        && !readFinishedStatus);

                // Another way to detect a timeout is to check the Read 
                //  Completion Status bit in the GSR.  It is set for a timeout.
                rcsErrTmp = XsAc97CtrlGetStatus (XS_AC97CTRL_STAT_RCS_ERR);
                if ( rcsErrTmp || 
                    !readFinishedStatus)
                {
                    // Timed out on read
                    status      = ERR_T_TIMEOUT;
                    timeoutLoc  = 1;                // First timeout opportunity
                }
                else  // OK to do real read
                {
                    if (!gotLink)                   // Didn't get the ACLINK
                    {
                        status = ERR_T_TIMEOUT;
                        timeoutLoc  = 2;            // Second timeout opportunity
                    }
                    else  // No problems.  Perform the read operation.
                    {
                        *mixerRegValueP = *mixerRegsAccessP;     // THE REAL READ.
                    }

                }  // else  (OK to do real read)

            } // else  (We got the link.  Perform the read operations.)

            XsIcRestoreInterruptsIrq (irqIntState);     // End atomic zone.

        } // do: try communication until retries run out or success.
        while (retries++ < XS_AC97CTRL_CODEC_READ_RETRIES && (status)); 

        // Some statistics
        irqIntState = XsIcDisableInterruptsIrq();
        codeStatsP->readCodecTotalRetries += retries -1; // Adjust for post-increment

        if (status)
        {
            codeStatsP->readCodecNumFailures++; 
        }
        else
        {
            // Clean up after real read.  Why must we do it here instead 
            //  of speculatively at the beginning of the read process?
            //  Need to investigate proper procedure.
            minorIterations = 0;
            do
            {
                DM_WaitUs(1);
                readFinishedStatus = 
                    XsAc97CtrlGetStatus (XS_AC97CTRL_STAT_SDONE);
            }
            // Wait while time remaining and read I/O still incomplete
            // SDONE bit is high when done.
            while (   (minorIterations++ < XS_AC97CTRL_READ_TIMEOUT_1USECS)
                    && !readFinishedStatus);
            
        }

        XsIcRestoreInterruptsIrq (irqIntState);

    } // if (!status): got past initial parameter checks


    if (status)
    {

//        LOGERROR (XsAc97CtrlContext.loggedError,
  //          ERR_L_XSAC97CTRL, 
    //        ERR_S_XSAC97CTRL_CODEC_READ, 
      //      status,
        //    badParamNum, 
          //  timeoutLoc, 
            //targetRegister)
    }

    return (status);

} // XsAc97CtrlCodecRead ()


/*
*******************************************************************************
    Non-standard, test-oriented API of main processor on-board 
        AC'97 controller driver.  Lower level access provided.
*******************************************************************************
*/

/*
*******************************************************************************
*
* FUNCTION:         XsAc97CtrlColdReset
*
* DESCRIPTION:      Perform a cold reset of the processor's AC'97 Controller,
*                   the AC Link and all AC'97 codecs and modems attached to 
*                   the controller's AC'97 cold reset pin.
*
* INPUT PARAMETERS: None
*
* RETURNS:
*       Success:    0 (ERR_NONE); All codecs reported ready within time limit.
*       Failure:    ERR_T_TIMEOUT:   A timeout occurred on one of the codecs.
*                        In systems with multiple codecs, the calling function 
*                        could determine which device(s) is/are not ready by 
*                        performing XsAc97CtrlGetStatus() on 
*                        XS_AC97CTRL_STAT_PCRDY and XS_AC97CTRL_STAT_SCRDY.
*
* GLOBAL EFFECTS:   All codecs initialized to default settings.  Controller
*                   set to default state and is operational.
*
* ASSUMPTIONS:      Not used in an interrupt service routine.
*
* CALLS:            
*
* CALLED BY:        
*
* PROTOTYPE:        UINT32  XsAc97CtrlColdReset (void);
*
*******************************************************************************
*/

UINT32  XsAc97CtrlColdReset (void)
{ 
    UINT32   status            = ERR_NONE; 
    INT      numCodecsReady;
    BOOL     primaryCodecReady; 
    INT      timeRemaining; 
    UINT32   irqIntState;

    // Activate cold reset line under interrupt protection
    irqIntState = XsIcDisableInterruptsIrq();   // Begin atomic zone.

    XsAc97CtrlRegsP = (XsAc97CtrlRegsT *) XS_AC97CTRL_REGISTER_BASE;

    XsAc97CtrlRegsP->GCR &= ~(XS_AC97CTRL_GCR_COLD_RESET_MSK); // Activate

    XsIcRestoreInterruptsIrq (irqIntState);     // End atomic zone.

    // Hold reset active for a minimum time
    for (timeRemaining = 0 ; 
        timeRemaining < XS_AC97CTRL_COLD_HOLD_50USECS; 
        timeRemaining++ )
    {
        DM_WaitUs(50);
    }

    // Deactivate cold reset line
    irqIntState = XsIcDisableInterruptsIrq();   // Begin atomic zone.

    XsAc97CtrlRegsP->GCR |= XS_AC97CTRL_GCR_COLD_RESET_MSK; // Deactivate

    XsIcRestoreInterruptsIrq (irqIntState);     // End atomic zone.

    // And wait with timeout for all codecs to respond.

    numCodecsReady    = 0;         // Codecs plus modems. 
    primaryCodecReady = FALSE; 
    timeRemaining = XS_AC97CTRL_COLD_TIMEOUT_50USECS;

    do
    {
        DM_WaitUs(50);

        if ((!primaryCodecReady) && (XsAc97CtrlRegsP->GSR & XS_AC97CTRL_GSR_PCRDY_MSK))
        {
            // Note: Don't bother trying to clear the interrupt trigger for the 
            //   primary codec ready status indicator.  This is not an 
            //   interrupt-based function.
            primaryCodecReady = TRUE;
            numCodecsReady ++;
        }

        // Note: Other codecs or modems would be checked here, if supported by 
        //  the platform.

    } // exit loop if timeout or all devices ready
    while (timeRemaining-- && (numCodecsReady < XS_AC97CTRL_NUM_CODECS));


    // Timeout status if some of the devices weren't ready.
    if (numCodecsReady < XS_AC97CTRL_NUM_CODECS)
    {
        status = ERR_T_TIMEOUT;
//        LOGERROR (XsAc97CtrlContext.loggedError, ERR_L_XSAC97CTRL, 
  //          ERR_S_XSAC97CTRL_COLD_RESET, status, 0, 0, 0);
    }

    return (status);

} // XsAc97CtrlColdReset ()


/*
*******************************************************************************
*

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本va欧美va精品发布| 亚洲永久免费av| 欧美一级高清片| 欧美一区二区高清| 91精品国产一区二区三区| 欧美日韩不卡视频| 欧美日韩国产大片| 91精品黄色片免费大全| 日韩三级.com| 久久综合九色综合97婷婷| 精品处破学生在线二十三| 久久免费的精品国产v∧| 国产日韩欧美一区二区三区乱码 | 中文字幕中文字幕中文字幕亚洲无线| 欧美va亚洲va香蕉在线| 日韩亚洲欧美在线观看| 久久男人中文字幕资源站| 亚洲国产精品99久久久久久久久 | 国产福利一区二区三区在线视频| 韩国欧美国产一区| 成人丝袜18视频在线观看| 91网站在线观看视频| 欧美日韩高清在线播放| 日韩欧美国产不卡| 国产精品久久久久久户外露出| 亚洲精品va在线观看| 青草av.久久免费一区| 国产传媒一区在线| 91福利视频在线| 欧美不卡一区二区三区四区| 亚洲国产精品成人综合| 亚洲线精品一区二区三区八戒| 久久疯狂做爰流白浆xx| 91麻豆自制传媒国产之光| 91麻豆精品国产91久久久久久久久| 日韩欧美高清dvd碟片| 日韩美女精品在线| 麻豆精品一区二区综合av| 91丝袜呻吟高潮美腿白嫩在线观看| 欧美男女性生活在线直播观看| 国产日韩欧美制服另类| 免费成人av在线| 色国产精品一区在线观看| 26uuu精品一区二区在线观看| 亚洲精品写真福利| 国产成人综合亚洲91猫咪| 欧美军同video69gay| 亚洲视频在线一区观看| 精品一区二区三区在线观看国产| 91日韩在线专区| 久久久.com| 精品一区中文字幕| 精品国产91九色蝌蚪| 亚洲男人的天堂网| 成人激情免费视频| 久久久久久久网| 久久aⅴ国产欧美74aaa| 欧洲日韩一区二区三区| 自拍偷拍欧美精品| 不卡的av在线| 国产精品久久久久影院色老大 | 久久综合中文字幕| 蜜臀av一区二区在线免费观看| 日本韩国一区二区| 亚洲婷婷综合色高清在线| 成人免费不卡视频| 欧美国产综合一区二区| 国产成a人亚洲精品| 欧美精品一区二区不卡| 国产在线精品免费av| 日韩一区二区三区免费看| 免费在线观看不卡| 日韩一区二区三区免费观看| 秋霞电影网一区二区| 91精品国产综合久久国产大片| 午夜久久久久久| 欧美精品一级二级| 蜜桃av一区二区| 欧美第一区第二区| 国产一区二区美女| 久久精品一区八戒影视| 不卡高清视频专区| 亚洲自拍与偷拍| 制服丝袜在线91| 久草在线在线精品观看| 亚洲国产精品成人综合| 99精品视频在线播放观看| 一区二区三区欧美激情| 欧美三日本三级三级在线播放| 亚洲国产综合人成综合网站| 69精品人人人人| 韩国女主播一区| 国产精品拍天天在线| 在线观看三级视频欧美| 日韩激情中文字幕| 久久精品一区二区| 色综合一区二区| 亚洲一区二区精品视频| 日韩一区二区在线观看视频播放 | 国产精品美女久久久久久2018| 成人午夜av影视| 亚洲va欧美va人人爽午夜| 欧美一级艳片视频免费观看| 国产成人av一区| 一区二区三区四区不卡在线| 宅男噜噜噜66一区二区66| 大胆欧美人体老妇| 五月天视频一区| 日韩一区中文字幕| 欧美一区二区视频在线观看2022 | 7777精品伊人久久久大香线蕉完整版 | 欧美电视剧在线观看完整版| 成人一区二区三区视频| 午夜不卡av免费| 国产精品动漫网站| 日韩美女一区二区三区四区| 99热这里都是精品| 极品美女销魂一区二区三区| 亚洲女人小视频在线观看| 精品国产伦一区二区三区免费| 波多野结衣91| 精品在线观看视频| 亚洲成人自拍一区| 国产精品久久久一本精品| 欧美电影免费观看高清完整版 | 亚洲乱码中文字幕| 精品国产91乱码一区二区三区| 91首页免费视频| 国产精品自拍av| 视频一区在线播放| 亚洲一区二区欧美| 亚洲欧美日韩国产一区二区三区| 日韩精品最新网址| 国产午夜精品久久久久久久| 精品视频一区三区九区| 91麻豆免费在线观看| 国产盗摄女厕一区二区三区| 蜜臀久久99精品久久久久宅男| 亚洲精品欧美激情| 1区2区3区欧美| 欧美激情一区二区三区| 国产日韩欧美精品一区| 久久人人97超碰com| 精品国产一区二区三区不卡 | 欧美美女直播网站| 欧美日韩一级黄| 在线观看av一区二区| 一本久久精品一区二区| 99国产欧美另类久久久精品| 成人aaaa免费全部观看| 丁香六月久久综合狠狠色| 国产毛片精品视频| 国产成人av电影在线| 国产成人综合网站| a4yy欧美一区二区三区| 91麻豆国产香蕉久久精品| 91国偷自产一区二区使用方法| 91麻豆国产精品久久| 色老汉av一区二区三区| 欧美日韩一卡二卡| 日韩午夜电影av| 欧美r级在线观看| 国产日韩欧美高清在线| 国产精品丝袜久久久久久app| 国产精品美女久久久久av爽李琼| 最新热久久免费视频| 亚洲五码中文字幕| 美美哒免费高清在线观看视频一区二区| 日本在线不卡一区| 国产东北露脸精品视频| 91免费版pro下载短视频| 欧美日韩在线精品一区二区三区激情 | 99综合电影在线视频| 日本久久精品电影| 91精品国产色综合久久不卡蜜臀| 日韩一级精品视频在线观看| 久久免费偷拍视频| 亚洲精品国产一区二区三区四区在线| 亚洲亚洲人成综合网络| 狠狠网亚洲精品| av在线不卡免费看| 91精品国产一区二区三区香蕉 | 99国产欧美另类久久久精品| 欧美性xxxxxxxx| 久久久噜噜噜久久人人看| 日韩一区中文字幕| 蜜桃av一区二区三区电影| 白白色亚洲国产精品| 8v天堂国产在线一区二区| 国产亚洲1区2区3区| 久久不见久久见免费视频7| 国产夫妻精品视频| 91精品国产一区二区三区香蕉| 日本一区二区免费在线| 免费观看在线色综合| 色婷婷激情综合| 国产精品午夜在线| 久久草av在线| 欧美男人的天堂一二区| 亚洲男人的天堂网|