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

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

?? c6x1x_edma_mcasp.c

?? 通過BIOS在DEC6713上實現了音頻的采樣與播放
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
 *  Copyright 2003 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  
 */
/* "@(#) DDK 1.11.00.00 11-04-03 (ddk-b13)" */
/* 
 *  ======== c6x1x_edma_mcasp.c ========
 * 
 *  Generic McASP driver for the TMS320C6x1x series. Uses the EDMA.
 */

#include <std.h>
#include <atm.h>
#include <hwi.h>
#include <que.h>

#include <iom.h>

#include <csl.h>
#include <csl_mcasp.h>
#include <csl_irq.h>
#include <csl_edma.h>
#include <csl_cache.h>
#include <csl_chip.h>

#include <c6x1x_edma_mcasp.h>

/*
 *  Macro to start serializer & state machine
 *  if turned on, driver will start both transmit and receive serializer 
 *  and state machine synchronously  
 */
#define STARTSERIALIZERSYNC     0

/*
 *  Macro to enable edma loop job interrupt
 *  if turned on, each time edma loop job gets running, an ineterrupt will
 *  be generated. This is only used for debug purpose.
 */
#define ENABLELOOPINTR          0 

#if ENABLELOOPINTR
#include <log.h>
extern far LOG_Obj trace;
#endif

#define IRQEVTINPUT             5
#define IRQEVTOUTPUT            6
#define IRQEDMA                 8


/* Maximum number of EDMA jobs linked at a time (Must be 2). */
#define MAXLINKCNT 2

/* Used as index since IOM mode is a bit mask and not an index */
#define INPUT   0
#define OUTPUT  1

/* States for chanCleanUp() */
#define SETFALSE 1
#define FREETCC 2
#define FREETABLE 3
#define FREETABLEEX 4
#define DELCHAN 5

/* Macro to increment and return the indice that ranges over MAXLINKCNT */
#define nextIndex(index) ((index) ^ 1)

/* Number of ports available */
#define NUMPORTS _MCASP_PORT_CNT 

/* Number of channels per port (one input and one output channel) */
#define NUMCHANS 2

/* Structure containing channel specific variables */
typedef struct ChanObj {
    Uns inUse;                /* True if the channel is in use */
    Int mode;                 /* Input or output channel */
    struct PortObj *port;     /* Pointer to the port which owns this chan */
    EDMA_Handle xferPram;     /* Handle to transfer PaRAM */
    EDMA_Handle pramTbl[MAXLINKCNT]; /* Handles to link PaRAMs */
    EDMA_Handle prevPramPtr;  /* Points to the PaRAM last used */
    EDMA_Handle loophEdma;    /* Handle to the Loop job PaRAM */
    IOM_Packet *flushPacket;  /* Holds the flushpacket (if any) */
    IOM_Packet *abortPacket;  /* Holds the abortpacket (if any) */
    IOM_Packet *packetList[MAXLINKCNT]; /* Holds linked  packets */
    QUE_Obj packetQueue;      /* Holds submitted but not linked packets */
    Int submitCount;          /* Number of submit calls pending */
    Int writeIndex;           /* Index of next PaRAM to write to */
    Int readIndex;            /* Index of next PaRAM to read from */
    Int tcc;                  /* Channel transfer complete code */
    IOM_TiomCallback cbFxn;   /* Called when I/O complete */
    Ptr cbArg;                /* Argument to callback function */
} ChanObj, *ChanHandle;

/* Structure containing port specific variables */
typedef struct PortObj {
    Uns inUse;                /* True if the port is in use */
    Int devId;                /* The device id passed to mdBindDev() */
    Bool cacheCalls;          /* Submitted buffers are in cacheable memory */
    Uint32 enableHclkg;       /* Holds enable Hclk variable */
    Uint32 enableClkg;        /* Holds enable Clk variable */
    Uint32 enableFsyncg;      /* Holds enable Fsync variable */
    MCASP_Handle hMcasp;      /* CSL Device handle */
    ChanObj chans[NUMCHANS];  /* The channels associated with the port */
    Uns chanCreated;          /* One channel in this port has been Created */
    C6X1X_EDMA_MCASP_TevtCallback evtCallback; /* event callback */
    Uns evtMask;              /* registered events */
} PortObj, *PortHandle;

/* Declare the port and channel structures */
static PortObj ports[NUMPORTS];

/* Define EDMA Event Id's Array */
static Uns eventIds[NUMPORTS][2] = {
    { EDMA_CHA_AREVT0, EDMA_CHA_AXEVT0 },
#if NUMPORTS >= 2
    { EDMA_CHA_AREVT1, EDMA_CHA_AXEVT1 },
#endif
#if NUMPORTS == 3
    { EDMA_CHA_AREVT2, EDMA_CHA_AXEVT2 }
#endif
};

/*
 * Forward declaration of the IOM interface functions. They are only
 * exposed via the IOM function table to avoid namespace pollution.
 */
static Int mdBindDev(Ptr *devp, Int devid, Ptr devParams);
static Int mdCreateChan(Ptr *chanp, Ptr devp, String name, Int mode,
                        Ptr chanParams, IOM_TiomCallback cbFxn, Ptr cbArg);
static Int mdDeleteChan(Ptr chanp);
static Int mdSubmitChan(Ptr chanp, IOM_Packet *packet);
static Int mdUnBindDev(Ptr devp);

#if ENABLELOOPINTR
static Void isrLoop(Int tcc);
#endif

/* Public IOM interface table */
IOM_Fxns C6X1X_EDMA_MCASP_FXNS = {
    &mdBindDev,
    &mdUnBindDev,
    IOM_CONTROLCHANNOTIMPL,
    &mdCreateChan,
    &mdDeleteChan,
    &mdSubmitChan
};

/* Local function prototypes */
static Void chanCleanUp(ChanHandle chan, Uns state);
static Void isrCommon(ChanHandle chan);
static Void isrInput(Int tcc);
static Void isrOutput(Int tcc);
static Void isrEvent(Int mode);
static Void linkPacket(ChanHandle chan, IOM_Packet *packet);

/* Local driver variables. */
static Uint32 loopDstBuf;
static Uint32 loopSrcBuf;

#if ENABLELOOPINTR
static Void isrLoop(Int tcc)
{
    LOG_printf(&trace, "LOOP=%d", tcc);
}
#endif

/*
 * ======== chanCleanUp ========
 * Cleans up the channel resources.
 */
static Void chanCleanUp(ChanHandle chan, Uns state)
{
    switch(state) {
    case DELCHAN:
        /* Close the EDMA channel */
        EDMA_close(chan->xferPram);

        /* Disable transfer interrupts from the EDMA */
        EDMA_intDisable(chan->tcc);
        /* will fall through the next case */
    case FREETABLEEX:
        /* Free the EDMA link PaRAM tables */
        EDMA_freeTableEx(MAXLINKCNT, chan->pramTbl);
        /* will fall through the next case */
    case FREETABLE:
        /* Free the loop EDMA PaRAM table */
        EDMA_freeTable(chan->loophEdma);
        /* will fall through the next case */
    case FREETCC:
        /* Free the transfer complete code */
        EDMA_intFree(chan->tcc);
        /* will fall through the next case */
    case SETFALSE:
        /* Mark the channel as closed */
        chan->inUse = FALSE;
        break;
    }
}
/*
 * ======== isrCommon ========
 * Shared ISR code between input and output. Processes a normal EDMA job.
 */
static Void isrCommon(ChanHandle chan)
{
    IOM_Packet *packet;
    Int cnt;

    /* Check to see if this is a completed async abort call */
    if (chan->abortPacket) {
        /* Discard all packets in transmission or queued up */
        if (chan->submitCount > MAXLINKCNT) {
            cnt = MAXLINKCNT;
        }
        else {
            cnt = chan->submitCount;
        }

        while (cnt > 0) {
            packet = chan->packetList[chan->readIndex];
            packet->status = IOM_ABORTED;
            (*chan->cbFxn)(chan->cbArg, packet);

            chan->readIndex = nextIndex(chan->readIndex);
            cnt--;
        }

        while (!QUE_empty(&chan->packetQueue)) {
            packet = QUE_dequeue(&chan->packetQueue);
            packet->status = IOM_ABORTED;
            (*chan->cbFxn)(chan->cbArg, packet);
        }

        /* Reset the driver channel state */
        chan->writeIndex = 0;
        chan->readIndex = 0;
        chan->submitCount = 0;

        chan->abortPacket->status = IOM_COMPLETED;
        (*chan->cbFxn)(chan->cbArg, chan->abortPacket);
        chan->abortPacket = NULL;
        return;
    }

    /* Fetch the completed packet */
    packet = chan->packetList[chan->readIndex];

    chan->readIndex = nextIndex(chan->readIndex);

    /* Mark the packet as completed */
    packet->status = IOM_COMPLETED;

    /* Call the callback function */
    (*chan->cbFxn)(chan->cbArg, packet);

    chan->submitCount--;

    /*
     * See if there are any unlinked packets in the packetQueue
     * and if so link them.
     */
    if (chan->submitCount >= MAXLINKCNT) {
        packet = QUE_dequeue(&chan->packetQueue);
        linkPacket(chan, packet);
    }
}

/*
 * ======== isrInput ========
 * The input isr called from the EDMA dispatcher every time an input
 * EDMA job completes.
 */
static Void isrInput(Int tcc)
{
    ChanHandle chan;
    Int portNbr;

    /* Check which port was responsible for the interrupt */
    for (portNbr = 0; portNbr < NUMPORTS; portNbr++) {
        chan = &ports[portNbr].chans[INPUT];

        if (chan->tcc == tcc && chan->inUse) {

            if (EDMA_RGETH(chan->xferPram, DST) == (Uint32) &loopDstBuf &&
                chan->submitCount > 1 && !chan->abortPacket) {
                /*
                 * An emulation halt has occured with more than 1 job
                 * submitted. Link the currently executing job (the Loop job)
                 * to the first of the linked jobs which hadn't been called
                 * back. This way we still have the same number of submitted
                 * jobs after the execution continues as we had before the
                 * emulation halt (breakpoint) occured (this preserves double
                 * buffering if used).
                 */
                EDMA_disableChannel(chan->xferPram);
                EDMA_link(chan->xferPram, chan->pramTbl[chan->readIndex]);
                EDMA_enableChannel(chan->xferPram);
            }
            else {
                /* Call the common ISR code for a finished normal EDMA job */
                isrCommon(chan);
            }
        }
    }
}

/*
 * ======== isrOutput ========
 * The output isr called from the EDMA dispatcher every time an output
 * EDMA job completes.
 */
static Void isrOutput(Int tcc)
{
    ChanHandle chan;
    Int portNbr;

    /* Check which port was responsible for the interrupt */
    for (portNbr = 0; portNbr < NUMPORTS; portNbr++) {
        chan = &ports[portNbr].chans[OUTPUT];

        if (chan->tcc == tcc && chan->inUse) {

            if (EDMA_RGETH(chan->xferPram, SRC) == (Uint32)&loopSrcBuf &&
                chan->submitCount > 1 && !chan->abortPacket) {
                /*
                 * An emulation halt has occured with more than 1 job
                 * submitted. Link the currently executing job (the Loop job)
                 * to the first of the linked jobs which hadn't been called
                 * back. This way we still have the same number of submitted
                 * jobs after the execution continues as we had before the
                 * emulation halt (breakpoint) occured (this preserves double
                 * buffering if used).
                 */
                EDMA_disableChannel(chan->xferPram);
                EDMA_link(chan->xferPram, chan->pramTbl[chan->readIndex]);
                EDMA_enableChannel(chan->xferPram);
            }
            else {
                /* Call the common ISR code for a finished normal EDMA job */
                isrCommon(chan);

                /* Check to see if an async flush has completed */
                if (chan->submitCount == 0 && chan->flushPacket) {
                    chan->flushPacket->status = IOM_COMPLETED;
                    (*chan->cbFxn)(chan->cbArg,chan->flushPacket);
                    chan->flushPacket = NULL;
                }
            }
        }
    }
}

/*
 * ======== isrEvent ========
 * The event isr called when an McASP input/output event happens
 * This is used for exception event handling asserted by McASP. Normal data
 * hanlding is done by EDMA. 
 */
static Void isrEvent(Int mode)
{
    MCASP_Handle hMcasp;
    Uns portNbr;
    Uns events;
    Uns eventReturn;
    
    /* Check which port was responsible for the interrupt */
    for (portNbr = 0; portNbr < NUMPORTS; portNbr++) {
        if (ports[portNbr].inUse) {
            hMcasp = ports[portNbr].hMcasp;
            events = 0;
            if (mode == INPUT) {          
                if (MCASP_FGETH(hMcasp, RSTAT, ROVRN)) {
                    MCASP_FSETSH(hMcasp, RSTAT, ROVRN, YES);
                    events |= C6X1X_EDMA_MCASP_EVT_ROVRN;
                } 
                if (MCASP_FGETH(hMcasp, RSTAT, RCKFAIL)) {
                    MCASP_FSETSH(hMcasp, RSTAT, RCKFAIL, YES);
                    events |= C6X1X_EDMA_MCASP_EVT_RCKFAIL;
                }
                if (MCASP_FGETH(hMcasp, RSTAT, RSYNCERR)) {
                    MCASP_FSETSH(hMcasp, RSTAT, RSYNCERR, YES);
                    events |= C6X1X_EDMA_MCASP_EVT_RSYNCERR;
                }   
                if (MCASP_FGETH(hMcasp, RSTAT, RDMAERR)) {
                    MCASP_FSETH(hMcasp, RSTAT, RDMAERR, 1);
                    events |= C6X1X_EDMA_MCASP_EVT_RDMAERR;
                }   
                /* Clear not registered events here */
                MCASP_RSETH(hMcasp, RSTAT, 0xFFFFFFFF);
            } 
            else {
                if (MCASP_FGETH(hMcasp, XSTAT, XUNDRN)) {
                    MCASP_FSETSH(hMcasp, XSTAT, XUNDRN, YES);
                    events |= C6X1X_EDMA_MCASP_EVT_XUNDRN;
                } 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩电影在线免费观看| 国产欧美日韩久久| 日本精品视频一区二区三区| 国产资源在线一区| 麻豆91精品视频| 日韩精品欧美精品| 蜜桃一区二区三区在线观看| 日韩高清不卡一区二区三区| 奇米影视在线99精品| 麻豆久久久久久| 国产美女av一区二区三区| 国产一二精品视频| 99精品国产热久久91蜜凸| jlzzjlzz国产精品久久| 一本一道波多野结衣一区二区 | 美日韩一级片在线观看| 全国精品久久少妇| 久久综合综合久久综合| 国产精品一卡二| 99久久精品免费看国产| 色噜噜夜夜夜综合网| 欧美精品粉嫩高潮一区二区| 精品卡一卡二卡三卡四在线| 国产视频一区在线播放| 亚洲激情网站免费观看| 日本欧美一区二区| 国产不卡免费视频| 在线免费视频一区二区| 91精品国产手机| 国产精品每日更新在线播放网址| 亚洲欧洲性图库| 青青草伊人久久| 丰满放荡岳乱妇91ww| 欧美日韩一二三区| 日本一区二区视频在线| 一区二区三区四区五区视频在线观看| 日韩在线观看一区二区| 成人av网站大全| 欧美一区二区三区视频在线| 日本一区二区三区四区在线视频| 亚洲国产cao| 国产成都精品91一区二区三| 欧美人狂配大交3d怪物一区| 中文字幕 久热精品 视频在线| 亚洲电影一级片| 成人精品视频网站| 精品国产乱码久久久久久老虎| 亚洲精品视频自拍| 国产美女av一区二区三区| 欧美日韩美少妇| 亚洲欧洲成人av每日更新| 精品一区精品二区高清| 欧美伊人久久久久久久久影院 | bt欧美亚洲午夜电影天堂| 欧美精品欧美精品系列| 精品国产一区二区三区av性色| 亚洲最大成人网4388xx| av电影一区二区| 日本一二三四高清不卡| 精品一区二区三区的国产在线播放| 在线观看亚洲专区| 日韩久久一区二区| 懂色中文一区二区在线播放| 精品剧情v国产在线观看在线| 亚洲精品国产无天堂网2021| caoporn国产精品| 国产精品人人做人人爽人人添| 美女网站色91| 欧美成人性福生活免费看| 肉色丝袜一区二区| 欧美精品久久天天躁| 亚洲高清久久久| 欧美日韩精品一区二区三区四区 | 日韩欧美在线影院| 日韩成人av影视| 欧美一区二区三区喷汁尤物| 亚洲成人精品一区| 欧美高清www午色夜在线视频| 一区二区三区不卡在线观看| 在线观看亚洲a| 亚洲第一福利一区| 日韩一区二区三区免费观看| 久久成人18免费观看| 日韩欧美成人一区二区| 国产一区二区视频在线| 中文一区在线播放| 色综合久久久久综合| 亚洲一区精品在线| 欧美久久久久久蜜桃| 丝袜a∨在线一区二区三区不卡| 91精品欧美一区二区三区综合在 | 色欧美88888久久久久久影院| 国产精品乱人伦中文| 91年精品国产| 日韩激情一二三区| 精品国产乱码久久久久久蜜臀| 国产69精品一区二区亚洲孕妇| **欧美大码日韩| 欧美日高清视频| 精品写真视频在线观看| 欧美激情一区二区三区不卡| 色婷婷精品久久二区二区蜜臀av| 亚洲第一搞黄网站| 久久久久久麻豆| 在线观看日韩精品| 日韩激情视频网站| 国产精品九色蝌蚪自拍| 337p亚洲精品色噜噜噜| 国产黄色91视频| 午夜亚洲福利老司机| 欧美成人伊人久久综合网| av一区二区久久| 麻豆成人久久精品二区三区红| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 蜜臀av性久久久久蜜臀av麻豆| 久久精品亚洲一区二区三区浴池| 91小宝寻花一区二区三区| 久久er精品视频| 一区二区视频在线看| 久久久久久电影| 欧洲亚洲精品在线| 高清免费成人av| 久久69国产一区二区蜜臀| 亚洲欧美国产毛片在线| 久久久久久久免费视频了| 欧美日韩中字一区| 国产一本一道久久香蕉| 亚洲成人午夜电影| 亚洲卡通欧美制服中文| 国产亚洲欧美日韩日本| 日韩免费看网站| 欧美日韩在线播放| 色偷偷久久人人79超碰人人澡| 国产在线一区观看| 男女激情视频一区| 亚洲成精国产精品女| 一个色在线综合| 中文字幕不卡在线| 国产视频在线观看一区二区三区 | 91久久国产最好的精华液| 国产剧情一区二区| 无吗不卡中文字幕| 亚洲国产aⅴ天堂久久| 一区二区在线观看视频| 亚洲精品成人悠悠色影视| 中文字幕在线不卡一区二区三区| 久久蜜桃一区二区| 久久午夜免费电影| 欧美本精品男人aⅴ天堂| 日韩一区二区三区视频在线观看| 69久久99精品久久久久婷婷| 欧美日韩一区二区三区四区| 91黄色免费看| 欧美亚男人的天堂| 欧美日本一区二区三区四区| 欧美亚洲日本一区| 欧美二区乱c少妇| 日韩一级大片在线| 欧美精品一区二区三区在线| 精品福利在线导航| 久久久.com| 1024国产精品| 一区二区三区影院| 日韩av中文字幕一区二区三区| 日韩av不卡在线观看| 激情欧美一区二区| 国产麻豆成人传媒免费观看| 成人av中文字幕| 99久久伊人精品| 欧美亚洲禁片免费| 日韩欧美一级二级三级久久久| 精品噜噜噜噜久久久久久久久试看| 欧美日韩一区二区在线观看视频| 欧美一区二区三区电影| 久久―日本道色综合久久| 国产蜜臀97一区二区三区| 亚洲国产综合视频在线观看| 亚洲国产欧美日韩另类综合| 亚洲大片在线观看| 国产一本一道久久香蕉| 99久久精品国产导航| 欧美久久久一区| 中文字幕av在线一区二区三区| 亚洲蜜臀av乱码久久精品蜜桃| 亚洲超碰97人人做人人爱| 国产尤物一区二区| 在线中文字幕一区| 日韩精品一区二区三区三区免费| 国产精品久久久久7777按摩| 亚洲成国产人片在线观看| 国产麻豆视频精品| 7777精品久久久大香线蕉| 国产精品久久久久久久久久免费看 | 国产天堂亚洲国产碰碰| 亚洲综合精品久久| 国产麻豆精品在线| 欧美日韩精品福利| 中文av一区特黄| 麻豆精品新av中文字幕| 色噜噜狠狠色综合欧洲selulu|