newlib: new functions get_skin_height() and get_os_event()

git-svn-id: svn://kolibrios.org@4499 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2014-01-21 14:12:35 +00:00
parent 05df377e5f
commit db4fbe185d

View File

@ -1,7 +1,6 @@
#ifndef __KOS_32_SYS_H__
#define __KOS_32_SYS_H__
#include <newlib.h>
#include <stdint.h>
#include <stddef.h>
@ -12,6 +11,8 @@
// #define DBG(format,...)
//#endif
#define TYPE_3_BORDER_WIDTH 5
typedef unsigned int color_t;
typedef union __attribute__((packed))
@ -60,6 +61,18 @@ void DefineButton(uint32_t x_w, uint32_t y_h, uint32_t id, uint32_t color)
};
static inline
uint32_t get_skin_height(void)
{
uint32_t height;
__asm__ __volatile__(
"int $0x40 \n\t"
:"=a"(height)
:"a"(48),"b"(4));
return height;
}
static inline
void BeginDraw(void)
{
@ -74,15 +87,15 @@ void EndDraw(void)
"int $0x40" ::"a"(12),"b"(2));
};
static inline void DrawWindow(int x, int y, int w, int h, char *name,
static inline void DrawWindow(int x, int y, int w, int h, const char *name,
color_t workcolor, uint32_t style)
{
__asm__ __volatile__(
"int $0x40"
::"a"(0),
"b"((x << 16) | (w & 0xFFFF)),
"c"((y << 16) | (h & 0xFFFF)),
"b"((x << 16) | ((w-1) & 0xFFFF)),
"c"((y << 16) | ((h-1) & 0xFFFF)),
"d"((style << 24) | (workcolor & 0xFFFFFF)),
"D"(name));
};
@ -159,6 +172,16 @@ static inline uint32_t check_os_event()
return val;
};
static inline uint32_t get_os_event()
{
uint32_t val;
__asm__ __volatile__(
"int $0x40"
:"=a"(val)
:"a"(10));
return val;
};
static inline
uint32_t get_tick_count(void)
{