www.pudn.com > Linuxserial.zip > types.h


#ifndef _TYPES_H
#define _TYPES_H

#define _(text) text
#define  TEXT(text)	text

/* 
 * sizeof (int) == 4;
 * sizeof (short) == 2;
 * sizeof (char) == 1;
 */
typedef int LONG;
typedef unsigned short WORD;
typedef unsigned int DWORD;
typedef unsigned char BYTE;
typedef char TCHAR;

typedef int INT32;
typedef short INT16;
typedef char INT8;
typedef unsigned int UINT32;
typedef unsigned short UINT16;
typedef unsigned char UINT8;

typedef int int32;
typedef short int16;
typedef char int8;
typedef unsigned int uint32;
typedef unsigned short uint16;
typedef unsigned char uint8;


typedef struct {
    const char *const program_name;     // program name 
    const char *const package;  // package name 
    const char *const version;  // version 
    const char *const authors;  // authors 
    const INT32 reserved;       // reserved, must be zero 
} pkginfo_t, *p_pkginfo_t;

typedef struct {
    INT8 prompt;                // prompt after reciving data
    INT32 baudrate;             // baudrate 
    INT8 databit;               // data bits, 5, 6, 7, 8 
    INT8 debug;                 // debug mode, 0:none, 1:debug 
    INT8 echo;                  // echo mode, 0:none, 1:echo 
    INT8 fctrl;                 // flow control, 0:None, 1:Hardware, 2:Software 
    INT8 tty;                   // tty: 0, 1, 2, 3, 4, 5, 6, 7 
    INT8 parity;                // parity, 0:none, 1:odd, 2:even 
    INT8 stopbit;               // stop bits, 1, 2 supported, 1.5 don't 
    const INT32 reserved;       // reserved, must be zero 
} portinfo_t, *p_portinfo_t;

typedef struct {
    pkginfo_t *p_pkginfo;
    portinfo_t *p_portinfo;

} args_t, *p_args_t;

extern p_args_t p_args;
#define DEBUG p_args->p_portinfo->debug

#endif                          /* types.h */