drivers/cfontz/cfontz.h

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(__CFONTZ_H__)
00022 #define __CFONTZ_H__
00023 
00024 #include "driver.h"
00025 #include "packet.h"
00026 
00027 
00028 typedef struct _tag_cfontz_device_instance * LP_CFONTZ_DEV_INSTANCE;
00029 
00030 
00031 int cfontz_InitDevice(LP_CFONTZ_DEV_INSTANCE pInst);
00032 
00033 /*
00034  * Some OS-specific stuff here for device initialisation, which includes:
00035  *
00036  * - How we refer to the OS device handle
00037  * - Macro which expands to the function used for initialisation
00038  * - A prototype for the above function
00039  */
00040 
00041 #if defined(_WIN32)
00042 #   define PHYSICAL_DEVICE_HANDLE       HANDLE
00043 #   define NULL_PHYSICAL_DEVICE_HANDLE  0
00044 #else
00045 #   define PHYSICAL_DEVICE_HANDLE       int
00046 #   define NULL_PHYSICAL_DEVICE_HANDLE  0
00047 #endif
00048 
00049 
00050 
00051 typedef enum _tag_cfontz_device_type
00052 {
00053     CFONTZ_DEVICE_TYPE_UNKNOWN = 0,
00054     CFONTZ_DEVICE_TYPE_CFA635  = 1,
00055     CFONTZ_DEVICE_TYPE_CFA633  = 2
00056 }
00057 CFontzDeviceType;
00058 
00059 
00060 
00065 typedef struct _tag_cfontz_device_instance
00066 {
00067     unsigned int nHeight;
00068 
00069     unsigned int nWidth;
00070 
00071     unsigned int nLEDCount;
00072 
00073     unsigned int nFanCount;
00074 
00075     PHYSICAL_DEVICE_HANDLE Device;
00076 
00077     /* ID of the RxThread */
00078     pthread_t        RxThreadID;
00079 
00080     /* Mutex to lock when waiting for an Rx packet */
00081     pthread_mutex_t  RxMutex;
00082 
00083     /* Semaphore on which to wait when waiting for an Rx packet */
00084     pthread_cond_t   RxSemaphore;
00085 
00086     /* Flag to indicate the Rx thread should stay running */
00087     unsigned int     RxRunning;
00088 
00089     /* Mutex used to sync up running status */
00090     pthread_mutex_t  RunningMutex;
00091 
00092     /* The packet received in reply */
00093     LPPACKET         pReplyPacket;
00094 
00096     struct {
00097         pfnDrvCBFanSpeed FanSpeed;
00098         pfnDrvCBTemp     Temp;
00099         pfnDrvCBKeyEvent KeyEvent;
00100     } pfn;
00101 
00103     struct {
00104         void * FanSpeed;
00105         void * Temp;
00106         void * KeyEvent;
00107     } context;
00108 
00114     unsigned int * nFanPower;
00115 
00116     CFontzDeviceType deviceType;
00117 
00118     /* Current fan reporting mask */
00119     unsigned int fanReportMask;
00120 
00121     /* Current temperature sensor reporting mask */
00122     unsigned int tempReportMask;
00123 
00124     /* Current mask used to report key presses */
00125     unsigned int keyPressMask;
00126 
00127     /* Current mask used to report key releases */
00128     unsigned int keyReleaseMask;
00129 
00131     char *     pszPort;
00132 
00134     unsigned int bStarted;
00135 
00137     unsigned int bSCABPresent;
00138 
00139 } CFONTZ_DEV_INSTANCE;
00140 
00141 
00142 /*
00143  * Trace constants
00144  */
00145 
00146 #define T_driver_Create                 0x2A
00147 #define T_cfontz_InitDevice             0x2B
00148 #define T_cfontz_InitDevice_unix        0x2C
00149 #define T_cfontz_InitDevice_w32         0x2D
00150 #define T_parserDeviceUseLED            0x2E
00151 #define T_cfontz_InitDeviceType         0x2F
00152 #define T_cfontz_UpdateTempReport       0x30
00153 
00154 #endif /* __CFONTZ_H__ */
00155 
00156 

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