aboutsummaryrefslogtreecommitdiff
path: root/src/busses.h
blob: 9c08f2578c633b8fb7085dab2df3c4aee0c19159 (plain)
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
#ifndef INCLUDED_BUSSES_H
#define INCLUDED_BUSSES_H

#include <raylib.h>
#include <inttypes.h>
#include "connections.h"

#define IS_BUS_FREE(bus) ((bus)->reserved_connection == CONNECTION_NONE)
#define FREE_BUS(bus)    ((bus)->reserved_connection =  CONNECTION_NONE)

typedef struct bus {
  int reserved_connection;
  int connection_targets;
  bool linked;
  CONNECTION cache_connections[CPU_COUNT];
  CONNECTION memory_connection;
  float y;
  float scale;
  Color color;
  char *label;
  Vector2 label_size;
} *BUS;

extern int *cache_locking_busses;
extern int *bus_cycles;
extern BUS   data_bus;
extern BUS   addr_bus;
extern BUS shared_bus;

void init_bus (BUS, CONNECTION caches[CPU_COUNT], CONNECTION memory, float y, float scale, Color, char *label);
void draw_bus (BUS);
void bus_link_connection   (BUS, CONNECTION);
void bus_unlink_connection (BUS);
void bus_link_connections  (BUS, CONNECTION cons[CPU_COUNT]);

#endif