-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmos_sys.h
251 lines (233 loc) · 13 KB
/
mos_sys.h
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
/*
** This file is part of the Matrix Brandy Basic VI Interpreter.
** Copyright (C) 2018-2024 Michael McConnell and contributors
**
** Brandy is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2, or (at your option)
** any later version.
**
** Brandy is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Brandy; see the file COPYING. If not, write to
** the Free Software Foundation, 59 Temple Place - Suite 330,
** Boston, MA 02111-1307, USA.
**
** This file defines SWI numbers that are implemented in Matrix Brandy.
** We don't actually implement a Software Interrupt, however these
** are the implemented system calls available through the BASIC "SYS"
** command.
*/
#ifndef MOS_SWINUMS_H
#define MOS_SWINUMS_H
extern void mos_sys_ext(size_t swino, sysparm inregs[], size_t outregs[], int32 xflag, size_t *flags);
typedef struct {
size_t swinum; /* RISC OS SWI number */
char *swiname; /* SWI Name */
} switable;
/* Source: http://www.riscos.com/support/developers/prm_index/numswilist.html */
/* Used by mos.c: int32 mos_getswinum(char *name, int32 length) */
#define SWI_OS_WriteC 0x00
#define SWI_OS_Write0 0x02
#define SWI_OS_NewLine 0x03
#define SWI_OS_ReadC 0x04
#define SWI_OS_CLI 0x05
#define SWI_OS_Byte 0x06
#define SWI_OS_Word 0x07
#define SWI_OS_File 0x08
#define SWI_OS_ReadLine 0x0E
#define SWI_OS_GetEnv 0x10
#define SWI_OS_UpdateMEMC 0x1A
#define SWI_OS_Mouse 0x1C
#define SWI_OS_ReadPalette 0x2F
#define SWI_OS_ReadVduVariables 0x31
#define SWI_OS_ReadModeVariable 0x35
#define SWI_OS_SWINumberToString 0x38
#define SWI_OS_SWINumberFromString 0x39
#define SWI_OS_ReadMonotonicTime 0x42
#define SWI_OS_Plot 0x45
#define SWI_OS_WriteN 0x46
#define SWI_OS_SetECFOrigin 0x56
#define SWI_OS_ReadSysInfo 0x58
#define SWI_OS_SetColour 0x61
#define SWI_OS_ScreenMode 0x65
#define SWI_OS_Reset 0x6A
#define SWI_OS_ReadLine32 0x7D
#define SWI_ColourTrans_SetGCOL 0x40743
#define SWI_ColourTrans_GCOLToColourNumber 0x4074C
#define SWI_ColourTrans_ColourNumberToGCOL 0x4074D
#define SWI_ColourTrans_SetTextColour 0x40761
/* Tank's GPIO module for Risc OS - not all will be implemented, and only RasPi ones listed */
#define SWI_GPIO_ReadData 0x58F80
#define SWI_GPIO_WriteData 0x58F81
#define SWI_GPIO_ReadOE 0x58F82
#define SWI_GPIO_WriteOE 0x58F83
#define SWI_GPIO_ExpAsGPIO 0x58F85
#define SWI_GPIO_ExpAsUART 0x58F8B
#define SWI_GPIO_ExpAsMMC 0x58F8D
#define SWI_GPIO_ReadMode 0x58F8F
#define SWI_GPIO_WriteMode 0x58F90
#define SWI_GPIO_ReadLevel0 0x58F91
#define SWI_GPIO_WriteLevel0 0x58F92
#define SWI_GPIO_ReadLevel1 0x58F93
#define SWI_GPIO_WriteLevel1 0x58F94
#define SWI_GPIO_ReadRising 0x58F95
#define SWI_GPIO_WriteRising 0x58F96
#define SWI_GPIO_ReadFalling 0x58F97
#define SWI_GPIO_WriteFalling 0x58F98
#define SWI_GPIO_ReadExp32 0x58F9F
#define SWI_GPIO_WriteExp32 0x58FA2
#define SWI_GPIO_ReadExpOE32 0x58FA5
#define SWI_GPIO_WriteExpOE32 0x58FA8
#define SWI_GPIO_ReadEvent 0x58FAB
#define SWI_GPIO_WriteEvent 0x58FAC
#define SWI_GPIO_ReadAsync 0x58FAD
#define SWI_GPIO_WriteAsync 0x58FAE
#define SWI_GPIO_FlashOn 0x58FB4
#define SWI_GPIO_FlashOff 0x58FB5
#define SWI_GPIO_Info 0x58FB6
#define SWI_GPIO_I2CInfo 0x58FB7
#define SWI_GPIO_LoadConfig 0x58FBB
#define SWI_GPIO_ReadConfig 0x58FBC
#define SWI_GPIO_EnableI2C 0x58FBD
#define SWI_GPIO_GetBoard 0x58FBE
#define SWI_GPIO_RescanI2C 0x58FBF
/* Stuff that's local to Matrix Brandy */
#define SWI_Brandy_Version 0x140000
#define SWI_Brandy_Swap16Palette 0x140001
#define SWI_Brandy_GetVideoDriver 0x140002
#define SWI_Brandy_SetFailoverMode 0x140003
#define SWI_Brandy_AccessVideoRAM 0x140004
#define SWI_Brandy_INTusesFloat 0x140005
#define SWI_Brandy_LegacyIntMaths 0x140006
#define SWI_Brandy_Hex64 0x140007
#define SWI_Brandy_DELisBS 0x140008
#define SWI_Brandy_PseudovarsUnsigned 0x140009
#define SWI_Brandy_TekEnabled 0x14000A
#define SWI_Brandy_uSleep 0x14000B
#define SWI_Brandy_dlopen 0x14000C
#define SWI_Brandy_dlcall 0x14000D
#define SWI_Brandy_MAlloc 0x14000E
#define SWI_Brandy_Free 0x14000F
#define SWI_Brandy_BitShift64 0x140010
#define SWI_Brandy_Platform 0x140011
#define SWI_Brandy_CascadedIFtweak 0x140012
#define SWI_Brandy_MouseEventExpire 0x140013
#define SWI_Brandy_dlgetaddr 0x140014
#define SWI_Brandy_dlcalladdr 0x140015
#define SWI_Brandy_Strict 0x140016
#define SWI_Brandy_TranslateFNames 0x140017
#define SWI_Brandy_MemSet 0x140018
#define SWI_Brandy_AllowLowercase 0x140019
#define SWI_RaspberryPi_GPIOInfo 0x140100
#define SWI_RaspberryPi_GetGPIOPortMode 0x140101
#define SWI_RaspberryPi_SetGPIOPortMode 0x140102
#define SWI_RaspberryPi_SetGPIOPortPullUpDownMode 0x140103
#define SWI_RaspberryPi_ReadGPIOPort 0x140104
#define SWI_RaspberryPi_WriteGPIOPort 0x140105
#ifdef _MOS_C
static switable swilist[] = {
{SWI_OS_WriteC, "OS_WriteC"},
{SWI_OS_Write0, "OS_Write0"},
{SWI_OS_NewLine, "OS_NewLine"},
{SWI_OS_ReadC, "OS_ReadC"},
{SWI_OS_CLI, "OS_CLI"},
{SWI_OS_Byte, "OS_Byte"},
{SWI_OS_Word, "OS_Word"},
{SWI_OS_File, "OS_File"},
{SWI_OS_ReadLine, "OS_ReadLine"},
{SWI_OS_GetEnv, "OS_GetEnv"},
{SWI_OS_UpdateMEMC, "OS_UpdateMEMC"}, /* Recognised, does nothing */
{SWI_OS_Mouse, "OS_Mouse"},
{SWI_OS_ReadPalette, "OS_ReadPalette"},
{SWI_OS_ReadVduVariables, "OS_ReadVduVariables"},
{SWI_OS_ReadModeVariable, "OS_ReadModeVariable"},
{SWI_OS_SWINumberToString, "OS_SWINumberToString"},
{SWI_OS_SWINumberFromString, "OS_SWINumberFromString"},
{SWI_OS_ReadMonotonicTime, "OS_ReadMonotonicTime"},
{SWI_OS_Plot, "OS_Plot"},
{SWI_OS_WriteN, "OS_WriteN"},
{SWI_OS_SetECFOrigin, "OS_SetECFOrigin"},
{SWI_OS_ReadSysInfo, "OS_ReadSysInfo"},
{SWI_OS_SetColour, "OS_SetColour"},
{SWI_OS_ScreenMode, "OS_ScreenMode"},
{SWI_OS_Reset, "OS_Reset"},
{SWI_OS_ReadLine32, "OS_ReadLine32"},
{SWI_ColourTrans_SetGCOL, "ColourTrans_SetGCOL"},
{SWI_ColourTrans_GCOLToColourNumber, "ColourTrans_GCOLToColourNumber"},
{SWI_ColourTrans_ColourNumberToGCOL, "ColourTrans_ColourNumberToGCOL"},
{SWI_ColourTrans_SetTextColour, "ColourTrans_SetTextColour"},
{SWI_GPIO_ReadData, "GPIO_ReadData"},
{SWI_GPIO_WriteData, "GPIO_WriteData"},
{SWI_GPIO_ReadOE, "GPIO_ReadOE"},
{SWI_GPIO_WriteOE, "GPIO_WriteOE"},
{SWI_GPIO_ExpAsGPIO, "GPIO_ExpAsGPIO"},
{SWI_GPIO_ExpAsUART, "GPIO_ExpAsUART"},
{SWI_GPIO_ExpAsMMC, "GPIO_ExpAsMMC"},
{SWI_GPIO_ReadMode, "GPIO_ReadMode"},
{SWI_GPIO_WriteMode, "GPIO_WriteMode"},
{SWI_GPIO_ReadLevel0, "GPIO_ReadLevel0"},
{SWI_GPIO_WriteLevel0, "GPIO_WriteLevel0"},
{SWI_GPIO_ReadLevel1, "GPIO_ReadLevel1"},
{SWI_GPIO_WriteLevel1, "GPIO_WriteLevel1"},
{SWI_GPIO_ReadRising, "GPIO_ReadRising"},
{SWI_GPIO_WriteRising, "GPIO_WriteRising"},
{SWI_GPIO_ReadFalling, "GPIO_ReadFalling"},
{SWI_GPIO_WriteFalling, "GPIO_WriteFalling"},
{SWI_GPIO_ReadExp32, "GPIO_ReadExp32"},
{SWI_GPIO_WriteExp32, "GPIO_WriteExp32"},
{SWI_GPIO_ReadExpOE32, "GPIO_ReadExpOE32"},
{SWI_GPIO_WriteExpOE32, "GPIO_WriteExpOE32"},
{SWI_GPIO_ReadEvent, "GPIO_ReadEvent"},
{SWI_GPIO_WriteEvent, "GPIO_WriteEvent"},
{SWI_GPIO_ReadAsync, "GPIO_ReadAsync"},
{SWI_GPIO_WriteAsync, "GPIO_WriteAsync"},
{SWI_GPIO_FlashOn, "GPIO_FlashOn"},
{SWI_GPIO_FlashOff, "GPIO_FlashOff"},
{SWI_GPIO_Info, "GPIO_Info"},
{SWI_GPIO_I2CInfo, "GPIO_I2CInfo"},
{SWI_GPIO_LoadConfig, "GPIO_LoadConfig"},
{SWI_GPIO_ReadConfig, "GPIO_ReadConfig"},
{SWI_GPIO_EnableI2C, "GPIO_EnableI2C"},
{SWI_GPIO_GetBoard, "GPIO_GetBoard"},
{SWI_GPIO_RescanI2C, "GPIO_RescanI2C"},
{SWI_Brandy_Version, "Brandy_Version"},
{SWI_Brandy_Swap16Palette, "Brandy_Swap16Palette"},
{SWI_Brandy_GetVideoDriver, "Brandy_GetVideoDriver"},
{SWI_Brandy_SetFailoverMode, "Brandy_SetFailoverMode"},
{SWI_Brandy_AccessVideoRAM, "Brandy_AccessVideoRAM"},
{SWI_Brandy_INTusesFloat, "Brandy_INTusesFloat"},
{SWI_Brandy_LegacyIntMaths, "Brandy_LegacyIntMaths"},
{SWI_Brandy_Hex64, "Brandy_Hex64"},
{SWI_Brandy_DELisBS, "Brandy_DELisBS"},
{SWI_Brandy_PseudovarsUnsigned, "Brandy_PseudovarsUnsigned"},
{SWI_Brandy_TekEnabled, "Brandy_TekEnabled"},
{SWI_Brandy_uSleep, "Brandy_uSleep"},
{SWI_Brandy_dlopen, "Brandy_dlopen"},
{SWI_Brandy_dlcall, "Brandy_dlcall"},
{SWI_Brandy_MAlloc, "Brandy_MAlloc"},
{SWI_Brandy_Free, "Brandy_Free"},
{SWI_Brandy_BitShift64, "Brandy_BitShift64"},
{SWI_Brandy_Platform, "Brandy_Platform"},
{SWI_Brandy_CascadedIFtweak, "Brandy_CascadedIFtweak"},
{SWI_Brandy_MouseEventExpire, "Brandy_MouseEventExpire"},
{SWI_Brandy_dlgetaddr, "Brandy_dlgetaddr"},
{SWI_Brandy_dlcalladdr, "Brandy_dlcalladdr"},
{SWI_Brandy_Strict, "Brandy_Strict"},
{SWI_Brandy_TranslateFNames, "Brandy_TranslateFNames"},
{SWI_Brandy_MemSet, "Brandy_MemSet"},
{SWI_Brandy_AllowLowercase, "Brandy_AllowLowercase"},
{SWI_RaspberryPi_GPIOInfo, "RaspberryPi_GPIOInfo"},
{SWI_RaspberryPi_GetGPIOPortMode, "RaspberryPi_GetGPIOPortMode"},
{SWI_RaspberryPi_SetGPIOPortMode, "RaspberryPi_SetGPIOPortMode"},
{SWI_RaspberryPi_SetGPIOPortPullUpDownMode, "RaspberryPi_SetGPIOPortPullUpDownMode"},
{SWI_RaspberryPi_ReadGPIOPort, "RaspberryPi_ReadGPIOPort"},
{SWI_RaspberryPi_WriteGPIOPort, "RaspberryPi_WriteGPIOPort"},
{0xFFFFFFFF, "End_of_list"}
};
#endif
#endif