gonzui


Format: Advanced Search

tkernel_2/include/sys/consio.hbare sourcepermlink (0.01 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T-Kernel 2.0 Software Package
    4:  *
    5:  *    Copyright 2011 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
   10:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   11:  *
   12:  *----------------------------------------------------------------------
   13:  */
   14: 
   15: /*
   16:  *      @(#)consio.h (sys)
   17:  *
   18:  *      Console I/O
   19:  */
   20: 
   21: #ifndef __SYS_CONSIO_H__
   22: #define __SYS_CONSIO_H__
   23: 
   24: #include <basic.h>
   25: #include <tk/typedef.h>
   26: 
   27: #ifdef __cplusplus
   28: extern "C" {
   29: #endif
   30: 
   31: /* ------------------------------------------------------------------------ */
   32: /*
   33:  *      Interface between application and buffer
   34:  */
   35: 
   36: /* Default port definition */
   37: #define CONSOLE_PORT    1  /* Debug console */
   38: #define RS_PORT         2      /* Download serial port */
   39: 
   40: IMPORT int _GetChar( void );
   41: IMPORT int _PutChar( int c );
   42: IMPORT int _GetString( char *s );
   43: IMPORT int _PutString( const char *s );
   44: IMPORT int cons_ioctl( int req, int arg );
   45: 
   46: /* Serial port (RS_PORT) only */
   47: IMPORT int RS_putchar( int c );
   48: IMPORT int RS_getchar();
   49: IMPORT int RS_ioctl( int req, int arg );
   50: 
   51: /*
   52:  * cons_ioctl() request code
   53:  */
   54: #define GETCTL          0x100U  /* Get setting:
   55:                                    Get current settings (as function values)
   56:                                    via an OR with something other than INIT.
   57:                                    (GETCTL | ECHO), etc */
   58: 
   59: #define ECHO            1 /* Echo presence (1 = yes, 0 = no) */
   60: #define INPUT           2        /* Input mode (RAW, etc.) */
   61: #define NEWLINE         3      /* When transmission, convert LF to CR, LF
   62:                                    (1 = convert, 0 = don't convert) */
   63: #define FLOWC           4        /* Flow control (0 = no, IXON, etc.) */
   64: 
   65: #define SNDTMO          0x81U   /* Transmission timeout(milliseconds)
   66:                                    -1 = none */
   67: #define RCVTMO          0x82U   /* Reception timeout (milliseconds)
   68:                                    -1 = none */
   69: 
   70: #define RCVBUFSZ        0x83U  /* Input buffer size: GET only */
   71: #define SNDBUFSZ        0x84U  /* Output buffer size: GET only */
   72: 
   73: /* Input mode */
   74: #define RAW             1  /* Raw input character by character */
   75: #define CANONICAL       3     /* Single row input (CR converted to LF) */
   76: #define EDIT            5 /* Single row editing input */
   77: 
   78: /* Flow control */
   79: #define IXON            0x01U     /* XON/XOFF output flow control */
   80: #define IXANY           0x02U    /* Output restarted if any character
   81:                                    received during IXON */
   82: #define IXOFF           0x04U    /* XON/XOFF input flow control */
   83: 
   84: /* ------------------------------------------------------------------------ */
   85: /*
   86:  *      Interface between console and buffer
   87:  */
   88: 
   89: IMPORT W cons_put(W port, B *buf, UW len, W tmout);
   90: IMPORT W cons_get(W port, B *buf, UW len, W tmout);
   91: IMPORT W cons_conf(W req, UW *arg);
   92: 
   93: /*
   94:  * cons_conf() request code
   95:  */
   96: #define CS_CREATE       0x11U /* Generate console port                */
   97:                                 /* arg[0] = port number                 OUT    */
   98:                                 /* arg[1] = configuration       IN    */
   99:                                 /* arg[2] = input buffer size           IN        */
  100:                                 /* arg[3] = output buffer size          IN       */
  101: 
  102: #define CS_DELETE       0x12U /* Delete console port                  */
  103:                                 /* arg[0] = port number                 IN     */
  104: 
  105: #define CS_SETCONF      0x13U        /* Console structure setting           */
  106:                                 /* arg[0] = port number                 IN     */
  107:                                 /* arg[1] = configuration       IN    */
  108:                                 /* arg[2] = input buffer size           IN        */
  109:                                 /* arg[3] = output buffer size      IN      */
  110: 
  111: #define CS_GETCONF      0x14U        /* Get console structure               */
  112:                                 /* arg[0] = port number                 IN     */
  113:                                 /* arg[1] = configuration       OUT   */
  114:                                 /* arg[2] = input buffer size           OUT       */
  115:                                 /* arg[3] = output buffer size          OUT */
  116: 
  117: #define CS_GETPORT      0x21U        /* Get standard console port           */
  118:                                 /* arg[0] = port number                 OUT    */
  119: 
  120: #define CS_SETPORT      0x22U        /* Standard console port setting       */
  121:                                 /* arg[0] = port number                 IN     */
  122: 
  123: #define CS_SRCHPORT     0x23U       /* Console port search                        */
  124:                                 /* arg[0] = port number              IN/OUT    */
  125:                                 /* arg[1] = configuration       IN    */
  126: 
  127: /* Configuration */
  128: #define CONF_SERIAL_0   (0)       /* Serial port #0                     */
  129: #define CONF_SERIAL(n)  (n)      /* Serial port #N                    */
  130: #define CONF_SELF       (-1)  /* Self console                          */
  131: #define CONF_BUFIO      (-2) /* Buffer IO                            */
  132: 
  133: /* ------------------------------------------------------------------------ */
  134: 
  135: /*
  136:  * Definitions for interface library auto generation (mkiflib)
  137:  */
  138: /*** DEFINE_IFLIB
  139: [INCLUDE FILE]
  140: <sys/consio.h>
  141: 
  142: [PREFIX]
  143: CONSIO
  144: ***/
  145: 
  146: /* [BEGIN SYSCALLS] */
  147: /* Input/output between console and buffer */
  148: /* ALIGN_NO 0x10 */
  149: IMPORT ER console_get(W port, B *buf, UW len, W tmout);
  150: IMPORT ER console_put(W port, B *buf, UW len, W tmout);
  151: IMPORT ER console_conf(W req, UW *arg);
  152: 
  153: /* Input/output between application and buffer */
  154: /* ALIGN_NO 0x10 */
  155: IMPORT ER console_in(W port, B *buf, UW len);
  156: IMPORT ER console_out(W port, B *buf, UW len);
  157: IMPORT ER console_ctl(W port, W req, W arg);
  158: /* [END SYSCALLS] */
  159: 
  160: #ifdef __cplusplus
  161: }
  162: #endif
  163: #endif /* __SYS_CONSIO_H__ */