BigOS/include/console.h
2023-01-08 11:12:41 +08:00

49 lines
1.7 KiB
C

/*************************************************************************/ /**
*****************************************************************************
* @file console.h
* @brief
* @author Forrest Y. Yu
* @date 2005
*****************************************************************************
*****************************************************************************/
/**********************************************************
* console.h //added by mingxuan 2019-5-17
***********************************************************/
#ifndef _ORANGES_CONSOLE_H_
#define _ORANGES_CONSOLE_H_
/* CONSOLE */
typedef struct s_console
{
unsigned int row;
unsigned int col;
unsigned int buf_head; // for futher restore after true tty initialized
unsigned int buf_tail;
char *buf;
} CONSOLE;
void simpleconsole_init();
void simpleconsole_write(char* buf, int nr);
void simpleconsole_transfer(void (*write)(char ch));
void simpleconsole_setcur(int row, int col);
#define CON_MAX_LOGBUF 1024
#define SCR_UP 1 /* scroll upward */
#define SCR_DN -1 /* scroll downward */
#define SCR_WIDTH 80
#define SCR_HEIGHT 25
#define SCR_SIZE (SCR_HEIGHT * SCR_WIDTH)
#define SCR_BUFSIZE (2 * SCR_SIZE)
#define SCR_MAXLINE (SCR_BUFSIZE / SCR_WIDTH)
#define DEFAULT_CHAR_COLOR ((MAKE_COLOR(BLACK, WHITE | BRIGHT)) << 8)
#define GRAY_CHAR (MAKE_COLOR(BLACK, BLACK) | BRIGHT)
#define RED_CHAR (MAKE_COLOR(BLUE, RED) | BRIGHT)
#define MAKE_CELL(clr, ch) (clr | ch)
#define BLANK MAKE_CELL(DEFAULT_CHAR_COLOR, ' ')
#endif /* _ORANGES_CONSOLE_H_ */