打印

仿真时,从DDR(SDRAM)中快速提取大数据的方法求教

[复制链接]
1671|6
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
dull_man|  楼主 | 2013-7-11 08:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
沙发
dull_man|  楼主 | 2013-7-11 13:28 | 只看该作者
没有人 - -! 有谁用过rtdx,能否给些资料,或者是rtdx能否满足上述需求?

使用特权

评论回复
板凳
zhangmangui| | 2013-7-11 13:50 | 只看该作者
我具体没搞过   下面是相关资料

利用RTDX实现DSP与Matlab的数据交换.pdf (418.67 KB)



RTDX提供了实时、连续了解目标系统程序运行情况的手段,它允许用户在不干扰目标系统程序运行的情况下,在主机和目标系统之间传送数据。目标系统与主机之间的RTDX实际上仍然是通过JTAG接口完成的,目标系统中的RDTX目标库和位于CCS中的RDTX主机库之间实时交换数据。

主机客户程序:运行在主机上利用COM接口项目表应用程序发送数据或者从目标应用程序接收数据的程序。

目标应用程序通过调用RTDX目标库中的函数发送数据。这些数据实际上只是放在RTDX目标库的缓冲区中,然后函数立即返回。RTDX目标库在处理器空闲时将本地缓冲区中的数据发送出去,这样就不干扰主应用程序的正常运行。RTDX主机库对外提供COM接口,可以认为是COM服务器,主机客户程序通过COM接口获取数据,并根据需要分析和显示数据。

同样,当主机应用程序向客户应用程序发送数据时,数据被放在RTDX主机库的缓冲区中。当RTDX主机库接收到目标应用程序要求数据的请求时,如果缓冲区中有足够的数据满足要求,数据就会发送到目标应用程序。数据被写入指定的存储器,不干扰目标应用程序运行,同时主机会通知RTDX目标库操作已经完成。

下面贴上DM642的DSP程序
//rtdxbios.c


#include <std.h>
#include <rtdx.h>
#include"target.h"   
#include <stdio.h>     
#include <log.h>
#include <tsk.h>
#include "rtdxbioscfg.h"

int arraydata[10];
  
Void reading(int n);
Void writing(int n);
Void processing(int n);
Void taskend();
Void main()
{
}                        
        

Void reading(int n)
{      

}

Void writing(int n)
{      
      
        int status;
        n=10;
        LOG_printf(&trace,"writing");
      
        status=RTDX_write(&ochan,&arraydata,4*n);//如何传输一个文件呢?

        if ( status == 0 ) {
                LOG_printf(&trace,"ERROR: RTDX_write failed!\n" );
                exit( -1 );
        }
        LOG_printf(&trace,"has been writed to the host");
}
Void processing(int n)
{
   
int i;
n=10;
      
TARGET_INITIALIZE();

RTDX_enableInput(&ichan);
RTDX_enableOutput(&ochan);
LOG_printf(&trace,"begin");
LOG_printf(&trace,"processing");
    for(i=0;i<n;i++)
    {
     arraydata=i;
    }
}
   
Void taskend()
{      
         while ( RTDX_writing != NULL )
         {
                #if RTDX_POLLING_IMPLEMENTATION
                    RTDX_Poll();
                #endif
         }

         
        RTDX_disableInput(&ichan);                           
        RTDX_disableOutput(&ochan);
        LOG_printf(&trace, "Program Complete!\n" );
        exit(-1);
}

本例程用DSP/BIOS实现,设定了四个任务线程,读函数没有操作,因为个人只想测试一下DSP通过JTAG向PC发送数据。
具体的函数参考DSP/BIOS API 手册,另外因为用到了RTDX,所以必须设置RTDX




主机口程序用VC++6.0写的
// rtdxint.cpp : Defines the entry point for the console application.
//
#import "F:\MFC\rtdxint\rtdxint.dll"
#include "stdafx.h"
#include "rtdxint.h"
#include <iostream.h>

using namespace RTDXINTLib;
int main(int argc, char* argv[])
{
        IRtdxExpPtr rtdx;       // holds pointer to IRtdxExp interface
        short data;             // holds data received from target application
        long status;            // holds status of RTDX COM API calls
        HRESULT hr;             // holds status of generic COM API calls
        // initialize COM
        ::CoInitialize( NULL );
        // instantiate the RTDX COM Object
        hr = rtdx.CreateInstance( L"RTDX" );
  cout.setf( ios::showbase );
        if ( FAILED(hr) ) {
                cerr << hex << hr << " - Error: Instantiation failed! \n";
                return -1;
        }
        // open a channel (ochan) for reading data
        status = rtdx->Open( "ochan", "R" );
        if ( status ) {
                cerr << hex << status \
                     << " -  Error: Opening of channel \"ochan\" failed! \n";
                return -1;
  }
          // loop until we have read all of our messages
        do {
                // read a message
                status = rtdx->ReadI2( &data );

                // test status returned from ReadI2
                switch ( status ) {
                        case Success:
        //如何传输一个文件呢?
                                // display data
                                cout << data << "\n";
                                break;
                        case Failure:
                                cerr << hex << status \
                                     << " - Error: ReadI2 returned failure! \n";
                                return -1;
                        case ENoDataAvailable:
                                cout << "\n\nNo Data is currently available!\n";
                                cout << "\n\nWould you like to continue reading [y or n]?\n";
                                char option;
                                cin >> option;
                                if ( (option == 'y') || (option == 'Y') )
                                        break;
                                else
          return -1;
                        case EEndOfLogFile:
        
                                cout << "\n\nData Processing Complete!\n";
                                break;
                        default:
                                cerr << hex << status \
                                     << " - Error: Unknown return code! \n";
                                return -1;
                }
        } while ( status != EEndOfLogFile );

        // close the channel
        status = rtdx->Close();

        // release the RTDX COM Object
        rtdx.Release();

        // unitialize COM
        ::CoUninitialize();

        return 0;
}
RTDX 是通过JTAG接口实现DSP与PC的双向数据传输,JTAG接口决定了数据通信比特率很低,Kbps级别,用于实时调试还是蛮好,真要做大量数据传输就不合适了。











使用特权

评论回复
地板
dull_man|  楼主 | 2013-7-11 14:11 | 只看该作者
版主果然给力,这个资料我倒是有,但是就是到我手里行不通

使用特权

评论回复
5
zhangmangui| | 2013-7-11 16:21 | 只看该作者
dull_man 发表于 2013-7-11 14:11
版主果然给力,这个资料我倒是有,但是就是到我手里行不通

帮主研究的高深   没涉及过这方面的东西
你修炼成功了还请多多指点

使用特权

评论回复
6
dull_man|  楼主 | 2013-7-11 20:20 | 只看该作者
有这个需求啊,也没办法,一定分享

使用特权

评论回复
7
comeon201208| | 2013-7-11 22:41 | 只看该作者
zhangmangui 发表于 2013-7-11 13:50
我具体没搞过   下面是相关资料

我收下楼主的这个资料的了

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

94

主题

176

帖子

0

粉丝