Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / x68k / stand / libiocs / scsi.h
blob85db763c8367053f3952b3d5b05e050fc342d13b
1 /*
2 * X680x0 ROM IOCS access definitions.
3 * based on Project C Library X68000 Programing Interface Definition
4 * /usr/include/sys/scsi.h
5 * $Id: scsi.h,v 1.2 2005/12/24 20:07:41 perry Exp $
6 */
7 /*
8 * PROJECT C Library, X68000 PROGRAMMING INTERFACE DEFINITION
9 * --------------------------------------------------------------------
10 * This file is written by the Project C Library Group, and completely
11 * in public domain. You can freely use, copy, modify, and redistribute
12 * the whole contents, without this notice.
13 * --------------------------------------------------------------------
14 * from RCS Id: scsi.h,v 1.3 1994/07/31 17:21:50 mura Exp
17 #ifndef __INLINE_SCSI_H__
18 #define __INLINE_SCSI_H__
20 struct _readcap {
21 unsigned long block;
22 unsigned long size;
25 struct _inquiry {
26 unsigned char unit;
27 unsigned char info;
28 unsigned char ver;
29 unsigned char reserve;
30 unsigned char size;
31 unsigned char buff[0];
34 static inline int _scsi_inquiry (int n, int id, struct _inquiry *buf)
36 register int reg_d0 __asm ("%d0");
38 __asm volatile ("moveml %%d3-%%d4,%%sp@-\n\t"
39 "movel %2,%%d3\n\t"
40 "movel %3,%%d4\n\t"
41 "movel %4,%%a1\n\t"
42 "movel #0x20,%%d1\n\t"
43 "movel #0xf5,%%d0\n\t"
44 "trap #15\n\t"
45 "moveml %%sp@+,%%d3-%%d4"
46 : "=d" (reg_d0), "=m" (*buf)
47 : "ri" (n), "ri" (id), "g" ((int) buf)
48 : "%d1", "%d2", "%a1");
50 return reg_d0;
52 static inline int _scsi_modesense (int page, int n, int id, void *buf)
54 register int reg_d0 __asm ("%d0");
56 __asm volatile ("moveml %%d3-%%d4,%%sp@-\n\t"
57 "movel %2,%%d2\n\t"
58 "movel %3,%%d3\n\t"
59 "movel %4,%%d4\n\t"
60 "movel %5,%%a1\n\t"
61 "movel #0x29,%%d1\n\t"
62 "movel #0xf5,%%d0\n\t"
63 "trap #15\n\t"
64 "moveml %%sp@+,%%d3-%%d4"
65 : "=d" (reg_d0), "=m" (*(char*) buf)
66 : "ri" (page), "ri" (n), "ri" (id), "g" ((int) buf)
67 : "%d1", "%d2", "%a1");
69 return reg_d0;
72 static inline int _scsi_read (int pos, int blk, int id, int size, void *buf)
74 register int reg_d0 __asm ("%d0");
76 __asm volatile ("moveml %%d3-%%d5,%%sp@-\n\t"
77 "movel %2,%%d2\n\t"
78 "movel %3,%%d3\n\t"
79 "movel %4,%%d4\n\t"
80 "movel %5,%%d5\n\t"
81 "movel %6,%%a1\n\t"
82 "movel #0x21,%%d1\n\t"
83 "movel #0xf5,%%d0\n\t"
84 "trap #15\n\t"
85 "moveml %%sp@+,%%d3-%%d5"
86 : "=d" (reg_d0), "=m" (*(char*) buf)
87 : "ri" (pos), "ri" (blk), "ri" (id), "ri" (size), "g" ((int) buf)
88 : "%d1", "%d2", "%a1");
90 return reg_d0;
93 static inline int _scsi_readcap (int id, struct _readcap *buf)
95 register int reg_d0 __asm ("%d0");
97 __asm volatile ("moveml %%d4,%%sp@-\n\t"
98 "movel %2,%%d4\n\t"
99 "movel %3,%%a1\n\t"
100 "movel #0x25,%%d1\n\t"
101 "movel #0xf5,%%d0\n\t"
102 "trap #15\n\t"
103 "moveml %%sp@+,%%d4"
104 : "=d" (reg_d0), "=m" (*buf)
105 : "ri" (id), "g" ((int) buf)
106 : "%d1", "%a1");
108 return reg_d0;
111 static inline int _scsi_seek (int pos, int id)
113 register int reg_d0 __asm ("%d0");
115 __asm volatile ("moveml %%d4,%%sp@-\n\t"
116 "movel %1,%%d2\n\t"
117 "movel %2,%%d4\n\t"
118 "movel #0x2d,%%d1\n\t"
119 "movel #0xf5,%%d0\n\t"
120 "trap #15\n\t"
121 "moveml %%sp@+,%%d4"
122 : "=d" (reg_d0)
123 : "ri" (pos), "ri" (id)
124 : "%d1", "%d2");
126 return reg_d0;
129 static inline int _scsi_testunit (int id)
131 register int reg_d0 __asm ("%d0");
133 __asm volatile ("moveml %%d4,%%sp@-\n\t"
134 "movel %1,%%d4\n\t"
135 "movel #0x24,%%d1\n\t"
136 "movel #0xf5,%%d0\n\t"
137 "trap #15\n\t"
138 "moveml %%sp@+,%%d4"
139 : "=d" (reg_d0)
140 : "ri" (id)
141 : "%d1");
143 return reg_d0;
146 static inline int _scsi_write (int pos, int blk, int id, int size, void *buf)
148 register int reg_d0 __asm ("%d0");
150 __asm volatile ("moveml %%d3-%%d5,%%sp@-\n\t"
151 "movel %1,%%d2\n\t"
152 "movel %2,%%d3\n\t"
153 "movel %3,%%d4\n\t"
154 "movel %4,%%d5\n\t"
155 "movel %5,%%a1\n\t"
156 "movel #0x22,%%d1\n\t"
157 "movel #0xf5,%%d0\n\t"
158 "trap #15\n\t"
159 "moveml %%sp@+,%%d3-%%d5"
160 : "=d" (reg_d0)
161 : "ri" (pos), "ri" (blk), "ri" (id), "ri" (size), "g" ((int) buf)
162 : "%d1", "%d2", "%a1");
164 return reg_d0;
167 static inline void _scsi_reset (void)
169 __asm volatile ("movel #0,%%d1\n\t"
170 "movel #0xf5,%%d0\n\t"
171 "trap #15\n\t"
174 : "%d0", "%d1");
177 #endif