80 lines
1.5 KiB
C
80 lines
1.5 KiB
C
#ifndef __VXBOOT_TERMINAL_H__
|
|
# define __VXBOOT_TERMINAL_H__
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <gint/defs/types.h>
|
|
|
|
/* internal terminal hardcoded information */
|
|
#define TERM_PRIVATE_WATERMARK (0xdeadbeef)
|
|
#define TERM_RDBUFFER_NBLINE (32)
|
|
|
|
/* hardcoded font size (TODO: dynamic !) */
|
|
#ifdef FXCG50
|
|
#define FWIDTH 8
|
|
#define FHEIGHT 9
|
|
#endif
|
|
#ifdef FX9860G
|
|
#define FWIDTH 5
|
|
#define FHEIGHT 7
|
|
#endif
|
|
|
|
/* define terminal structure */
|
|
struct terminal {
|
|
/* windows information */
|
|
struct {
|
|
unsigned short ws_col;
|
|
unsigned short ws_row;
|
|
unsigned short ws_xpixel;
|
|
unsigned short ws_ypixel;
|
|
unsigned short ft_xpixel;
|
|
unsigned short ft_ypixel;
|
|
} winsize;
|
|
|
|
/* cursor information */
|
|
struct {
|
|
unsigned short x;
|
|
unsigned short y;
|
|
} cursor;
|
|
|
|
/* buffer information */
|
|
struct {
|
|
uint8_t *data;
|
|
off_t cursor;
|
|
size_t size;
|
|
} buffer;
|
|
|
|
/* private information */
|
|
struct {
|
|
struct {
|
|
int id;
|
|
} timer;
|
|
uint32_t watermark;
|
|
struct {
|
|
int fg;
|
|
int bg;
|
|
} color;
|
|
} private;
|
|
};
|
|
|
|
/* define the terminal */
|
|
extern struct terminal terminal;
|
|
|
|
//---
|
|
// User interface
|
|
//---
|
|
extern int terminal_open(void);
|
|
extern int terminal_write(const char *format, ...);
|
|
extern int terminal_read(void *buffer, size_t nb);
|
|
extern int terminal_close(void);
|
|
|
|
//---
|
|
// Internal interface
|
|
//---
|
|
extern void terminal_clear(void);
|
|
extern int terminal_cursor_handler(void);
|
|
extern void terminal_buffer_display(void);
|
|
extern void terminal_buffer_insert(char *buffer, size_t nb);
|
|
|
|
#endif /*__FXBOOT_TERMINAL_H__*/
|