PCem

view src/device.h @ 113:f749363ad763

Added per-device configuration. Reworked configuration parser a bit. Added configuration for S3 ViRGE and 8-bit Sound Blasters. IRQ 2 routed to IRQ 9 on AT machines.
author TomW
date Mon Jun 30 21:31:28 2014 +0100
parents f53b76ab6f15
children 24b744b9a632
line source
1 #define CONFIG_STRING 0
2 #define CONFIG_INT 1
3 #define CONFIG_BINARY 2
4 #define CONFIG_SELECTION 3
6 typedef struct device_config_selection_t
7 {
8 char description[256];
9 int value;
10 } device_config_selection_t;
12 typedef struct device_config_t
13 {
14 char name[256];
15 char description[256];
16 int type;
17 char default_string[256];
18 int default_int;
19 device_config_selection_t selection[16];
20 } device_config_t;
22 typedef struct device_t
23 {
24 char name[50];
25 uint32_t flags;
26 void *(*init)();
27 void (*close)(void *p);
28 int (*available)();
29 void (*speed_changed)(void *p);
30 void (*force_redraw)(void *p);
31 int (*add_status_info)(char *s, int max_len, void *p);
32 device_config_t *config;
33 } device_t;
35 void device_init();
36 void device_add(device_t *d);
37 void device_close_all();
38 int device_available(device_t *d);
39 void device_speed_changed();
40 void device_force_redraw();
41 char *device_add_status_info(char *s, int max_len);
43 int device_get_config_int(char *name);
44 char *device_get_config_string(char *name);
46 enum
47 {
48 DEVICE_NOT_WORKING = 1 /*Device does not currently work correctly and will be disabled in a release build*/
49 };