s4l3.c

来自「TMS320c6000系列dsp软件模拟器在集成开发环境CCS中应用实例」· C语言 代码 · 共 68 行

C
68
字号
/*********************************************************************

 * S4L3.c - (Section 4, Lesson 3) SENDING STRUCTURED DATA

 *          This is the RTDX Target Code for Section 4, Lesson 3

 *

 * This example sends a structure of 3 integers, with values 1,2 & 3

 * to the host.

 ********************************************************************/

 

#include <rtdx.h>       /* defines RTDX target API calls            */

#include "target.h"     /* defines TARGET_INITIALIZE()              */

#include <stdio.h>      /* C_I/O                                    */





/* These are the values we are going to send to the host            */

#define VALUE_FOR_SDATA1 1

#define VALUE_FOR_SDATA2 2

#define VALUE_FOR_SDATA3 3



/*********************************************************************

 * Insert code from Step #2 here - to declare a structure of 3

 *                                 integers

 ********************************************************************/

struct {

        int s_data1;

        int s_data2;

        int s_data3;

}mystruct;



/* declare a global output an channel                               */

RTDX_CreateOutputChannel( ochan );



 

void main()

{

        int status;



        mystruct.s_data1 = VALUE_FOR_SDATA1;

        mystruct.s_data2 = VALUE_FOR_SDATA2;

        mystruct.s_data3 = VALUE_FOR_SDATA3;



        TARGET_INITIALIZE();



        /* enable the output channel                                */

        RTDX_enableOutput( &ochan );



        /*************************************************************

         * Insert code from Step #3 here - to send the structure to

         *                                 the host

         ************************************************************/ 

        status = RTDX_write( &ochan, &mystruct, sizeof(mystruct) );



        if ( status == 0 ) {

                puts( "ERROR: RTDX_write failed!\n" );

                exit( -1 );

        }



        while ( RTDX_writing != NULL ) {

#if RTDX_POLLING_IMPLEMENTATION

                RTDX_Poll();

#endif

        }



        /* disable the output channel                               */

        RTDX_disableOutput( &ochan );

	

        puts( "Program Complete!\n" );

}

⌨️ 快捷键说明

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