亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲精品一区二区三区精华液| 色88888久久久久久影院野外| 欧美大片日本大片免费观看| 日韩成人午夜电影| 欧美色综合影院| 天堂va蜜桃一区二区三区漫画版| 欧美视频一二三区| 蜜桃av一区二区三区| 久久综合色婷婷| 波多野洁衣一区| 一二三区精品视频| 日韩一区二区在线免费观看| 国产一区视频导航| 亚洲欧美日韩成人高清在线一区| 91久久一区二区| 日韩av二区在线播放| 国产无人区一区二区三区| 波多野结衣在线一区| 一个色在线综合| 精品久久久久久久久久久久包黑料| 国产精品一区二区在线观看不卡 | 欧美精品日韩精品| 看电视剧不卡顿的网站| 中文字幕欧美国产| 欧美午夜免费电影| 国产成人精品亚洲午夜麻豆| 亚洲欧美日韩久久精品| 欧美一区二区在线免费播放| 国产精品77777竹菊影视小说| 亚洲免费观看高清完整版在线观看熊 | 久久中文字幕电影| 色综合色狠狠天天综合色| 日韩电影一区二区三区| 国产精品成人午夜| 欧美一级二级在线观看| 97精品国产露脸对白| 日韩精品视频网站| √…a在线天堂一区| 日韩女优电影在线观看| 91国模大尺度私拍在线视频| 久久99精品国产麻豆婷婷洗澡| 亚洲色图一区二区| 2023国产精品自拍| 欧美日韩成人一区| 91香蕉视频在线| 国产在线乱码一区二区三区| 亚洲va国产天堂va久久en| 中文字幕乱码亚洲精品一区| 日韩三级在线观看| 欧美主播一区二区三区| 成人黄色电影在线 | 日本伊人色综合网| 成人欧美一区二区三区在线播放| 日韩精品影音先锋| 欧美午夜片在线观看| 91丨九色丨黑人外教| 福利电影一区二区三区| 久久99精品一区二区三区三区| 亚洲一区二区三区影院| 日韩伦理电影网| 国产精品久久久久9999吃药| 久久麻豆一区二区| 久久丝袜美腿综合| 精品福利二区三区| 精品国产亚洲一区二区三区在线观看 | 亚洲免费高清视频在线| 国产精品福利一区| 国产免费观看久久| 中文字幕电影一区| 欧美国产精品v| 国产精品美女久久久久久 | 中文字幕一区二区三区不卡在线| 久久亚洲一级片| 久久亚洲一级片| 久久久久久久电影| 国产亚洲一二三区| 欧美激情一区二区三区四区| 欧美高清一级片在线观看| 久久九九国产精品| 亚洲国产精品激情在线观看| 国产精品乱码人人做人人爱 | 国产午夜精品一区二区三区视频| 日韩三级在线观看| www久久久久| 中文字幕乱码日本亚洲一区二区| 国产精品天美传媒| 一区在线播放视频| 亚洲综合在线电影| 亚洲电影一区二区三区| 丝袜美腿成人在线| 久久国产精品免费| 国产成a人亚洲精品| 91亚洲永久精品| 欧美日韩国产一级二级| 日韩一卡二卡三卡四卡| 久久久不卡影院| 亚洲精品日日夜夜| 无码av中文一区二区三区桃花岛| 秋霞午夜av一区二区三区| 久久成人久久爱| 成人精品一区二区三区四区| 色欧美88888久久久久久影院| 在线观看欧美日本| 欧美一卡二卡在线观看| 国产三级一区二区| 一区二区免费看| 蜜桃精品视频在线观看| 播五月开心婷婷综合| 欧美日韩一区久久| 久久日一线二线三线suv| 一区免费观看视频| 日韩黄色免费电影| 成人听书哪个软件好| 欧美私模裸体表演在线观看| 精品区一区二区| 亚洲丝袜精品丝袜在线| 日本中文字幕一区二区视频| 丁香激情综合国产| 欧美色精品在线视频| 久久久www免费人成精品| 亚洲激情一二三区| 国产精品99久久久久| 精品视频免费在线| 日本一区二区三区在线不卡| 五月综合激情网| 不卡区在线中文字幕| 日韩精品专区在线影院重磅| 亚洲精品高清在线观看| 国产精品资源在线| 欧美日韩午夜在线| 国产精品白丝在线| 久久99国产精品尤物| 91黄色激情网站| 国产精品嫩草99a| 国模娜娜一区二区三区| 欧美午夜精品久久久久久孕妇| 国产欧美精品日韩区二区麻豆天美| 亚洲超丰满肉感bbw| 99免费精品在线观看| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 粉嫩13p一区二区三区| 日韩色在线观看| 亚洲1区2区3区视频| 色综合天天综合| 欧美国产禁国产网站cc| 国产美女av一区二区三区| 日韩欧美www| 青青青爽久久午夜综合久久午夜| 色综合久久久网| 国产精品初高中害羞小美女文| 国产一区二区三区免费| 日韩欧美亚洲一区二区| 三级不卡在线观看| 欧美美女一区二区在线观看| 亚洲精品免费在线播放| 99免费精品在线观看| 国产精品国产自产拍高清av| 国产成人免费av在线| 久久精品亚洲精品国产欧美kt∨| 免费观看成人av| 欧美一区二区三区婷婷月色| 日韩精品国产欧美| 69堂亚洲精品首页| 五月婷婷另类国产| 欧美美女黄视频| 午夜欧美大尺度福利影院在线看| 欧美丝袜丝交足nylons图片| 亚洲一区二区3| 欧美精选在线播放| 免费成人在线视频观看| 日韩欧美一区二区免费| 久久精品国产免费看久久精品| 日韩一级片网站| 国产一区激情在线| 欧美韩国日本一区| 99re这里只有精品6| 亚洲精品高清视频在线观看| 欧美日韩三级在线| 蜜桃久久久久久| 久久久www免费人成精品| 成人美女视频在线看| 亚洲免费视频成人| 欧美日本乱大交xxxxx| 蜜臀av一区二区三区| 久久久综合视频| gogogo免费视频观看亚洲一| 亚洲欧洲日产国码二区| 欧美综合天天夜夜久久| 青青草伊人久久| 亚洲国产精品二十页| 色播五月激情综合网| 日韩中文字幕一区二区三区| 久久五月婷婷丁香社区| 成人av在线播放网址| 亚洲丶国产丶欧美一区二区三区| 日韩欧美电影一二三| 99免费精品视频| 无吗不卡中文字幕| 欧美极品xxx| 337p亚洲精品色噜噜|