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

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

?? codec.c

?? Cirrus Logic EP7312處理器部分控制程序。
?? C
字號:
//****************************************************************************
//
// CODEC.C - Routines to enable the serial codec interface and use it to
//           playback and record waveform data
//
// Copyright (c) 1998-2001 Cirrus Logic, Inc.
//
//****************************************************************************
#include "ep7312.h"
#include "lib7312.h"

//****************************************************************************
//
// The following variables describe the buffer of PCM data that is currently
// being played back.
//
//****************************************************************************
static char * volatile pcCurPlayBuffer = 0;
static char * volatile pcNextPlayBuffer = 0;
static long lCurPlayPos;
static long lCurPlayLength;
static long lNextPlayLength;

//****************************************************************************
//
// The following variables describe the buffer of PCM data that is currently
// being recorded.
//
//****************************************************************************
static char * volatile pcCurRecordBuffer = 0;
static char * volatile pcNextRecordBuffer = 0;
static long lCurRecordPos;
static long lCurRecordLength;
static long lNextRecordLength;

//****************************************************************************
//
// CodecISR is the interrupt handler for the codec interrupt.  It will write
// samples into the codec FIFO until it is full.  If there are no samples
// available, it will write silence instead.
//
//****************************************************************************
static void
CodecISR(void)
{
    unsigned long * volatile pulPtr = (unsigned long *)HwBaseAddress;
    volatile char cTemp;

    //
    // Loop until the output FIFO is full.
    //
    while(!(pulPtr[HwStatus >> 2] & HwStatusCodecTxFifoFull))
    {
        //
        // If there is not a buffer of samples waiting to be played, then
        // simply fill the FIFO with silence.
        //
        if(!pcCurPlayBuffer && !pcNextPlayBuffer)
        {
            pulPtr[HwCodecData >> 2] = 0xFF;
            continue;
        }

        //
        // See if we need to move to the next buffer.
        //
        if(!pcCurPlayBuffer)
        {
            //
            // Move the next buffer to the current buffer.
            //
            pcCurPlayBuffer = pcNextPlayBuffer;
            lCurPlayLength = lNextPlayLength;
            lCurPlayPos = 0;

            //
            // Clear out the next buffer.
            //
            pcNextPlayBuffer = 0;
            lNextPlayLength = 0;
        }

        //
        // Write another sample into the FIFO.
        //
        pulPtr[HwCodecData >> 2] = pcCurPlayBuffer[lCurPlayPos++];

        //
        // See if we've reached the end of the play buffer.
        //
        if(lCurPlayPos == lCurPlayLength)
        {
            pcCurPlayBuffer = 0;
        }
    }

    //
    // Loop until the input FIFO is empty.
    //
    while(!(pulPtr[HwStatus >> 2] & HwStatusCodecRxFifoEmpty))
    {
        //
        // If there is not a buffer to record into, then simply throw away the
        // sample from the FIFO.
        //
        if(!pcCurRecordBuffer && !pcNextRecordBuffer)
        {
            cTemp = pulPtr[HwCodecData >> 2];
            continue;
        }

        //
        // See if we need to move to the next buffer.
        //
        if(!pcCurRecordBuffer)
        {
            //
            // Move the next buffer to the current buffer.
            //
            pcCurRecordBuffer = pcNextRecordBuffer;
            lCurRecordLength = lNextRecordLength;
            lCurRecordPos = 0;

            //
            // Clear out the next buffer.
            //
            pcNextRecordBuffer = 0;
            lNextRecordLength = 0;
        }

        //
        // Read another sample from the FIFO.
        //
        pcCurRecordBuffer[lCurRecordPos++] = (pulPtr[HwCodecData >> 2] & 0xff);

        //
        // See if we've reached the end of the record buffer.
        //
        if(lCurRecordPos == lCurRecordLength)
        {
            pcCurRecordBuffer = 0;
        }
    }
}

//****************************************************************************
//
// CodecEnable configures the codec for playback and recording of u-law PCM
// data.
//
//****************************************************************************
void
CodecEnable(void)
{
    unsigned long * volatile pulPtr = (unsigned long *)HwBaseAddress;

    //
    // Select CODEC/SSI mode instead of DAI mode.
    //
    pulPtr[HwControl3 >> 2] &= ~HwControl3DAISelect;

    //
    // The codec enable bit must always be set for the codec interface to work.
    //
    pulPtr[HwControl2 >> 2] |= HwControl2CodecEnable;

    //
    // Enable the codec transmit and receive buffers.  They can not be
    // individually controlled (even they have separate control bits).
    //
    pulPtr[HwControl >> 2] |= HwControlCodecTxEnable | HwControlCodecRxEnable;

    //
    // Turn on the codec and external speaker on the EP7209 eval board.
    //
    ((unsigned char *)pulPtr)[HwPortE] |= HwPortECodecPower;

    
    //
    // Install the ISR so that we can process the codec interrupt.
    //
    InterruptInstallIRQ();

    //
    // Install the codec interrupt handler.
    //
    InterruptSetCodecHandler(CodecISR);

    //
    // Enable the codec interrupt.
    //
    pulPtr[HwIntMask >> 2] |= HwIrqCodec;
}

//****************************************************************************
//
// CodecDisable powers down the codec.
//
//****************************************************************************
void
CodecDisable(void)
{
    unsigned long * volatile pulPtr = (unsigned long *)HwBaseAddress;

    //
    // Disable the codec interrupt.
    //
    pulPtr[HwIntMask >> 2] &= ~HwIrqCodec;

    //
    // Remove the codec interrupt handler.
    //
    InterruptSetCodecHandler(0);

    //
    // Remove the interrupt handler.
    //
    InterruptRemoveIRQ();

    //
    // Disable the codec transmit and receive buffers.
    //
    pulPtr[HwControl >> 2] &= ~(HwControlCodecTxEnable |
                                HwControlCodecRxEnable);

    //
    // Turn off the codec and external speaker on the EP7209 eval board.
    //
    ((unsigned char *)pulPtr)[HwPortE] &= ~HwPortECodecPower;

    //
    // Mark both playback and record buffers as completed.
    //
    pcCurPlayBuffer = 0;
    pcNextPlayBuffer = 0;
    pcCurRecordBuffer = 0;
    pcNextRecordBuffer = 0;
}

//****************************************************************************
//
// CodecPlay plays the specified buffer of u-law PCM data out via the codec.
//
//****************************************************************************
void
CodecPlay(char *pcBuffer, long lLength)
{
    //
    // Wait until there is space in the play queue.
    //
    while(pcNextPlayBuffer)
    {
    }

    //
    // Setup the buffer to be played in the background.
    //
    lNextPlayLength = lLength;
    pcNextPlayBuffer = pcBuffer;

    //
    // Wait until the entire buffer has been consumed.
    //
    while(pcNextPlayBuffer || pcCurPlayBuffer)
    {
    }
}

//****************************************************************************
//
// CodecPlayBg plays the specified buffer of u-law PCM data out via the codec
// in the background (i.e. it returns before the data has been played,
// allowing other processing to occur).
//
//****************************************************************************
void
CodecPlayBg(char *pcBuffer, long lLength)
{
    //
    // Wait until there is space in the play queue.
    //
    while(pcNextPlayBuffer)
    {
    }

    //
    // Setup the buffer to be played in the background.
    //
    lNextPlayLength = lLength;
    pcNextPlayBuffer = pcBuffer;
}

//****************************************************************************
//
// CodecPlaySpaceAvailable determines if there is space available in the
// playback data queue.
//
//****************************************************************************
int
CodecPlaySpaceAvailable(void)
{
    //
    // If the next buffer pointer is currently set, then there is not space in
    // the playback data queue.
    //
    if(pcNextPlayBuffer)
    {
        return(0);
    }

    //
    // There is room in the playback data queue.
    //
    return(1);
}

//****************************************************************************
//
// CodecPlayIsDone determines whether or not the current data buffer has
// completed playing.
//
//****************************************************************************
int
CodecPlayIsDone(void)
{
    //
    // See if the either buffer is still playing.
    //
    if(pcNextPlayBuffer || pcCurPlayBuffer)
    {
        //
        // It is, so indicate that the playback is not done.
        //
        return(0);
    }

    //
    // The playback is done.
    //
    return(1);
}

//****************************************************************************
//
// CodecPlayWaitTilDone does not return until the current data buffer has
// completed playing.
//
//****************************************************************************
void
CodecPlayWaitTilDone(void)
{
    //
    // Loop until the buffers are marked as being done.
    //
    while(pcNextPlayBuffer || pcCurPlayBuffer)
    {
    }
}

//****************************************************************************
//
// CodecRecord fills the specified buffer with u-law PCM data recorded via the
// codec.
//
//****************************************************************************
void
CodecRecord(char *pcBuffer, long lLength)
{
    //
    // Wait until there is space in the record queue.
    //
    while(pcNextRecordBuffer)
    {
    }

    //
    // Setup the buffer to be recorded in the background.
    //
    lNextRecordLength = lLength;
    pcNextRecordBuffer = pcBuffer;

    //
    // Wait until the entire buffer has been recorded.
    //
    while(pcNextRecordBuffer || pcCurRecordBuffer)
    {
    }
}

//****************************************************************************
//
// CodecRecordBg fills the specified buffer with u-law PCM data recorded via
// the codec in the background (i.e. it returns before the data has been
// recorded, allowing other processing to occur).
//
//****************************************************************************
void
CodecRecordBg(char *pcBuffer, long lLength)
{
    //
    // Wait until there is space in the record queue.
    //
    while(pcNextRecordBuffer)
    {
    }

    //
    // Setup the buffer to be recorded in the background.
    //
    lNextRecordLength = lLength;
    pcNextRecordBuffer = pcBuffer;
}

//****************************************************************************
//
// CodecRecordSpaceAvailable determines if there is space available in the
// record data queue.
//
//****************************************************************************
int
CodecRecordSpaceAvailable(void)
{
    //
    // If the next buffer pointer is current set, then there is not space in
    // the record data queue.
    //
    if(pcNextRecordBuffer)
    {
        return(0);
    }

    //
    // There is room in the record data queue.
    //
    return(1);
}

//****************************************************************************
//
// CodecRecordIsDone determines whether or not the current data buffer has
// completed recording.
//
//****************************************************************************
int
CodecRecordIsDone(void)
{
    //
    // See if the either buffer is still recording.
    //
    if(pcNextRecordBuffer || pcCurRecordBuffer)
    {
        //
        // It is, so indicate that the record is not done.
        //
        return(0);
    }

    //
    // The record is done.
    //
    return(1);
}

//****************************************************************************
//
// CodecRecordWaitTilDone does not return until the current data buffer has
// completed recording.
//
//****************************************************************************
void
CodecRecordWaitTilDone(void)
{
    //
    // Loop until the buffers are marked as being done.
    //
    while(pcNextRecordBuffer || pcCurRecordBuffer)
    {
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本成人中文字幕在线视频| 亚洲成人av在线电影| 7777精品伊人久久久大香线蕉经典版下载 | 欧美国产一区在线| 日韩欧美中文一区二区| 在线成人小视频| 4438成人网| 日韩一区二区精品葵司在线| 欧美电影在线免费观看| 欧美色爱综合网| 在线不卡一区二区| 91精品国产麻豆国产自产在线 | 精品国产123| 日韩美一区二区三区| 日韩视频一区二区三区在线播放| 欧美精品自拍偷拍| 亚洲精品一线二线三线无人区| 精品久久一区二区| 国产精品免费视频一区| 亚洲视频中文字幕| 亚洲v精品v日韩v欧美v专区| 日韩国产精品久久| 粗大黑人巨茎大战欧美成人| 99久久伊人精品| 在线观看一区不卡| 日韩视频免费观看高清在线视频| 亚洲精品一区二区在线观看| 国产精品天美传媒沈樵| 亚洲精品国产品国语在线app| 夜夜精品视频一区二区| 日韩精品欧美成人高清一区二区| 美国一区二区三区在线播放| 国产成人综合精品三级| 一本大道久久精品懂色aⅴ| 欧美日韩视频第一区| 欧美成人vps| 亚洲乱码中文字幕| 久久99精品国产.久久久久| 福利一区福利二区| 欧美日本韩国一区二区三区视频| 欧美mv日韩mv国产网站| 亚洲人亚洲人成电影网站色| 日韩国产欧美在线视频| 99久久久国产精品| 91精品国产一区二区人妖| 国产精品免费人成网站| 日韩电影一区二区三区| 波多野结衣视频一区| 欧美一级二级三级乱码| 国产精品国产a级| 美脚の诱脚舐め脚责91| 在线精品亚洲一区二区不卡| 久久综合九色综合97婷婷女人| 一区二区三区欧美日韩| 国产成人亚洲精品青草天美| 欧美日韩aaa| 亚洲丝袜制服诱惑| 国产成都精品91一区二区三| 日韩视频免费直播| 午夜欧美电影在线观看| 色婷婷国产精品久久包臀| 欧美国产精品v| 日韩成人午夜电影| 欧美色图在线观看| 亚洲人成精品久久久久久| 国产高清在线精品| 精品粉嫩超白一线天av| 五月激情六月综合| 欧洲亚洲国产日韩| 中文字幕一区二区日韩精品绯色| 国产一区二区成人久久免费影院| 日韩一区二区免费在线观看| 日日夜夜精品免费视频| 欧美麻豆精品久久久久久| 亚洲综合激情小说| 日本精品裸体写真集在线观看| 国产精品无遮挡| 成人午夜视频在线| 国产精品亲子伦对白| 国产寡妇亲子伦一区二区| 精品久久久久香蕉网| 理论电影国产精品| www国产精品av| 国精品**一区二区三区在线蜜桃| 精品国精品自拍自在线| 久久精品国产精品亚洲精品| 欧美成人精品福利| 国产精品一区三区| 国产精品你懂的| 成人av在线看| 亚洲激情综合网| 欧美久久婷婷综合色| 人人超碰91尤物精品国产| 日韩欧美的一区二区| 精品一区二区免费| 国产午夜精品一区二区 | 久久免费视频一区| 国产高清一区日本| 中文字幕中文乱码欧美一区二区 | 色成年激情久久综合| 亚洲一区二区三区四区不卡| 欧美亚洲愉拍一区二区| 日韩成人精品在线观看| 久久久亚洲综合| 91网页版在线| 蜜桃精品视频在线| 国产精品狼人久久影院观看方式| 一本色道久久综合亚洲aⅴ蜜桃| 亚洲成国产人片在线观看| 日韩一区和二区| 成人精品视频.| 亚洲成av人在线观看| 久久日一线二线三线suv| 国产成人无遮挡在线视频| 一区二区三区视频在线看| 9191精品国产综合久久久久久| 日韩—二三区免费观看av| 久久精品一区二区三区四区| 一本色道久久综合亚洲aⅴ蜜桃| 亚瑟在线精品视频| 中文字幕精品三区| 欧美日韩精品一区二区天天拍小说 | 裸体一区二区三区| 国产精品免费视频一区| 4438x成人网最大色成网站| 国产**成人网毛片九色| 日韩黄色一级片| 亚洲欧洲一区二区三区| 日韩丝袜美女视频| 91福利精品第一导航| 国产成人精品网址| 日韩福利视频导航| 亚洲精品免费视频| 欧美高清在线一区| 日韩精品一区二区三区视频播放 | 亚洲美女视频在线观看| 日韩免费看的电影| 欧美日韩在线三级| 色婷婷综合久久久久中文| 国产成人综合在线播放| 日本女人一区二区三区| 亚洲久草在线视频| 国产日韩欧美麻豆| 日韩一级免费观看| 欧美日韩亚洲综合在线 | 欧美日韩高清一区二区| 成人精品视频.| 国产一区二区三区电影在线观看| 亚洲国产日韩a在线播放| 国产精品久久久久久福利一牛影视| 欧美sm极限捆绑bd| 日韩一区二区精品在线观看| 欧美日韩激情一区| 在线亚洲高清视频| 99精品久久只有精品| 国产精品99久久久久久宅男| 美女脱光内衣内裤视频久久网站 | 午夜电影一区二区三区| 亚洲精品日产精品乱码不卡| 国产精品福利一区二区三区| 国产欧美日韩视频在线观看| 久久老女人爱爱| 久久影视一区二区| 久久午夜免费电影| 久久蜜臀精品av| 欧美精品一区二区在线播放| 精品国产电影一区二区| 久久久91精品国产一区二区三区| 精品国产乱码久久久久久影片| 日韩欧美不卡在线观看视频| 日韩免费一区二区| 欧美mv日韩mv| 国产日韩欧美精品一区| 欧美激情中文字幕一区二区| 国产欧美日韩另类视频免费观看| 久久免费美女视频| 中文字幕一区二区三区av | 久久久久国产精品麻豆| 国产亲近乱来精品视频| 国产女人18水真多18精品一级做| 中文字幕av在线一区二区三区| 欧美国产亚洲另类动漫| 中文一区二区完整视频在线观看| 日本一区二区三区久久久久久久久不| 国产欧美精品区一区二区三区 | 成人午夜免费av| gogo大胆日本视频一区| 色婷婷激情一区二区三区| 欧美精品一区二区三区久久久| 精品国产自在久精品国产| 国产日韩欧美麻豆| 一区二区激情视频| 日本成人在线不卡视频| 国产电影一区二区三区| 91亚洲精品一区二区乱码| 欧美午夜理伦三级在线观看| 69p69国产精品| 国产亚洲欧美日韩日本| 亚洲色图在线播放| 青娱乐精品视频|