84 lines
2.1 KiB
C
84 lines
2.1 KiB
C
#ifndef __KERNEL_UTIL_CASIO_H__
|
|
# define __KERNEL_UTIL_CASIO_H__
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
//---
|
|
// Casio's wrapper
|
|
//---
|
|
extern void casio_return_menu(int mode);
|
|
|
|
|
|
|
|
// Internal Casio datat structure
|
|
struct rect
|
|
{
|
|
int left;
|
|
int top;
|
|
int right;
|
|
int bottom;
|
|
};
|
|
|
|
// GetKeyWait macros
|
|
#define KEYWAIT_HALTON_TIMEROFF 0
|
|
#define KEYWAIT_HALTOFF_TIMEROFF 1
|
|
#define KEYWAIT_HALTON_TIMERON 2
|
|
|
|
//
|
|
// Casio prototypes.
|
|
//
|
|
/* GetKey() - display Casio's VRAM and wait keyboard input. */
|
|
void casio_GetKey(unsigned int *key);
|
|
void casio_GetKeyWait(int *row, int *column, int type_waiting, int timeout, int menu, unsigned int *key);
|
|
|
|
/* Bdisp_PutDisp_DD - display Casio's VRAM on screen */
|
|
void casio_Bdisp_PutDisp_DD(void);
|
|
|
|
/* Bdisp_AllClr_VRAM() - clear entirely the Casio's VRAM */
|
|
void casio_Bdisp_AllClr_VRAM(void);
|
|
|
|
/* Bdisp_AreaClr_VRAM() - clear only VRAM area. */
|
|
void casio_Bdisp_AreaClr_VRAM(const struct rect *buf);
|
|
|
|
/* PrintMini() - print string in Casio's VRAM (and display on screen ?) */
|
|
void casio_Bdisp_PrintMini(size_t x, size_t y, char const *str, int mode);
|
|
|
|
/* Bdisp_DrawLine_VRAM() - draw line in Casio's VRAM. */
|
|
void casio_Bdisp_DrawLine_VRAM(int x1, int y1, int x2, int y2);
|
|
|
|
/* RestoreDisp() - restore saved screen. */
|
|
void casio_RestoreDisp(unsigned char page);
|
|
|
|
/* SaveDisp() - save the content of the screen. */
|
|
void casio_SaveDisp(unsigned char page);
|
|
|
|
/* Malloc() - malloc syscall */
|
|
void *casio_Malloc(size_t size);
|
|
|
|
/* Free() - free syscall */
|
|
void *casio_Free(void *ptr);
|
|
|
|
/* GetVRAM - Get the Video RAM used by Casio */
|
|
void *casio_Bdisp_GetVRAM(void);
|
|
|
|
/* Bkey_PutKeyCode - Inject keycode to key buffer */
|
|
void casio_Bkey_PutKeymatrix(uint16_t *code);
|
|
|
|
// Internal casio abstraction.
|
|
static inline void dclear_area(int x1, int y1, int x2, int y2)
|
|
{
|
|
struct rect area = {.left = x1, .top = y1, .right = x2, .bottom = y2};
|
|
casio_Bdisp_AreaClr_VRAM(&area);
|
|
}
|
|
|
|
// Timer syscalls
|
|
extern int casio_TimerInstall(int id, void (*handler)(void), int delay_ms);
|
|
extern int casio_TimerUninstall(int id);
|
|
extern int casio_TimerStart(int id);
|
|
extern int casio_TimerStop(int id);
|
|
|
|
|
|
|
|
#endif /*__KERNEL_UTIL_CASIO_H__*/
|