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 (79 lines) | stat: -rw-r--r-- 1,630 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// vi/controller.h: Video interface 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 CEN64_VI_CONTROLLER_H
#define CEN64_VI_CONTROLLER_H
#include "common.h"
#include "gl_common.h"
#include "gl_context.h"
#include "gl_display.h"
#include "gl_screen.h"
#include "gl_window.h"
#include "timer.h"

struct bus_controller *bus;

enum vi_register {
#define X(reg) reg,
#include "vi/registers.md"
#undef X
  NUM_VI_REGISTERS
};

#ifdef DEBUG_MMIO_REGISTER_ACCESS
extern const char *vi_register_mnemonics[NUM_VI_REGISTERS];
#endif

struct render_area {
  struct {
    unsigned start;
    unsigned end;
  } x;

  struct {
    unsigned start;
    unsigned end;
  } y;

  unsigned height;
  unsigned width;
  int hskip;
};

struct vi_controller {
  struct bus_controller *bus;
  uint32_t regs[NUM_VI_REGISTERS];

  uint32_t counter;

  // Client rendering structures.
  cen64_gl_display display;
  cen64_gl_screen screen;
  cen64_gl_window window;
  cen64_gl_context context;

  struct render_area render_area;
  float viuv[8];
  float quad[8];

  cen64_time last_update_time;
  unsigned frame_count;
};

cen64_cold int vi_init(struct vi_controller *vi, struct bus_controller *bus,
  bool no_interface);

cen64_flatten cen64_hot void vi_cycle(struct vi_controller *vi);

cen64_cold int read_vi_regs(void *opaque, uint32_t address, uint32_t *word);
cen64_cold int write_vi_regs(void *opaque, uint32_t address, uint32_t word, uint32_t dqm);

#endif