dtlk.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /* -*- linux-c -*-
  3. * dtlk.c - DoubleTalk PC driver for Linux
  4. *
  5. * Original author: Chris Pallotta <chris@allmedia.com>
  6. * Current maintainer: Jim Van Zandt <jrv@vanzandt.mv.com>
  7. *
  8. * 2000-03-18 Jim Van Zandt: Fix polling.
  9. * Eliminate dtlk_timer_active flag and separate dtlk_stop_timer
  10. * function. Don't restart timer in dtlk_timer_tick. Restart timer
  11. * in dtlk_poll after every poll. dtlk_poll returns mask (duh).
  12. * Eliminate unused function dtlk_write_byte. Misc. code cleanups.
  13. */
  14. /* This driver is for the DoubleTalk PC, a speech synthesizer
  15. manufactured by RC Systems (http://www.rcsys.com/). It was written
  16. based on documentation in their User's Manual file and Developer's
  17. Tools disk.
  18. The DoubleTalk PC contains four voice synthesizers: text-to-speech
  19. (TTS), linear predictive coding (LPC), PCM/ADPCM, and CVSD. It
  20. also has a tone generator. Output data for LPC are written to the
  21. LPC port, and output data for the other modes are written to the
  22. TTS port.
  23. Two kinds of data can be read from the DoubleTalk: status
  24. information (in response to the "\001?" interrogation command) is
  25. read from the TTS port, and index markers (which mark the progress
  26. of the speech) are read from the LPC port. Not all models of the
  27. DoubleTalk PC implement index markers. Both the TTS and LPC ports
  28. can also display status flags.
  29. The DoubleTalk PC generates no interrupts.
  30. These characteristics are mapped into the Unix stream I/O model as
  31. follows:
  32. "write" sends bytes to the TTS port. It is the responsibility of
  33. the user program to switch modes among TTS, PCM/ADPCM, and CVSD.
  34. This driver was written for use with the text-to-speech
  35. synthesizer. If LPC output is needed some day, other minor device
  36. numbers can be used to select among output modes.
  37. "read" gets index markers from the LPC port. If the device does
  38. not implement index markers, the read will fail with error EINVAL.
  39. Status information is available using the DTLK_INTERROGATE ioctl.
  40. */
  41. #include <linux/module.h>
  42. #define KERNEL
  43. #include <linux/types.h>
  44. #include <linux/fs.h>
  45. #include <linux/mm.h>
  46. #include <linux/errno.h> /* for -EBUSY */
  47. #include <linux/ioport.h> /* for request_region */
  48. #include <linux/delay.h> /* for loops_per_jiffy */
  49. #include <linux/sched.h>
  50. #include <linux/mutex.h>
  51. #include <asm/io.h> /* for inb_p, outb_p, inb, outb, etc. */
  52. #include <linux/uaccess.h> /* for get_user, etc. */
  53. #include <linux/wait.h> /* for wait_queue */
  54. #include <linux/init.h> /* for __init, module_{init,exit} */
  55. #include <linux/poll.h> /* for EPOLLIN, etc. */
  56. #include <linux/dtlk.h> /* local header file for DoubleTalk values */
  57. #ifdef TRACING
  58. #define TRACE_TEXT(str) printk(str);
  59. #define TRACE_RET printk(")")
  60. #else /* !TRACING */
  61. #define TRACE_TEXT(str) ((void) 0)
  62. #define TRACE_RET ((void) 0)
  63. #endif /* TRACING */
  64. static DEFINE_MUTEX(dtlk_mutex);
  65. static void dtlk_timer_tick(struct timer_list *unused);
  66. static int dtlk_major;
  67. static int dtlk_port_lpc;
  68. static int dtlk_port_tts;
  69. static int dtlk_busy;
  70. static int dtlk_has_indexing;
  71. static unsigned int dtlk_portlist[] =
  72. {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0};
  73. static wait_queue_head_t dtlk_process_list;
  74. static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick);
  75. /* prototypes for file_operations struct */
  76. static ssize_t dtlk_read(struct file *, char __user *,
  77. size_t nbytes, loff_t * ppos);
  78. static ssize_t dtlk_write(struct file *, const char __user *,
  79. size_t nbytes, loff_t * ppos);
  80. static __poll_t dtlk_poll(struct file *, poll_table *);
  81. static int dtlk_open(struct inode *, struct file *);
  82. static int dtlk_release(struct inode *, struct file *);
  83. static long dtlk_ioctl(struct file *file,
  84. unsigned int cmd, unsigned long arg);
  85. static const struct file_operations dtlk_fops =
  86. {
  87. .owner = THIS_MODULE,
  88. .read = dtlk_read,
  89. .write = dtlk_write,
  90. .poll = dtlk_poll,
  91. .unlocked_ioctl = dtlk_ioctl,
  92. .open = dtlk_open,
  93. .release = dtlk_release,
  94. .llseek = no_llseek,
  95. };
  96. /* local prototypes */
  97. static int dtlk_dev_probe(void);
  98. static struct dtlk_settings *dtlk_interrogate(void);
  99. static int dtlk_readable(void);
  100. static char dtlk_read_lpc(void);
  101. static char dtlk_read_tts(void);
  102. static int dtlk_writeable(void);
  103. static char dtlk_write_bytes(const char *buf, int n);
  104. static char dtlk_write_tts(char);
  105. /*
  106. static void dtlk_handle_error(char, char, unsigned int);
  107. */
  108. static ssize_t dtlk_read(struct file *file, char __user *buf,
  109. size_t count, loff_t * ppos)
  110. {
  111. unsigned int minor = iminor(file_inode(file));
  112. char ch;
  113. int i = 0, retries;
  114. TRACE_TEXT("(dtlk_read");
  115. /* printk("DoubleTalk PC - dtlk_read()\n"); */
  116. if (minor != DTLK_MINOR || !dtlk_has_indexing)
  117. return -EINVAL;
  118. for (retries = 0; retries < loops_per_jiffy; retries++) {
  119. while (i < count && dtlk_readable()) {
  120. ch = dtlk_read_lpc();
  121. /* printk("dtlk_read() reads 0x%02x\n", ch); */
  122. if (put_user(ch, buf++))
  123. return -EFAULT;
  124. i++;
  125. }
  126. if (i)
  127. return i;
  128. if (file->f_flags & O_NONBLOCK)
  129. break;
  130. msleep_interruptible(100);
  131. }
  132. if (retries == loops_per_jiffy)
  133. printk(KERN_ERR "dtlk_read times out\n");
  134. TRACE_RET;
  135. return -EAGAIN;
  136. }
  137. static ssize_t dtlk_write(struct file *file, const char __user *buf,
  138. size_t count, loff_t * ppos)
  139. {
  140. int i = 0, retries = 0, ch;
  141. TRACE_TEXT("(dtlk_write");
  142. #ifdef TRACING
  143. printk(" \"");
  144. {
  145. int i, ch;
  146. for (i = 0; i < count; i++) {
  147. if (get_user(ch, buf + i))
  148. return -EFAULT;
  149. if (' ' <= ch && ch <= '~')
  150. printk("%c", ch);
  151. else
  152. printk("\\%03o", ch);
  153. }
  154. printk("\"");
  155. }
  156. #endif
  157. if (iminor(file_inode(file)) != DTLK_MINOR)
  158. return -EINVAL;
  159. while (1) {
  160. while (i < count && !get_user(ch, buf) &&
  161. (ch == DTLK_CLEAR || dtlk_writeable())) {
  162. dtlk_write_tts(ch);
  163. buf++;
  164. i++;
  165. if (i % 5 == 0)
  166. /* We yield our time until scheduled
  167. again. This reduces the transfer
  168. rate to 500 bytes/sec, but that's
  169. still enough to keep up with the
  170. speech synthesizer. */
  171. msleep_interruptible(1);
  172. else {
  173. /* the RDY bit goes zero 2-3 usec
  174. after writing, and goes 1 again
  175. 180-190 usec later. Here, we wait
  176. up to 250 usec for the RDY bit to
  177. go nonzero. */
  178. for (retries = 0;
  179. retries < loops_per_jiffy / (4000/HZ);
  180. retries++)
  181. if (inb_p(dtlk_port_tts) &
  182. TTS_WRITABLE)
  183. break;
  184. }
  185. retries = 0;
  186. }
  187. if (i == count)
  188. return i;
  189. if (file->f_flags & O_NONBLOCK)
  190. break;
  191. msleep_interruptible(1);
  192. if (++retries > 10 * HZ) { /* wait no more than 10 sec
  193. from last write */
  194. printk("dtlk: write timeout. "
  195. "inb_p(dtlk_port_tts) = 0x%02x\n",
  196. inb_p(dtlk_port_tts));
  197. TRACE_RET;
  198. return -EBUSY;
  199. }
  200. }
  201. TRACE_RET;
  202. return -EAGAIN;
  203. }
  204. static __poll_t dtlk_poll(struct file *file, poll_table * wait)
  205. {
  206. __poll_t mask = 0;
  207. unsigned long expires;
  208. TRACE_TEXT(" dtlk_poll");
  209. /*
  210. static long int j;
  211. printk(".");
  212. printk("<%ld>", jiffies-j);
  213. j=jiffies;
  214. */
  215. poll_wait(file, &dtlk_process_list, wait);
  216. if (dtlk_has_indexing && dtlk_readable()) {
  217. del_timer(&dtlk_timer);
  218. mask = EPOLLIN | EPOLLRDNORM;
  219. }
  220. if (dtlk_writeable()) {
  221. del_timer(&dtlk_timer);
  222. mask |= EPOLLOUT | EPOLLWRNORM;
  223. }
  224. /* there are no exception conditions */
  225. /* There won't be any interrupts, so we set a timer instead. */
  226. expires = jiffies + 3*HZ / 100;
  227. mod_timer(&dtlk_timer, expires);
  228. return mask;
  229. }
  230. static void dtlk_timer_tick(struct timer_list *unused)
  231. {
  232. TRACE_TEXT(" dtlk_timer_tick");
  233. wake_up_interruptible(&dtlk_process_list);
  234. }
  235. static long dtlk_ioctl(struct file *file,
  236. unsigned int cmd,
  237. unsigned long arg)
  238. {
  239. char __user *argp = (char __user *)arg;
  240. struct dtlk_settings *sp;
  241. char portval;
  242. TRACE_TEXT(" dtlk_ioctl");
  243. switch (cmd) {
  244. case DTLK_INTERROGATE:
  245. mutex_lock(&dtlk_mutex);
  246. sp = dtlk_interrogate();
  247. mutex_unlock(&dtlk_mutex);
  248. if (copy_to_user(argp, sp, sizeof(struct dtlk_settings)))
  249. return -EINVAL;
  250. return 0;
  251. case DTLK_STATUS:
  252. portval = inb_p(dtlk_port_tts);
  253. return put_user(portval, argp);
  254. default:
  255. return -EINVAL;
  256. }
  257. }
  258. /* Note that nobody ever sets dtlk_busy... */
  259. static int dtlk_open(struct inode *inode, struct file *file)
  260. {
  261. TRACE_TEXT("(dtlk_open");
  262. switch (iminor(inode)) {
  263. case DTLK_MINOR:
  264. if (dtlk_busy)
  265. return -EBUSY;
  266. return stream_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");