EasyManuals Logo

Texas Instruments TMS320 User Manual

Texas Instruments TMS320
288 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #245 background imageLoading...
Page #245 background image
Stream I/O—Reading and Writing Streams
Streaming I/O and Device Drivers 7-15
Example 7-7. Using the Issue/Reclaim Model
The output for Example 7-7 is the same as found in Example 7-5.
/* ======== doIRstreaming ======== */
Void doIRstreaming(Uns nloops)
{
Ptr buf;
Arg arg;
Int i, nbytes;
/* Prime the stream with a couple of buffers */
buf = MEM_alloc(IDRAM1, SIO_bufsize(input), 0);
if (buf == MEM_ILLEGAL) {
SYS_abort("Memory allocation error");
}
/* Issue an empty buffer to the input stream */
if (SIO_issue(input, buf, SIO_bufsize(input), NULL) < 0) {
SYS_abort("Error issuing buffer %d", i);
}
buf = MEM_alloc(IDRAM1, SIO_bufsize(input), 0);
if (buf == MEM_ILLEGAL) {
SYS_abort("Memory allocation error");
}
for (i = 0; i < nloops; i++) {
/* Issue an empty buffer to the input stream */
if (SIO_issue(input, buf, SIO_bufsize(input), NULL) < 0) {
SYS_abort("Error issuing buffer %d", i);
}
/* Reclaim full buffer from the input stream */
if ((nbytes = SIO_reclaim(input, &buf, &arg)) < 0) {
SYS_abort("Error reclaiming buffer %d", i);
}
/* Issue full buffer to the output stream */
if (SIO_issue(output, buf, nbytes, NULL) < 0) {
SYS_abort("Error issuing buffer %d", i);
}
/* Reclaim empty buffer from the output stream to be reused */
if (SIO_reclaim(output, &buf, &arg) < 0) {
SYS_abort("Error reclaiming buffer %d", i);
}
}
/* Reclaim and delete the buffers used */
MEM_free(IDRAM1, buf, SIO_bufsize(input));
if ((nbytes = SIO_reclaim(input, &buf, &arg)) < 0) {
SYS_abort("Error reclaiming buffer %d", i);
}
if (SIO_issue(output, buf, nbytes, NULL) < 0) {
SYS_abort("Error issuing buffer %d", i);
}
if (SIO_reclaim(output, &buf, &arg) < 0) {
SYS_abort("Error reclaiming buffer %d", i);
}
MEM_free(IDRAM1, buf, SIO_bufsize(input));
}

Table of Contents

Other manuals for Texas Instruments TMS320

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TMS320 and is the answer not in the manual?

Texas Instruments TMS320 Specifications

General IconGeneral
BrandTexas Instruments
ModelTMS320
CategoryComputer Hardware
LanguageEnglish

Related product manuals