Starting the developers docs in docbook.

This commit is contained in:
gfk
2002-10-01 18:40:21 +00:00
parent 71389edb05
commit 46f930bf98
10 changed files with 1163 additions and 1 deletions
+146
View File
@@ -0,0 +1,146 @@
<chapter id="make-driver">
<title>Making a LCDproc driver</title>
<sect1 id="make-driver-intro">
<title>Introduction</title>
<para>
LCDproc is meant to be modular, it is relatively easy to add new input and output drivers to LCDproc. Actually, there are a few things that you can do to make your life easier, they are listed here.
</para>
<para>
This chapter will explain you the major steps and few gotchas of adding your own driver to LCDproc. Enjoy!
</para>
</sect1>
<sect1 id="driver-shared-files">
<title>Shared files specific for drivers</title>
<para>
Driving an LCD display is not easy; you need to address ports, to send bytes in a certain order, to respect timing, and unfortunaly no two operating system let you do this in the same way. But don't dispair! There's hope! Someone in a galaxy far far away, has allready done the dirty job for you! This dirty job has been put in shared files. These shared files are full cross platform and are automagically configured by the configure script. You only need to include them and use their functions to benefit from them.
</para>
<para>
These files are provided only for drivers, others are provided for all of LCDproc. These files are located in the shared directory, they have a dedicated chapter in this book.
</para>
<sect2 id="port.h">
<title>port.h : Parallel port I/O</title>
<para>The file port.h, located in the server/drivers/ directory provide Input/Output and port permissions for the PC compatible parallel port, also known as the LPT port.</para>
<para>
Of course, these functions will only work if the computer where LCDproc runs has parallel port! In these situations, the configure script will see this and disable drivers that need a parallel port.
</para>
<para>port.h file defines 6 static inline functions for port I/O:</para>
<sect3 id="port_in">
<title>Read a byte from port</title>
<funcsynopsis>
<funcprototype>
<funcdef>static inline int <function>port_in</function></funcdef>
<paramdef>unsigned short int <parameter>port</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>Returns the content of the byte.</para>
</sect3>
<sect3 id="port_out">
<title>Write a char(byte) 'val' to port</title>
<funcsynopsis>
<funcprototype>
<funcdef>static inline void <function>port_out</function></funcdef>
<paramdef>unsigned short int <parameter>port</parameter></paramdef>
<paramdef>unsigned char <parameter>val</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>Returns nothing (void).</para>
</sect3>
<sect3 id="port_access">
<title>Get access to a specific port</title>
<funcsynopsis>
<funcprototype>
<funcdef>static inline int <function>port_access</function></funcdef>
<paramdef>unsigned short int <parameter>port</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>Returns 0 if successful, -1 if failed.</para>
</sect3>
<sect3 id="port_deny">
<title>Close access to a specific port</title>
<funcsynopsis>
<funcprototype>
<funcdef>static inline int <function>port_deny</function></funcdef>
<paramdef>unsigned short int <parameter>port</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>Returns 0 if successful, -1 if failed.</para>
</sect3>
<sect3 id="port_access_full">
<title>Get access to three sequential ports</title>
<funcsynopsis>
<funcsynopsisinfo>/* port (CONTROL), port+1 (STATUS) and port+2 (DATA) */ </funcsynopsisinfo>
<funcprototype>
<funcdef>static inline int <function>port_access_full</function></funcdef>
<paramdef>unsigned short int <parameter>port</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>Returns 0 if successful, -1 if failed.</para>
</sect3>
<sect3 id="port_deny_full">
<title>Close access to three sequential ports</title>
<funcsynopsis>
<funcprototype>
<funcdef>static inline int <function>port_deny_full</function></funcdef>
<paramdef>unsigned short int <parameter>port</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>Returns 0 if successful, -1 if failed.</para>
</sect3>
<sect3 id="port.h-example">
<title>Example use</title>
<screen>
#include "port.h"
/* Get access to these 3 ports:
0x378 (CONTROL),
0x379 (STATUS) and
0x37A (DATA)
*/
if ( -1 == port_access_full(0x378) ) {
/* Access denied, do something */
}
/* Write a 'A' to the control port */
ort_out(0x378, 'A');
/* Read from the status port */
char status = port_in(0x379);
/* Close the 3 ports */
port_deny_full(0x378);
</screen>
</sect3>
</sect2>
</sect1>
</chapter>