10.07.2015 Views

DSP II: ELEC 4523 Real-Time Data Exchange - Faculty

DSP II: ELEC 4523 Real-Time Data Exchange - Faculty

DSP II: ELEC 4523 Real-Time Data Exchange - Faculty

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Real</strong>-<strong>Time</strong> <strong>Data</strong> <strong>Exchange</strong> Page 3/10read function. The RTDX_read function actually waits in a loop for the read to becompleted. It will not cause a task to enter the TSK_BLOCKED state.RTDX_readRTDX_readNBRTDX_write• Disable the channel after use. The functions to disable either an input or output channel aregiven below.RTDX_disableInputRTDX_disableOutputThis process is shown in the following code section where an SWI is set up to output data tothe host. In this example a single integer is sent to the host one time. Examine the code sectionan compare to the steps outlined above. This example assumes that the configuration tool is usedto set up <strong>DSP</strong>/BIOS and therefore the target does not need to be initialized./* create a global output channel */RTDX_CreateOutputChannel( ochan );void funSWI(){int data = 10; /* data to send to host */int status;/* enable the output channel */RTDX_enableOutput( &ochan );/* send the data to the host */status = RTDX_write( &ochan, &data, sizeof(data) );/* check the status of the write operation */if ( status == 0 ) {puts("ERROR: RTDX_write failed!\n" );exit(-1 );}}/* disable the channel after use */RTDX_disableOutput( &ochan );The next section of code shows a similar SWI set up to input an integer from the host.Notice that the structure of the code is the same as the above section of code./* create a global input channel */RTDX_CreateInputChannel( ichan );void funSWI(){int data;int status;/* enable the input channel */RTDX_enableInput( &ichan );/* send the data to the host */

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!