Search
lxdream.org :: lxdream/src/modules.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/modules.h
changeset 23:1ec3acd0594d
prev17:944f75eea496
next27:1ef09a52cd1e
author nkeynes
date Fri Dec 23 11:44:55 2005 +0000 (16 years ago)
permissions -rw-r--r--
last change Start of "real" time slices, general structure in place now
file annotate diff log raw
nkeynes@15
     1
nkeynes@15
     2
#ifndef dreamcast_modules_H
nkeynes@15
     3
#define dreamcast_modules_H 1
nkeynes@15
     4
nkeynes@15
     5
#include <stdlib.h>
nkeynes@15
     6
#include <stdio.h>
nkeynes@15
     7
nkeynes@15
     8
#ifdef __cplusplus
nkeynes@15
     9
extern "C" {
nkeynes@15
    10
#endif
nkeynes@15
    11
nkeynes@15
    12
/**
nkeynes@15
    13
 * Basic module structure defining the common operations across all
nkeynes@15
    14
 * modules, ie start, stop, reset, etc. Nothing here is time-sensitive.
nkeynes@15
    15
 */
nkeynes@15
    16
typedef struct dreamcast_module {
nkeynes@15
    17
    char *name;
nkeynes@15
    18
    /**
nkeynes@15
    19
     * Perform all initial module setup (ie register / allocate any
nkeynes@15
    20
     * memory required, etc). Only called once during DreamOn startup
nkeynes@15
    21
     */
nkeynes@15
    22
    void (*init)();
nkeynes@15
    23
    /**
nkeynes@15
    24
     * Reset the module into it's initial system boot state. Will be called
nkeynes@15
    25
     * once after init(), as well as whenever the user requests a reset.
nkeynes@15
    26
     */
nkeynes@15
    27
    void (*reset)();
nkeynes@15
    28
    /**
nkeynes@15
    29
     * Set the module into a running state (may be NULL)
nkeynes@15
    30
     */
nkeynes@15
    31
    void (*start)();
nkeynes@15
    32
    /**
nkeynes@23
    33
     * Execute one time-slice worth of operations, for the given number of
nkeynes@23
    34
     * micro-seconds.
nkeynes@23
    35
     */
nkeynes@23
    36
    void (*run_time_slice)( int microsecs );
nkeynes@23
    37
    /**
nkeynes@15
    38
     * Set the module into a stopped state (may be NULL)
nkeynes@15
    39
     */
nkeynes@15
    40
    void (*stop)();
nkeynes@15
    41
    /**
nkeynes@15
    42
     * Save the module state to the FILE stream. May be NULL, in which case
nkeynes@15
    43
     * the module is considered to have no state.
nkeynes@15
    44
     */
nkeynes@15
    45
    void (*save)(FILE *);
nkeynes@15
    46
    /**
nkeynes@15
    47
     * Load the saved module state from the FILE stream. May be NULL, in which
nkeynes@15
    48
     * case reset() will be called instead.
nkeynes@17
    49
     * @return 0 on success, nonzero on failure.
nkeynes@15
    50
     */
nkeynes@17
    51
    int (*load)(FILE *);
nkeynes@15
    52
} *dreamcast_module_t;
nkeynes@15
    53
nkeynes@15
    54
void dreamcast_register_module( dreamcast_module_t );
nkeynes@15
    55
nkeynes@15
    56
extern struct dreamcast_module mem_module;
nkeynes@15
    57
extern struct dreamcast_module sh4_module;
nkeynes@15
    58
extern struct dreamcast_module asic_module;
nkeynes@15
    59
extern struct dreamcast_module pvr2_module;
nkeynes@15
    60
extern struct dreamcast_module aica_module;
nkeynes@15
    61
extern struct dreamcast_module ide_module;
nkeynes@15
    62
extern struct dreamcast_module maple_module;
nkeynes@15
    63
extern struct dreamcast_module pvr2_module;
nkeynes@15
    64
extern struct dreamcast_module gui_module;
nkeynes@15
    65
nkeynes@17
    66
void fwrite_string( char *s, FILE *f );
nkeynes@17
    67
int fread_string( char *s, int maxlen, FILE *f );
nkeynes@17
    68
nkeynes@15
    69
#ifdef __cplusplus
nkeynes@15
    70
}
nkeynes@15
    71
#endif
nkeynes@15
    72
nkeynes@15
    73
#endif /* !dreamcast_modules_H */
.