60 lines
1.9 KiB
C
60 lines
1.9 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_
|
|
#include "tty.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;
|
|
} s_console;
|
|
|
|
typedef struct ringbuf {
|
|
unsigned int head;
|
|
unsigned int tail;
|
|
unsigned int maxsize;
|
|
unsigned int size;
|
|
void* buf;
|
|
} ringbuf_t;
|
|
|
|
void simpleconsole_init();
|
|
void simpleconsole_write(char* buf, int nr);
|
|
void simpleconsole_transfer(void (*write)(char ch));
|
|
void simpleconsole_setcur(int row, int col);
|
|
void fbcon_tty_write(NTTY* tty, char ch) ;
|
|
void fbcon_screen_setup();
|
|
|
|
#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 FLASH_CHAR 0x8000
|
|
#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_ */ |