luxos/SysCore/include/system.h
2021-09-14 18:34:14 +03:00

40 lines
1.1 KiB
C

/*******************************************************************
* system.c - Basic system functions and variables declaration *
*******************************************************************/
#ifndef __SYSTEM_H
#define __SYSTEM_H
#include <regs.h>
#define true 1
#define false 0
// Data type declarations
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned int dword;
extern byte *TextVideoRam;
extern volatile int cursor_x, cursor_y;
extern int current_mode_width;
extern int current_mode_height;
extern void *memcpy(void *dest, const void *src, int count);
extern void *memset(void *dest, char val, int count);
extern unsigned short *memsetw(unsigned short *dest, unsigned short val, int count);
extern byte inportb (word _port);
extern byte inb (word _port);
static inline void outportb (word _port, byte _data) {
__asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data));
}
static inline void outb (word _port, byte _data) {
__asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data));
}
static inline void iowait() {
asm volatile ("outb %al, $0x80");
}
#endif