dev_colorplanemask.cc Source File

Back to the index.

dev_colorplanemask.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003-2009 Anders Gavare. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. The name of the author may not be used to endorse or promote products
13  * derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  *
28  * COMMENT: Color plane mask, used in the DECstation 3100 machine
29  *
30  * Just a one-byte thingy, but the way things work now this has to
31  * be a separate device. :-/
32  */
33 
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <string.h>
37 
38 #include "devices.h"
39 #include "memory.h"
40 #include "misc.h"
41 
42 
44  unsigned char *color_plane_mask;
45 };
46 
47 
48 DEVICE_ACCESS(colorplanemask)
49 {
50  struct colorplanemask_data *d = (struct colorplanemask_data *) extra;
51 
52  switch (relative_addr) {
53 
54  case 0x00:
55  if (writeflag == MEM_WRITE) {
56  *d->color_plane_mask = data[0];
57  } else {
58  debug("[ colorplanemask: read isn't actually "
59  "supported ]\n");
60  data[0] = *d->color_plane_mask;
61  }
62  break;
63 
64  default:
65  if (writeflag == MEM_WRITE) {
66  debug("[ colorplanemask: unimplemented write "
67  "to address 0x%x, data=0x%02x ]\n",
68  (int)relative_addr, data[0]);
69  } else {
70  debug("[ colorplanemask: unimplemented read "
71  "from address 0x%x ]\n", (int)relative_addr);
72  }
73  }
74 
75  /* Pretend it was ok: */
76  return 1;
77 }
78 
79 
80 /*
81  * dev_colorplanemask_init():
82  */
83 void dev_colorplanemask_init(struct memory *mem, uint64_t baseaddr,
84  unsigned char *color_plane_mask)
85 {
86  struct colorplanemask_data *d;
87 
89  malloc(sizeof(struct colorplanemask_data)));
90  memset(d, 0, sizeof(struct colorplanemask_data));
91 
93 
94  memory_device_register(mem, "colorplanemask", baseaddr,
96  (void *)d, DM_DEFAULT, NULL);
97 }
98 
data
u_short data
Definition: siireg.h:79
colorplanemask_data::color_plane_mask
unsigned char * color_plane_mask
Definition: dev_colorplanemask.cc:44
memory
Definition: memory.h:75
debug
#define debug
Definition: dev_adb.cc:57
memory_device_register
void memory_device_register(struct memory *mem, const char *, uint64_t baseaddr, uint64_t len, int(*f)(struct cpu *, struct memory *, uint64_t, unsigned char *, size_t, int, void *), void *extra, int flags, unsigned char *dyntrans_data)
Definition: memory.cc:339
DEV_COLORPLANEMASK_LENGTH
#define DEV_COLORPLANEMASK_LENGTH
Definition: devices.h:159
DM_DEFAULT
#define DM_DEFAULT
Definition: memory.h:130
MEM_WRITE
#define MEM_WRITE
Definition: memory.h:117
dev_colorplanemask_access
int dev_colorplanemask_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *)
misc.h
dev_colorplanemask_init
void dev_colorplanemask_init(struct memory *mem, uint64_t baseaddr, unsigned char *color_plane_mask)
Definition: dev_colorplanemask.cc:83
colorplanemask_data
Definition: dev_colorplanemask.cc:43
DEVICE_ACCESS
DEVICE_ACCESS(colorplanemask)
Definition: dev_colorplanemask.cc:48
devices.h
memory.h
CHECK_ALLOCATION
#define CHECK_ALLOCATION(ptr)
Definition: misc.h:239

Generated on Tue Aug 25 2020 19:25:06 for GXemul by doxygen 1.8.18