Textual updates, moved thread.h to win/plat_thread.h (and thread.c to new lnx/ folder) to clean that up.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Modified Makefile for Win32 (MinGW32) environment.
|
||||
#
|
||||
# Version: @(#)Makefile.mingw 1.0.24 2017/06/04
|
||||
# Version: @(#)Makefile.mingw 1.0.25 2017/06/04
|
||||
#
|
||||
# Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
# Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -143,9 +143,9 @@ SYSOBJ = model.o \
|
||||
scat.o \
|
||||
sis496.o \
|
||||
wd76c10.o \
|
||||
laserxt.o \
|
||||
acer386sx.o acerm3a.o amstrad.o \
|
||||
compaq.o olivetti_m24.o jim.o ps1.o ps2.o ps2_mca.o \
|
||||
compaq.o laserxt.o jim.o \
|
||||
olivetti_m24.o ps1.o ps2.o ps2_mca.o \
|
||||
tandy_eeprom.o tandy_rom.o
|
||||
DEVOBJ = bugger.o lpt.o serial.o \
|
||||
um8669f.o pc87306.o sis85c471.o w83877f.o \
|
||||
|
||||
@@ -8,27 +8,28 @@
|
||||
*
|
||||
* Sound emulation core.
|
||||
*
|
||||
* Version: @(#)sound.c 1.0.0 2017/05/30
|
||||
* Version: @(#)sound.c 1.0.1 2017/06/04
|
||||
*
|
||||
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "../ibm.h"
|
||||
#include "../device.h"
|
||||
#include "../timer.h"
|
||||
#include "../thread.h"
|
||||
#include "../cdrom.h"
|
||||
#include "../win/plat_thread.h"
|
||||
#include "sound.h"
|
||||
#include "snd_opl.h"
|
||||
#include "snd_adlib.h"
|
||||
#include "snd_adlibgold.h"
|
||||
/* #include "snd_pas16.h" */
|
||||
#if 0
|
||||
#include "snd_pas16.h"
|
||||
#endif
|
||||
#include "snd_sb.h"
|
||||
#include "snd_sb_dsp.h"
|
||||
#include "snd_wss.h"
|
||||
@@ -48,26 +49,27 @@ typedef struct
|
||||
|
||||
static SOUND_CARD sound_cards[] =
|
||||
{
|
||||
{"None", "none", NULL},
|
||||
{"Adlib", "adlib", &adlib_device},
|
||||
{"Adlib MCA", "adlib_mca", &adlib_mca_device},
|
||||
{"Sound Blaster 1.0", "sb", &sb_1_device},
|
||||
{"Sound Blaster 1.5", "sb1.5", &sb_15_device},
|
||||
{"Sound Blaster MCV", "sbmcv", &sb_mcv_device},
|
||||
{"Sound Blaster 2.0", "sb2.0", &sb_2_device},
|
||||
{"Sound Blaster Pro v1", "sbprov1", &sb_pro_v1_device},
|
||||
{"Sound Blaster Pro v2", "sbprov2", &sb_pro_v2_device},
|
||||
{"Sound Blaster Pro MCV", "sbpromcv", &sb_pro_mcv_device},
|
||||
{"Sound Blaster 16", "sb16", &sb_16_device},
|
||||
{"Sound Blaster AWE32", "sbawe32", &sb_awe32_device},
|
||||
{"Adlib Gold", "adlibgold", &adgold_device},
|
||||
{"Windows Sound System", "wss", &wss_device},
|
||||
{ "None", "none", NULL },
|
||||
{ "Adlib", "adlib", &adlib_device },
|
||||
{ "Adlib MCA", "adlib_mca", &adlib_mca_device },
|
||||
{ "Sound Blaster 1.0", "sb", &sb_1_device },
|
||||
{ "Sound Blaster 1.5", "sb1.5", &sb_15_device },
|
||||
{ "Sound Blaster MCV", "sbmcv", &sb_mcv_device },
|
||||
{ "Sound Blaster 2.0", "sb2.0", &sb_2_device },
|
||||
{ "Sound Blaster Pro v1", "sbprov1", &sb_pro_v1_device },
|
||||
{ "Sound Blaster Pro v2", "sbprov2", &sb_pro_v2_device },
|
||||
{ "Sound Blaster Pro MCV", "sbpromcv", &sb_pro_mcv_device },
|
||||
{ "Sound Blaster 16", "sb16", &sb_16_device },
|
||||
{ "Sound Blaster AWE32", "sbawe32", &sb_awe32_device },
|
||||
{ "Adlib Gold", "adlibgold", &adgold_device },
|
||||
{ "Windows Sound System", "wss", &wss_device },
|
||||
#if 0
|
||||
{"Pro Audio Spectrum 16", "pas16", &pas16_device},
|
||||
{ "Pro Audio Spectrum 16", "pas16", &pas16_device },
|
||||
#endif
|
||||
{"", "", NULL}
|
||||
{ "", "", NULL }
|
||||
};
|
||||
|
||||
|
||||
int sound_card_available(int card)
|
||||
{
|
||||
if (sound_cards[card].device)
|
||||
@@ -112,7 +114,7 @@ int sound_card_get_from_internal_name(char *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sound_card_init()
|
||||
void sound_card_init(void)
|
||||
{
|
||||
if (sound_cards[sound_card_current].device)
|
||||
device_add(sound_cards[sound_card_current].device);
|
||||
@@ -235,7 +237,7 @@ static float *outbuffer_ex;
|
||||
|
||||
static int cd_thread_enable = 0;
|
||||
|
||||
void sound_init()
|
||||
void sound_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
int available_cdrom_drives = 0;
|
||||
@@ -306,12 +308,12 @@ void sound_poll(void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
void sound_speed_changed()
|
||||
void sound_speed_changed(void)
|
||||
{
|
||||
sound_poll_latch = (int)((double)TIMER_USEC * (1000000.0 / 48000.0));
|
||||
}
|
||||
|
||||
void sound_reset()
|
||||
void sound_reset(void)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@@ -330,7 +332,7 @@ void sound_reset()
|
||||
}
|
||||
}
|
||||
|
||||
void sound_cd_thread_reset()
|
||||
void sound_cd_thread_reset(void)
|
||||
{
|
||||
int i = 0;
|
||||
int available_cdrom_drives = 0;
|
||||
|
||||
@@ -8,14 +8,13 @@
|
||||
*
|
||||
* ATi Mach64 graphics card emulation.
|
||||
*
|
||||
* Version: @(#)vid_ati_mach64.c 1.0.0 2017/05/30
|
||||
* Version: @(#)vid_ati_mach64.c 1.0.1 2017/06/04
|
||||
*
|
||||
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "../ibm.h"
|
||||
#include "../device.h"
|
||||
@@ -23,7 +22,7 @@
|
||||
#include "../mem.h"
|
||||
#include "../pci.h"
|
||||
#include "../rom.h"
|
||||
#include "../thread.h"
|
||||
#include "../win/plat_thread.h"
|
||||
#include "video.h"
|
||||
#include "vid_svga.h"
|
||||
#include "vid_svga_render.h"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "../pci.h"
|
||||
#include "../rom.h"
|
||||
#include "../device.h"
|
||||
#include "../thread.h"
|
||||
#include "../win/plat_thread.h"
|
||||
#include "video.h"
|
||||
#include "vid_svga.h"
|
||||
#include "vid_icd2061.h"
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#include "../pci.h"
|
||||
#include "../pic.h"
|
||||
#include "../rom.h"
|
||||
#include "../thread.h"
|
||||
#include "../timer.h"
|
||||
#include "../device.h"
|
||||
#include "../win/plat_thread.h"
|
||||
#include "video.h"
|
||||
#include "vid_nv_riva128.h"
|
||||
#include "vid_svga.h"
|
||||
|
||||
@@ -9,22 +9,21 @@
|
||||
* Emulation of the S3 Trio32, S3 Trio64, and S3 Vision864
|
||||
* graphics cards.
|
||||
*
|
||||
* Version: @(#)vid_s3.c 1.0.0 2017/05/30
|
||||
* Version: @(#)vid_s3.c 1.0.1 2017/06/04
|
||||
*
|
||||
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "../ibm.h"
|
||||
#include "../io.h"
|
||||
#include "../mem.h"
|
||||
#include "../pci.h"
|
||||
#include "../rom.h"
|
||||
#include "../thread.h"
|
||||
#include "../device.h"
|
||||
#include "../win/plat_thread.h"
|
||||
#include "video.h"
|
||||
#include "vid_s3.h"
|
||||
#include "vid_svga.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "../pci.h"
|
||||
#include "../rom.h"
|
||||
#include "../device.h"
|
||||
#include "../thread.h"
|
||||
#include "../win/plat_thread.h"
|
||||
#include "video.h"
|
||||
#include "vid_s3_virge.h"
|
||||
#include "vid_svga.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "../pci.h"
|
||||
#include "../rom.h"
|
||||
#include "../device.h"
|
||||
#include "../thread.h"
|
||||
#include "../win/plat_thread.h"
|
||||
#include "video.h"
|
||||
#include "vid_svga.h"
|
||||
#include "vid_svga_render.h"
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include "../mem.h"
|
||||
#include "../rom.h"
|
||||
#include "../pci.h"
|
||||
#include "../thread.h"
|
||||
#include "../timer.h"
|
||||
#include "../device.h"
|
||||
#include "../win/plat_thread.h"
|
||||
#include "video.h"
|
||||
#include "vid_svga.h"
|
||||
#include "vid_voodoo.h"
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#include "../rom.h"
|
||||
#include "../config.h"
|
||||
#include "../device.h"
|
||||
#include "../thread.h"
|
||||
#include "../timer.h"
|
||||
#include "../win/plat_thread.h"
|
||||
#include "video.h"
|
||||
#include "vid_svga.h"
|
||||
#ifndef __unix
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
*
|
||||
* The Emulator's Windows core.
|
||||
*
|
||||
* Version: @(#)win.c 1.0.1 2017/06/03
|
||||
* Version: @(#)win.c 1.0.2 2017/06/04
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
@@ -29,7 +30,6 @@
|
||||
#include "../mem.h"
|
||||
#include "../rom.h"
|
||||
#include "../nvr.h"
|
||||
#include "../thread.h"
|
||||
#include "../config.h"
|
||||
#include "../model.h"
|
||||
#include "../ide.h"
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "plat_iodev.h"
|
||||
#include "plat_mouse.h"
|
||||
#include "plat_midi.h"
|
||||
#include "plat_thread.h"
|
||||
|
||||
#include "win.h"
|
||||
#include "win_cgapal.h"
|
||||
|
||||
108
src/lnx/lnx_thread.c
Normal file
108
src/lnx/lnx_thread.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
#include "plat_thread.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
pthread_cond_t cond;
|
||||
pthread_mutex_t mutex;
|
||||
} event_pthread_t;
|
||||
|
||||
|
||||
thread_t *thread_create(void (*thread_rout)(void *param), void *param)
|
||||
{
|
||||
pthread_t *thread = malloc(sizeof(pthread_t));
|
||||
|
||||
if (thread != NULL)
|
||||
pthread_create(thread, NULL, thread_rout, param);
|
||||
|
||||
return(thread);
|
||||
}
|
||||
|
||||
|
||||
void thread_kill(thread_t *handle)
|
||||
{
|
||||
pthread_t *thread = (pthread_t *)handle;
|
||||
|
||||
if (thread != NULL) {
|
||||
pthread_cancel(*thread);
|
||||
pthread_join(*thread, NULL);
|
||||
|
||||
free(thread);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
event_t *thread_create_event(void)
|
||||
{
|
||||
event_pthread_t *event = malloc(sizeof(event_pthread_t));
|
||||
|
||||
if (event != NULL) {
|
||||
pthread_cond_init(&event->cond, NULL);
|
||||
pthread_mutex_init(&event->mutex, NULL);
|
||||
}
|
||||
|
||||
return((event_t *)event);
|
||||
}
|
||||
|
||||
|
||||
void thread_set_event(event_t *handle)
|
||||
{
|
||||
event_pthread_t *event = (event_pthread_t *)handle;
|
||||
|
||||
if (event != NULL) {
|
||||
pthread_mutex_lock(&event->mutex);
|
||||
pthread_cond_broadcast(&event->cond);
|
||||
pthread_mutex_unlock(&event->mutex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void thread_reset_event(event_t *handle)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int thread_wait_event(event_t *handle, int timeout)
|
||||
{
|
||||
event_pthread_t *event = (event_pthread_t *)handle;
|
||||
struct timespec abstime;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &abstime);
|
||||
abstime.tv_nsec += (timeout % 1000) * 1000000;
|
||||
abstime.tv_sec += (timeout / 1000);
|
||||
if (abstime.tv_nsec > 1000000000) {
|
||||
abstime.tv_nsec -= 1000000000;
|
||||
abstime.tv_sec++;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&event->mutex);
|
||||
pthread_cond_timedwait(&event->cond, &event->mutex, &abstime);
|
||||
pthread_mutex_unlock(&event->mutex);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
void thread_destroy_event(event_t *handle)
|
||||
{
|
||||
event_pthread_t *event = (event_pthread_t *)handle;
|
||||
|
||||
if (event != NULL) {
|
||||
pthread_cond_destroy(&event->cond);
|
||||
pthread_mutex_destroy(&event->mutex);
|
||||
|
||||
free(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void thread_sleep(int t)
|
||||
{
|
||||
usleep(t * 1000);
|
||||
}
|
||||
24
src/lnx/plat_thread.h
Normal file
24
src/lnx/plat_thread.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
#ifndef PLAT_THREAD_H
|
||||
# define PLAT_THREAD_H
|
||||
|
||||
|
||||
typedef void thread_t;
|
||||
typedef void event_t;
|
||||
|
||||
|
||||
extern thread_t *thread_create(void (*thread_rout)(void *param), void *param);
|
||||
extern void thread_kill(thread_t *handle);
|
||||
|
||||
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);
|
||||
|
||||
extern void thread_sleep(int t);
|
||||
|
||||
|
||||
#endif /*PLAT_THREAD_H*/
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle WinPcap library processing.
|
||||
*
|
||||
* Version: @(#)net_pcap.c 1.0.4 2017/05/23
|
||||
* Version: @(#)net_pcap.c 1.0.5 2017/06/04
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*/
|
||||
@@ -19,10 +19,10 @@
|
||||
#include <pcap.h>
|
||||
#include "ibm.h"
|
||||
#include "config.h"
|
||||
#include "thread.h"
|
||||
#include "device.h"
|
||||
#include "network.h"
|
||||
#include "plat_dynld.h"
|
||||
#include "plat_thread.h"
|
||||
|
||||
|
||||
static void *pcap_handle; /* handle to WinPcap DLL */
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "ibm.h"
|
||||
#include "config.h"
|
||||
#include "device.h"
|
||||
#include "thread.h"
|
||||
#include "network.h"
|
||||
#include "plat_thread.h"
|
||||
|
||||
|
||||
static queueADT slirpq; /* SLiRP library handle */
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
#include "thread.h"
|
||||
|
||||
typedef struct event_pthread_t
|
||||
{
|
||||
pthread_cond_t cond;
|
||||
pthread_mutex_t mutex;
|
||||
} event_pthread_t;
|
||||
|
||||
thread_t *thread_create(void (*thread_rout)(void *param), void *param)
|
||||
{
|
||||
pthread_t *thread = malloc(sizeof(pthread_t));
|
||||
|
||||
pthread_create(thread, NULL, thread_rout, param);
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
void thread_kill(thread_t *handle)
|
||||
{
|
||||
pthread_t *thread = (pthread_t *)handle;
|
||||
|
||||
pthread_cancel(*thread);
|
||||
pthread_join(*thread, NULL);
|
||||
|
||||
free(thread);
|
||||
}
|
||||
|
||||
event_t *thread_create_event()
|
||||
{
|
||||
event_pthread_t *event = malloc(sizeof(event_pthread_t));
|
||||
|
||||
pthread_cond_init(&event->cond, NULL);
|
||||
pthread_mutex_init(&event->mutex, NULL);
|
||||
|
||||
return (event_t *)event;
|
||||
}
|
||||
|
||||
void thread_set_event(event_t *handle)
|
||||
{
|
||||
event_pthread_t *event = (event_pthread_t *)handle;
|
||||
|
||||
pthread_mutex_lock(&event->mutex);
|
||||
pthread_cond_broadcast(&event->cond);
|
||||
pthread_mutex_unlock(&event->mutex);
|
||||
}
|
||||
|
||||
void thread_reset_event(event_t *handle)
|
||||
{
|
||||
}
|
||||
|
||||
int thread_wait_event(event_t *handle, int timeout)
|
||||
{
|
||||
event_pthread_t *event = (event_pthread_t *)handle;
|
||||
struct timespec abstime;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &abstime);
|
||||
abstime.tv_nsec += (timeout % 1000) * 1000000;
|
||||
abstime.tv_sec += (timeout / 1000);
|
||||
if (abstime.tv_nsec > 1000000000)
|
||||
{
|
||||
abstime.tv_nsec -= 1000000000;
|
||||
abstime.tv_sec++;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&event->mutex);
|
||||
pthread_cond_timedwait(&event->cond, &event->mutex, &abstime);
|
||||
pthread_mutex_unlock(&event->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void thread_destroy_event(event_t *handle)
|
||||
{
|
||||
event_pthread_t *event = (event_pthread_t *)handle;
|
||||
|
||||
pthread_cond_destroy(&event->cond);
|
||||
pthread_mutex_destroy(&event->mutex);
|
||||
|
||||
free(event);
|
||||
}
|
||||
|
||||
void thread_sleep(int t)
|
||||
{
|
||||
usleep(t * 1000);
|
||||
}
|
||||
15
src/thread.h
15
src/thread.h
@@ -1,15 +0,0 @@
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
typedef void thread_t;
|
||||
thread_t *thread_create(void (*thread_rout)(void *param), void *param);
|
||||
void thread_kill(thread_t *handle);
|
||||
|
||||
typedef void event_t;
|
||||
event_t *thread_create_event();
|
||||
void thread_set_event(event_t *event);
|
||||
void thread_reset_event(event_t *_event);
|
||||
int thread_wait_event(event_t *event, int timeout);
|
||||
void thread_destroy_event(event_t *_event);
|
||||
|
||||
void thread_sleep(int t);
|
||||
Reference in New Issue
Block a user