📄 t_read.c
字号:
/*********************************************************************
* FILENAME: $RCSfile: t_read.c,v $
* VERSION : $Revision: 1.2 $
* DATE : $Date: 2000/11/03 19:21:05 $
* Copyright (c) 1997-2000 Texas Instruments Incorporated
*
* Target Read Example:
*____________________________________________________________________
* - Reads 100, one at a time via RTDX_read().
* - Uses ONE input channel
*
* - This is the module to be run on the TARGET.
* - This program is meant to be used with the RTDX Excel project's
* VBA module h_write().
********************************************************************/
#include <stdio.h> /* fprintf(), puts() */
#include <stdlib.h> /* abort() */
#include <rtdx.h> /* RTDX */
#include "target.h" /* TARGET_INITIALIZE() */
#define ITERATIONS 100
struct tagData {
int recvd; /* Data received */
#ifdef HSRTDX
// Silicon HSRTDX workaround...
// - User must define extra 32bit word AFTER all Host-to-target receive
// buffers & align on 32bit boundaries.
#ifdef _TMS320C6X
unsigned dummy;
#elif defined(__TMS320C55X__)
unsigned long dummy;
#else
#error "Unknown how to use Dummy word for this target."
#endif
#endif
} data;
/* Declare and initialize an input channel called "ichan" */
RTDX_CreateInputChannel(ichan);
void main()
{
unsigned int i; /* loop counter */
/* Target initialization for RTDX */
TARGET_INITIALIZE();
/* Enable the channel, "ichan" */
RTDX_enableInput(&ichan);
for ( i = 0; i < ITERATIONS; i++ ) {
/* Request an integer from the host */
if ( (RTDX_read( &ichan, &data.recvd, sizeof(data.recvd) )) !=
sizeof(data.recvd) ) {
fprintf(stderr,
"\nError: RTDX_read() failed\n");
abort();
}
}
/* Disable the channel, "ichan" */
RTDX_disableInput(&ichan);
puts("\nProgram Completed!");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -