dtlk.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. /* -*- linux-c -*-
  2. * dtlk.c - DoubleTalk PC driver for Linux
  3. *
  4. * Original author: Chris Pallotta <chris@allmedia.com>
  5. * Current maintainer: Jim Van Zandt <jrv@vanzandt.mv.com>
  6. *
  7. * 2000-03-18 Jim Van Zandt: Fix polling.
  8. * Eliminate dtlk_timer_active flag and separate dtlk_stop_timer
  9. * function. Don't restart timer in dtlk_timer_tick. Restart timer
  10. * in dtlk_poll after every poll. dtlk_poll returns mask (duh).
  11. * Eliminate unused function dtlk_write_byte. Misc. code cleanups.
  12. */
  13. /* This driver is for the DoubleTalk PC, a speech synthesizer
  14. manufactured by RC Systems (http://www.rcsys.com/). It was written
  15. based on documentation in their User's Manual file and Developer's
  16. Tools disk.
  17. The DoubleTalk PC contains four voice synthesizers: text-to-speech
  18. (TTS), linear predictive coding (LPC), PCM/ADPCM, and CVSD. It
  19. also has a tone generator. Output data for LPC are written to the
  20. LPC port, and output data for the other modes are written to the
  21. TTS port.
  22. Two kinds of data can be read from the DoubleTalk: status
  23. information (in response to the "\001?" interrogation command) is
  24. read from the TTS port, and index markers (which mark the progress
  25. of the speech) are read from the LPC port. Not all models of the
  26. DoubleTalk PC implement index markers. Both the TTS and LPC ports
  27. can also display status flags.
  28. The DoubleTalk PC generates no interrupts.
  29. These characteristics are mapped into the Unix stream I/O model as
  30. follows:
  31. "write" sends bytes to the TTS port. It is the responsibility of
  32. the user program to switch modes among TTS, PCM/ADPCM, and CVSD.
  33. This driver was written for use with the text-to-speech
  34. synthesizer. If LPC output is needed some day, other minor device
  35. numbers can be used to select among output modes.
  36. "read" gets index markers from the LPC port. If the device does
  37. not implement index markers, the read will fail with error EINVAL.
  38. Status information is available using the DTLK_INTERROGATE ioctl.
  39. */
  40. #include <linux/module.h>
  41. #define KERNEL
  42. #include <linux/types.h>
  43. #include <linux/fs.h>
  44. #include <linux/mm.h>
  45. #include <linux/errno.h> /* for -EBUSY */
  46. #include <linux/ioport.h> /* for request_region */
  47. #include <linux/delay.h> /* for loops_per_jiffy */
  48. #include <linux/sched.h>
  49. #include <linux/mutex.h>
  50. #include <asm/io.h> /* for inb_p, outb_p, inb, outb, etc. */
  51. #include <asm/uaccess.h> /* for get_user, etc. */
  52. #include <linux/wait.h> /* for wait_queue */
  53. #include <linux/init.h> /* for __init, module_{init,exit} */
  54. #include <linux/poll.h> /* for POLLIN, etc. */
  55. #include <linux/dtlk.h> /* local header file for DoubleTalk values */
  56. #ifdef TRACING
  57. #define TRACE_TEXT(str) printk(str);
  58. #define TRACE_RET printk(")")
  59. #else /* !TRACING */
  60. #define TRACE_TEXT(str) ((void) 0)
  61. #define TRACE_RET ((void) 0)
  62. #endif /* TRACING */
  63. static DEFINE_MUTEX(dtlk_mutex);
  64. static void dtlk_timer_tick(unsigned long data);
  65. static int dtlk_major;
  66. static int dtlk_port_lpc;
  67. static int dtlk_port_tts;
  68. static int dtlk_busy;
  69. static int dtlk_has_indexing;
  70. static unsigned int dtlk_portlist[] =
  71. {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0};
  72. static wait_queue_head_t dtlk_process_list;
  73. static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick, 0, 0);
  74. /* prototypes for file_operations struct */
  75. static ssize_t dtlk_read(struct file *, char __user *,
  76. size_t nbytes, loff_t * ppos);
  77. static ssize_t dtlk_write(struct file *, const char __user *,
  78. size_t nbytes, loff_t * ppos);
  79. static unsigned int dtlk_poll(struct file *, poll_table *);
  80. static int dtlk_open(struct inode *, struct file *);
  81. static int dtlk_release(struct inode *, struct file *);
  82. static long dtlk_ioctl(struct file *file,
  83. unsigned int cmd, unsigned long arg);
  84. static const struct file_operations dtlk_fops =
  85. {
  86. .owner = THIS_MODULE,
  87. .read = dtlk_read,
  88. .write = dtlk_write,
  89. .poll = dtlk_poll,
  90. .unlocked_ioctl = dtlk_ioctl,
  91. .open = dtlk_open,
  92. .release = dtlk_release,
  93. .llseek = no_llseek,
  94. };
  95. /* local prototypes */
  96. static int dtlk_dev_probe(void);
  97. static struct dtlk_settings *dtlk_interrogate(void);
  98. static int dtlk_readable(void);
  99. static char dtlk_read_lpc(void);
  100. static char dtlk_read_tts(void);
  101. static int dtlk_writeable(void);
  102. static char dtlk_write_bytes(const char *buf, int n);
  103. static char dtlk_write_tts(char);
  104. /*
  105. static void dtlk_handle_error(char, char, unsigned int);
  106. */
  107. static ssize_t dtlk_read(struct file *file, char __user *buf,
  108. size_t count, loff_t * ppos)
  109. {
  110. unsigned int minor = iminor(file_inode(file));
  111. char ch;
  112. int i = 0, retries;
  113. TRACE_TEXT("(dtlk_read");
  114. /* printk("DoubleTalk PC - dtlk_read()\n"); */
  115. if (minor != DTLK_MINOR || !dtlk_has_indexing)
  116. return -EINVAL;
  117. for (retries = 0; retries < loops_per_jiffy; retries++) {
  118. while (i < count && dtlk_readable()) {
  119. ch = dtlk_read_lpc();
  120. /* printk("dtlk_read() reads 0x%02x\n", ch); */
  121. if (put_user(ch, buf++))
  122. return -EFAULT;
  123. i++;
  124. }
  125. if (i)
  126. return i;
  127. if (file->f_flags & O_NONBLOCK)
  128. break;
  129. msleep_interruptible(100);
  130. }
  131. if (retries == loops_per_jiffy)
  132. printk(KERN_ERR "dtlk_read times out\n");
  133. TRACE_RET;
  134. return -EAGAIN;
  135. }
  136. static ssize_t dtlk_write(struct file *file, const char __user *buf,
  137. size_t count, loff_t * ppos)
  138. {
  139. int i = 0, retries = 0, ch;
  140. TRACE_TEXT("(dtlk_write");
  141. #ifdef TRACING
  142. printk(" \"");
  143. {
  144. int i, ch;
  145. for (i = 0; i < count; i++) {
  146. if (get_user(ch, buf + i))
  147. return -EFAULT;
  148. if (' ' <= ch && ch <= '~')
  149. printk("%c", ch);
  150. else
  151. printk("\\%03o", ch);
  152. }
  153. printk("\"");
  154. }
  155. #endif
  156. if (iminor(file_inode(file)) != DTLK_MINOR)
  157. return -EINVAL;
  158. while (1) {
  159. while (i < count && !get_user(ch, buf) &&
  160. (ch == DTLK_CLEAR || dtlk_writeable())) {
  161. dtlk_write_tts(ch);
  162. buf++;
  163. i++;
  164. if (i % 5 == 0)
  165. /* We yield our time until scheduled
  166. again. This reduces the transfer
  167. rate to 500 bytes/sec, but that's
  168. still enough to keep up with the
  169. speech synthesizer. */
  170. msleep_interruptible(1);
  171. else {
  172. /* the RDY bit goes zero 2-3 usec
  173. after writing, and goes 1 again
  174. 180-190 usec later. Here, we wait
  175. up to 250 usec for the RDY bit to
  176. go nonzero. */
  177. for (retries = 0;
  178. retries < loops_per_jiffy / (4000/HZ);
  179. retries++)
  180. if (inb_p(dtlk_port_tts) &
  181. TTS_WRITABLE)
  182. break;
  183. }
  184. retries = 0;
  185. }
  186. if (i == count)
  187. return i;
  188. if (file->f_flags & O_NONBLOCK)
  189. break;
  190. msleep_interruptible(1);
  191. if (++retries > 10 * HZ) { /* wait no more than 10 sec
  192. from last write */
  193. printk("dtlk: write timeout. "
  194. "inb_p(dtlk_port_tts) = 0x%02x\n",
  195. inb_p(dtlk_port_tts));
  196. TRACE_RET;
  197. return -EBUSY;
  198. }
  199. }
  200. TRACE_RET;
  201. return -EAGAIN;
  202. }
  203. static unsigned int dtlk_poll(struct file *file, poll_table * wait)
  204. {
  205. int mask = 0;
  206. unsigned long expires;
  207. TRACE_TEXT(" dtlk_poll");
  208. /*
  209. static long int j;
  210. printk(".");
  211. printk("<%ld>", jiffies-j);
  212. j=jiffies;
  213. */
  214. poll_wait(file, &dtlk_process_list, wait);
  215. if (dtlk_has_indexing && dtlk_readable()) {
  216. del_timer(&dtlk_timer);
  217. mask = POLLIN | POLLRDNORM;
  218. }
  219. if (dtlk_writeable()) {
  220. del_timer(&dtlk_timer);
  221. mask |= POLLOUT | POLLWRNORM;
  222. }
  223. /* there are no exception conditions */
  224. /* There won't be any interrupts, so we set a timer instead. */
  225. expires = jiffies + 3*HZ / 100;
  226. mod_timer(&dtlk_timer, expires);
  227. return mask;
  228. }
  229. static void dtlk_timer_tick(unsigned long data)
  230. {
  231. TRACE_TEXT(" dtlk_timer_tick");
  232. wake_up_interruptible(&dtlk_process_list);
  233. }
  234. static long dtlk_ioctl(struct file *file,
  235. unsigned int cmd,
  236. unsigned long arg)
  237. {
  238. char __user *argp = (char __user *)arg;
  239. struct dtlk_settings *sp;
  240. char portval;
  241. TRACE_TEXT(" dtlk_ioctl");
  242. switch (cmd) {
  243. case DTLK_INTERROGATE:
  244. mutex_lock(&dtlk_mutex);
  245. sp = dtlk_interrogate();
  246. mutex_unlock(&dtlk_mutex);
  247. if (copy_to_user(argp, sp, sizeof(struct dtlk_settings)))
  248. return -EINVAL;
  249. return 0;
  250. case DTLK_STATUS:
  251. portval = inb_p(dtlk_port_tts);
  252. return put_user(portval, argp);
  253. default:
  254. return -EINVAL;
  255. }
  256. }
  257. /* Note that nobody ever sets dtlk_busy... */
  258. static int dtlk_open(struct inode *inode, struct file *file)
  259. {
  260. TRACE_TEXT("(dtlk_open");
  261. nonseekable_open(inode, file);
  262. switch (iminor(inode)) {
  263. case DTLK_MINOR:
  264. if (dtlk_busy)
  265. return -EBUSY;
  266. return nonseekable_open(inode, file);
  267. default:
  268. return -ENXIO;
  269. }
  270. }
  271. static int dtlk_release(struct inode *inode, struct file *file)
  272. {
  273. TRACE_TEXT("(dtlk_release");
  274. switch (iminor(inode)) {
  275. case DTLK_MINOR:
  276. break;
  277. default:
  278. break;
  279. }
  280. TRACE_RET;
  281. del_timer_sync(&dtlk_timer);
  282. return 0;
  283. }
  284. static int __init dtlk_init(void)
  285. {
  286. int err;
  287. dtlk_port_lpc = 0;
  288. dtlk_port_tts = 0;
  289. dtlk_busy = 0;
  290. dtlk_major = register_chrdev(0, "dtlk", &dtlk_fops);
  291. if (dtlk_major < 0) {
  292. printk(KERN_ERR "DoubleTalk PC - cannot register device\n");
  293. return dtlk_major;
  294. }
  295. err = dtlk_dev_probe();
  296. if (err) {
  297. unregister_chrdev(dtlk_major, "dtlk");
  298. return err;
  299. }
  300. printk(", MAJOR %d\n", dtlk_major);
  301. init_waitqueue_head(&dtlk_process_list);
  302. return 0;
  303. }
  304. static void __exit dtlk_cleanup (void)
  305. {
  306. dtlk_write_bytes("goodbye", 8);
  307. msleep_interruptible(500); /* nap 0.50 sec but
  308. could be awakened
  309. earlier by
  310. signals... */
  311. dtlk_write_tts(DTLK_CLEAR);
  312. unregister_chrdev(dtlk_major, "dtlk");
  313. release_region(dtlk_port_lpc, DTLK_IO_EXTENT);
  314. }
  315. module_init(dtlk_init);
  316. module_exit(dtlk_cleanup);
  317. /* ------------------------------------------------------------------------ */
  318. static int dtlk_readable(void)
  319. {
  320. #ifdef TRACING
  321. printk(" dtlk_readable=%u@%u", inb_p(dtlk_port_lpc) != 0x7f, jiffies);
  322. #endif
  323. return inb_p(dtlk_port_lpc) != 0x7f;
  324. }
  325. static int dtlk_writeable(void)
  326. {
  327. /* TRACE_TEXT(" dtlk_writeable"); */
  328. #ifdef TRACINGMORE
  329. printk(" dtlk_writeable=%u", (inb_p(dtlk_port_tts) & TTS_WRITABLE)!=0);
  330. #endif
  331. return inb_p(dtlk_port_tts) & TTS_WRITABLE;
  332. }
  333. static int __init dtlk_dev_probe(void)
  334. {
  335. unsigned int testval = 0;
  336. int i = 0;
  337. struct dtlk_settings *sp;
  338. if (dtlk_port_lpc | dtlk_port_tts)
  339. return -EBUSY;
  340. for (i = 0; dtlk_portlist[i]; i++) {
  341. #if 0
  342. printk("DoubleTalk PC - Port %03x = %04x\n",
  343. dtlk_portlist[i], (testval = inw_p(dtlk_portlist[i])));
  344. #endif
  345. if (!request_region(dtlk_portlist[i], DTLK_IO_EXTENT,
  346. "dtlk"))
  347. continue;
  348. testval = inw_p(dtlk_portlist[i]);
  349. if ((testval &= 0xfbff) == 0x107f) {
  350. dtlk_port_lpc = dtlk_portlist[i];
  351. dtlk_port_tts = dtlk_port_lpc + 1;
  352. sp = dtlk_interrogate();
  353. printk("DoubleTalk PC at %03x-%03x, "
  354. "ROM version %s, serial number %u",
  355. dtlk_portlist[i], dtlk_portlist[i] +
  356. DTLK_IO_EXTENT - 1,
  357. sp->rom_version, sp->serial_number);
  358. /* put LPC port into known state, so
  359. dtlk_readable() gives valid result */
  360. outb_p(0xff, dtlk_port_lpc);
  361. /* INIT string and index marker */
  362. dtlk_write_bytes("\036\1@\0\0012I\r", 8);
  363. /* posting an index takes 18 msec. Here, we
  364. wait up to 100 msec to see whether it
  365. appears. */
  366. msleep_interruptible(100);
  367. dtlk_has_indexing = dtlk_readable();
  368. #ifdef TRACING
  369. printk(", indexing %d\n", dtlk_has_indexing);
  370. #endif
  371. #ifdef INSCOPE
  372. {
  373. /* This macro records ten samples read from the LPC port, for later display */
  374. #define LOOK \
  375. for (i = 0; i < 10; i++) \
  376. { \
  377. buffer[b++] = inb_p(dtlk_port_lpc); \
  378. __delay(loops_per_jiffy/(1000000/HZ)); \
  379. }
  380. char buffer[1000];
  381. int b = 0, i, j;
  382. LOOK
  383. outb_p(0xff, dtlk_port_lpc);
  384. buffer[b++] = 0;
  385. LOOK
  386. dtlk_write_bytes("\0012I\r", 4);
  387. buffer[b++] = 0;
  388. __delay(50 * loops_per_jiffy / (1000/HZ));
  389. outb_p(0xff, dtlk_port_lpc);
  390. buffer[b++] = 0;
  391. LOOK
  392. printk("\n");
  393. for (j = 0; j < b; j++)
  394. printk(" %02x", buffer[j]);
  395. printk("\n");
  396. }
  397. #endif /* INSCOPE */
  398. #ifdef OUTSCOPE
  399. {
  400. /* This macro records ten samples read from the TTS port, for later display */
  401. #define LOOK \
  402. for (i = 0; i < 10; i++) \
  403. { \
  404. buffer[b++] = inb_p(dtlk_port_tts); \
  405. __delay(loops_per_jiffy/(1000000/HZ)); /* 1 us */ \
  406. }
  407. char buffer[1000];
  408. int b = 0, i, j;
  409. mdelay(10); /* 10 ms */
  410. LOOK
  411. outb_p(0x03, dtlk_port_tts);
  412. buffer[b++] = 0;
  413. LOOK
  414. LOOK
  415. printk("\n");
  416. for (j = 0; j < b; j++)
  417. printk(" %02x", buffer[j]);
  418. printk("\n");
  419. }
  420. #endif /* OUTSCOPE */
  421. dtlk_write_bytes("Double Talk found", 18);
  422. return 0;
  423. }
  424. release_region(dtlk_portlist[i], DTLK_IO_EXTENT);
  425. }
  426. printk(KERN_INFO "DoubleTalk PC - not found\n");
  427. return -ENODEV;
  428. }
  429. /*
  430. static void dtlk_handle_error(char op, char rc, unsigned int minor)
  431. {
  432. printk(KERN_INFO"\nDoubleTalk PC - MINOR: %d, OPCODE: %d, ERROR: %d\n",
  433. minor, op, rc);
  434. return;
  435. }
  436. */
  437. /* interrogate the DoubleTalk PC and return its settings */
  438. static struct dtlk_settings *dtlk_interrogate(void)
  439. {
  440. unsigned char *t;
  441. static char buf[sizeof(struct dtlk_settings) + 1];
  442. int total, i;
  443. static struct dtlk_settings status;
  444. TRACE_TEXT("(dtlk_interrogate");
  445. dtlk_write_bytes("\030\001?", 3);
  446. for (total = 0, i = 0; i < 50; i++) {
  447. buf[total] = dtlk_read_tts();
  448. if (total > 2 && buf[total] == 0x7f)
  449. break;
  450. if (total < sizeof(struct dtlk_settings))
  451. total++;
  452. }
  453. /*
  454. if (i==50) printk("interrogate() read overrun\n");
  455. for (i=0; i<sizeof(buf); i++)
  456. printk(" %02x", buf[i]);
  457. printk("\n");
  458. */
  459. t = buf;
  460. status.serial_number = t[0] + t[1] * 256; /* serial number is
  461. little endian */
  462. t += 2;
  463. i = 0;
  464. while (*t != '\r') {
  465. status.rom_version[i] = *t;
  466. if (i < sizeof(status.rom_version) - 1)
  467. i++;
  468. t++;
  469. }
  470. status.rom_version[i] = 0;
  471. t++;
  472. status.mode = *t++;
  473. status.punc_level = *t++;
  474. status.formant_freq = *t++;
  475. status.pitch = *t++;
  476. status.speed = *t++;
  477. status.volume = *t++;
  478. status.tone = *t++;
  479. status.expression = *t++;
  480. status.ext_dict_loaded = *t++;
  481. status.ext_dict_status = *t++;
  482. status.free_ram = *t++;
  483. status.articulation = *t++;
  484. status.reverb = *t++;
  485. status.eob = *t++;
  486. status.has_indexing = dtlk_has_indexing;
  487. TRACE_RET;
  488. return &status;
  489. }
  490. static char dtlk_read_tts(void)
  491. {
  492. int portval, retries = 0;
  493. char ch;
  494. TRACE_TEXT("(dtlk_read_tts");
  495. /* verify DT is ready, read char, wait for ACK */
  496. do {
  497. portval = inb_p(dtlk_port_tts);
  498. } while ((portval & TTS_READABLE) == 0 &&
  499. retries++ < DTLK_MAX_RETRIES);
  500. if (retries > DTLK_MAX_RETRIES)
  501. printk(KERN_ERR "dtlk_read_tts() timeout\n");
  502. ch = inb_p(dtlk_port_tts); /* input from TTS port */
  503. ch &= 0x7f;
  504. outb_p(ch, dtlk_port_tts);
  505. retries = 0;
  506. do {
  507. portval = inb_p(dtlk_port_tts);
  508. } while ((portval & TTS_READABLE) != 0 &&
  509. retries++ < DTLK_MAX_RETRIES);
  510. if (retries > DTLK_MAX_RETRIES)
  511. printk(KERN_ERR "dtlk_read_tts() timeout\n");
  512. TRACE_RET;
  513. return ch;
  514. }
  515. static char dtlk_read_lpc(void)
  516. {
  517. int retries = 0;
  518. char ch;
  519. TRACE_TEXT("(dtlk_read_lpc");
  520. /* no need to test -- this is only called when the port is readable */
  521. ch = inb_p(dtlk_port_lpc); /* input from LPC port */
  522. outb_p(0xff, dtlk_port_lpc);
  523. /* acknowledging a read takes 3-4
  524. usec. Here, we wait up to 20 usec
  525. for the acknowledgement */
  526. retries = (loops_per_jiffy * 20) / (1000000/HZ);
  527. while (inb_p(dtlk_port_lpc) != 0x7f && --retries > 0);
  528. if (retries == 0)
  529. printk(KERN_ERR "dtlk_read_lpc() timeout\n");
  530. TRACE_RET;
  531. return ch;
  532. }
  533. /* write n bytes to tts port */
  534. static char dtlk_write_bytes(const char *buf, int n)
  535. {
  536. char val = 0;
  537. /* printk("dtlk_write_bytes(\"%-*s\", %d)\n", n, buf, n); */
  538. TRACE_TEXT("(dtlk_write_bytes");
  539. while (n-- > 0)
  540. val = dtlk_write_tts(*buf++);
  541. TRACE_RET;
  542. return val;
  543. }
  544. static char dtlk_write_tts(char ch)
  545. {
  546. int retries = 0;
  547. #ifdef TRACINGMORE
  548. printk(" dtlk_write_tts(");
  549. if (' ' <= ch && ch <= '~')
  550. printk("'%c'", ch);
  551. else
  552. printk("0x%02x", ch);
  553. #endif
  554. if (ch != DTLK_CLEAR) /* no flow control for CLEAR command */
  555. while ((inb_p(dtlk_port_tts) & TTS_WRITABLE) == 0 &&
  556. retries++ < DTLK_MAX_RETRIES) /* DT ready? */
  557. ;
  558. if (retries > DTLK_MAX_RETRIES)
  559. printk(KERN_ERR "dtlk_write_tts() timeout\n");
  560. outb_p(ch, dtlk_port_tts); /* output to TTS port */
  561. /* the RDY bit goes zero 2-3 usec after writing, and goes
  562. 1 again 180-190 usec later. Here, we wait up to 10
  563. usec for the RDY bit to go zero. */
  564. for (retries = 0; retries < loops_per_jiffy / (100000/HZ); retries++)
  565. if ((inb_p(dtlk_port_tts) & TTS_WRITABLE) == 0)
  566. break;
  567. #ifdef TRACINGMORE
  568. printk(")\n");
  569. #endif
  570. return 0;
  571. }
  572. MODULE_LICENSE("GPL");