common/driver.h

Go to the documentation of this file.
00001 /*
00002  * Copyright Ian Burnett 2005, 2006.
00003  *
00004  * This file is part of Ian's Interactive LCD controller (IILC).
00005  * 
00006  * IILC is free software; you can redistribute it and/or modify it under
00007  * the terms of the GNU General Public License as published by the Free
00008  * Software Foundation; either version 2 of the License, or (at your
00009  * option) any later version.
00010  *
00011  * IILC is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00014  * for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License along
00017  * with IILC; if not, write to the Free Software Foundation, Inc.,
00018  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
00019  */
00020 
00021 #if !defined(__DRIVER_H__)
00022 #define __DRIVER_H__
00023 
00033 typedef void (* pfnDrvCBFanSpeed)(void * context,
00034                                   unsigned int fan_id,
00035                                   unsigned int rpm);
00036 
00037 typedef void (* pfnDrvCBTemp)(void * context,
00038                               unsigned int sensor_id,
00039                               double degrees_c);
00040 
00041 typedef void (* pfnDrvCBKeyEvent)(void * context,
00042                                   unsigned int key_event);
00043 
00051 #define IILC_DRIVER_API 
00052 
00058 typedef struct _tag_driver_instance_data * LP_DRIVER_INSTANCE;
00059 
00060 typedef struct _tag_driver_function_array * LP_DRIVER_FN_ARRAY;
00061 
00068 #define DECLARE_DRIVER_INTERFACE_FUNC(name, retVal, args) \
00069     IILC_DRIVER_API retVal driver_ ## name args ; \
00070     typedef retVal (* pfnDriver ## name ) args
00071 
00072 
00089 DECLARE_DRIVER_INTERFACE_FUNC(Create, int, (
00090                                 const char * pszPort,
00091                                 LP_DRIVER_FN_ARRAY pFnArray,
00092                                 LP_DRIVER_INSTANCE * ppDriverInstData
00093                                 ));
00094 
00108 DECLARE_DRIVER_INTERFACE_FUNC(Dispose, int, (
00109                                 LP_DRIVER_INSTANCE * ppDriverInstData
00110                                 ));
00111 
00112 
00126 DECLARE_DRIVER_INTERFACE_FUNC(Start, int, (
00127                                 LP_DRIVER_INSTANCE pDriverInstData
00128                                 ));
00129 
00147 DECLARE_DRIVER_INTERFACE_FUNC(Stop, int, (
00148                                 LP_DRIVER_INSTANCE pDriverInstData
00149                                 ));
00150 
00165 DECLARE_DRIVER_INTERFACE_FUNC(SetBacklight, int, (
00166                                 LP_DRIVER_INSTANCE pDriverInstData,
00167                                 unsigned int nBacklightValue
00168                                 ));
00169 
00183 DECLARE_DRIVER_INTERFACE_FUNC(SetContrast, int, (
00184                                 LP_DRIVER_INSTANCE pDriverInstData,
00185                                 unsigned int nBacklightValue
00186                                 ));
00187 
00209 DECLARE_DRIVER_INTERFACE_FUNC(SetLED, int, (
00210                                 LP_DRIVER_INSTANCE pDriverInstData,
00211                                 unsigned int led_id,
00212                                 unsigned int nRed,
00213                                 unsigned int nGreen,
00214                                 unsigned int nBlue
00215                                 ));
00216 
00226 DECLARE_DRIVER_INTERFACE_FUNC(Restart, int, (
00227                                 LP_DRIVER_INSTANCE pDriverInstData
00228                                 ));
00229 
00238 DECLARE_DRIVER_INTERFACE_FUNC(ClearScreen, int, (
00239                                 LP_DRIVER_INSTANCE pDriverInstData
00240                                 ));
00241 
00262 DECLARE_DRIVER_INTERFACE_FUNC(WriteText, int, (
00263                                 LP_DRIVER_INSTANCE pDriverInstData,
00264                                 unsigned int x, 
00265                                 unsigned int y, 
00266                                 char * strData,
00267                                 unsigned int strLen
00268                                 ));
00269 
00286 DECLARE_DRIVER_INTERFACE_FUNC(SetFanPower, int, (
00287                                 LP_DRIVER_INSTANCE pDriverInstData,
00288                                 unsigned int fan_id,
00289                                 unsigned int nPower
00290                                 ));
00291 
00292 
00293 DECLARE_DRIVER_INTERFACE_FUNC(GetHardwareVersion, int, (
00294                                 LP_DRIVER_INSTANCE pDriverInstData,
00295                                 unsigned int * pnVersionMajor,
00296                                 unsigned int * pnVersionMinor
00297                                 ));
00298 
00299 DECLARE_DRIVER_INTERFACE_FUNC(GetScreenSize, int, (
00300                                 LP_DRIVER_INSTANCE pDriverInstData,
00301                                 unsigned int * pnScreenWidth,
00302                                 unsigned int * pnScreenHeight
00303                                 ));
00304 
00305 DECLARE_DRIVER_INTERFACE_FUNC(EnableFanReport, int, (
00306                                 LP_DRIVER_INSTANCE pDriverInstData,
00307                                 unsigned int fan_id
00308                                 ));
00309 
00310 DECLARE_DRIVER_INTERFACE_FUNC(DisableFanReport, int, (
00311                                 LP_DRIVER_INSTANCE pDriverInstData,
00312                                 unsigned int fan_id
00313                                 ));
00314 
00315 DECLARE_DRIVER_INTERFACE_FUNC(EnableTempReport, int, (
00316                                 LP_DRIVER_INSTANCE pDriverInstData,
00317                                 unsigned int sensor_id
00318                                 ));
00319 
00320 DECLARE_DRIVER_INTERFACE_FUNC(DisableTempReport, int, (
00321                                 LP_DRIVER_INSTANCE pDriverInstData,
00322                                 unsigned int sensor_id
00323                                 ));
00324 
00325 DECLARE_DRIVER_INTERFACE_FUNC(SetCallbackFan, int, (
00326                                 LP_DRIVER_INSTANCE pDriverInstData,
00327                                 pfnDrvCBFanSpeed pfnDrvCBFanSpeed,
00328                                 void * context
00329                                 ));
00330 
00331 DECLARE_DRIVER_INTERFACE_FUNC(SetCallbackTemp, int, (
00332                                 LP_DRIVER_INSTANCE pDriverInstData,
00333                                 pfnDrvCBTemp pfnDrvCBTemp,
00334                                 void * context
00335                                 ));
00336 
00337 /*
00338 IILC_DRIVER_API int deviceSetFanReporting(LPDEVICE pdevice, unsigned int mask);
00339 
00340 IILC_DRIVER_API int deviceSetTemperatureReporting(LPDEVICE pdevice, unsigned int mask);
00341 
00342 
00343 
00344 IILC_DRIVER_API int deviceSetFanFailsafeTimeout(LPDEVICE pDevice, unsigned int mask, int milliseconds);
00345 */
00346 
00347 typedef struct _tag_driver_function_array
00348 {
00350     pfnDriverDispose Dispose;
00351 
00353     pfnDriverStart Start;
00354 
00356     pfnDriverStop Stop;
00357         
00358     pfnDriverSetBacklight SetBacklight;
00359 
00360     pfnDriverWriteText WriteText;
00361 
00362     pfnDriverSetContrast SetContrast;
00363 
00364     pfnDriverSetLED SetLED;
00365 
00366     pfnDriverRestart Restart;
00367 
00368     pfnDriverClearScreen ClearScreen;
00369 
00370     pfnDriverSetFanPower SetFanPower;
00371 
00372     pfnDriverGetHardwareVersion GetHardwareVersion;
00373 
00374     pfnDriverGetScreenSize GetScreenSize;
00375 
00376     pfnDriverEnableFanReport EnableFanReport;
00377 
00378     pfnDriverDisableFanReport DisableFanReport;
00379 
00380     pfnDriverSetCallbackFan SetCallbackFan;
00381 
00382     pfnDriverEnableTempReport EnableTempReport;
00383 
00384     pfnDriverDisableTempReport DisableTempReport;
00385 
00386     pfnDriverSetCallbackTemp SetCallbackTemp;
00387 
00388 } DRIVER_FN_ARRAY;
00389 
00390 
00391 
00392 
00393 #endif /* __DRIVER_H__ */

Generated on Mon Jul 17 01:36:11 2006 for IILC by  doxygen 1.4.6