Nut/OS  4.10.3
API Reference
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  
00059 #define LCD_SET_AUTOLF      0x0415
00060 #define LCD_GET_AUTOLF      0x0416
00061 
00062 #ifndef TIOCGWINSZ
00063 #define TIOCGWINSZ          0x0501  
00064 #endif
00065 #ifndef TIOCSWINSZ
00066 #define TIOCSWINSZ          0x0502  
00067 #endif
00068 
00069 #define LCD_MF_CURSORON     0x00000001UL    
00070 #define LCD_MF_COOKEDMODE   0x00020000UL    
00071 #define LCD_MF_AUTOLF       0x00040000UL    
00072 #define LCD_MF_AUTOSCROLL   0x00080000UL    
00073 #define LCD_MF_INVERTED     0x10000000UL    
00075 #ifndef ESC_CHAR
00076 #define ESC_CHAR        "\x1B"
00077 #endif
00078 
00079 #define ESC_POS         ESC_CHAR "Y"
00080 #define ESC_UP          ESC_CHAR "A"
00081 #define ESC_DOWN        ESC_CHAR "B"
00082 #define ESC_RIGHT       ESC_CHAR "C"
00083 #define ESC_LEFT        ESC_CHAR "D"
00084 #define ESC_CLRHOME     ESC_CHAR "E"
00085 
00086 #define ESC_HOME        ESC_CHAR "H"
00087 #define ESC_CLREND      ESC_CHAR "J"
00088 #define ESC_CLREOL      ESC_CHAR "K"
00089 #define ESC_CLRSTART    ESC_CHAR "d"
00090 #define ESC_CLRSOL      ESC_CHAR "o"
00091 
00092 #define ESC_INSCHAR     ESC_CHAR "@"
00093 #define ESC_INSLINE     ESC_CHAR "L"
00094 #define ESC_DELCHAR     ESC_CHAR "P"
00095 #define ESC_DELLINE     ESC_CHAR "M"
00096 #define ESC_RLF         ESC_CHAR "I"
00097 
00098 #define ESC_CURSORON    ESC_CHAR "e"
00099 #define ESC_CURSOROFF   ESC_CHAR "f"
00100 #define ESC_INVERTON    ESC_CHAR "i"
00101 #define ESC_INVERTOFF   ESC_CHAR "n"
00102 #define ESC_SPECIALSET  ESC_CHAR "F"
00103 #define ESC_DEFAULTSET  ESC_CHAR "G"
00104 #define ESC_ACTIVE      ESC_CHAR "R"
00105 #define ESC_SLEEP       ESC_CHAR "S"
00106 
00111 #define ESC_CLR         ESC_CLRHOME
00112 
00113 /*
00114  * winsize structure
00115  */
00116 typedef struct _WINSIZE WINSIZE;
00117 
00118 struct _WINSIZE {
00119     uint16_t ws_row;
00120     uint16_t ws_col;
00121     uint16_t ws_xpixel;
00122     uint16_t ws_ypixel;
00123 };
00124 
00128 typedef struct _TERMDCB TERMDCB;
00129 
00134 struct _TERMDCB {
00135 
00138     int (*dss_init)(NUTDEVICE *);
00139 
00142     void (*dss_write)(uint8_t);
00143 
00146     void (*dss_command)(uint8_t, uint8_t);
00147 
00150     void (*dss_clear)(void);
00151 
00154     void (*dss_set_cursor)(uint8_t);
00155 
00158     void (*dss_cursor_home)(void);
00159 
00162     void (*dss_cursor_left)(void);
00163 
00166     void (*dss_cursor_right)(void);
00167 
00170     void (*dss_cursor_mode)(uint8_t);
00171 
00174     uint32_t dcb_modeflags;
00175 
00178     uint8_t dcb_ctlseq;
00179 
00183     uint8_t dcb_nrows;
00184 
00188     uint8_t dcb_ncols;
00189 
00193     uint8_t dcb_vcols;
00194 
00197     uint8_t dcb_row;
00198 
00201     uint8_t dcb_col;
00202 
00205     uint8_t *dcb_smem;
00206 
00209     uint8_t *dcb_sptr;
00210 };
00211 
00214 extern int TermInit(NUTDEVICE * dev);
00215 extern int TermIOCtl(NUTDEVICE * dev, int req, void *conf);
00216 extern int TermWrite(NUTFILE * fp, CONST void *buffer, int len);
00217 #ifdef __HARVARD_ARCH__
00218 extern int TermWrite_P(NUTFILE * fp, PGM_P buffer, int len);
00219 #endif
00220 extern NUTFILE *TermOpen(NUTDEVICE * dev, CONST char *name, int mode, int acc);
00221 extern int TermClose(NUTFILE * fp);
00222 
00223 #endif