⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 copy.c

📁 关于DM642的dsp/bios的基本操作的例程
💻 C
字号:
/*
 *  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.
 *  
 */
/* "@(#) DSP/BIOS 4.90.270 06-11-03 (barracuda-m10)" */
/*
 *  ======== copy.c ========
 */

#include <std.h>

#include <hst.h>
#include <pip.h>
#include <swi.h>
#include <log.h>

#include "copycfg.h"

Void inputReady(Void);
Void outputReady(Void);

static Void error(Void);    /* called if an error occurs */

/*
 *  ======== main ========
 */
Void main(Int argc, String argv[])
{

    LOG_printf(&trace, "Copy example started.");

    /* fall into BIOS idle loop */
    return;                 
}

/*
 *  ======== copy ========
 */
Void copy(HST_Obj *input, HST_Obj *output)
{
    PIP_Obj     *in, *out;
    Uns         *src, *dst;
    Uns         size;
    
    in = HST_getpipe(input);
    out = HST_getpipe(output);

    if (PIP_getReaderNumFrames(in) == 0 || PIP_getWriterNumFrames(out) == 0) {
        error();
    }

    /* get input data and allocate output buffer */
    PIP_get(in);
    PIP_alloc(out);

    /* copy input data to output buffer */
    src = PIP_getReaderAddr(in);
    dst = PIP_getWriterAddr(out);

    size = PIP_getReaderSize(in);
    PIP_setWriterSize(out, size);

    for (; size > 0; size--) {
        *dst++ = *src++;
    }

    /* output copied data and free input buffer */
    PIP_put(out);
    PIP_free(in);
}

/*
 *  ======== error ========
 */
static Void error(Void)
{
    LOG_printf(&trace, "Error: copy signal falsely triggered!");
    
    for (;;) {
        ;       /* loop for ever */
    }
}

/*
 * ======== inputReady ========
 */
Void inputReady(Void)
{

     SWI_andn(&copySwi, 1); /* clear swi mbx bit position 0 */

}

/*
 * ======== outputReady ========
 */
Void outputReady(Void)
{

     SWI_andn(&copySwi, 2); /* clear swi mbx bit position 1 */

}

⌨️ 快捷键说明

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