next up previous
Next: The API Up: Enhancing XRTiC Previous: Enhancing XRTiC

Adding Modules

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 xrtic internals. A sample application is shown in Figure 5.1.

Figure 5.1: Smallest application possible using the xrtic module API
1: #include ``rtic_module.h''
2: 
3: int main(int argc, char *argv[])
4: {
5:   /* initialize connection to xrtic */
6:   rtic_connect_init(&argc, &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: }

Line 1 includes the necessary header file. Line 6 initializes the connection to xrtic 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 xrtic.

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

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

where the shell variable RTIC_ROOT denotes the path to the rtic-lab source tree, for example /home/jonny/devel/rtic-lab. 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.



Subsections
next up previous
Next: The API Up: Enhancing XRTiC Previous: Enhancing XRTiC
Michael Barabanov 2001-06-19