llvm-mos-sdk
hardware.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 Adrian "asie" Siekierka
3  *
4  * Licensed under the Apache License, Version 2.0 with LLVM Exceptions,
5  * See https://github.com/llvm-mos/llvm-mos-sdk/blob/main/LICENSE for license
6  * information.
7  */
8 
9 #ifndef _RPC8E_HARDWARE_H_
10 #define _RPC8E_HARDWARE_H_
11 
12 #include <stdint.h>
13 
18 #define MMU_WRITE 0x00
19 #define MMU_READ 0x80
20 #define MMU_ENABLE 0x00
21 #define MMU_DISABLE 0x80
22 #define MMU_REDBUS_ID 0x00
23 #define MMU_REDBUS_WINDOW_OFFSET 0x01
24 #define MMU_REDBUS_ACTIVE 0x02
25 #define MMU_ADDRESS_BRK 0x05
26 #define MMU_ADDRESS_POR 0x06
27 #define MMU_DEBUG 0xFF
28 
29 #define IO_DISPLAY_ROW_Y ((volatile uint8_t *)0x0300)
30 #define IO_DISPLAY_CURSOR_X ((volatile uint8_t *)0x0301)
31 #define IO_DISPLAY_CURSOR_Y ((volatile uint8_t *)0x0302)
32 #ifdef __ASSEMBLER__
33 #define CURSOR_MODE_HIDDEN 0x00
34 #define CURSOR_MODE_SOLID 0x01
35 #define CURSOR_MODE_BLINK 0x02
36 #else
37 typedef enum {
42 #endif
43 #define IO_DISPLAY_CURSOR_MODE ((volatile uint8_t *)0x0303)
44 #define IO_DISPLAY_KEY_BUFFER_START ((volatile uint8_t *)0x0304)
45 #define IO_DISPLAY_KEY_BUFFER_POS ((volatile uint8_t *)0x0305)
46 #define IO_DISPLAY_KEY_BUFFER_VALUE ((volatile uint8_t *)0x0306)
47 #ifdef __ASSEMBLER__
48 #define DISPLAY_BLIT_MODE_NONE 0x00
49 #define DISPLAY_BLIT_MODE_FILL 0x01
50 #define DISPLAY_BLIT_MODE_INVERT 0x02
51 #define DISPLAY_BLIT_MODE_SHIFT 0x03
52 #else
53 typedef enum {
59 #endif
60 #define IO_DISPLAY_BLIT_MODE ((volatile uint8_t *)0x0307)
61 #define IO_DISPLAY_BLIT_SRC_X ((volatile uint8_t *)0x0308)
62 #define IO_DISPLAY_BLIT_SRC_Y ((volatile uint8_t *)0x0309)
63 #define IO_DISPLAY_BLIT_DEST_X ((volatile uint8_t *)0x030A)
64 #define IO_DISPLAY_BLIT_DEST_Y ((volatile uint8_t *)0x030B)
65 #define IO_DISPLAY_BLIT_WIDTH ((volatile uint8_t *)0x030C)
66 #define IO_DISPLAY_BLIT_HEIGHT ((volatile uint8_t *)0x030D)
67 #define IO_DISPLAY_BLIT_FILL_VALUE ((volatile uint8_t *)0x0308)
68 #define IO_DISPLAY_ROW ((volatile uint8_t *)0x0310)
69 
70 #define IO_DRIVE_BUFFER ((volatile uint8_t *)0x0300)
71 #define IO_DRIVE_SECTOR ((volatile uint16_t *)0x0380)
72 #ifdef __ASSEMBLER__
73 #define DRIVE_COMMAND_IDLE 0x00
74 #define DRIVE_COMMAND_READ_NAME 0x01
75 #define DRIVE_COMMAND_WRITE_NAME 0x02
76 #define DRIVE_COMMAND_READ_SERIAL 0x03
77 #define DRIVE_COMMAND_READ_SECTOR 0x04
78 #define DRIVE_COMMAND_WRITE_SECTOR 0x05
79 #else
80 typedef enum {
103 #endif
104 #define IO_DRIVE_COMMAND ((volatile uint8_t *)0x0382)
105 #define DRIVE_STATUS_SUCCESS 0x00
106 #define DRIVE_STATUS_ERROR 0xFF
107 #define IO_DRIVE_STATUS ((volatile uint8_t *)0x0382)
108 
109 #define COLOR_WHITE 0x0001
110 #define COLOR_ORANGE 0x0002
111 #define COLOR_MAGENTA 0x0004
112 #define COLOR_LIGHT_BLUE 0x0008
113 #define COLOR_YELLOW 0x0010
114 #define COLOR_LIME 0x0020
115 #define COLOR_PINK 0x0040
116 #define COLOR_GRAY 0x0080
117 #define COLOR_LIGHT_GRAY 0x0100
118 #define COLOR_CYAN 0x0200
119 #define COLOR_PURPLE 0x0400
120 #define COLOR_BLUE 0x0800
121 #define COLOR_BROWN 0x1000
122 #define COLOR_GREEN 0x2000
123 #define COLOR_RED 0x4000
124 #define COLOR_BLACK 0x8000
125 
126 #define IO_IOX_INPUT ((volatile uint16_t *)0x0300)
127 #define IO_IOX_OUTPUT ((volatile uint16_t *)0x0302)
128 
129 #ifdef __ASSEMBLER__
130 #define SORTRON_COMMAND_READ_SLOT_COUNT 0x01
131 #define SORTRON_COMMAND_READ_SLOT 0x02
132 #define SORTRON_COMMAND_EXTRACT_SLOT 0x03
133 #define SORTRON_COMMAND_MATCH_INPUT 0x04
134 #else
135 typedef enum {
158 #endif
159 #define IO_SORTRON_COMMAND ((volatile uint8_t *)0x0300)
160 #define SORTRON_STATUS_SUCCESS 0x00
161 #define SORTRON_STATUS_ERROR 0xFF
162 #define IO_SORTRON_STATUS ((volatile uint8_t *)0x0300)
163 #define IO_SORTRON_ITEM_COUNT ((volatile uint8_t *)0x0301)
164 #define IO_SORTRON_ITEM_SLOT ((volatile uint16_t *)0x0302)
165 #define IO_SORTRON_ITEM_HASH ((volatile uint32_t *)0x0304)
166 #define IO_SORTRON_ITEM_DAMAGE ((volatile uint16_t *)0x0308)
167 #define IO_SORTRON_ITEM_MAX_DAMAGE ((volatile uint16_t *)0x030A)
168 
169 #ifdef __ASSEMBLER__
170 #define COLOR_TAG_NONE 0
171 #define COLOR_TAG_WHITE 1
172 #define COLOR_TAG_ORANGE 2
173 #define COLOR_TAG_MAGENTA 3
174 #define COLOR_TAG_LIGHT_BLUE 4
175 #define COLOR_TAG_YELLOW 5
176 #define COLOR_TAG_LIME 6
177 #define COLOR_TAG_PINK 7
178 #define COLOR_TAG_GRAY 8
179 #define COLOR_TAG_LIGHT_GRAY 9
180 #define COLOR_TAG_CYAN 10
181 #define COLOR_TAG_PURPLE 11
182 #define COLOR_TAG_BLUE 12
183 #define COLOR_TAG_BROWN 13
184 #define COLOR_TAG_GREEN 14
185 #define COLOR_TAG_RED 15
186 #define COLOR_TAG_BLACK 16
187 #else
188 typedef enum {
206 } color_tag_t;
207 #endif
208 
209 #define IO_SORTRON_ITEM_IN_COLOR_TAG ((volatile uint8_t *)0x030C)
210 #define IO_SORTRON_ITEM_OUT_COLOR_TAG ((volatile uint8_t *)0x030D)
211 
212 #endif /* _RPC8E_HARDWARE_H_ */
DISPLAY_BLIT_MODE_INVERT
@ DISPLAY_BLIT_MODE_INVERT
Definition: hardware.h:56
COLOR_TAG_GRAY
@ COLOR_TAG_GRAY
Definition: hardware.h:197
CURSOR_MODE_BLINK
@ CURSOR_MODE_BLINK
Definition: hardware.h:40
COLOR_TAG_CYAN
@ COLOR_TAG_CYAN
Definition: hardware.h:199
DISPLAY_BLIT_MODE_NONE
@ DISPLAY_BLIT_MODE_NONE
Definition: hardware.h:54
COLOR_TAG_BLACK
@ COLOR_TAG_BLACK
Definition: hardware.h:205
SORTRON_COMMAND_READ_SLOT
@ SORTRON_COMMAND_READ_SLOT
Definition: hardware.h:145
COLOR_TAG_PURPLE
@ COLOR_TAG_PURPLE
Definition: hardware.h:200
COLOR_TAG_WHITE
@ COLOR_TAG_WHITE
Definition: hardware.h:190
SORTRON_COMMAND_READ_SLOT_COUNT
@ SORTRON_COMMAND_READ_SLOT_COUNT
Definition: hardware.h:139
CURSOR_MODE_HIDDEN
@ CURSOR_MODE_HIDDEN
Definition: hardware.h:38
COLOR_TAG_LIGHT_GRAY
@ COLOR_TAG_LIGHT_GRAY
Definition: hardware.h:198
COLOR_TAG_NONE
@ COLOR_TAG_NONE
Definition: hardware.h:189
sortron_command_t
sortron_command_t
Definition: hardware.h:135
SORTRON_COMMAND_MATCH_INPUT
@ SORTRON_COMMAND_MATCH_INPUT
Definition: hardware.h:156
DRIVE_COMMAND_READ_NAME
@ DRIVE_COMMAND_READ_NAME
Definition: hardware.h:85
COLOR_TAG_PINK
@ COLOR_TAG_PINK
Definition: hardware.h:196
DISPLAY_BLIT_MODE_FILL
@ DISPLAY_BLIT_MODE_FILL
Definition: hardware.h:55
DRIVE_COMMAND_WRITE_SECTOR
@ DRIVE_COMMAND_WRITE_SECTOR
Definition: hardware.h:101
COLOR_TAG_BLUE
@ COLOR_TAG_BLUE
Definition: hardware.h:201
color_tag_t
color_tag_t
Definition: hardware.h:188
DRIVE_COMMAND_READ_SERIAL
@ DRIVE_COMMAND_READ_SERIAL
Definition: hardware.h:93
COLOR_TAG_GREEN
@ COLOR_TAG_GREEN
Definition: hardware.h:203
display_blit_mode_t
display_blit_mode_t
Definition: hardware.h:53
drive_command_t
drive_command_t
Definition: hardware.h:80
COLOR_TAG_LIGHT_BLUE
@ COLOR_TAG_LIGHT_BLUE
Definition: hardware.h:193
COLOR_TAG_BROWN
@ COLOR_TAG_BROWN
Definition: hardware.h:202
DRIVE_COMMAND_IDLE
@ DRIVE_COMMAND_IDLE
Definition: hardware.h:81
DRIVE_COMMAND_READ_SECTOR
@ DRIVE_COMMAND_READ_SECTOR
Definition: hardware.h:97
DRIVE_COMMAND_WRITE_NAME
@ DRIVE_COMMAND_WRITE_NAME
Definition: hardware.h:89
DISPLAY_BLIT_MODE_SHIFT
@ DISPLAY_BLIT_MODE_SHIFT
Definition: hardware.h:57
COLOR_TAG_ORANGE
@ COLOR_TAG_ORANGE
Definition: hardware.h:191
CURSOR_MODE_SOLID
@ CURSOR_MODE_SOLID
Definition: hardware.h:39
COLOR_TAG_RED
@ COLOR_TAG_RED
Definition: hardware.h:204
COLOR_TAG_YELLOW
@ COLOR_TAG_YELLOW
Definition: hardware.h:194
cursor_mode_t
cursor_mode_t
Definition: hardware.h:37
COLOR_TAG_LIME
@ COLOR_TAG_LIME
Definition: hardware.h:195
COLOR_TAG_MAGNETA
@ COLOR_TAG_MAGNETA
Definition: hardware.h:192
SORTRON_COMMAND_EXTRACT_SLOT
@ SORTRON_COMMAND_EXTRACT_SLOT
Definition: hardware.h:151