root/branches/volker_dev/drv.c

Revision 803, 4.4 kB (checked in by michael, 19 months ago)

Image driver libgd dependancy fix

  • Property svn:keywords set to Id URL Rev
Line 
1/* $Id$
2 * $URL$
3 *
4 * new framework for display drivers
5 *
6 * Copyright (C) 2003 Michael Reinelt <reinelt@eunet.at>
7 * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
8 *
9 * This file is part of LCD4Linux.
10 *
11 * LCD4Linux is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
15 *
16 * LCD4Linux is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 */
26
27/*
28 * exported functions:
29 *
30 * drv_list (void)
31 *   lists all available drivers to stdout
32 *
33 * drv_init (char *driver)
34 *    initializes the named driver
35 *
36 * int drv_quit (void)
37 *    de-initializes the driver
38 */
39
40#include "config.h"
41
42#include <stdlib.h>
43#include <stdio.h>
44#include <string.h>
45
46#include "debug.h"
47#include "cfg.h"
48#include "drv.h"
49
50extern DRIVER drv_BeckmannEgle;
51extern DRIVER drv_BWCT;
52extern DRIVER drv_Crystalfontz;
53extern DRIVER drv_Curses;
54extern DRIVER drv_Cwlinux;
55extern DRIVER drv_EA232graphic;
56extern DRIVER drv_G15;
57extern DRIVER drv_HD44780;
58extern DRIVER drv_Image;
59extern DRIVER drv_LCD2USB;
60extern DRIVER drv_LCDLinux;
61extern DRIVER drv_LCDTerm;
62extern DRIVER drv_LEDMatrix;
63extern DRIVER drv_LPH7508;
64extern DRIVER drv_LUIse;
65extern DRIVER drv_M50530;
66extern DRIVER drv_MatrixOrbital;
67extern DRIVER drv_MilfordInstruments;
68extern DRIVER drv_Noritake;
69extern DRIVER drv_NULL;
70extern DRIVER drv_picoLCD;
71extern DRIVER drv_RouterBoard;
72extern DRIVER drv_Sample;
73extern DRIVER drv_serdisplib;
74extern DRIVER drv_SimpleLCD;
75extern DRIVER drv_T6963;
76extern DRIVER drv_Trefon;
77extern DRIVER drv_USBHUB;
78extern DRIVER drv_USBLCD;
79extern DRIVER drv_WincorNixdorf;
80extern DRIVER drv_X11;
81
82/* output file for Image driver
83 * has to be defined here because it's referenced
84 * even if the raster driver is not included!
85 */
86char *output = NULL;
87
88DRIVER *Driver[] = {
89#ifdef WITH_BECKMANNEGLE
90    &drv_BeckmannEgle,
91#endif
92#ifdef WITH_BWCT
93    &drv_BWCT,
94#endif
95#ifdef WITH_CRYSTALFONTZ
96    &drv_Crystalfontz,
97#endif
98#ifdef WITH_CURSES
99    &drv_Curses,
100#endif
101#ifdef WITH_CWLINUX
102    &drv_Cwlinux,
103#endif
104#ifdef WITH_EA232graphic
105    &drv_EA232graphic,
106#endif
107#ifdef WITH_G15
108    &drv_G15,
109#endif
110#ifdef WITH_HD44780
111    &drv_HD44780,
112#endif
113#if (defined(WITH_PNG) && defined(WITH_GD)) || defined(WITH_PPM)
114    &drv_Image,
115#endif
116#ifdef WITH_LCD2USB
117    &drv_LCD2USB,
118#endif
119#ifdef WITH_LCDLINUX
120    &drv_LCDLinux,
121#endif
122#ifdef WITH_LCDTERM
123    &drv_LCDTerm,
124#endif
125#ifdef WITH_LEDMATRIX
126    &drv_LEDMatrix,
127#endif
128#ifdef WITH_LPH7508
129    &drv_LPH7508,
130#endif
131#ifdef WITH_LUISE
132    &drv_LUIse,
133#endif
134#ifdef WITH_M50530
135    &drv_M50530,
136#endif
137#ifdef WITH_MATRIXORBITAL
138    &drv_MatrixOrbital,
139#endif
140#ifdef WITH_MILINST
141    &drv_MilfordInstruments,
142#endif
143#ifdef WITH_NORITAKE
144    &drv_Noritake,
145#endif
146#ifdef WITH_NULL
147    &drv_NULL,
148#endif
149#ifdef WITH_picoLCD
150    &drv_picoLCD,
151#endif
152#ifdef WITH_ROUTERBOARD
153    &drv_RouterBoard,
154#endif
155#ifdef WITH_SAMPLE
156    &drv_Sample,
157#endif
158#ifdef WITH_SERDISPLIB
159    &drv_serdisplib,
160#endif
161#ifdef WITH_SIMPLELCD
162    &drv_SimpleLCD,
163#endif
164#ifdef WITH_T6963
165    &drv_T6963,
166#endif
167#ifdef WITH_TREFON
168    &drv_Trefon,
169#endif
170#ifdef WITH_USBHUB
171    &drv_USBHUB,
172#endif
173#ifdef WITH_USBLCD
174    &drv_USBLCD,
175#endif
176#ifdef WITH_WINCORNIXDORF
177    &drv_WincorNixdorf,
178#endif
179#ifdef WITH_X11
180    &drv_X11,
181#endif
182
183    NULL,
184};
185
186
187static DRIVER *Drv = NULL;
188
189
190int drv_list(void)
191{
192    int i;
193
194    printf("available display drivers:");
195
196    for (i = 0; Driver[i]; i++) {
197  printf("\n   %-20s: ", Driver[i]->name);
198  if (Driver[i]->list)
199      Driver[i]->list();
200    }
201    printf("\n");
202    return 0;
203}
204
205
206int drv_init(const char *section, const char *driver, const int quiet)
207{
208    int i;
209    for (i = 0; Driver[i]; i++) {
210  if (strcmp(Driver[i]->name, driver) == 0) {
211      Drv = Driver[i];
212      if (Drv->init == NULL)
213    return 0;
214      return Drv->init(section, quiet);
215  }
216    }
217    error("drv_init(%s) failed: no such driver", driver);
218    return -1;
219}
220
221
222int drv_quit(const int quiet)
223{
224    if (Drv->quit == NULL)
225  return 0;
226    return Drv->quit(quiet);
227}
Note: See TracBrowser for help on using the browser.