aboutsummaryrefslogtreecommitdiff
path: root/src/busses.h
diff options
context:
space:
mode:
authorLibravatar Martin Michalec <martin@michalec.dev>2026-11-08 00:37:41 +0000
committerLibravatar Martin Michalec <martin@michalec.dev>2026-11-08 00:37:41 +0000
commit1cf06615f97bc27f732a880e89e9366140095bf1 (patch)
treea02c356c64b150c164fd72254da33d872f572957 /src/busses.h
downloadcoursework-master.tar.gz
publishHEADmaster
Diffstat (limited to 'src/busses.h')
-rw-r--r--src/busses.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/busses.h b/src/busses.h
new file mode 100644
index 0000000..9c08f25
--- /dev/null
+++ b/src/busses.h
@@ -0,0 +1,36 @@
1#ifndef INCLUDED_BUSSES_H
2#define INCLUDED_BUSSES_H
3
4#include <raylib.h>
5#include <inttypes.h>
6#include "connections.h"
7
8#define IS_BUS_FREE(bus) ((bus)->reserved_connection == CONNECTION_NONE)
9#define FREE_BUS(bus) ((bus)->reserved_connection = CONNECTION_NONE)
10
11typedef struct bus {
12 int reserved_connection;
13 int connection_targets;
14 bool linked;
15 CONNECTION cache_connections[CPU_COUNT];
16 CONNECTION memory_connection;
17 float y;
18 float scale;
19 Color color;
20 char *label;
21 Vector2 label_size;
22} *BUS;
23
24extern int *cache_locking_busses;
25extern int *bus_cycles;
26extern BUS data_bus;
27extern BUS addr_bus;
28extern BUS shared_bus;
29
30void init_bus (BUS, CONNECTION caches[CPU_COUNT], CONNECTION memory, float y, float scale, Color, char *label);
31void draw_bus (BUS);
32void bus_link_connection (BUS, CONNECTION);
33void bus_unlink_connection (BUS);
34void bus_link_connections (BUS, CONNECTION cons[CPU_COUNT]);
35
36#endif