2017-10-10 03:07:29 -04:00
|
|
|
/*
|
|
|
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
|
|
|
* running old operating systems and software designed for IBM
|
|
|
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
|
|
|
* system designs based on the PCI bus.
|
|
|
|
|
*
|
|
|
|
|
* This file is part of the 86Box distribution.
|
|
|
|
|
*
|
|
|
|
|
* Define the various platform support functions.
|
|
|
|
|
*
|
2017-10-17 01:59:09 -04:00
|
|
|
* Version: @(#)plat.h 1.0.9 2017/10/16
|
2017-10-10 03:07:29 -04:00
|
|
|
*
|
|
|
|
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
|
|
|
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2016,2017 Miran Grca.
|
|
|
|
|
* Copyright 2017 Fred N. van Kempen.
|
|
|
|
|
*/
|
|
|
|
|
#ifndef EMU_PLAT_H
|
|
|
|
|
# define EMU_PLAT_H
|
|
|
|
|
|
2017-10-17 01:59:09 -04:00
|
|
|
#ifndef GLOBAL
|
|
|
|
|
# define GLOBAL extern
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* A hack (GCC-specific) to allow us to ignore unused parameters. */
|
|
|
|
|
#define UNUSED(arg) __attribute__((unused))arg
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Global variables residing in the platform module. */
|
2017-10-17 01:59:09 -04:00
|
|
|
GLOBAL int dopause;
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/* System-related functions. */
|
2017-10-12 14:25:17 -04:00
|
|
|
extern FILE *plat_fopen(wchar_t *path, wchar_t *mode);
|
|
|
|
|
extern void plat_remove(wchar_t *path);
|
|
|
|
|
extern int plat_getcwd(wchar_t *bufp, int max);
|
|
|
|
|
extern int plat_chdir(wchar_t *path);
|
2017-10-17 01:59:09 -04:00
|
|
|
extern void plat_get_exe_name(wchar_t *s, int size);
|
|
|
|
|
extern wchar_t *plat_get_filename(wchar_t *s);
|
|
|
|
|
extern wchar_t *plat_get_extension(wchar_t *s);
|
|
|
|
|
extern void plat_append_filename(wchar_t *dest, wchar_t *s1, wchar_t *s2, int size);
|
|
|
|
|
extern void plat_put_backslash(wchar_t *s);
|
|
|
|
|
extern int plat_dir_check(wchar_t *path);
|
|
|
|
|
extern int plat_dir_create(wchar_t *path);
|
|
|
|
|
extern uint64_t plat_timer_read(void);
|
|
|
|
|
extern uint32_t plat_get_ticks(void);
|
|
|
|
|
extern void plat_delay_ms(uint32_t count);
|
2017-10-14 00:49:08 -04:00
|
|
|
extern void plat_pause(int p);
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* Return the size (in wchar's) of a wchar_t array. */
|
|
|
|
|
#define sizeof_w(x) (sizeof((x)) / sizeof(wchar_t))
|
|
|
|
|
|
|
|
|
|
/* The Win32 API uses _wcsicmp. */
|
2017-10-12 14:25:17 -04:00
|
|
|
#ifdef WIN32
|
|
|
|
|
# define wcscasecmp _wcsicmp
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-10-11 05:40:44 -04:00
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
/* Resource management. */
|
|
|
|
|
extern wchar_t *plat_get_string(int id);
|
|
|
|
|
extern wchar_t *plat_get_string_from_string(char *str);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Platform-specific device support. */
|
|
|
|
|
extern uint8_t host_cdrom_drive_available[26];
|
|
|
|
|
extern uint8_t host_cdrom_drive_available_num;
|
|
|
|
|
extern uint32_t cdrom_capacity;
|
|
|
|
|
|
|
|
|
|
extern void cdrom_init_host_drives(void);
|
|
|
|
|
extern void cdrom_eject(uint8_t id);
|
|
|
|
|
extern void cdrom_reload(uint8_t id);
|
|
|
|
|
extern void removable_disk_unload(uint8_t id);
|
|
|
|
|
extern void removable_disk_eject(uint8_t id);
|
|
|
|
|
extern void removable_disk_reload(uint8_t id);
|
|
|
|
|
extern int ioctl_open(uint8_t id, char d);
|
|
|
|
|
extern void ioctl_reset(uint8_t id);
|
|
|
|
|
extern void ioctl_close(uint8_t id);
|
|
|
|
|
|
|
|
|
|
|
2017-10-11 05:40:44 -04:00
|
|
|
/* Thread support. */
|
|
|
|
|
typedef void thread_t;
|
|
|
|
|
typedef void event_t;
|
2017-10-14 20:04:21 -04:00
|
|
|
typedef void mutex_t;
|
2017-10-11 05:40:44 -04:00
|
|
|
|
|
|
|
|
extern thread_t *thread_create(void (*thread_rout)(void *param), void *param);
|
|
|
|
|
extern void thread_kill(thread_t *handle);
|
|
|
|
|
|
2017-10-14 20:04:21 -04:00
|
|
|
extern void thread_sleep(int t);
|
|
|
|
|
|
2017-10-11 05:40:44 -04:00
|
|
|
extern event_t *thread_create_event(void);
|
|
|
|
|
extern void thread_set_event(event_t *event);
|
|
|
|
|
extern void thread_reset_event(event_t *_event);
|
|
|
|
|
extern int thread_wait_event(event_t *event, int timeout);
|
|
|
|
|
extern void thread_destroy_event(event_t *_event);
|
|
|
|
|
|
2017-10-14 20:04:21 -04:00
|
|
|
extern mutex_t *thread_create_mutex(wchar_t *name);
|
|
|
|
|
extern void thread_close_mutex(mutex_t *mutex);
|
|
|
|
|
extern int thread_wait_mutex(mutex_t *mutex);
|
|
|
|
|
extern int thread_release_mutex(mutex_t *mutex);
|
2017-10-11 05:40:44 -04:00
|
|
|
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
/* Other stuff. */
|
|
|
|
|
extern void startblit(void);
|
|
|
|
|
extern void endblit(void);
|
2017-10-17 01:59:09 -04:00
|
|
|
extern void updatewindowsize(int x, int y);
|
|
|
|
|
extern void uws_natural(void);
|
|
|
|
|
extern void leave_fullscreen(void);
|
2017-10-11 05:40:44 -04:00
|
|
|
extern void take_screenshot(void);
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-10-11 05:40:44 -04:00
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
#endif /*EMU_PLAT_H*/
|