本例程用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: