dss.c

来自「使用在TI 系列dsk5402 的很多可用例子」· C语言 代码 · 共 101 行

C
101
字号
/*

 *  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.

 *

 *  @(#) XDAS 2.51.00 11-29-2003 (xdas-2.50.00.9)

 */

/*

 *  ======== dss.c ========

 *

 */



#include <std.h>



#include <dss.h>

#include <pip.h>



Int     DSS_error = 0;



Int     DSS_rxCnt = 0;

Int     DSS_txCnt = 0;



Int     *DSS_rxPtr = NULL;

Int     *DSS_txPtr = NULL;



#ifdef _DMA_

#include <dma.h>

#endif

#ifdef _EDMA_

#include <edma.h>

#endif



/*

 *  ======= DSS_txPrime ========

 */

void DSS_txPrime(void)

{

    PIP_Obj     *txPipe = &DSS_txPipe;

    static int delay = 1;       /* or 2, 3, etc. */

    static Int nested = 0;



    if (nested) {       /* prohibit recursive call via PIP_get() */

        return;

    }



    if (delay) {

        delay--;

        return;

    }



    nested = 1;



    if (DSS_txCnt == 0 && PIP_getReaderNumFrames(txPipe) > 0) {

        PIP_get(txPipe);



        DSS_txPtr = PIP_getReaderAddr(txPipe);/* must set 'Ptr' before 'Cnt' */

        DSS_txCnt = PIP_getReaderSize(txPipe);/* to synchronize with isr() */



#ifdef _DMA_

        DMA_txStart(DSS_txPtr, DSS_txCnt);

#endif

#ifdef _EDMA_

        EDMA_txStart(DSS_txPtr, DSS_txCnt);

#endif

    }



    nested = 0;

}



/*

 *  ======= DSS_rxPrime ========

 */

void DSS_rxPrime(void)

{

    PIP_Obj     *rxPipe = &DSS_rxPipe;

    static Int  nested = 0;



    if (nested) {       /* prohibit recursive call via PIP_alloc() */

        return;

    }



    nested = 1;



    if (DSS_rxCnt == 0 && PIP_getWriterNumFrames(rxPipe) > 0) {

        PIP_alloc(rxPipe);



        DSS_rxPtr = PIP_getWriterAddr(rxPipe);/* must set 'Ptr' before 'Cnt' */

        DSS_rxCnt = PIP_getWriterSize(rxPipe);/* to synchronize with isr() */



#ifdef _DMA_

        DMA_rxStart(DSS_rxPtr, DSS_rxCnt);

#endif

#ifdef _EDMA_

        EDMA_rxStart(DSS_rxPtr, DSS_rxCnt);

#endif

    }



    nested = 0;

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?