No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / acorn26 / stand / lib / riscoscalls.h
blobead9a09e6b15e191ee4b9e37171e789d50aa3296
1 /* $NetBSD: riscoscalls.h,v 1.3 2005/12/11 12:16:05 christos Exp $ */
3 /*-
4 * Copyright (c) 2001 Ben Harris
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * This file defines the interface for the veneers over RISC OS SWIs used
32 * by libsa. Only those SWIs actually needed by libsa are included. In
33 * general, the interface is based on the one provided by OsLib, though
34 * this implementation is independent.
37 #define OS_WriteC 0x000000
38 #define XOS_WriteC 0x020000
39 #define OS_NewLine 0x000003
40 #define XOS_NewLine 0x020003
41 #define OS_ReadC 0x000004
42 #define XOS_ReadC 0x020004
43 #define OS_CLI 0x000005
44 #define XOS_CLI 0x020005
45 #define OS_Byte 0x000006
46 #define XOS_Byte 0x020006
47 #define OS_Word 0x000007
48 #define XOS_Word 0x020007
49 #define OS_Args 0x000009
50 #define XOS_Args 0x020009
51 #define OS_GBPB 0x00000c
52 #define XOS_GBPB 0x02000c
53 #define OS_Find 0x00000d
54 #define XOS_Find 0x02000d
55 #define OS_GetEnv 0x000010
56 #define XOS_GetEnv 0x020010
57 #define OS_Exit 0x000011
58 #define XOS_Exit 0x020011
59 #define OS_IntOff 0x000014
60 #define XOS_IntOff 0x020014
61 #define OS_EnterOS 0x000016
62 #define XOS_EnterOS 0x020016
63 #define OS_Module 0x00001e
64 #define XOS_Module 0x02001e
65 #define OS_FSControl 0x000029
66 #define XOS_FSControl 0x020029
67 #define OS_ServiceCall 0x000030
68 #define XOS_ServiceCall 0x020030
69 #define OS_ReadVduVariables 0x000031
70 #define XOS_ReadVduVariables 0x020031
71 #define OS_SWINumberFromString 0x000039
72 #define XOS_SWINumberFromString 0x020039
73 #define OS_ReadMemMapInfo 0x000051
74 #define XOS_ReadMemMapInfo 0x020051
75 #define OS_ReadMemMapEntries 0x000052
76 #define XOS_ReadMemMapEntries 0x020052
77 #define OS_ReadSysInfo 0x000058
78 #define XOS_ReadSysInfo 0x020058
79 #define OS_Memory 0x000068
80 #define XOS_Memory 0x020068
82 #define Cache_Control 0x000280
83 #define XCache_Control 0x020280
85 #ifndef __ASSEMBLER__
86 typedef struct os_error {
87 u_int32_t errnum;
88 char errmess[252];
89 } os_error;
91 /* Errors talking to the console may as well be fatal. */
93 extern void os_writec(int);
94 extern void os_new_line(void);
95 extern int os_readc(void);
96 #endif
98 /* OS_CLI */
100 #ifndef __ASSEMBLER__
101 extern void os_cli(char *);
102 extern os_error *xos_cli(char *);
103 #endif
105 /* OS_Byte */
107 #define osbyte_OUTPUT_CURSOR_POSITION 165
109 #ifndef __ASSEMBLER__
110 extern void os_byte(int, int, int, int *, int *);
111 #endif
113 /* OS_Word */
115 #define osword_WRITE_SCREEN_ADDRESS 22
117 #ifndef __ASSEMBLER__
118 extern void os_word(int, char *);
119 #endif
121 /* OS_Args */
123 #define OSArgs_ReadPtr 0
124 #define OSArgs_SetPtr 1
125 #define OSArgs_ReadExt 2
126 #define OSArgs_SetExt 3
127 #define OSArgs_ReadAllocation 4
128 #define OSArgs_ReadEOFStatus 5
130 #ifndef __ASSEMBLER__
131 extern os_error *xosargs_read(int, int, int *);
132 extern os_error *xosargs_set(int, int, int);
134 #define xosargs_read_ptr(f, vp) xosargs_read(OSArgs_ReadPtr, (f), (vp))
135 #define xosargs_set_ptr(f, v) xosargs_set(OSArgs_SetPtr, (f), (v))
136 #define xosargs_read_ext(f, vp) xosargs_read(OSArgs_ReadExt, (f), (vp))
137 #define xosargs_set_ext(f, v) xosargs_set(OSArgs_SetExt, (f), (v))
138 #define xosargs_read_allocation(f, vp) \
139 xosargs_read(OSArgs_ReadAllocation, (f), (vp))
140 #define xosargs_read_eof_status(f, vp) \
141 xosargs_read(OSArgs_ReadEOFStatus, (f), (vp))
142 #endif
144 /* OS_GBPB */
146 #define OSGBPB_WriteAt 1
147 #define OSGBPB_Write 2
148 #define OSGBPB_ReadAt 3
149 #define OSGBPB_Read 4
151 #ifndef __ASSEMBLER__
152 extern os_error *xosgbpb_write(int, char const *, int, int *);
153 extern os_error *xosgbpb_read(int, char *, int, int *);
154 #endif
156 /* OS_Find */
158 #define OSFind_Close 0x00
159 #define OSFind_Openin 0x40
160 #define OSFind_Openout 0x80
161 #define OSFind_Openup 0xc0
163 #define osfind_PATH 0x01
164 #define osfind_PATH_VAR 0x02
165 #define osfind_NO_PATH 0x03
166 #define osfind_ERROR_IF_DIR 0x04
167 #define osfind_ERROR_IF_ABSENT 0x08
169 #ifndef __ASSEMBLER__
170 extern os_error *xosfind_close(int);
171 extern os_error *xosfind_open(int, char const *, char const *, int *);
172 #endif
174 /* OS_ReadSysInfo */
176 #define OSReadSysInfo_ReadConfiguredScreenSize 0x00
177 #define OSReadSysInfo_ReadMonitorInfo 0x01
178 #define OSReadSysInfo_ReadChipPresenceAndId 0x02
179 #define OSReadSysInfo_ReadSuperIOFeatures 0x03
181 #define osreadsysinfo_IOEB_ASIC_PRESENT 0x01
182 #define osreadsysinfo_SUPERIO_PRESENT 0x02
183 #define osreadsysinfo_LCD_ASIC_PRESENT 0x04
185 #ifndef __ASSEMBLER__
186 extern void os_readsysinfo(int what, int *r0, int *r1, int *r2, int *r3, int *r4);
187 #define os_readsysinfo_configured_screensize(s) \
188 os_readsysinfo(OSReadSysInfo_ReadConfiguredScreenSize, (s), 0, 0, 0, 0)
190 #define os_readsysinfo_monitor_info(mode, type, sync) \
191 os_readsysinfo(OSReadSysInfo_ReadMonitorInfo, (mode), (type), (sync), 0, 0)
193 #define os_readsysinfo_chip_presence(ioeb, superio, lcd) \
194 os_readsysinfo(OSReadSysInfo_ReadChipPresenceAndId, (ioeb), (superio), (lcd), 0, 0)
196 #define os_readsysinfo_unique_id(low, high) \
197 os_readsysinfo(OSReadSysInfo_ReadChipPresenceAndId, 0, 0, 0, (low), (high))
199 #define os_readsysinfo_superio_features(basic, extra) \
200 os_readsysinfo(OSReadSysInfo_ReadSuperIOFeatures, (basic), (extra), 0, 0, 0)
202 #endif
204 /* OS_Memory */
206 #define OSMemory_PageOp 0x00
207 #define OSMemory_ReadArrangementTableSize 0x06
208 #define OSMemory_ReadArrangementTable 0x07
209 #define OSMemory_ReadSize 0x08
210 #define OSMemory_ReadController 0x09
212 #define osmemory_GIVEN_PAGE_NO 0x0100
213 #define osmemory_GIVEN_LOG_ADDR 0x0200
214 #define osmemory_GIVEN_PHYS_ADDR 0x0400
215 #define osmemory_RETURN_PAGE_NO 0x0800
216 #define osmemory_RETURN_LOG_ADDR 0x1000
217 #define osmemory_RETURN_PHYS_ADDR 0x2000
219 #define osmemory_TYPE 0xf00
220 #define osmemory_TYPE_SHIFT 8
221 #define osmemory_TYPE_ABSENT 0x0
222 #define osmemory_TYPE_DRAM 0x1
223 #define osmemory_TYPE_VRAM 0x2
224 #define osmemory_TYPE_ROM 0x3
225 #define osmemory_TYPE_IO 0x4
226 /* 5, 6, 7 are undefined */
227 #define osmemory_TYPE_ALLOCATABLE_MASK 0x8 /* bit signaling allocatable */
230 #ifndef __ASSEMBLER__
231 struct page_info {
232 int pagenumber;
233 int logical;
234 int physical;
237 extern void osmemory_read_arrangement_table_size(int *size, int *nbpp);
238 extern void osmemory_read_arrangement_table(unsigned char *block);
239 extern void osmemory_page_op(int fromto, struct page_info *block, int num_pages);
240 #endif
242 /* Misc */
243 #ifndef __ASSEMBLER__
244 extern char *os_get_env(void **, void **);
246 extern void os_exit(os_error const *, int) __attribute__((noreturn));
248 extern void os_int_off(void);
250 extern void os_enter_os(void);
251 #endif
253 #define OSFSControl_Shutdown 23
255 #ifndef __ASSEMBLER__
256 extern os_error *xosfscontrol_shutdown(void);
257 #endif
259 #define Service_PreReset 0x45
261 #ifndef __ASSEMBLER__
262 extern void service_pre_reset(void);
263 #endif
265 #define os_MODEVAR_LOG2_BPP 9
266 #define os_MODEVAR_XWIND_LIMIT 11
267 #define os_MODEVAR_YWIND_LIMIT 12
268 #define os_VDUVAR_DISPLAY_START 149
269 #define os_VDUVAR_TOTAL_SCREEN_SIZE 150
270 #define os_VDUVAR_TCHAR_SPACEY 170
272 #ifndef __ASSEMBLER__
273 extern void os_read_vdu_variables(const int *, int *);
275 extern os_error *xos_swi_number_from_string(char const *, int *);
277 extern void os_read_mem_map_info(int *, int *);
279 struct os_mem_map_request {
280 int page_no;
281 void *map;
282 int access;
283 #define os_AREA_ACCESS_READ_WRITE 0
284 #define os_AREA_ACCESS_READ_ONLY 1
285 #define os_AREA_ACCESS_NONE 3
288 extern void os_read_mem_map_entries(struct os_mem_map_request *);
290 extern os_error xcache_control(u_int, u_int, u_int *);
292 struct filecore_disc {
293 u_int8_t log2secsize;
294 u_int8_t secspertrack;
295 u_int8_t heads;
296 u_int8_t density;
297 u_int8_t idlen;
298 u_int8_t log2bpmp;
299 u_int8_t skew;
300 u_int8_t bootoption;
301 u_int8_t lowsector;
302 u_int8_t nzones;
303 u_int16_t zone_spare;
304 u_int32_t root;
305 u_int32_t disc_size;
306 u_int16_t disc_id;
307 char disc_name[10];
308 u_int32_t disc_type;
309 u_int32_t disc_size_hi;
310 u_int8_t share_size;
311 u_int8_t big_flag;
312 u_int8_t reserved[22];
315 #endif
317 /* RISC OS Error numbers */
319 #define error_IS_ADIR 0xa8
320 #define error_TOO_MANY_OPEN_FILES 0xc0
321 #define error_FILE_NOT_FOUND 0xd6
323 #ifndef __ASSEMBLER__
324 extern int riscos_errno(os_error *);
325 #endif