File: node47.html

package info (click to toggle)
rtlinux 3.1pre3-2
  • links: PTS
  • area: non-free
  • in suites: sarge, woody
  • size: 4,892 kB
  • ctags: 4,228
  • sloc: ansic: 26,204; sh: 2,069; makefile: 1,414; perl: 855; tcl: 489; asm: 380; cpp: 42
file content (169 lines) | stat: -rw-r--r-- 5,231 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2K.1beta (1.48)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Adding Modules</TITLE>
<META NAME="description" CONTENT="Adding Modules">
<META NAME="keywords" CONTENT="rtic">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="rtic.css">

<LINK REL="next" HREF="node50.html">
<LINK REL="previous" HREF="node46.html">
<LINK REL="up" HREF="node46.html">
<LINK REL="next" HREF="node48.html">
</HEAD>

<BODY bgcolor="white">
<!--Navigation Panel-->
<A NAME="tex2html644"
  HREF="node48.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="/usr/share/latex2html/icons/next.png"></A> 
<A NAME="tex2html642"
  HREF="node46.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="/usr/share/latex2html/icons/up.png"></A> 
<A NAME="tex2html636"
  HREF="node46.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="/usr/share/latex2html/icons/prev.png"></A>   
<BR>
<B> Next:</B> <A NAME="tex2html645"
  HREF="node48.html">The API</A>
<B> Up:</B> <A NAME="tex2html643"
  HREF="node46.html">Enhancing XRTiC</A>
<B> Previous:</B> <A NAME="tex2html637"
  HREF="node46.html">Enhancing XRTiC</A>
<BR>
<BR>
<!--End of Navigation Panel-->

<H2><A NAME="SECTION00511000000000000000">
Adding Modules</A>
</H2>

<P>
Modules may be written to perform user defined activities in soft real
time.  For example, modules can be used to display data (aka. plotting
package), animate machinery (aka. a three dimensional graphic image of
a robotic arm), or simply to monitor the embedded tasks (aka. FFT
calculations on the incoming data).  To do so, the user needs to
create his/her own independent application without needing to worry
about the <TT>xrtic</TT> internals.  A sample application is shown in
Figure <A HREF="node47.html#example_module">5.1</A>.

<P>

<P></P>
<DIV ALIGN="CENTER"><A NAME="example_module"></A><A NAME="2810"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 5.1:</STRONG>
Smallest application possible using the <TT>xrtic</TT> module API</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"></DIV><TABLE  WIDTH="60%">
<TR><TD>
<PRE>
1: #include ``rtic_module.h''
2: 
3: int main(int argc, char *argv[])
4: {
5:   /* initialize connection to xrtic */
6:   rtic_connect_init(&amp;argc, &amp;argv, TRUE);
7:  
8:   /*
9:      connection dependent program goes here
10:   */
11:
12:	
13:  /* disconnect from xrtic */
14:  rtic_connect_quit();
15:  	
16:  return(0);
17: }
</PRE></TD></TR>
</TABLE>
<DIV ALIGN="CENTER">
</DIV></TD></TR>
</TABLE>
</DIV><P></P>

<P>
Line 1 includes the necessary header file.  Line 6 initializes the
connection to <TT>xrtic</TT> and line 14 terminates it.  Everything else
in between lines 6 and 13 is dependent on the user's application, and
does not interfere with <TT>xrtic</TT>.

<P>
To compile this program, called <TT>mytest.c</TT>, one would compile it
(assuming that rtic-lab has already been compiled) using the
following:

<P><PRE>
1: gcc -Wall -O2 \
2:         -I\$(RTIC\-\_ROOT)/include \
3:        -L\$(RTIC\-\_ROOT)/non\-\_rt\-\_tasks/modules\
4:        mytest.c \
5:        -lmodules
</PRE>

<P>
where the shell variable <TT>RTIC_ROOT</TT> denotes the path to the
rtic-lab source tree, for example <TT>/home/jonny/devel/rtic-lab</TT>. Here, line 1 calls up the GCC
compiler with all warnings turned on and the highest level of
optimization available.  Line 2 tells the compiler where to look for
the header files. Line 3 tells the compiler where to look for the
``modules'' library. Line 4 is our source file, and line 5 is the
rtic-library that we need to link into our program.

<P>
<BR><HR>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>

<UL>
<LI><A NAME="tex2html646"
  HREF="node48.html">The API</A>
<LI><A NAME="tex2html647"
  HREF="node49.html">Example Calls</A>
</UL>
<!--End of Table of Child-Links-->
<HR>
<!--Navigation Panel-->
<A NAME="tex2html644"
  HREF="node48.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="/usr/share/latex2html/icons/next.png"></A> 
<A NAME="tex2html642"
  HREF="node46.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="/usr/share/latex2html/icons/up.png"></A> 
<A NAME="tex2html636"
  HREF="node46.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="/usr/share/latex2html/icons/prev.png"></A>   
<BR>
<B> Next:</B> <A NAME="tex2html645"
  HREF="node48.html">The API</A>
<B> Up:</B> <A NAME="tex2html643"
  HREF="node46.html">Enhancing XRTiC</A>
<B> Previous:</B> <A NAME="tex2html637"
  HREF="node46.html">Enhancing XRTiC</A>
<!--End of Navigation Panel-->
<ADDRESS>
Michael Barabanov
2001-06-19
</ADDRESS>
</BODY>
</HTML>