beautypg.com

Driver task, Case reversal task, River – Sundance SMT401 User Manual

Page 18: Eversal

background image

Released

Page 18 of 21

SMT401 PMC TIM Carrier User Guide

Document Name:

SMT401 User Guide V1.2.doc

Issue : 02

Rev.: 1.11

5.2 Driver

Task

The purpose of the driver task is to act as a front end to the case reversal
task:

#include

#include

main(int argc, char* argv[], char* envp[],

CHAN* in_ports[], int ins,

CHAN* out_ports[], int outs)

{

int c;

for (;;) {

c = getchar();

chan_out_word(c, out_ports[0]);

if (c == EOF)

break;

chan_in_word(&c, in_ports[0]);

putchar(c);

}

exit(0);

}

5.3 Case Reversal Task

The case reversal task receives characters from the driver task, inverts their
case if alphabetic, and then returns them to the driver task.

#include

#include

#include

main(int argc, char* argv[], char* envp[],

CHAN* in_ports[], int ins, CHAN* out_ports[], int

outs)

{

int c;

Product Name:

SMT401

Revision Date:

07 December 2004

Author:

Mark I. Cartlidge (Updated by SM, added JTAG slave section)

Original Date:

12 May 1999