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    
00071 #define ESC_CHAR        "\x1B"
00072 
00073 #define ESC_POS         ESC_CHAR "Y"
00074 #define ESC_UP          ESC_CHAR "A"
00075 #define ESC_DOWN        ESC_CHAR "B"
00076 #define ESC_RIGHT       ESC_CHAR "C"
00077 #define ESC_LEFT        ESC_CHAR "D"
00078 #define ESC_CLRHOME     ESC_CHAR "H"
00079 
00080 #define ESC_CLR         ESC_CHAR "E"
00081 #define ESC_CLREND      ESC_CHAR "J"
00082 #define ESC_CLREOL      ESC_CHAR "K"
00083 #define ESC_CLRSTART    ESC_CHAR "d"
00084 #define ESC_CLRSOL      ESC_CHAR "o"
00085 
00086 #define ESC_INSCHAR     ESC_CHAR "@"
#define ESC_INSLINE     ESC_CHAR "L"
00087 #define ESC_DELCHAR     ESC_CHAR "P"
00088 #define ESC_DELLINE     ESC_CHAR "M"
00089 #define ESC_RLF         ESC_CHAR "I"
00090 
00091 #define ESC_CURSORON    ESC_CHAR "e"
00092 #define ESC_CURSOROFF   ESC_CHAR "f"
00093 #define ESC_SPECIALSET  ESC_CHAR "F"
00094 #define ESC_DEFAULTSET  ESC_CHAR "G"
00095 #define ESC_ACTIVE      ESC_CHAR "R"
00096 #define ESC_SLEEP       ESC_CHAR "S"
00097 
00098 /*
00099  * winsize structure
00100  */
00101 typedef struct _WINSIZE WINSIZE;
00102 
00103 struct _WINSIZE {
00104     uint16_t ws_row;
00105     uint16_t ws_col;
00106     uint16_t ws_xpixel;
00107     uint16_t ws_ypixel;
00108 };
00109 
00113 typedef struct _TERMDCB TERMDCB;
00114 
00119 struct _TERMDCB {
00120 
00123     void (*dss_init)(NUTDEVICE*);
00124 
00127     void (*dss_write)(uint8_t);
00128 
00131     void (*dss_command)(uint8_t, uint8_t);
00132 
00135     void (*dss_clear)(void);
00136 
00139     void (*dss_set_cursor)(uint8_t);
00140 
00143     void (*dss_cursor_home)(void);
00144 
00147     void (*dss_cursor_left)(void);
00148 
00151     void (*dss_cursor_right)(void);
00152 
00155     void (*dss_cursor_mode)(uint8_t);
00156 
00159     uint32_t dcb_modeflags;
00160 
00163     uint8_t dcb_ctlseq;
00164 
00168     uint8_t dcb_nrows;
00169 
00173     uint8_t dcb_ncols;
00174 
00178     uint8_t dcb_vcols;
00179 
00182     uint8_t dcb_row;
00183 
00186     uint8_t dcb_col;
00187 
00190     uint8_t *dcb_smem;
00191 
00194     uint8_t *dcb_sptr;
00195 };
00196 
00199 extern int TermInit(NUTDEVICE * dev);
00200 extern int TermIOCtl(NUTDEVICE * dev, int req, void *conf);
00201 extern int TermWrite(NUTFILE * fp, CONST void *buffer, int len);
00202 #ifdef __HARVARD_ARCH__
00203 extern int TermWrite_P(NUTFILE * fp, PGM_P buffer, int len);
00204 #endif
00205 extern NUTFILE *TermOpen(NUTDEVICE * dev, CONST char *name, int mode, int acc);
00206 extern int TermClose(NUTFILE * fp);
00207 
00208 #endif
00209 

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