term.h

Go to the documentation of this file.
00001 #ifndef _DEV_TERM_H_
00002 #define _DEV_TERM_H_
00003 
00004 /*
00005  * Copyright (C) 2003-2005 by egnite Software GmbH. All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. Neither the name of the copyright holders nor the names of
00017  *    contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00024  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00027  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00028  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00030  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  * For additional information see http://www.ethernut.de/
00034  */
00035 
00036 #include <sys/device.h>
00037 
00047 
00048 /*
00049  * I/O control commands.
00050  */
00051 #define LCD_CMDBYTE         0x0401
00052 #define LCD_CMDWORD16       0x0402
00053 #define LCD_CMDWORD32       0x0403
00054 #define LCD_DATABYTE        0x0405
00055 #define LCD_DATAWORD16      0x0406
00056 #define LCD_DATAWORD32      0x0407
00057 #define LCD_SETCOOKEDMODE   0x0413  
00058 #define LCD_GETCOOKEDMODE   0x0414  
00060 #ifndef TIOCGWINSZ
00061 #define TIOCGWINSZ          0x0501  
00062 #endif
00063 #ifndef TIOCSWINSZ
00064 #define TIOCSWINSZ          0x0502  
00065 #endif
00066 
00067 #define LCD_MF_CURSORON     0x00000001UL    
00068 #define LCD_MF_COOKEDMODE   0x00020000UL    
00069 #define LCD_MF_INVERTED     0x10000000UL    
00072 #define ESC_CHAR        "\x1B"
00073 
00074 #define ESC_POS         ESC_CHAR "Y"
00075 #define ESC_UP          ESC_CHAR "A"
00076 #define ESC_DOWN        ESC_CHAR "B"
00077 #define ESC_RIGHT       ESC_CHAR "C"
00078 #define ESC_LEFT        ESC_CHAR "D"
00079 #define ESC_CLRHOME     ESC_CHAR "E"
00080 
00081 #define ESC_HOME        ESC_CHAR "H"
00082 #define ESC_CLREND      ESC_CHAR "J"
00083 #define ESC_CLREOL      ESC_CHAR "K"
00084 #define ESC_CLRSTART    ESC_CHAR "d"
00085 #define ESC_CLRSOL      ESC_CHAR "o"
00086 
00087 #define ESC_INSCHAR     ESC_CHAR "@"
00088 #define ESC_INSLINE     ESC_CHAR "L"
00089 #define ESC_DELCHAR     ESC_CHAR "P"
00090 #define ESC_DELLINE     ESC_CHAR "M"
00091 #define ESC_RLF         ESC_CHAR "I"
00092 
00093 #define ESC_CURSORON    ESC_CHAR "e"
00094 #define ESC_CURSOROFF   ESC_CHAR "f"
00095 #define ESC_INVERTON    ESC_CHAR "i"
00096 #define ESC_INVERTOFF   ESC_CHAR "n" 
00097 #define ESC_SPECIALSET  ESC_CHAR "F"
00098 #define ESC_DEFAULTSET  ESC_CHAR "G"
00099 #define ESC_ACTIVE      ESC_CHAR "R"
00100 #define ESC_SLEEP       ESC_CHAR "S"
00101 
00106 #define ESC_CLR         ESC_CLRHOME
00107 
00108 /*
00109  * winsize structure
00110  */
00111 typedef struct _WINSIZE WINSIZE;
00112 
00113 struct _WINSIZE {
00114     uint16_t ws_row;
00115     uint16_t ws_col;
00116     uint16_t ws_xpixel;
00117     uint16_t ws_ypixel;
00118 };
00119 
00123 typedef struct _TERMDCB TERMDCB;
00124 
00129 struct _TERMDCB {
00130 
00133     void (*dss_init)(NUTDEVICE*);
00134 
00137     void (*dss_write)(uint8_t);
00138 
00141     void (*dss_command)(uint8_t, uint8_t);
00142 
00145     void (*dss_clear)(void);
00146 
00149     void (*dss_set_cursor)(uint8_t);
00150 
00153     void (*dss_cursor_home)(void);
00154 
00157     void (*dss_cursor_left)(void);
00158 
00161     void (*dss_cursor_right)(void);
00162 
00165     void (*dss_cursor_mode)(uint8_t);
00166 
00169     uint32_t dcb_modeflags;
00170 
00173     uint8_t dcb_ctlseq;
00174 
00178     uint8_t dcb_nrows;
00179 
00183     uint8_t dcb_ncols;
00184 
00188     uint8_t dcb_vcols;
00189 
00192     uint8_t dcb_row;
00193 
00196     uint8_t dcb_col;
00197 
00200     uint8_t *dcb_smem;
00201 
00204     uint8_t *dcb_sptr;
00205 };
00206 
00209 extern int TermInit(NUTDEVICE * dev);
00210 extern int TermIOCtl(NUTDEVICE * dev, int req, void *conf);
00211 extern int TermWrite(NUTFILE * fp, CONST void *buffer, int len);
00212 #ifdef __HARVARD_ARCH__
00213 extern int TermWrite_P(NUTFILE * fp, PGM_P buffer, int len);
00214 #endif
00215 extern NUTFILE *TermOpen(NUTDEVICE * dev, CONST char *name, int mode, int acc);
00216 extern int TermClose(NUTFILE * fp);
00217 
00218 #endif

© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/