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

📄 hst.c

📁 DSP内核代码
💻 C
字号:
#include<std.h>

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

#include"hstcfg.h"

int read_from_host(int *in);

int input_buf[128];        /*buf receive from host*/
int process_buf[128];      /*process the buf*/
int save_buf[128];         /*buf save to host*/

main()
{
}

void save_to_host(int *in)
{
     PIP_Handle pipe;
     Uns size;
     int *addr;
     int i;
     
     pipe=HST_getpipe(&HST0);/*get the hst object*/
     
     if(PIP_getWriterNumFrames(pipe)<=0)
        return;
     PIP_alloc(pipe);
     size=PIP_getWriterSize(pipe);
     addr=PIP_getWriterAddr(pipe);
     for(i=0;i<size;i++)
        *addr++=*in++;
     PIP_put(pipe);
}

int read_from_host(int *in)
{
    PIP_Handle pipe;
    Uns size;
    int *addr;
    int i;
    
    pipe=HST_getpipe(&HST1);
    if(PIP_getReaderNumFrames(pipe)<=0)
       return(-1);
    PIP_get(pipe);
    size=PIP_getReaderSize(pipe);
    addr=PIP_getReaderAddr(pipe);
    for(i=0;i<size;i++)
        *in++=*addr++;
    PIP_free(pipe);
    return(0);
}

void processing(int *in,int *out)
{
    int i;
    if(read_from_host(in)<0)
       return;
    in+=127;
    for(i=0;i<128;i++)
       *out++=*in--;
       out-=128;
       save_to_host(out);
}

void receive()
{
    SWI_post(&SWI0);
}



     
     
     
     










⌨️ 快捷键说明

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