www.pudn.com > 4510b_dma.rar > POLLIO.H


/********************************************************************/ 
/*                                                                  */ 
/*      Polled I/O  Program for KS32C50100                          */ 
/*                                                                  */ 
/*------------------------------------------------------------------*/ 
/*      Copyright (C) 1997 Samsung Electronics.                     */ 
/*------------------------------------------------------------------*/ 
/*                                                                  */ 
/*      Description : 1997-05-12 first edited                       */ 
/*                  : 1997-06-19 modified for ks32c50100            */ 
/*------------------------------------------------------------------*/ 
 
#ifndef _POLLIO_H 
#define _POLLIO_H 
 
 
/*---------------------------------------------------------------------*/ 
/* General Definitions                                                 */ 
/*---------------------------------------------------------------------*/ 
#define UCHAR   unsigned char 
#define USHORT  unsigned short 
#define UINT    unsigned int 
#define ULONG   unsigned long 
 
/*---------------------------------------------------------------------*/ 
/* Symbol Definitions                                                  */ 
/*---------------------------------------------------------------------*/ 
#define NL          0x0A 
#define CR          0x0D 
#define BSP         0x08 
#define ESC         0x1B 
#define CTRLZ       0x1A 
#define RUBOUT      0x7F 
#define LTRUE       0xFF 
#define FALSE       0 
#define NULL        0 
#define DEFAULT     -1 
#define DEFAULT_P   6      /* default precision */ 
 
/*---------------------------------------------------------------------*/ 
/* Input buffer                                                        */ 
/*---------------------------------------------------------------------*/ 
#define INP_LEN 100 
 
/*---------------------------------------------------------------------*/ 
/* This structure is used to store information obtained from parsing a */ 
/* format specifier.                                                   */ 
/*---------------------------------------------------------------------*/ 
typedef struct 
{ 
    long width;            /* field width */ 
    long precision;        /* precision specifier */ 
    ULONG count;           /* character count */ 
                           /* BOOLEAN flags with default values */ 
    UCHAR space;           /* FALSE */ 
    UCHAR right;           /* TRUE */ 
    UCHAR alter;           /* FALSE */ 
    UCHAR plus;            /* FALSE */ 
    UCHAR zero;            /* FALSE */ 
    UCHAR mod;             /* process modifier */ 
    UCHAR type;            /* conversion type */ 
} FORMAT; 
 
/*---------------------------------------------------------------------*/ 
/* Buffer structure - used to set up the formatted output.             */ 
/*---------------------------------------------------------------------*/ 
#define BUFFSIZE 60 
typedef struct 
{ 
    UCHAR buff[BUFFSIZE];     /* data buffer */ 
    UCHAR *ptr;               /* ptr to current position in buffer */ 
    UCHAR *end;               /* last position in buffer */ 
} BUFFER; 
 
/*---------------------------------------------------------------------*/ 
/* Function Prototypes                                                 */ 
/*---------------------------------------------------------------------*/ 
#define SerialPollConin() 	get_byte() 
#define SerialPollConout(c)	put_byte(c) 
#define SerialPollConsts(n)	(1) 
 
 
extern ULONG Print(char * /*format */, ...); 
 
#define get_string(s)           read_string(s) 
extern UCHAR read_string(char */*dest_ptr*/); 
/***********************************************************************/ 
/* read_string: Read a string from the input                           */ 
/*                                                                     */ 
/*     RETURNS: number of characters in the string                     */ 
/*     OUTPUTS: *dest_ptr contains the null-terminated string.         */ 
/*                                                                     */ 
/***********************************************************************/ 
 
 
extern ULONG get_number(void); 
/***********************************************************************/ 
/* read_number: Read a number from the input                           */ 
/*                                                                     */ 
/*     RETURNS: number                                                 */ 
/*                                                                     */ 
/***********************************************************************/ 
 
extern UCHAR get_ch(U32 /*cur_pos*/); 
 
#endif /* End of _POLLIO_H */