\begin{flushleft}
{\small
\verb%interface.c(3)                                     interface.c(3)%\\
\verb%%\\
\verb%%\\
\verb%%\\
\verb%%{\large NAME}\verb%%\\
\verb%       interface.c - Implementation of an example interface to a%\\
\verb%       simple robot with two independent axies.%\\
\verb%%\\
\verb%%{\large SYNOPSIS}\verb%%\\
\verb%       #include <stdio.h>%\\
\verb%       #include <unistd.h>%\\
\verb%       #include <stdlib.h>%\\
\verb%       #include <asm/io.h>%\\
\verb%       #include <time.h>%\\
\verb%       #include <sys/wait.h>%\\
\verb%%\\
\verb%%\\
\verb%   %{\large Defines}\verb%%\\
\verb%       #define %{\large interface\_ymax\_time}\verb%   20000%\\
\verb%           %\underline{\tt Time it rakes to drive to robot form y}\verb%%{\large \_}\verb%%\underline{\tt min to y}\verb%%{\large \_}\verb%%\underline{\tt max.}\verb%%\\
\verb%       #define %{\large interface\_xmax\_time}\verb%   20000%\\
\verb%           %\underline{\tt Time it rakes to drive to robot form x}\verb%%{\large \_}\verb%%\underline{\tt min to x}\verb%%{\large \_}\verb%%\underline{\tt max.}\verb%%\\
\verb%       #define %{\large interface\_ymax}\verb%   100%\\
\verb%           %\underline{\tt Maximal Y value (cosidered as 100 percent).}\verb%%\\
\verb%       #define %{\large interface\_xmax}\verb%   100%\\
\verb%           %\underline{\tt Maximal X value (cosidered as 100 percent).}\verb%%\\
\verb%       #define %{\large interface\_ioport}\verb%   0x378%\\
\verb%           %\underline{\tt IO Port to which lowest nible to robot is connected.}\verb%%\\
\verb%%\\
\verb%   %{\large Functions}\verb%%\\
\verb%       unsigned char %{\large input }\verb%(int addr)%\\
\verb%           %\underline{\tt Read a byte from an IO port.}\verb%%\\
\verb%       unsigned char %{\large output }\verb%(int addr, unsigned char out)%\\
\verb%           %\underline{\tt Write a byte to an IO port.}\verb%%\\
\verb%       void %{\large msleep }\verb%(int msec)%\\
\verb%           %\underline{\tt Wait a specified number of milliseconds.}\verb%%\\
\verb%       int %{\large getmax }\verb%(int a, int b)%\\
\verb%           %\underline{\tt Get to highest number out of two input numbers.}\verb%%\\
\verb%       int %{\large getmin }\verb%(int a, int b)%\\
\verb%           %\underline{\tt Get to lowest number out of two input numbers.}\verb%%\\
\verb%       void %{\large interface\_drive }\verb%(int h, int v)%\\
\verb%           %\underline{\tt Drive the robot in a specified direction.}\verb%%\\
\verb%       void %{\large interface\_init }\verb%(int mode)%\\
\verb%           %\underline{\tt Initialze the interface and drive the robot to the}\verb%%\\
\verb%           %\underline{\tt start position.}\verb%%\\
\verb%       void %{\large interface\_driveto }\verb%(int x, int y)%\\
\verb%           %\underline{\tt Drive to robot to absolute coordinates.}\verb%%\\
\verb%       void %{\large interface\_stop }\verb%()%\\
\verb%           %\underline{\tt Stop the interface, switch all off.}\verb%%\\
\verb%%\\
\verb%   %{\large Variables}\verb%%\\
\verb%       int %{\large interface\_x}\verb%%\\
\verb%           %\underline{\tt current X possition of robot (global).}\verb%%\\
\verb%       int %{\large interface\_y}\verb%%\\
\verb%           %\underline{\tt current X possition of robot (global).}\verb%%\\
\verb%       int %{\large interface\_mode}\verb%%\\
\verb%           %\underline{\tt mode of interface: 0: normal, 1: simulation (do all}\verb%%\\
\verb%           %\underline{\tt except to drive the robot), 2: simulation with}\verb%%\\
\verb%           %\underline{\tt position-output 3: Blocked: Do nothing.}\verb%%\\
\verb%%\\
\verb%%{\large DETAILED DESCRIPTION}\verb%%\\
\verb%       Implementation of an example interface to a simple robot%\\
\verb%       with two independent axies.%\\
\verb%%\\
\verb%       The robot has four inputs whish are connected to the lower%\\
\verb%       nible on IO port 'interface_ioport'. The bits are%\\
\verb%       connected in this way (the signals a high-active):%\\
\verb%%\\
\verb%       Bit 0: Drive Up wires: switch to GND: yellow-green; +24V:%\\
\verb%       gray-black%\\
\verb%%\\
\verb%       Bit 1: Dirve down wires: switch to GND: red-green; +24V:%\\
\verb%       orange-black%\\
\verb%%\\
\verb%       Bit 2: Dirve right wires: switch to GND: green-red; +24V:%\\
\verb%       yellow-black%\\
\verb%%\\
\verb%       Bit 3: Dirve left wires: switch to GND: white-red; +24V:%\\
\verb%       red-blue%\\
\verb%%\\
\verb%       power wires: GND: blue; +24V: red%\\
\verb%%\\
\verb%       This interface assumes a linear dependency betwenn the%\\
\verb%       coverence of distance and moving time. The 0,0 coordinates%\\
\verb%       is left,bottom.%\\
\verb%%\\
\verb%       User functions are:%\\
\verb%%\\
\verb%       %{\large interface\_init}\verb%() - Initialze the interface and drive the%\\
\verb%       robot to the start position (X=undefined; Y=0).%\\
\verb%%\\
\verb%       %{\large interface\_driveto}\verb%(int x, int y) - Drive the robot to the%\\
\verb%       absolute coordinates x,y.%\\
\verb%%\\
\verb%%\\
\verb%%{\large DEFINE DOCUMENTATION}\verb%%\\
\verb%   %{\large #define interface\_ioport}\verb%   %{\large 0x378}\verb%%\\
\verb%       IO Port to which lowest nible to robot is connected.%\\
\verb%%\\
\verb%%\\
\verb%   %{\large #define interface\_xmax}\verb%   %{\large 100}\verb%%\\
\verb%       Maximal X value (cosidered as 100 percent).%\\
\verb%%\\
\verb%%\\
\verb%   %{\large #define interface\_xmax\_time}\verb%   %{\large 20000}\verb%%\\
\verb%       Time it rakes to drive to robot form x_min to x_max.%\\
\verb%%\\
\verb%%\\
\verb%   %{\large #define interface\_ymax}\verb%   %{\large 100}\verb%%\\
\verb%       Maximal Y value (cosidered as 100 percent).%\\
\verb%%\\
\verb%%\\
\verb%   %{\large #define interface\_ymax\_time}\verb%   %{\large 20000}\verb%%\\
\verb%       Time it rakes to drive to robot form y_min to y_max.%\\
\verb%%\\
\verb%%\\
\verb%%{\large FUNCTION DOCUMENTATION}\verb%%\\
\verb%   %{\large int getmax (int a, int b)}\verb%%\\
\verb%       Get to highest number out of two input numbers.%\\
\verb%%\\
\verb%       Parameters:%\\
\verb%%\\
\verb%       %\underline{\tt a}\verb%      (int) first input number%\\
\verb%%\\
\verb%       %\underline{\tt b}\verb%      (int) second input number%\\
\verb%%\\
\verb%       %{\large Returns:}\verb%%\\
\verb%           (int) the highest of the input numbers%\\
\verb%%\\
\verb%   %{\large int getmin (int a, int b)}\verb%%\\
\verb%       Get to lowest number out of two input numbers.%\\
\verb%%\\
\verb%       Parameters:%\\
\verb%%\\
\verb%       %\underline{\tt a}\verb%      (int) first input number%\\
\verb%%\\
\verb%       %\underline{\tt b}\verb%      (int) second input number%\\
\verb%%\\
\verb%       %{\large Returns:}\verb%%\\
\verb%           (int) the lowest of the input numbers%\\
\verb%%\\
\verb%   %{\large unsigned char input (int addr)}\verb%%\\
\verb%       Read a byte from an IO port.%\\
\verb%%\\
\verb%       Parameters:%\\
\verb%%\\
\verb%       %\underline{\tt addr}\verb%   (int): address of port to read%\\
\verb%%\\
\verb%       %{\large Returns:}\verb%%\\
\verb%           (unsigned char) read byte%\\
\verb%%\\
\verb%   %{\large void interface\_drive (int h, int v)}\verb%%\\
\verb%       Drive the robot in a specified direction.%\\
\verb%%\\
\verb%       Any axies can be zero, greater than zero or less than%\\
\verb%       zero, in this cases the robot will not driven, driven to%\\
\verb%       increase to position (up[v,y] or right[h,x]) and decrease%\\
\verb%       the position (down[-v,-y] or left[-h,-x]).%\\
\verb%%\\
\verb%       Parameters:%\\
\verb%%\\
\verb%       %\underline{\tt h}\verb%      (int) horizontal or X axias.%\\
\verb%%\\
\verb%       %\underline{\tt v}\verb%      (int) vertical or Y axias.%\\
\verb%%\\
\verb%   %{\large void interface\_driveto (int x, int y)}\verb%%\\
\verb%       Drive to robot to absolute coordinates.%\\
\verb%%\\
\verb%       Parameters:%\\
\verb%%\\
\verb%       %\underline{\tt x}\verb%      (int): absolute x coordinate%\\
\verb%%\\
\verb%       %\underline{\tt y}\verb%      (int): absolute y coordinate%\\
\verb%%\\
\verb%   %{\large void interface\_init (int mode)}\verb%%\\
\verb%       Initialze the interface and drive the robot to the start%\\
\verb%       position.%\\
\verb%%\\
\verb%%\\
\verb%   %{\large void interface\_stop ()}\verb%%\\
\verb%       Stop the interface, switch all off.%\\
\verb%%\\
\verb%%\\
\verb%   %{\large void msleep (int msec)}\verb%%\\
\verb%       Wait a specified number of milliseconds.%\\
\verb%%\\
\verb%       Parameters:%\\
\verb%%\\
\verb%       %\underline{\tt msec}\verb%   (int): milliseconds to wait%\\
\verb%%\\
\verb%   %{\large unsigned char output (int addr, unsigned char out)}\verb%%\\
\verb%       Write a byte to an IO port.%\\
\verb%%\\
\verb%       Parameters:%\\
\verb%%\\
\verb%       %\underline{\tt addr}\verb%   (int): address of port to write onto%\\
\verb%%\\
\verb%       %\underline{\tt out}\verb%    (unsigned char): byte to write%\\
\verb%%\\
\verb%       %{\large Returns:}\verb%%\\
\verb%           (unsigned char) written byte%\\
\verb%%\\
\verb%%{\large VARIABLE DOCUMENTATION}\verb%%\\
\verb%   %{\large int interface\_mode}\verb%%\\
\verb%       mode of interface: 0: normal, 1: simulation (do all except%\\
\verb%       to drive the robot), 2: simulation with position-output 3:%\\
\verb%       Blocked: Do nothing.%\\
\verb%%\\
\verb%%\\
\verb%   %{\large int interface\_x}\verb%%\\
\verb%       current X possition of robot (global).%\\
\verb%%\\
\verb%%\\
\verb%   %{\large int interface\_y}\verb%%\\
\verb%       current X possition of robot (global).%\\
\verb%%\\
\verb%%\\
\verb%%{\large AUTHOR}\verb%%\\
\verb%       Generated automatically by Doxygen for%\\
\verb%       Hofmeier_FYP:libcomm from the source code.%\\
\verb%%\\
\verb%%\\
\verb%%\\
\verb%Hofmeier_FYP:libcomm       25 Apr 2005             interface.c(3)%\\
\verb%%
}
\end{flushleft}
