/usr/share/doc/HOWTO/ja-html/PCMCIA-PROG-7.html is in doc-linux-ja-html 2006.05.25-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Linux PCMCIA ¥×¥í¥°¥é¥Þ¤Î¼ê°ú¤: ¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¥¤¥ó¥¿¥Õ¥§¡¼¥¹</TITLE>
<LINK HREF="PCMCIA-PROG-8.html" REL=next>
<LINK HREF="PCMCIA-PROG-6.html" REL=previous>
<LINK HREF="PCMCIA-PROG.html#toc7" REL=contents>
</HEAD>
<BODY>
<A HREF="PCMCIA-PROG-8.html">¼¡¤Î¥Ú¡¼¥¸</A>
<A HREF="PCMCIA-PROG-6.html">Á°¤Î¥Ú¡¼¥¸</A>
<A HREF="PCMCIA-PROG.html#toc7">Ìܼ¡¤Ø</A>
<HR>
<H2><A NAME="s7">7. ¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¥¤¥ó¥¿¥Õ¥§¡¼¥¹</A></H2>
<P>¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤Ï¡¢¥«¡¼¥É¥µ¡¼¥Ó¥¹¤Î¥¯¥é¥¤¥¢¥ó¥È¥É¥é¥¤¥Ð¤È <CODE>cardmgr</CODE> ¤Î
¤è¤¦¤Ê¥æ¡¼¥¶¥â¡¼¥É¤Î¥æ¥Æ¥£¥ê¥Æ¥£¤ò·ë¤ÓÉÕ¤±¤Þ¤¹¡£¥«¡¼¥É¥µ¡¼¥Ó¥¹¤Î
¡Ö¥¹¡¼¥Ñ¥¯¥é¥¤¥¢¥ó¥È¡×¤È¤¤¤Ã¤Æ¤â¤è¤¤¤Ç¤·¤ç¤¦¡£¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤Ï¡¢
<CODE>BindDevice</CODE> ´Ø¿ô¤ò»È¤Ã¤Æ¡¢Â¾¤Î¥¯¥é¥¤¥¢¥ó¥È¥É¥é¥¤¥Ð¤ò¤½¤ì¤¾¤ì¤Î PCMCIA
¥«¡¼¥É¤È·ë¤ÓÉÕ¤±¤Þ¤¹¡£Â¾¤Î¥¯¥é¥¤¥¢¥ó¥È¤È¤Ï°Û¤Ê¤ê¡¢¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤Ï¡¢
¥«¡¼¥É¤ÎÈ´¤º¹¤·¤¬¹Ô¤ï¤ì¤Æ¤â¡¢¤º¤Ã¤ÈÁ´Éô¤Î¥½¥±¥Ã¥È¤Ë¹´Â«¤µ¤ì¤¿¤Þ¤Þ»Ä
¤ê¤Þ¤¹¡£
<P>
<P>
<H2><A NAME="ss7.1">7.1 ¾¤Î¥¯¥é¥¤¥¢¥ó¥È¥É¥é¥¤¥Ð¤Ø¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹</A>
</H2>
<P>¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤Ï¡¢Æ³Æþ¤µ¤ì¤Æ¤¤¤Æ¥½¥±¥Ã¥È¤Ë·ë¹ç¤Ç¤¤ë¾õÂ֤ˤʤäƤ¤¤ë
¤¹¤Ù¤Æ¤Î¥¯¥é¥¤¥¢¥ó¥È¥É¥é¥¤¥Ð¤òÇÄ°®¤·¤Æ¤¤¤Þ¤¹¡£¥¯¥é¥¤¥¢¥ó¥È¥É¥é¥¤¥Ð¤Ë
¤Ï¡¢¥Ç¥Ð¥¤¥¹¤Î¡Ö¼ÂÂΡפκîÀ®¤Èºï½ü¤ò¤¹¤ë¤¿¤á¤Î¹àÌܤ¬¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»
¤ó¡£¤³¤³¤Ç¸À¤¦¥Ç¥Ð¥¤¥¹¤Î¼ÂÂΤȤϡ¢¤¢¤ë PCMCIA ¥«¡¼¥É¤òÀ©¸æ¤¹¤ë¤¿¤á¤Ë
ɬÍפʤ¹¤Ù¤Æ¤ò°ÕÌ£¤·¤Þ¤¹¡£
<P>³Æ¥Ç¥Ð¥¤¥¹¤Ï¡¢<CODE>cs_types.h</CODE> ¤ËÄêµÁ¤µ¤ì¤¿ÆÃÊ̤ʷ¿ <CODE>dev_info_t</CODE> ¤ò»ý¤Ä¡¢
¥æ¥Ë¡¼¥¯¤Ê1 6 ʸ»ú¤Î¥¿¥°¤Ç¼±Ê̤µ¤ì¤Þ¤¹¡£³Æ¥Ç¥Ð¥¤¥¹¤Î¼ÂÂΤϡ¢
<CODE>dev_link_t</CODE> ¹½Â¤ÂΤǵ½Ò¤µ¤ì¤Þ¤¹¡£
<P>
<H3>dev_link_t ¹½Â¤ÂÎ</H3>
<P><CODE>dev_link_t</CODE> ¤Î¥Ç¡¼¥¿¹½Â¤ÂΤϼ¡¤Î¤È¤ª¤ê:
<BLOCKQUOTE><CODE>
<PRE>
#include "ds.h"
typedef struct dev_node_t {
char dev_name[8];
u_char major, minor;
struct dev_node_t *next;
}
typedef struct dev_link_t {
dev_node_t *dev;
u_long state, open;
struct wait_queue *pending
struct timer_list release
client_handle_t handle;
io_req_t io;
irq_req_t irq;
config_req_t conf;
window_handle_t win;
void *priv;
struct dev_link_t *next;
} dev_link_t;
</PRE>
</CODE></BLOCKQUOTE>
<P><CODE>dev_link_t</CODE> ¹½Â¤ÂΤΠ<CODE>dev</CODE> ÊÑ¿ô¤Ï¥ê¥ó¥¯¥ê¥¹¥È¤Î <CODE>dev_node_t</CODE>
¹½Â¤ÂΤò¥Ý¥¤¥ó¥È¤·¤Æ¤¤¤Þ¤¹¡£<CODE>dev_node_t</CODE> ¤Î
<CODE>dev_name</CODE> ÊÑ¿ô¤Ï¡¢¥É¥é¥¤¥Ð¤Ë¤è¤Ã¤Æ¡¢¤³¤Î¥Ç¥Ð¥¤¥¹¤ò¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¤Î
¥Õ¥¡¥¤¥ë̾¤¬½ñ¤¹þ¤Þ¤ì¤Þ¤¹(²Äǽ¤Ê¾ì¹ç¤Î¤ß)¡£Î㤨¤Ð¡¢<CODE>serial_cs</CODE> ¤Ï
¡Ö<CODE>ttyS1</CODE>¡×¤ÎÍͤÊ̾Á°¤ò»È¤¤¤Þ¤¹¡£<CODE>major</CODE> ¤È <CODE>minor</CODE> ¤ÎÊÑ¿ô¤Ï¡¢
¤³¤Î¥Ç¥Ð¥¤¥¹
¤ò¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¤Î¥á¥¸¥ã¡¼ÈÖ¹æ¤È¥Þ¥¤¥Ê¡¼ÈÖ¹æ¤Ç¤¹¡£¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹
¤Ï¡¢¤³¤ì¤é¤ÎÊÑ¿ô¤ò <CODE>DS_GET_DEVICE_INFO</CODE> ioctl ¤Ç¥æ¡¼¥¶¥â¡¼¥É¥×¥í¥°¥é¥à
¤ËÊÖ¤·¤Þ¤¹¡£
<P><CODE>dev_link_t</CODE> ¤Î <CODE>state</CODE> ÊÑ¿ô¤Ï¡¢¸½ºß¤Î¥Ç¥Ð¥¤¥¹¤Î¾õÂÖ¤òÇÄ°®¤¹¤ë
¤¿¤á¤Ë»È¤ï¤ì¤Þ¤¹¡£¼¡¤Î¥Õ¥é¥°¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£:
<P>
<DL>
<DT><B><CODE>DEV_PRESENT</CODE></B><DD><P>¥«¡¼¥É¤¬Â¸ºß¤¹¤ë¤³¤È¤ò¼¨¤·¤Þ¤¹¡£¤³¤Î¥Ó¥Ã¥È¤Ï¡¢¥É¥é¥¤¥Ð¤Î¥¤¥Ù¥ó¥È
¥Ï¥ó¥É¥é¤Ë¤è¤Ã¤Æ¡¢¥«¡¼¥É¤ÎÈ´º¹¤·¤Î¥¤¥Ù¥ó¥È¤ËÂбþ¤·¤Æ¥»¥Ã¥È¤Þ¤¿¤Ï
¥¯¥ê¥¢¤µ¤ì¤Þ¤¹¡£
<DT><B><CODE>DEV_CONFIG</CODE></B><DD><P>¥«¡¼¥É¤¬ÀßÄêºÑ¤ß¤Ç¤¢¤ë¤³¤È¤ò¼¨¤·¤Þ¤¹¡£
<DT><B><CODE>DEV_CONFIG_PENDING</CODE></B><DD><P>¥«¡¼¥É¤ÎÀßÄêºî¶È¤¬¼Â¹ÔÃæ¤Ç¤¢¤ë¤³¤È¤ò¼¨¤·¤Þ¤¹¡£
<DT><B><CODE>DEV_SUSPEND</CODE></B><DD><P>¥«¡¼¥É¤¬°ì»þŪ¤Ë»ÈÍѤǤ¤Ê¤¤¤³¤È¤ò¼¨¤·¤Þ¤¹¡£
<DT><B><CODE>DEV_BUSY</CODE></B><DD><P>Æþ½ÐÎÏÆ°ºî¤¬¼Â¹ÔÃæ¤Ç¤¢¤ë¤³¤È¤ò¼¨¤·¤Þ¤¹¡£¤³¤Î¥Ó¥Ã¥È¤Ï¡¢¥¢¥¯¥»¥¹¤Î
¾×ÆͤòËɤ°¤¿¤á¤Î¥¤¥ó¥¿¡¼¥í¥Ã¥¯¤È¤·¤Æ»È¤¦¤³¤È¤â¤Ç¤¤Þ¤¹¡£
<DT><B><CODE>DEV_STALE_CONFIG</CODE></B><DD><P>¥É¥é¥¤¥Ð¤Ë¤è¤Ã¤Æ¤Ï¡¢¼Â¹ÔÃæ¤Î¥«¡¼¥É¤¬È´¤«¤ì¤¿»þ¤Ë¤Ï¡¢¤½¤Î¥«¡¼¥É
¤ËÂбþ¤¹¤ë¤¹¤Ù¤Æ¤Î¥Ç¥Ð¥¤¥¹¤¬ÊĤ¸¤ë¤Þ¤Ç¤Ï¡¢¥½¥±¥Ã¥È¤ò²òÊü¤¹¤Ù¤
¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£¤³¤Î¥Õ¥é¥°¤Ï¡¢¥Ç¥Ð¥¤¥¹¤¬¥¯ÊĤ¸¤¿»þ¤Ë¥½¥±¥Ã¥È¤ò
²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤³¤È¤ò¼¨¤·¤Þ¤¹¡£
<DT><B><CODE>DEV_STALE_LINK</CODE></B><DD><P>¥É¥é¥¤¥Ð¤Î¼ÂÂΤϡ¢¤½¤Î¤¹¤Ù¤Æ¤Î PCMCIA ¥ê¥½¡¼¥¹¤¬²òÊü¤µ¤ì¤ë¤Þ¤Ç
ºï½ü¤µ¤ì¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£¤³¤Î¥Õ¥é¥°¤Ï¡¢¥½¥±¥Ã¥È¤¬²òÊü¤µ¤ì¤¿¤é
¤¹¤°¤Ë¥É¥é¥¤¥Ð¤Î¼ÂÂΤ¬ºï½ü¤µ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤³¤È¤ò¼¨¤·¤Þ¤¹¡£
</DL>
<P><CODE>open</CODE> ÊÑ¿ô¤Ï¡¢¤³¤Î¥Ç¥Ð¥¤¥¹¤¬²¿½Å¤Ë»È¤ï¤ì¤Æ¤¤¤ë¤«¤ò¿ô¤¨¤Þ¤¹¡£
¥Ç¥Ð¥¤¥¹¤Ï¡¢¤³¤Î¥«¥¦¥ó¥È¤¬¥¼¥í¤Ë¤Ê¤ë¤Þ¤Ç²òÊü¤µ¤ì¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£
<CODE>pending</CODE> ÊÑ¿ô¤Ï¡¢¤³¤Î¥Ç¥Ð¥¤¥¹¤ò»È¤¦¤¿¤á¤ËÂԤäƤ¤¤ë¥×¥í¥»¥¹¤ÎÂÔ¤Á¹ÔÎó
¤ò´ÉÍý¤¹¤ë¤¿¤á¤Ë»È¤¦¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
<P><CODE>release</CODE> ÊÑ¿ô¤Ï¡¢¥«¡¼¥É¤¬È´¤«¤ì¤¿»þ¤Ë¡¢¥Ç¥Ð¥¤¥¹¤Î¥·¥ã¥Ã¥È¥À¥¦¥ó½èÍý¤ò
ͽÄê¤ËÆþ¤ì¤ë¤¿¤á¤Ë»È¤ï¤ì¤Þ¤¹¡£¥«¡¼¥É¤Î°úÈ´¤¤Î¥¤¥Ù¥ó¥È¤Ï¹â¤¤Í¥ÀèÅÙ¤Ç
¼Â¹Ô¤µ¤ì¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¥É¥é¥¤¥Ð¤Î¥¤¥Ù¥ó¥È¥Ï¥ó¥É¥é¤Ï¡¢Ä̾ï¥Ç¥Ð¥¤¥¹
¾õÂ֤Π<CODE>DEV_PRESENT</CODE> ¥Ó¥Ã¥È¤ò¥ê¥»¥Ã¥È¤·¡¢¤½¤Î»þ¥·¥ã¥Ã¥È¥À¥¦¥ó½èÍý¤¬¸å¤Ç
¼Â¹Ô¤µ¤ì¤ë¤è¤¦¤ËͽÄꤹ¤ë¤³¤È¤Ç¥¤¥¸¥§¥¯¥È¤Î½èÍý¤ò¤·¤Þ¤¹¡£
<P><CODE>handle</CODE>¡¢<CODE>io</CODE>¡¢<CODE>irq</CODE>¡¢<CODE>conf</CODE>¤ª¤è¤Ó <CODE>win</CODE> ¤Î³ÆÊÑ¿ô¤Ï¡¢
Ä̾ï¤Î PCMCIA Æþ½ÐÎÏ¥«¡¼¥É¤òÁȤ߹þ¤à¤¿¤á¤ËɬÍפÊÉáÄ̤ΠPCMCIA ¥Ç¡¼¥¿
¹½Â¤¤ËÂбþ¤·¤Þ¤¹¡£
<P><CODE>priv</CODE> ÊÑ¿ô¤Ï¡¢¥Ç¥Ð¥¤¥¹¤ò´ÉÍý¤¹¤ë¤¿¤á¤ËɬÍפʤɤó¤Ê»äŪ¤Ê¥Ç¡¼¥¿¹½Â¤¤Î
ÌÜŪ¤Î¤¿¤á¤Ë¤Ç¤â»È¤¦¤³¤È¤¬¤Ç¤¤Þ¤¹¡£<CODE>next</CODE> ÊÑ¿ô¤Ï¡¢Ê£¿ô¤Î¼ÂÂΤò°·¤¦
¤³¤È¤Î¤Ç¤¤ë¥É¥é¥¤¥Ð¤Ç¡¢<CODE>dev_link_t</CODE> ¹½Â¤ÂΤηë¹ç¥ê¥¹¥È¤òºî¤ë¤¿¤á¤Ë
»È¤¦¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
<P>
<P>
<H3>register_pcmcia_driver</H3>
<P>
<BLOCKQUOTE><CODE>
<PRE>
int register_pcmcia_driver(dev_info_t *dev_info,
dev_link_t *(*attach)(void),
void (*detach)(dev_link_t *));
</PRE>
</CODE></BLOCKQUOTE>
<CODE>register_pcmcia_driver</CODE> ¤Ï¡¢¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤Ë¡¢¥¯¥é¥¤¥¢¥ó¥È¥É¥é¥¤¥Ð¤¬
¸ºß¤·¤Æ¤¤¤Æ¥½¥±¥Ã¥È¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤ë¾õÂ֤Ǥ¢¤ë¤³¤È¤òÃΤ餻¤Þ¤¹¡£
¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤¬¤³¤Î¥É¥é¥¤¥Ð¤Î <CODE>dev_info</CODE> ʸ»úÎó¤ËÅù¤·¤¤
<CODE>DS_BIND_REQUEST</CODE> ioctl ¤ò¼õ¤±¼è¤ë¤È¡¢¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤Ï¥É¥é¥¤¥Ð¤Î
<CODE>attach()</CODE> ´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£<CODE>DS_UNBIND_REQU EST</CODE> ioctl ¤ò
¼õ¤±¼è¤Ã¤¿¤È¤¤Ï¡¢<CODE>detach()</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<P>
<P>
<H3>unregister_pcmcia_driver</H3>
<P>
<BLOCKQUOTE><CODE>
<PRE>
int unregister_pcmcia_driver(dev_info_t *dev_info);
</PRE>
</CODE></BLOCKQUOTE>
<P>¤³¤Î´Ø¿ô¤Ï¡¢¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤Ë¡¢»ØÄꤵ¤ì¤¿¥¯¥é¥¤¥¢¥ó¥È¥É¥é¥¤¥Ð¤Ë¤Ï
¥½¥±¥Ã¥È¤ò·ë¤ÓÉÕ¤±¤Æ¤Ï¤Ê¤é¤Ê¤¤¤³¤È¤òÃΤ餻¤Þ¤¹¡£
<P>
<P>
<H2><A NAME="ss7.2">7.2 ¥æ¡¼¥¶¥â¡¼¥É¤Î PCMCIA ¥æ¥Æ¥£¥ê¥Æ¥£¤È¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹</A>
</H2>
<P>¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤Ï¡¢¥æ¡¼¥¶¥â¡¼¥É¤Î PCMCIA ¥æ¥Æ¥£¥ê¥Æ¥£¤ÈÄÌ¿®¤¹¤ë
¤¿¤á¤Ëµ¿»÷¥Ç¥Ð¥¤¥¹¤òºî¤ê¤Þ¤¹¡£¤³¤Î¥Ç¥Ð¥¤¥¹¤Î¥á¥¸¥ã¡¼ÈÖ¹æ¤ÏưŪ¤Ë
Áª¤Ð¤ì¡¢PCMCIA ¥æ¥Æ¥£¥ê¥Æ¥£¤Ï <CODE>/proc/devices</CODE> ¤òÆɤó¤Ç¤½¤ÎÃÍ
¤òÆÀ¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¥Þ¥¤¥Ê¡¼ÈÖ¹æ¤Ï 0 ¤«¤é»Ï¤Þ¤ë¥½¥±¥Ã¥È¤ÎÈÖ¹æ¤ËÂбþ
¤·¤Þ¤¹¡£
<P>¤¿¤À°ì¤Ä¤Î¥×¥í¥»¥¹¤À¤±¤¬¡¢¤¢¤ë¥½¥±¥Ã¥È¤òÆɽñ¤¤Î¤¿¤á¤Ë¥ª¡¼¥×¥ó¤¹¤ë
¤³¤È¤¬¤Ç¤¤Þ¤¹¡£Â¾¤Î¥×¥í¥»¥¹¤Ï¡¢ÆɽФ·ÀìÍѥ⡼¥É¤Ç¤Î¤ß¡¢¤³¤Î¥½¥±¥Ã¥È
¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤¹¡£ÆɽФ·¤Î¤ß¤ÎÀܳ¤Ç¤Ï¡¢°ìÉô¤Î <CODE>ioctl</CODE> µ¡Ç½¤À¤±¤¬
»È¤¨¤Þ¤¹¡£Æɽñ¤Î¾Êý¤ÎÀܳ¤Ç¤Ï¡¢¤¹¤Ù¤Æ¤Î <CODE>ioctl</CODE> µ¡Ç½¤¬»È¤¨¡¢¥«¡¼¥É
¥µ¡¼¥Ó¥¹¤«¤é¤Î¥¤¥Ù¥ó¥È¤ÎÄÌÃΤò¼õ¤±¼è¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
<P>
<P>
<H3>¥«¡¼¥É¥µ¡¼¥Ó¥¹¤Î¥¤¥Ù¥ó¥ÈÄÌÃÎ</H3>
<P>¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤Ï¡¢¥¤¥Ù¥ó¥È¤ÎÄÌÃΤΤ¿¤á¤Ë <CODE>read()</CODE> ¤È <CODE>select()</CODE> ¤Î
´Ø¿ô¤ò¼ÂÁõ¤·¤Æ¤¤¤Þ¤¹¡£¤¢¤ë PCMCIA ¥Ç¥Ð¥¤¥¹¤«¤éÆɽФ·¤ò¹Ô¤¦¤È¡¢Á°²ó¤Î
<CODE>read()</CODE> °Ê¹ß¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤¬¼õ¿®¤·¤¿¤¹¤Ù¤Æ¤Î¥¤¥Ù¥ó¥È¤¬
unsigned long ¤ÎÃͤȤ·¤ÆÊÖ¤µ¤ì¤Þ¤¹¡£¤â¤·¥¤¥Ù¥ó¥È¤¬²¿¤âȯÀ¸¤·¤Æ¤¤¤Ê¤±¤ì
¤Ð¡¢¥¤¥Ù¥ó¥È¤¬È¯À¸¤¹¤ë¤Þ¤Ç¡¢¸Æ½Ð¤·¤ÏÉõº¿¤·¤Þ¤¹¡£<CODE>select()</CODE> ¤ò»È¤Ã¤Æ¡¢
Ê£¿ô¤Î¥½¥±¥Ã¥È¤Î¿·µ¬¤Î¥¤¥Ù¥ó¥È¤ò´Æ»ë¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
<P>¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤Ï¡¢¼¡¤Î¥¤¥Ù¥ó¥È¤ò´Æ»ë¤·¤Þ¤¹¡£:
<CODE>CS_EVENT_CARD_INSERTION</CODE>, <CODE>CS_EVENT_CARD_REMOVAL</CODE>,
<CODE>CS_EVENT_RESET_PHYSICAL</CODE>, <CODE>CS_EVENT_CARD_RESET</CODE> ¤È
<CODE>CS_EVENT_RESET_COMPLETE</CODE>.
<P>
<P>
<H3>ioctl ¤ÎÀâÌÀ</H3>
<P>¤Û¤È¤ó¤É¤Î¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤Î <CODE>ioctl</CODE> ¤ÎÆ°ºî¤Ï¡¢¥«¡¼¥É¥µ¡¼¥Ó¥¹¤Î´Ø¿ô¤Ë
ľÀÜÂбþ¤·¤Þ¤¹¡£<CODE>ioctl</CODE> ¤Î¸Æ½Ð¤·¤Ï¡¢¼¡¤Î·Á¼°¤Ç¤¹¡£:
<P>
<BLOCKQUOTE><CODE>
<PRE>
int ioctl(int fd, int cmd, ds_ioctl_arg_t *arg);
</PRE>
</CODE></BLOCKQUOTE>
<CODE>ds_ioctl_arg_t</CODE> ¤Î¹½Â¤ÂΤϼ¡¤Î¤È¤ª¤ê:
<BLOCKQUOTE><CODE>
<PRE>
typedef union ds_ioctl_arg_t {
servinfo_t servinfo;
adjust_t adjust;
config_info_t config;
tuple_t tuple;
tuple_parse_t tuple_parse;
client_req_t client_req;
status_t status;
conf_reg_t conf_reg;
cisinfo_t cisinfo;
region_info_t region;
bind_info_t bind_info;
mtd_info_t mtd_info;
} ds_ioctl_arg_t;
</PRE>
</CODE></BLOCKQUOTE>
<P>¼¡¤Î <CODE>ioctl</CODE> ¤Î¥³¥Þ¥ó¥É¤Ï¡¢Âбþ¤¹¤ë¥«¡¼¥É¥µ¡¼¥Ó¥¹¤Î´Ø¿ô¤ò¼Â¹Ô¤·¤Þ¤¹¡£:
<DL>
<DT><B><CODE>DS_GET_CARD_SERVICES_INFO</CODE></B><DD><P><CODE>CardServices(GetCardServicesInfo, ..., &arg->servinfo)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_ADJUST_RESOURCE_INFO</CODE></B><DD><P><CODE>CardServices(AdjustResourceInfo, ..., &arg->adjust)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_GET_CONFIGURATION_INFO</CODE></B><DD><P><CODE>CardServices(GetConfigurationInfo, ..., &arg->config)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_GET_FIRST_TUPLE</CODE></B><DD><P><CODE>CardServices(GetFirstTuple, ..., &arg->tuple)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_GET_NEXT_TUPLE</CODE></B><DD><P><CODE>CardServices(GetNextTuple, ..., &arg->tuple)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_GET_TUPLE_DATA</CODE></B><DD><P><CODE>CardServices(GetTupleData, ..., &arg->tuple_parse.tuple)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
¥¿¥×¥ë¥Ç¡¼¥¿¤¬ <CODE>arg->tuple_parse.data</CODE> ¤ÎÃæ¤ËÊÖ¤ê¤Þ¤¹¡£
<DT><B><CODE>DS_PARSE_TUPLE</CODE></B><DD><P><CODE>CardServices(ParseTuple, ..., &arg->tuple_parse.tuple, &arg->tuple_parse.parse)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_RESET_CARD</CODE></B><DD><P><CODE>CardServices(ResetCard, ...)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_GET_STATUS</CODE></B><DD><P><CODE>CardServices(GetStatus, ..., &arg->status)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_ACCESS_CONFIGURATION_REGISTER</CODE></B><DD><P><CODE>CardServices(AccessConfigurationRegister, ..., &arg->conf_reg)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_VALIDATE_CIS</CODE></B><DD><P><CODE>CardServices(ValidateCIS, ..., &arg->cisinfo)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_SUSPEND_CARD</CODE></B><DD><P><CODE>CardServices(SuspendCard, ...)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_RESUME_CARD</CODE></B><DD><P><CODE>CardServices(ResumeCard, ...)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_EJECT_CARD</CODE></B><DD><P><CODE>CardServices(EjectCard, ...)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_INSERT_CARD</CODE></B><DD><P><CODE>CardServices(InsertCard, ...)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_GET_FIRST_REGION</CODE></B><DD><P><CODE>CardServices(GetFirstRegion, ..., &arg->region)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
<DT><B><CODE>DS_GET_NEXT_REGION</CODE></B><DD><P><CODE>CardServices(GetNextRegion, ..., &arg->region)</CODE> ¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
</DL>
<P>¼¡¤Î <CODE>ioctl</CODE> ¤Î¥³¥Þ¥ó¥É¤Ï¡¢ÆÃÊ̤ʥɥ饤¥Ð¥µ¡¼¥Ó¥¹¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
¤³¤ì¤é¤Î¥³¥Þ¥ó¥É¤Ï¡¢<CODE>bind_info_t</CODE> ¹½Â¤ÂΤ˺îÍѤ·¤Þ¤¹¡£:
<BLOCKQUOTE><CODE>
<PRE>
typedef struct bind_info_t {
dev_info_t dev_info;
u_char function;
struct dev_info_t *instance;
char name[8];
u_char major, minor;
void *next;
} bind_info_t;
</PRE>
</CODE></BLOCKQUOTE>
<DL>
<DT><B><CODE>DS_BIND_REQUEST</CODE></B><DD><P>¤³¤Î¥³¥Þ¥ó¥É¤Ï¡¢¥½¥±¥Ã¥È¤ò¥¯¥é¥¤¥¢¥ó¥È¥É¥é¥¤¥Ð¤ËÀܳ¤·¤Þ¤¹¡£
»ØÄꤵ¤ì¤¿¥Ç¥Ð¥¤¥¹¼±Ê̻ҤΠ<CODE>dev_info</CODE> ¤¬¡¢ÅÐÏ¿¤µ¤ì¤¿¥É¥é¥¤¥Ð¤Î
¥ê¥¹¥È¤«¤é¸¡º÷¤µ¤ì¤Þ¤¹¡£¤â¤·¤³¤Î¥«¡¼¥É¤¬Â¿µ¡Ç½¥«¡¼¥É¤Î¾ì¹ç¤Ï¡¢
<CODE>function</CODE> ÊÑ¿ô¤¬¤É¤Î¥«¡¼¥Éµ¡Ç½¤òÀܳ¤¹¤ë¤«¤ò»ØÄꤷ¤Þ¤¹¡£¤â¤·
¥É¥é¥¤¥Ð¤¬¸«¤Ä¤«¤ë¤È¡¢¥É¥é¥¤¥Ð¤Ï¤³¤Î¥½¥±¥Ã¥È¤Èµ¡Ç½¤ò¡¢
<CODE>BindDevice</CODE> ¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤Ë¤è¤Ã¤ÆÀܳ¤µ¤ì¤Þ¤¹¡£¤½¤Î¸å¡¢
¥É¥é¥¤¥Ð¥µ¡¼¥Ó¥¹¤Ï¥É¥é¥¤¥Ð¤Î <CODE>attach()</CODE> ¹àÌܤò¸Æ¤Ó½Ð¤·¤Æ
¥Ç¥Ð¥¤¥¹¤Î¼ÂÂΤòºîÀ®¤·¤Þ¤¹¡£¿·¤·¤¤ <CODE>dev_link_t</CODE> ¤¬
<CODE>instance</CODE> ¤ÎÃæ¤ËÊÖ¤µ¤ì¤Þ¤¹¡£
<DT><B><CODE>DS_GET_DEVICE_INFO</CODE></B><DD><P>¤³¤Î¥³¥Þ¥ó¥É¤Ï¡¢<CODE>instance</CODE> ¤¬»Ø¤·¼¨¤¹ <CODE>dev_link_t</CODE> ¹½Â¤ÂΤ«¤é¡¢
<CODE>dev_name</CODE>¡¢<CODE>major</CODE>¡¢ <CODE>minor</CODE> ¤Î¹àÌܤò¸¡º÷¤·¤Þ¤¹¡£
<DT><B><CODE>DS_UNBIND_REQUEST</CODE></B><DD><P>¤³¤Î¥³¥Þ¥ó¥É¤Ï¥É¥é¥¤¥Ð¤È instance ¤ò»ØÄꤷ¤¿ <CODE>detach()</CODE> ´Ø¿ô
¤ò¸Æ¤Ó½Ð¤·¤Æ¥Ç¥Ð¥¤¥¹¤ò¥·¥ã¥Ã¥È¥À¥¦¥ó¤µ¤»¤Þ¤¹¡£
</DL>
<P>ºÇ¸å¤Ë <CODE>DS_BIND_MTD</CODE> Í×µá¤Ï¡¢°ú¤¿ô¤Ë <CODE>mtd_info_t</CODE> ¤Î·¿¤ò¤È¤ê¤Þ¤¹¡£:
<P>
<BLOCKQUOTE><CODE>
<PRE>
typedef struct mtd_info_t {
dev_info_t dev_info;
u_long Attributes;
u_long CardOffset;
} mtd_info_t;
</PRE>
</CODE></BLOCKQUOTE>
<P>¤³¤Î¸Æ¤Ó½Ð¤·¤Ï¡¢<CODE>dev_info</CODE> ¤Ë¤è¤Ã¤Æ¼±Ê̤µ¤ì¤ë MTD ¤È <CODE>Attributes</CODE> ¤È
<CODE>CardOffset</CODE> ¤Ë¤è¤Ã¤Æµ½Ò¤µ¤ì¤ë¥á¥â¥êÈϰϤò´ØÏ¢¤Å¤±¤Þ¤¹¡£
<CODE>Attributes</CODE> ¤È <CODE>CardOffset</CODE> ¤Ï¡¢¥«¡¼¥É¥µ¡¼¥Ó¥¹¤Î <CODE>BindMTD</CODE>
¤Î¸Æ½Ð¤·¤Î¤È¤¤ÈƱ¤¸°ÕÌ£¤Ç¤¹¡£
<P>
<P>
<HR>
<A HREF="PCMCIA-PROG-8.html">¼¡¤Î¥Ú¡¼¥¸</A>
<A HREF="PCMCIA-PROG-6.html">Á°¤Î¥Ú¡¼¥¸</A>
<A HREF="PCMCIA-PROG.html#toc7">Ìܼ¡¤Ø</A>
</BODY>
</HTML>
|