?? pollio.h
字號:
/********************************************************************/
/* */
/* Polled I/O Program for KS32C5000 */
/* */
/*------------------------------------------------------------------*/
/* Copyright (C) 1997 Samsung Electronics. */
/*------------------------------------------------------------------*/
/* */
/* Modified, programmed by qorrha (Jong H. BAIK) */
/* */
/* Description : 1997-05-12 first edited */
/* : 1997-06-19 modified for ks32c5000 */
/*------------------------------------------------------------------*/
#ifndef _POLLIO_H
#define _POLLIO_H
//#include "Graphics.h"
typedef enum parm_type
{
FLAG = 1, IP = 2, HEX = 3, DECIMAL = 4, CHAR = 5, STRING = 6
} PARM_TYPE;
#define DEV_UART 0
#define DEV_RAM 1
extern u16_t g_cur_dev, *g_cur_pos, g_cur_offset;
/*---------------------------------------------------------------------*/
/* 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 20
/*---------------------------------------------------------------------*/
/* This structure is used to store information obtained from parsing a */
/* format specifier. */
/*---------------------------------------------------------------------*/
typedef struct
{
s16_t width; /* field width */
u8_t space; /* FALSE */
u8_t right; /* TRUE */
u8_t alter; /* FALSE */
u8_t plus; /* FALSE */
u8_t zero; /* FALSE */
u8_t mod; /* process modifier */
u8_t type; /* conversion type */
} FORMAT;
/*---------------------------------------------------------------------*/
/* Function Prototypes */
/*---------------------------------------------------------------------*/
#define SerialPollConin() ({ \
u8_t ch; \
ch = get_byte(); \
if (ch == 8) \
{ \
SerialPollConout(' '); }\
SerialPollConout(ch); \
ch;})
#define SerialPollConout(c) do{ \
if (g_cur_dev == DEV_UART) \
{ \
WaitXmitter();\
put_byte(c); \
}\
else \
if (g_cur_dev == DEV_RAM)\
{\
putbyte(g_cur_pos,c,g_cur_offset++);\
}\
}while(0)
//#define SerialPollConout(c) do{ \
WaitXmitter();\
put_byte(c); \
}while(0)
#define SerialPollConsts(n) (1)
#define Printf(ram,pram) ({do { \
g_cur_dev = DEV_RAM; \
g_cur_pos = ram; \
g_cur_offset = 0; \
Print##pram;\
g_cur_dev = DEV_UART; \
} while(0);\
g_cur_offset;\
})
//#define Printf(x,y)
extern void Print(char * /*format */, ...);
#define get_string(s) read_string(s)
extern u8_t 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 */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -