~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to mess/src/emu/machine/nvram.h

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 
3
 
    nvram.h
4
 
 
5
 
    Generic non-volatile RAM.
6
 
 
7
 
****************************************************************************
8
 
 
9
 
    Copyright Aaron Giles
10
 
    All rights reserved.
11
 
 
12
 
    Redistribution and use in source and binary forms, with or without
13
 
    modification, are permitted provided that the following conditions are
14
 
    met:
15
 
 
16
 
        * Redistributions of source code must retain the above copyright
17
 
          notice, this list of conditions and the following disclaimer.
18
 
        * Redistributions in binary form must reproduce the above copyright
19
 
          notice, this list of conditions and the following disclaimer in
20
 
          the documentation and/or other materials provided with the
21
 
          distribution.
22
 
        * Neither the name 'MAME' nor the names of its contributors may be
23
 
          used to endorse or promote products derived from this software
24
 
          without specific prior written permission.
25
 
 
26
 
    THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
27
 
    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28
 
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29
 
    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
30
 
    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31
 
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32
 
    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33
 
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34
 
    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35
 
    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
 
    POSSIBILITY OF SUCH DAMAGE.
37
 
 
38
 
***************************************************************************/
39
 
 
40
 
#pragma once
41
 
 
42
 
#ifndef __NVRAM_H__
43
 
#define __NVRAM_H__
44
 
 
45
 
 
46
 
 
47
 
//**************************************************************************
48
 
//  INTERFACE CONFIGURATION MACROS
49
 
//**************************************************************************
50
 
 
51
 
#define MCFG_NVRAM_ADD_0FILL(_tag) \
52
 
        MCFG_DEVICE_ADD(_tag, NVRAM, 0) \
53
 
        nvram_device::static_set_default_value(*device, nvram_device::DEFAULT_ALL_0); \
54
 
 
55
 
#define MCFG_NVRAM_ADD_1FILL(_tag) \
56
 
        MCFG_DEVICE_ADD(_tag, NVRAM, 0) \
57
 
        nvram_device::static_set_default_value(*device, nvram_device::DEFAULT_ALL_1); \
58
 
 
59
 
#define MCFG_NVRAM_ADD_RANDOM_FILL(_tag) \
60
 
        MCFG_DEVICE_ADD(_tag, NVRAM, 0) \
61
 
        nvram_device::static_set_default_value(*device, nvram_device::DEFAULT_RANDOM); \
62
 
 
63
 
#define MCFG_NVRAM_ADD_NO_FILL(_tag) \
64
 
        MCFG_DEVICE_ADD(_tag, NVRAM, 0) \
65
 
        nvram_device::static_set_default_value(*device, nvram_device::DEFAULT_NONE); \
66
 
 
67
 
#define MCFG_NVRAM_ADD_CUSTOM(_tag, _class, _method) \
68
 
        MCFG_DEVICE_ADD(_tag, NVRAM, 0) \
69
 
        nvram_device::static_set_custom_handler(*device, nvram_init_delegate(&_class::_method, #_class "::" #_method, (_class *)0)); \
70
 
 
71
 
 
72
 
#define MCFG_NVRAM_REPLACE_0FILL(_tag) \
73
 
        MCFG_DEVICE_REPLACE(_tag, NVRAM, 0) \
74
 
        nvram_device::static_set_default_value(*device, nvram_device::DEFAULT_ALL_0); \
75
 
 
76
 
#define MCFG_NVRAM_REPLACE_1FILL(_tag) \
77
 
        MCFG_DEVICE_REPLACE(_tag, NVRAM, 0) \
78
 
        nvram_device::static_set_default_value(*device, nvram_device::DEFAULT_ALL_1); \
79
 
 
80
 
#define MCFG_NVRAM_REPLACE_RANDOM_FILL(_tag) \
81
 
        MCFG_DEVICE_REPLACE(_tag, NVRAM, 0) \
82
 
        nvram_device::static_set_default_value(*device, nvram_device::DEFAULT_RANDOM); \
83
 
 
84
 
#define MCFG_NVRAM_REPLACE_CUSTOM(_tag, _class, _method) \
85
 
        MCFG_DEVICE_REPLACE(_tag, NVRAM, 0) \
86
 
        nvram_device::static_set_custom_handler(*device, nvram_init_delegate(&_class::_method, #_class "::" #_method, (_class *)0)); \
87
 
 
88
 
 
89
 
 
90
 
//**************************************************************************
91
 
//  TYPE DEFINITIONS
92
 
//**************************************************************************
93
 
 
94
 
class nvram_device;
95
 
 
96
 
 
97
 
// custom initialization for default state
98
 
typedef delegate<void (nvram_device &, void *, size_t)> nvram_init_delegate;
99
 
 
100
 
 
101
 
// ======================> nvram_device
102
 
 
103
 
class nvram_device :    public device_t,
104
 
                                                public device_nvram_interface
105
 
{
106
 
public:
107
 
        // values
108
 
        enum default_value
109
 
        {
110
 
                DEFAULT_ALL_0,
111
 
                DEFAULT_ALL_1,
112
 
                DEFAULT_RANDOM,
113
 
                DEFAULT_CUSTOM,
114
 
                DEFAULT_NONE
115
 
        };
116
 
 
117
 
        // construction/destruction
118
 
        nvram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
119
 
 
120
 
        // inline configuration helpers
121
 
        static void static_set_default_value(device_t &device, default_value value);
122
 
        static void static_set_custom_handler(device_t &device, nvram_init_delegate callback);
123
 
 
124
 
        // controls
125
 
        void set_base(void *base, size_t length) { m_base = base; m_length = length; }
126
 
 
127
 
protected:
128
 
        // device-level overrides
129
 
        virtual void device_start();
130
 
 
131
 
        // device_nvram_interface overrides
132
 
        virtual void nvram_default();
133
 
        virtual void nvram_read(emu_file &file);
134
 
        virtual void nvram_write(emu_file &file);
135
 
 
136
 
        // internal helpers
137
 
        void determine_final_base();
138
 
 
139
 
        // configuration state
140
 
        default_value                           m_default_value;
141
 
        nvram_init_delegate                     m_custom_handler;
142
 
 
143
 
        // runtime state
144
 
        void *                                          m_base;
145
 
        size_t                                          m_length;
146
 
};
147
 
 
148
 
 
149
 
// device type definition
150
 
extern const device_type NVRAM;
151
 
 
152
 
 
153
 
#endif