common/driver.h File Reference

This file contains the definition of the interface between the server daemon and the person providing support for a particular type of character LCD display. More...

Go to the source code of this file.

Classes

struct  _tag_driver_function_array

Defines

#define __DRIVER_H__
#define IILC_DRIVER_API
#define DECLARE_DRIVER_INTERFACE_FUNC(name, retVal, args)
 Nifty little macro to typedef a function pointer which complies with the standards for a driver function pointer. Note that to get the Doxygen generation to be correct, you need to have the config file setup so that ENABLE_PREPROCESSING and MACRO_EXPANSION options are set to 'yes'.

Typedefs

typedef void(* pfnDrvCBFanSpeed )(void *context, unsigned int fan_id, unsigned int rpm)
typedef void(* pfnDrvCBTemp )(void *context, unsigned int sensor_id, double degrees_c)
typedef void(* pfnDrvCBKeyEvent )(void *context, unsigned int key_event)
typedef _tag_driver_instance_data * LP_DRIVER_INSTANCE
 A pointer to instance data held by the driver implementation.
typedef _tag_driver_function_arrayLP_DRIVER_FN_ARRAY
typedef int(* pfnDriverCreate )(const char *pszPort, LP_DRIVER_FN_ARRAY pFnArray, LP_DRIVER_INSTANCE *ppDriverInstData)
typedef int(* pfnDriverDispose )(LP_DRIVER_INSTANCE *ppDriverInstData)
typedef int(* pfnDriverStart )(LP_DRIVER_INSTANCE pDriverInstData)
typedef int(* pfnDriverStop )(LP_DRIVER_INSTANCE pDriverInstData)
typedef int(* pfnDriverSetBacklight )(LP_DRIVER_INSTANCE pDriverInstData, unsigned int nBacklightValue)
typedef int(* pfnDriverSetContrast )(LP_DRIVER_INSTANCE pDriverInstData, unsigned int nBacklightValue)
typedef int(* pfnDriverSetLED )(LP_DRIVER_INSTANCE pDriverInstData, unsigned int led_id, unsigned int nRed, unsigned int nGreen, unsigned int nBlue)
typedef int(* pfnDriverRestart )(LP_DRIVER_INSTANCE pDriverInstData)
typedef int(* pfnDriverClearScreen )(LP_DRIVER_INSTANCE pDriverInstData)
typedef int(* pfnDriverWriteText )(LP_DRIVER_INSTANCE pDriverInstData, unsigned int x, unsigned int y, char *strData, unsigned int strLen)
typedef int(* pfnDriverSetFanPower )(LP_DRIVER_INSTANCE pDriverInstData, unsigned int fan_id, unsigned int nPower)
typedef int(* pfnDriverGetHardwareVersion )(LP_DRIVER_INSTANCE pDriverInstData, unsigned int *pnVersionMajor, unsigned int *pnVersionMinor)
typedef int(* pfnDriverGetScreenSize )(LP_DRIVER_INSTANCE pDriverInstData, unsigned int *pnScreenWidth, unsigned int *pnScreenHeight)
typedef int(* pfnDriverEnableFanReport )(LP_DRIVER_INSTANCE pDriverInstData, unsigned int fan_id)
typedef int(* pfnDriverDisableFanReport )(LP_DRIVER_INSTANCE pDriverInstData, unsigned int fan_id)
typedef int(* pfnDriverEnableTempReport )(LP_DRIVER_INSTANCE pDriverInstData, unsigned int sensor_id)
typedef int(* pfnDriverDisableTempReport )(LP_DRIVER_INSTANCE pDriverInstData, unsigned int sensor_id)
typedef int(* pfnDriverSetCallbackFan )(LP_DRIVER_INSTANCE pDriverInstData, pfnDrvCBFanSpeed pfnDrvCBFanSpeed, void *context)
typedef int(* pfnDriverSetCallbackTemp )(LP_DRIVER_INSTANCE pDriverInstData, pfnDrvCBTemp pfnDrvCBTemp, void *context)
typedef _tag_driver_function_array DRIVER_FN_ARRAY

Functions

int driver_Create (const char *pszPort, LP_DRIVER_FN_ARRAY pFnArray, LP_DRIVER_INSTANCE *ppDriverInstData)
 Performs the initial creation of the driver instance.
int driver_Dispose (LP_DRIVER_INSTANCE *ppDriverInstData)
 Performs the final shutdown and cleanup of the driver instance.
int driver_Start (LP_DRIVER_INSTANCE pDriverInstData)
 Signals to the implementation to commence communications with the physical device.
int driver_Stop (LP_DRIVER_INSTANCE pDriverInstData)
 Signals to the implementation to cease communications with the physical device.
int driver_SetBacklight (LP_DRIVER_INSTANCE pDriverInstData, unsigned int nBacklightValue)
 Instructs the display to set the backlight to the specified brightness level.
int driver_SetContrast (LP_DRIVER_INSTANCE pDriverInstData, unsigned int nBacklightValue)
 Instructs the display to set the contrast to the specified ratio.
int driver_SetLED (LP_DRIVER_INSTANCE pDriverInstData, unsigned int led_id, unsigned int nRed, unsigned int nGreen, unsigned int nBlue)
 Sets the specified LED to the given colour.
int driver_Restart (LP_DRIVER_INSTANCE pDriverInstData)
 Restarts the physical device, resetting it to the initial power-on status.
int driver_ClearScreen (LP_DRIVER_INSTANCE pDriverInstData)
 Clears the screen of the display.
int driver_WriteText (LP_DRIVER_INSTANCE pDriverInstData, unsigned int x, unsigned int y, char *strData, unsigned int strLen)
 Writes the supplied text to the device at the location given.
int driver_SetFanPower (LP_DRIVER_INSTANCE pDriverInstData, unsigned int fan_id, unsigned int nPower)
 Sets the specified fan to a given power level.
int driver_GetHardwareVersion (LP_DRIVER_INSTANCE pDriverInstData, unsigned int *pnVersionMajor, unsigned int *pnVersionMinor)
int driver_GetScreenSize (LP_DRIVER_INSTANCE pDriverInstData, unsigned int *pnScreenWidth, unsigned int *pnScreenHeight)
int driver_EnableFanReport (LP_DRIVER_INSTANCE pDriverInstData, unsigned int fan_id)
int driver_DisableFanReport (LP_DRIVER_INSTANCE pDriverInstData, unsigned int fan_id)
int driver_EnableTempReport (LP_DRIVER_INSTANCE pDriverInstData, unsigned int sensor_id)
int driver_DisableTempReport (LP_DRIVER_INSTANCE pDriverInstData, unsigned int sensor_id)
int driver_SetCallbackFan (LP_DRIVER_INSTANCE pDriverInstData, pfnDrvCBFanSpeed pfnDrvCBFanSpeed, void *context)
int driver_SetCallbackTemp (LP_DRIVER_INSTANCE pDriverInstData, pfnDrvCBTemp pfnDrvCBTemp, void *context)


Detailed Description

This file contains the definition of the interface between the server daemon and the person providing support for a particular type of character LCD display.

Definition in file driver.h.


Define Documentation

#define DECLARE_DRIVER_INTERFACE_FUNC name,
retVal,
args   ) 
 

Value:

IILC_DRIVER_API retVal driver_ ## name args ; \
    typedef retVal (* pfnDriver ## name ) args
Nifty little macro to typedef a function pointer which complies with the standards for a driver function pointer. Note that to get the Doxygen generation to be correct, you need to have the config file setup so that ENABLE_PREPROCESSING and MACRO_EXPANSION options are set to 'yes'.

Definition at line 68 of file driver.h.


Typedef Documentation

typedef struct _tag_driver_instance_data* LP_DRIVER_INSTANCE
 

A pointer to instance data held by the driver implementation.

This is really just a better way of writing "void *", as this way the compiler gets to do a bit more type-checking.

Definition at line 58 of file driver.h.


Function Documentation

int driver_ClearScreen LP_DRIVER_INSTANCE  pDriverInstData  ) 
 

Clears the screen of the display.

Parameters:
pDriverInstData Driver instance data as supplied by a call to the driver_Create() function.
Return values:
int zero on success, non-zero otherwise.

Definition at line 884 of file cfontz.c.

Referenced by driver_ClearScreen().

int driver_Create const char *  pszPort,
LP_DRIVER_FN_ARRAY  pFnArray,
LP_DRIVER_INSTANCE ppDriverInstData
 

Performs the initial creation of the driver instance.

This will be the first function called for a given instance. This function will be called once and once only per device.

Parameters:
pszPort A string representation of the port which is sufficient to uniquely identify a physical device which this driver can control. Storage is owned by the caller.
ppDriverInstData pointer to an LP_DRIVER_INSTANCE field which can store context data for the driver module. Storage of the structure pointed to by the return value should be freed during the driver_Dispose() call.
Return values:
int zero on success, non-zero otherwise.

Definition at line 97 of file cfontz.c.

Referenced by driver_Create().

int driver_Dispose LP_DRIVER_INSTANCE ppDriverInstData  ) 
 

Performs the final shutdown and cleanup of the driver instance.

This function should cleanup any resources it allocated during the driver_Create() function call, or at any point during its lifecycle.

Parameters:
ppDriverInstData Pointer to an LP_DRIVER_INSTANCE field which has been initialised by a call to the driver_Create() function. It is typically expected that this function sets the contents of this parameter to be NULL upon successful cleanup.
Return values:
int zero on success, non-zero otherwise.

Definition at line 352 of file cfontz.c.

Referenced by driver_Create(), and driver_Dispose().

int driver_Restart LP_DRIVER_INSTANCE  pDriverInstData  ) 
 

Restarts the physical device, resetting it to the initial power-on status.

Parameters:
pDriverInstData Driver instance data as supplied by a call to the driver_Create() function.
Return values:
int zero on success, non-zero otherwise.

Definition at line 938 of file cfontz.c.

Referenced by driver_Restart().

int driver_SetBacklight LP_DRIVER_INSTANCE  pDriverInstData,
unsigned int  nBacklightValue
 

Instructs the display to set the backlight to the specified brightness level.

The brightness level is expressed as a percentage - 0 represents off, 100 represents on. A value outside of this range is an error.

Parameters:
pDriverInstData Driver instance data as supplied by a call to the driver_Create() function.
nBacklightValue A percentage value, where 0 <= nBacklightValue <= 100
Return values:
int zero on success, non-zero otherwise.

Definition at line 834 of file cfontz.c.

Referenced by driver_Create(), and driver_SetBacklight().

int driver_SetContrast LP_DRIVER_INSTANCE  pDriverInstData,
unsigned int  nBacklightValue
 

Instructs the display to set the contrast to the specified ratio.

The contrast ratio is expressed as a percentage - 0 represents off, 100 represents on. A value outside of this range is an error.

Parameters:
pDriverInstData Driver instance data as supplied by a call to the driver_Create() function.
nContrastValue A percentage value, where 0 <= nContrastValue <= 100
Return values:
int zero on success, non-zero otherwise.

Definition at line 861 of file cfontz.c.

Referenced by driver_Create(), and driver_SetContrast().

int driver_SetFanPower LP_DRIVER_INSTANCE  pDriverInstData,
unsigned int  fan_id,
unsigned int  nPower
 

Sets the specified fan to a given power level.

Fan power is expressed as a percentage and the value supplied must be in the range 0 to 100 inclusive.

Parameters:
pDriverInstData Driver instance data as supplied by a call to the driver_Create() function.
fan_id ID of the fan to adjust power output in the device. This is zero-based.
nPower 0 <= nPower <= 100, where 0 is off and 100 is fully on
Return values:
int zero on success, non-zero otherwise.

Definition at line 969 of file cfontz.c.

Referenced by driver_Create(), and driver_SetFanPower().

int driver_SetLED LP_DRIVER_INSTANCE  pDriverInstData,
unsigned int  led_id,
unsigned int  nRed,
unsigned int  nGreen,
unsigned int  nBlue
 

Sets the specified LED to the given colour.

Colour is expressed as a percentage of the three primary additive colours. Each of these values must be in the range 0 to 100 inclusive. An implementation should ignore a colour component if the LED device cannot render that specific colour.

Parameters:
pDriverInstData Driver instance data as supplied by a call to the driver_Create() function.
led_id ID of the LED to change in the device. This is zero-based.
nRed 0 <= nRed <= 100, where 0 is off and 100 is fully on
nGreen 0 <= nGreen <= 100, where 0 is off and 100 is fully on
nBlue 0 <= nBlue <= 100, where 0 is off and 100 is fully on
Return values:
int zero on success, non-zero otherwise.

Definition at line 441 of file cfontz.c.

Referenced by driver_SetLED().

int driver_Start LP_DRIVER_INSTANCE  pDriverInstData  ) 
 

Signals to the implementation to commence communications with the physical device.

This function will be called after the driver_Create() function, but before any other functions. There are no restrictions against the driver establishing communications before this function call, but it is an error for the driver to produce callbacks until after this function has exited.

Parameters:
pDriverInstData Driver instance data as supplied by a call to the driver_Create() function.
Return values:
int zero on success, non-zero otherwise.

Definition at line 409 of file cfontz.c.

Referenced by driver_Create(), and driver_Start().

int driver_Stop LP_DRIVER_INSTANCE  pDriverInstData  ) 
 

Signals to the implementation to cease communications with the physical device.

This function will be called before the driver_Dispose() function. There are no restrictions against the driver maintaining communications after this function call, but it is an error for the driver to produce callbacks after this function has exited.

It is permissible for there to be multiple driver_Start(), driver_Stop() cycles during the lifetime (driver_Create() to driver_Dispose()) of a driver instance. The implementation should cope with this eventuality.

Parameters:
pDriverInstData Driver instance data as supplied by a call to the driver_Create() function.
Return values:
int zero on success, non-zero otherwise.

Definition at line 419 of file cfontz.c.

Referenced by driver_Create(), and driver_Stop().

int driver_WriteText LP_DRIVER_INSTANCE  pDriverInstData,
unsigned int  x,
unsigned int  y,
char *  strData,
unsigned int  strLen
 

Writes the supplied text to the device at the location given.

Parameters:
pDriverInstData Driver instance data as supplied by a call to the driver_Create() function.
x Horizontal component of the coordinate to write the text. This metric is measured in character positions. This is zero-based.
y Vertical component of the coordinate where to write the text. This metric is measured in character positions. This is zero-based.
strData A string containing the character data to write. Some displays accept the character '' as a valid value, which is why this is not a null-terminated string.
strLen Length of the string in characters.
Return values:
int zero on success, non-zero otherwise.

Definition at line 907 of file cfontz.c.

Referenced by driver_Create(), and driver_WriteText().


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