drivers/cfontz/packet.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(__PACKET_H__)
00022 #define __PACKET_H__
00023 
00024 #include "lcd.h"
00025 
00026 /* Maximum amount of data a packet can hold */
00027 #define MAX_DATA_LENGTH 22
00028 
00029 
00030 typedef struct _tag_packet  * LPPACKET;
00031 
00032 
00033 typedef enum _tag_packet_type {
00034 
00035     PACKET_TYPE_PING                = 0x00,
00036     PACKET_TYPE_GET_VERSION_INFO    = 0x01,
00037     PACKET_TYPE_WRITE_FLASH_AREA    = 0x02,
00038     PACKET_TYPE_READ_FLASH_AREA     = 0x03,
00039     PACKET_TYPE_STORE_AS_BOOT       = 0x04,
00040     PACKET_TYPE_POWER_CONTROL       = 0x05,
00041     PACKET_TYPE_CLEAR_SCREEN        = 0x06,
00042  /* DEPRECATED                      = 0x07, */
00043  /* DEPRECATED                      = 0x08, */
00044     PACKET_TYPE_SET_CHAR_DATA       = 0x09,
00045     PACKET_TYPE_READ_LCD_MEMORY     = 0x0A,
00046     PACKET_TYPE_SET_CURSOR_POS      = 0x0B,
00047     PACKET_TYPE_SET_CURSOR_STYLE    = 0x0C,
00048     PACKET_TYPE_SET_LCD_CONTRAST    = 0x0D,
00049     PACKET_TYPE_SET_BACKLIGHT       = 0x0E,
00050  /* DEPRECATED                      = 0x0F, */
00051     PACKET_TYPE_SET_FAN_REPORTING   = 0x10,
00052     PACKET_TYPE_SET_FAN_POWER       = 0x11,
00053     PACKET_TYPE_READ_DOW_DEVICE     = 0x12,
00054     PACKET_TYPE_SET_TEMP_REPORTING  = 0x13,
00055     PACKET_TYPE_DOW_TRANSACTION     = 0x14,
00056  /* DEPRECATED                      = 0x15, */
00057     PACKET_TYPE_DIRECT_LCD_CMD      = 0x16,
00058     PACKET_TYPE_SET_KEY_REPORTING   = 0x17,
00059     PACKET_TYPE_READ_KEY_STATE      = 0x18,
00060     PACKET_TYPE_SET_FAN_FAILSAFE    = 0x19,
00061     PACKET_TYPE_SET_FAN_TACH_GLITCH = 0x1A,
00062     PACKET_TYPE_GET_FAN_FAILSAFE    = 0x1B,
00063     PACKET_TYPE_SET_ATX_POWER_SW    = 0x1C,
00064     PACKET_TYPE_MANAGE_WATCHDOG     = 0x1D,
00065     PACKET_TYPE_REPORTING_STATUS    = 0x1E,
00066     PACKET_TYPE_WRITE_DATA          = 0x1F,
00067  /* RESERVED                        = 0x20, */
00068     PACKET_TYPE_SET_BAUD_RATE       = 0x21,
00069     PACKET_TYPE_SET_GPIO            = 0x22,
00070     PACKET_TYPE_GET_GPIO            = 0x23,
00071     PACKET_TYPE_RPT_KEY_ACTIVITY    = 0x80,
00072     PACKET_TYPE_RPT_FAN_SPEED       = 0x81,
00073     PACKET_TYPE_RPT_TEMP_SENSOR     = 0x82
00074 
00075 } PACKET_TYPE;
00076 
00077 typedef enum _tag_packet_class {
00078 
00079     PACKET_CLASS_NORMAL_REQUEST      = 0x00,
00080     PACKET_CLASS_NORMAL_RESPONSE     = 0x01,
00081     PACKET_CLASS_NORMAL_REPORT       = 0x02,
00082     PACKET_CLASS_ERROR_RESPONSE      = 0x03
00083 
00084 } PACKET_CLASS;
00085 
00086 
00087 LCD_API int packetCreate(PACKET_TYPE type,
00088                          LPPACKET * ppPacket);
00089 
00090 LCD_API int packetDispose(LPPACKET * ppPacket);
00091 
00092 LCD_API int packetReadData(LPPACKET pPacket,
00093                            unsigned char * data);
00094 
00095 LCD_API int packetReadReset(LPPACKET pPacket);
00096 
00097 LCD_API int packetWriteData(LPPACKET pPacket,
00098                             unsigned char data);
00099 
00100 LCD_API int packetWriteString(LPPACKET pPacket,
00101                               char * strData,
00102                               int strDataLen);
00103 
00104 LCD_API int packetGetClass(LPPACKET pPacket);
00105 
00106 LCD_API int packetGetType(LPPACKET pPacket,
00107                           PACKET_TYPE * pType);
00108 
00109 
00110 /* ---------------------------------------------------------------
00111  * Callbacks used to transform packets to & from the wire format
00112  * --------------------------------------------------------------- */
00113 
00114 LCD_API int packetFlatten(LPPACKET pPacket,
00115                           unsigned char * buf,
00116                           int * pDataLen);
00117 
00118 LCD_API int packetInflate(unsigned char * buf,
00119                           int bufLen,
00120                           int * pBytesRead,
00121                           LPPACKET * ppPacket);
00122 
00123 
00124 #endif /* __PACKET_H__ */

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