2023-10-21 20:27:23 +03:00
|
|
|
|
/**
|
|
|
|
|
* sys.h
|
|
|
|
|
* Заголовок содержащий определения для работы системного API
|
|
|
|
|
*
|
|
|
|
|
* Данный заголовочный файл содержит определения которые используются для
|
|
|
|
|
* объявления структур и системных функций
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef SYS_H
|
|
|
|
|
#define SYS_H
|
|
|
|
|
|
2023-10-15 18:45:09 +03:00
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2023-10-31 19:06:56 +03:00
|
|
|
|
uint32_t *address;
|
|
|
|
|
uint64_t width;
|
|
|
|
|
uint64_t height;
|
|
|
|
|
uint64_t pitch;
|
|
|
|
|
uint16_t bpp;
|
2023-10-15 18:45:09 +03:00
|
|
|
|
int reserved;
|
|
|
|
|
} framebuffer_t;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
int reserved;
|
|
|
|
|
} sys_info_t;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
char *name;
|
|
|
|
|
void *addr;
|
|
|
|
|
} module_func_t;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
int reserved;
|
|
|
|
|
} func_t;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
uint8_t a[4];
|
|
|
|
|
uint8_t b[4];
|
|
|
|
|
uint8_t c[4];
|
|
|
|
|
uint8_t d[4];
|
|
|
|
|
} uid_t;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
uint16_t year;
|
|
|
|
|
uint8_t month;
|
|
|
|
|
uint8_t day;
|
|
|
|
|
uint8_t second;
|
|
|
|
|
} time_t;
|
2023-10-21 20:27:23 +03:00
|
|
|
|
|
2023-11-18 14:50:37 +03:00
|
|
|
|
typedef struct {
|
|
|
|
|
char *name;
|
|
|
|
|
char *message;
|
|
|
|
|
uint64_t type;
|
|
|
|
|
uint64_t data_size;
|
|
|
|
|
void *data;
|
|
|
|
|
int64_t err_code;
|
|
|
|
|
uint64_t module_id;
|
2023-12-15 00:23:23 +03:00
|
|
|
|
uint8_t irq; // Номер прерывания
|
|
|
|
|
void *irq_handler; // Адрес обработчика прерываний
|
2023-12-15 18:03:01 +03:00
|
|
|
|
void *(*get_func)(uint64_t id);
|
2023-11-18 14:50:37 +03:00
|
|
|
|
} __attribute__((packed)) module_info_t;
|
|
|
|
|
|
2023-10-24 23:53:20 +03:00
|
|
|
|
typedef struct {
|
|
|
|
|
uint64_t offset;
|
2023-11-07 22:34:26 +03:00
|
|
|
|
void (*fb_printf)(char *str, ...); // Временная функция
|
2023-12-16 00:13:37 +03:00
|
|
|
|
framebuffer_t (*alloc_framebuffer)( );
|
2023-11-07 22:34:26 +03:00
|
|
|
|
void (*free_framebuffer)(framebuffer_t *frame);
|
2023-11-26 13:12:57 +03:00
|
|
|
|
void *(*alloc)(uint64_t size);
|
|
|
|
|
void (*free)(void *ptr);
|
2023-11-07 22:34:26 +03:00
|
|
|
|
void (*exit)(int code);
|
|
|
|
|
int (*get_error)( );
|
|
|
|
|
sys_info_t *(*get_info)( );
|
|
|
|
|
module_info_t *(*get_module)(char *module_id);
|
|
|
|
|
uint64_t (*new_thread)(uint64_t func);
|
|
|
|
|
int (*delete_thread)(uint64_t thread_id);
|
|
|
|
|
time_t (*get_time)( );
|
2023-11-18 14:50:37 +03:00
|
|
|
|
} __attribute__((packed)) env_t;
|
2023-10-24 23:53:20 +03:00
|
|
|
|
|
2023-11-18 14:50:37 +03:00
|
|
|
|
env_t *sys_install(env_t *module);
|
2023-11-07 22:34:26 +03:00
|
|
|
|
|
2023-10-21 20:27:23 +03:00
|
|
|
|
#endif // sys.h
|