Milos RTOS v0.3.4a
Real Time Operating System
terminal.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  * terminal.h
00003  * (C) 2010 Ivan Meleca
00004  * Based on original code written by Ruben Meleca
00005  * www.milos.it
00006 
00007 #   This program is free software; you can redistribute it and/or modify
00008 #   it under the terms of the GNU General Public License as published by
00009 #   the Free Software Foundation; either version 2 of the License, or
00010 #   (at your option) any later version.
00011 #
00012 #   This program is distributed in the hope that it will be useful,
00013 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 #   GNU General Public License for more details.
00016 #
00017 #   You should have received a copy of the GNU General Public License
00018 #   along with this program; if not, write to the Free Software
00019 #   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020 
00021 ***************************************************************************/
00022 
00023 #ifndef __TERMINAL_H__
00024 #define __TERMINAL_H__
00025 
00026 #include <plat_cpu.h>
00027 #include "device.h"
00028 #include "lock.h"
00029 
00030 #if __CONFIG_COMPILE_TERMINAL
00031 
00032 /*
00033  * Advance terminal structure declaration.
00034  */
00035 struct __terminalTag;
00036 
00055 typedef __VOID (__TERMINALRXCMD)(struct __terminalTag* term, __PSTRING cmd, __PSTRING params);
00056 
00069 #define __TERMINAL_DEF_LINELEN      64
00070 
00079 #define __TERMINAL_ECHO_ENABLED     0x01
00080 #define __TERMINAL_DEBUG_COMMANDS   0x02
00081 #define __TERMINAL_STARTED          0x04
00082 
00095 typedef struct __terminalCommandTag
00096 {
00097     __PSTRING cmd;
00098     __TERMINALRXCMD* func;
00099     struct __terminalCommandTag* next;
00100 
00101 } __TERMINALCMD, *__PTERMINALCMD;
00102 
00103 typedef struct __terminalTag
00104 {
00105     __PSTRING name;                         
00106     __PDEVICE dv_in;                        
00107     __PDEVICE dv_out;                       
00108     __PSTRING tx_line;                      
00109     __PSTRING rx_line;                      
00110     __PSTRING prompt;                       
00111     u16 linelen;                            
00112     u16 rxoffs;                             
00113     u16 cursor;                             
00114     __PLOCK lock;                           
00115     u8 flags;                               
00116     __PTERMINALCMD cmds;                    
00117 } __TERMINAL, *__PTERMINAL;
00118 
00123 __PTERMINAL __terminalCreate(__PSTRING name, __PDEVICE in, __PDEVICE out, u16 linelen, __PSTRING prompt, u8 flags);
00124 __BOOL __terminalStart(__PTERMINAL term);
00125 __VOID __terminalWrite(__PTERMINAL term, __CONST __PSTRING str, ...);
00126 __VOID __terminalWriteLine(__PTERMINAL term, __CONST __PSTRING str, ...);
00127 __VOID __terminalOut(__PTERMINAL term, __BOOL crlf, __CONST __PSTRING str, __PSTRING args);
00128 __VOID __terminalAddCommand(__PTERMINAL term, __PTERMINALCMD cmd, u8 count);
00129 __VOID __terminalCreateCommand(__PTERMINAL term, __PSTRING cmd, __TERMINALRXCMD* func);
00130 
00135 #endif /* __CONFIG_COMPILE_TERMINAL */
00136 
00137 #endif /* __TERMINAL_H__ */
 All Data Structures Files Functions Variables Typedefs Defines