File: controller.h

package info (click to toggle)
cen64 0.3%2Bgit20160403-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,160 kB
  • sloc: ansic: 14,512; asm: 772; cpp: 663; makefile: 12
file content (63 lines) | stat: -rw-r--r-- 1,663 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// dd/controller.h: DD controller.
//
// CEN64: Cycle-Accurate Nintendo 64 Emulator.
// Copyright (C) 2015, Tyler J. Stachecki.
//
// This file is subject to the terms and conditions defined in
// 'LICENSE', which is part of this source code package.
//

#ifndef __dd_controller_h__
#define __dd_controller_h__
#include "common.h"
#include "bus/address.h"

struct bus_controller *bus;

enum dd_register {
#define X(reg) reg,
#include "dd/registers.md"
#undef X
  NUM_DD_REGISTERS
};

#ifdef DEBUG_MMIO_REGISTER_ACCESS
extern const char *dd_register_mnemonics[NUM_DD_REGISTERS];
#endif

struct dd_controller {
  struct bus_controller *bus;
  const uint8_t *ipl_rom;
  const uint8_t *rom;
  size_t rom_size;
  bool retail;

  bool write;
  uint32_t track_offset;
  uint32_t zone;
  uint8_t start_block;
  bool bm_reset_held;

  uint32_t regs[DD_REGS_ADDRESS_LEN / 4];
  uint8_t c2s_buffer[DD_C2S_BUFFER_LEN];
  uint8_t ds_buffer[DD_DS_BUFFER_LEN];
  uint8_t ms_ram[DD_MS_RAM_LEN];
};

cen64_cold int dd_init(struct dd_controller *dd, struct bus_controller *bus,
  const uint8_t *ddipl, const uint8_t *ddrom, size_t ddrom_size);

void dd_pi_write(void *opaque, uint32_t address);

int dd_dma_read(void *opaque, uint32_t source, uint32_t dest, uint32_t length);
int dd_dma_write(void *opaque, uint32_t source, uint32_t dest, uint32_t length);

int read_dd_ipl_rom(void *opaque, uint32_t address, uint32_t *word);
int write_dd_ipl_rom(void *opaque, uint32_t address, uint32_t word, uint32_t dqm);

int read_dd_controller(void *opaque, uint32_t address, uint32_t *word);
int write_dd_controller(void *opaque, uint32_t address, uint32_t word, uint32_t dqm);

#endif