Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / netisdn / i4b_tel.c
blob22d115957c97585521580df3496acb7144f8f3be
1 /*
2 * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
25 *---------------------------------------------------------------------------
27 * i4b_tel.c - device driver for ISDN telephony
28 * --------------------------------------------
30 * $Id: i4b_tel.c,v 1.24 2009/03/18 10:22:43 cegger Exp $
32 * $FreeBSD$
34 * last edit-date: [Fri Jan 5 11:33:47 2001]
36 *---------------------------------------------------------------------------*/
38 #include <sys/cdefs.h>
39 __KERNEL_RCSID(0, "$NetBSD: i4b_tel.c,v 1.23 2009/03/14 14:46:11 dsl Exp $");
41 #include "isdntel.h"
43 #if NISDNTEL > 0
45 #undef I4BTELDEBUG
47 #include <sys/param.h>
48 #include <sys/systm.h>
50 #if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__)
51 #include <sys/ioccom.h>
52 #include <sys/poll.h>
53 #else
54 #include <sys/ioctl.h>
55 #include <sys/fcntl.h>
56 #endif
58 #include <sys/conf.h>
59 #include <sys/uio.h>
60 #include <sys/kernel.h>
61 #include <sys/mbuf.h>
62 #include <sys/socket.h>
63 #include <net/if.h>
64 #include <sys/proc.h>
65 #include <sys/tty.h>
67 #ifdef __FreeBSD__
69 #if defined(__FreeBSD__) && __FreeBSD__ == 3
70 #include "opt_devfs.h"
71 #endif
73 #ifdef DEVFS
74 #include <sys/devfsext.h>
75 #endif
77 #endif /* __FreeBSD__ */
79 #ifdef __bsdi__
80 #include <sys/device.h>
81 #endif
83 #ifdef __FreeBSD__
84 #include <machine/i4b_ioctl.h>
85 #include <machine/i4b_tel_ioctl.h>
86 #include <machine/i4b_debug.h>
87 #else
88 #include <netisdn/i4b_ioctl.h>
89 #include <netisdn/i4b_tel_ioctl.h>
90 #include <netisdn/i4b_debug.h>
91 #endif
93 #include <netisdn/i4b_global.h>
94 #include <netisdn/i4b_mbuf.h>
95 #include <netisdn/i4b_l3l4.h>
97 #include <netisdn/i4b_l4.h>
99 /* minor number: lower 6 bits = unit number */
100 #define UNITBITS 6
101 #define UNITMASK 0x3f
102 #define UNIT(n) (minor(n) & UNITMASK)
104 /* minor number: upper 2 bits = function number */
106 #define FUNCMASK 0x03
107 #define FUNC(n) (((minor(n)) >> UNITBITS) & FUNCMASK)
109 #define FUNCTEL 0 /* 0 = normal i4btel device */
110 #define FUNCDIAL 1 /* 1 = i4bteld dialout device */
112 #define NOFUNCS 2 /* number of device classes */
114 typedef struct tel_softc {
116 /* used only in func = FUNCTEL */
118 isdn_link_t *isdn_linktab; /* isdn linktab */
119 int audiofmt; /* audio format conversion */
120 u_char *rcvttab; /* conversion table on read */
121 u_char *wcvttab; /* conversion table on write */
122 call_desc_t *cdp; /* call descriptor pointer */
124 /* link from FUNCTEL to FUNCDIAL */
125 struct tel_softc * dialer;
127 /* used only in func = FUNCDIAL */
129 char result; /* result code for dial dev */
131 /* used in func = FUNCDIAL and func = FUNCTEL*/
133 int devstate; /* state of this unit */
134 #define ST_IDLE 0x00 /* idle */
135 #define ST_CONNECTED 0x01 /* isdn connected state */
136 #define ST_ISOPEN 0x02 /* userland opened */
137 #define ST_RDWAITDATA 0x04 /* userland read waiting */
138 #define ST_WRWAITEMPTY 0x08 /* userland write waiting */
139 #define ST_TONE 0x10 /* tone generator */
141 struct selinfo selp; /* select / poll */
143 #if defined(__FreeBSD__) && __FreeBSD__ == 3
144 #ifdef DEVFS
145 void *devfs_token; /* token for DEVFS */
146 #endif
147 #endif
148 struct i4b_tel_tones tones;
149 int toneidx;
150 int toneomega;
151 int tonefreq;
153 } tel_sc_t;
155 static tel_sc_t tel_sc[NISDNTEL][NOFUNCS];
157 /* forward decl */
159 static void tel_rx_data_rdy(void *softc);
160 static void tel_tx_queue_empty(void *softc);
161 static void tel_connect(void *softc, void *cdp);
162 static void tel_disconnect(void *softc, void *cdp);
163 static void tel_tone(tel_sc_t *sc);
164 static void tel_activity(void *softc, int rxtx);
165 static void tel_updown(void *softc, int updown);
166 static void tel_dialresponse(void *softc, int status, cause_t cause);
167 static void* tel_get_softc(int unit);
168 static void tel_set_linktab(void *softc, isdn_link_t *ilt);
170 /* audio format conversion tables */
171 static unsigned char a2u_tab[];
172 static unsigned char u2a_tab[];
173 static unsigned char bitreverse[];
174 static u_char sinetab[];
176 #ifndef __FreeBSD__
177 #define PDEVSTATIC /* - not static - */
178 PDEVSTATIC void isdntelattach(void);
179 PDEVSTATIC int isdntelioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l);
181 int isdntelopen(dev_t dev, int flag, int fmt, struct lwp *l);
182 int isdntelclose(dev_t dev, int flag, int fmt, struct lwp *l);
183 int isdntelread(dev_t dev, struct uio *uio, int ioflag);
184 int isdntelwrite(dev_t dev, struct uio * uio, int ioflag);
186 #ifdef OS_USES_POLL
187 int isdntelpoll(dev_t dev, int events, struct lwp *l);
188 int isdntelkqfilter(dev_t dev, struct knote *kn);
189 #else
190 int isdntelsel(dev_t dev, int rw, struct lwp *l);
191 #endif
193 #endif /* __FreeBSD__ */
195 #ifdef __NetBSD__
196 const struct cdevsw isdntel_cdevsw = {
197 isdntelopen, isdntelclose, isdntelread, isdntelwrite, isdntelioctl,
198 nostop, notty, isdntelpoll, nommap, isdntelkqfilter, D_OTHER
200 #endif /* __NetBSD__ */
202 #if BSD > 199306 && defined(__FreeBSD__)
204 #define PDEVSTATIC static
205 PDEVSTATIC d_open_t i4btelopen;
206 PDEVSTATIC d_close_t i4btelclose;
207 PDEVSTATIC d_read_t i4btelread;
208 PDEVSTATIC d_read_t i4btelwrite;
209 PDEVSTATIC d_ioctl_t i4btelioctl;
211 #ifdef OS_USES_POLL
212 PDEVSTATIC d_poll_t i4btelpoll;
213 #define POLLFIELD i4btelpoll
214 #else
215 PDEVSTATIC d_select_t i4btelsel;
216 #define POLLFIELD i4btelsel
217 #endif
219 #define CDEV_MAJOR 56
221 #if defined(__FreeBSD__) && __FreeBSD__ >= 4
222 static struct cdevsw i4btel_cdevsw = {
223 /* open */ i4btelopen,
224 /* close */ i4btelclose,
225 /* read */ i4btelread,
226 /* write */ i4btelwrite,
227 /* ioctl */ i4btelioctl,
228 /* poll */ POLLFIELD,
229 /* mmap */ nommap,
230 /* strategy */ nostrategy,
231 /* name */ "i4btel",
232 /* maj */ CDEV_MAJOR,
233 /* dump */ nodump,
234 /* psize */ nopsize,
235 /* flags */ 0,
236 /* bmaj */ -1
238 #else
239 static struct cdevsw i4btel_cdevsw = {
240 i4btelopen, i4btelclose, i4btelread, i4btelwrite,
241 i4btelioctl, nostop, noreset, nodevtotty,
242 POLLFIELD, nommap, NULL, "i4btel", NULL, -1
244 #endif
246 PDEVSTATIC void isdntelinit(void *unused);
247 PDEVSTATIC void isdntelattach(void *);
249 PSEUDO_SET(isdntelattach, i4b_tel);
251 /*===========================================================================*
252 * DEVICE DRIVER ROUTINES
253 *===========================================================================*/
255 /*---------------------------------------------------------------------------*
256 * initialization at kernel load time
257 *---------------------------------------------------------------------------*/
258 PDEVSTATIC void
259 isdntelinit(void *unused)
261 #if defined(__FreeBSD__) && __FreeBSD__ >= 4
262 cdevsw_add(&i4btel_cdevsw);
263 #else
264 dev_t dev = makedev(CDEV_MAJOR, 0);
265 cdevsw_add(&dev, &i4btel_cdevsw, NULL);
266 #endif
269 SYSINIT(i4bteldev, SI_SUB_DRIVERS,
270 SI_ORDER_MIDDLE+CDEV_MAJOR, &i4btelinit, NULL);
272 #endif /* BSD > 199306 && defined(__FreeBSD__) */
274 #ifdef __bsdi__
276 int i4btelsel(dev_t dev, int rw, struct lwp *l);
277 int i4btelmatch(struct device *parent, struct cfdata *cf, void *aux);
278 void dummy_i4btelattach(struct device*, struct device *, void *);
280 #define CDEV_MAJOR 62
282 static struct cfdriver i4btelcd =
283 { NULL, "i4btel", i4btelmatch, dummy_i4btelattach, DV_DULL,
284 sizeof(struct cfdriver) };
285 struct devsw i4btelsw =
286 { &i4btelcd,
287 i4btelopen, i4btelclose, i4btelread, i4btelwrite,
288 i4btelioctl, i4btelsel, nommap, nostrat,
289 nodump, nopsize, 0, nostop
293 i4btelmatch(struct device *parent, struct cfdata *cf, void *aux)
295 NDBGL4(L4_TELDBG, "aux=0x%x", aux);
296 return 1;
299 void
300 dummy_i4btelattach(struct device *parent, struct device *self, void *aux)
302 NDBGL4(L4_TELDBG, "aux=0x%x", aux);
305 #endif /* __bsdi__ */
307 static const struct isdn_l4_driver_functions
308 tel_driver = {
309 tel_rx_data_rdy,
310 tel_tx_queue_empty,
311 tel_activity,
312 tel_connect,
313 tel_disconnect,
314 tel_dialresponse,
315 tel_updown,
316 tel_get_softc,
317 tel_set_linktab,
318 NULL
321 static int isdntel_driver_id = -1;
323 /*---------------------------------------------------------------------------*
324 * interface attach routine
325 *---------------------------------------------------------------------------*/
326 PDEVSTATIC void
327 #ifdef __FreeBSD__
328 isdntelattach(void *dummy)
329 #else
330 isdntelattach(void)
331 #endif
333 int i, j;
335 isdntel_driver_id = isdn_l4_driver_attach("isdntel", NISDNTEL, &tel_driver);
337 for(i=0; i < NISDNTEL; i++)
339 for(j=0; j < NOFUNCS; j++)
341 selinit(&tel_sc[i][j].selp);
343 tel_sc[i][j].devstate = ST_IDLE;
344 tel_sc[i][j].audiofmt = CVT_NONE;
345 tel_sc[i][j].rcvttab = 0;
346 tel_sc[i][j].wcvttab = 0;
347 tel_sc[i][j].result = 0;
349 if (j == FUNCTEL)
350 tel_sc[i][FUNCTEL].dialer = &tel_sc[i][FUNCDIAL];
351 else
352 tel_sc[i][j].dialer = NULL;
354 #if defined(__FreeBSD__)
355 #if __FreeBSD__ == 3
357 #ifdef DEVFS
359 /* XXX */ tel_sc[i][j].devfs_token
360 = devfs_add_devswf(&i4btel_cdevsw, i, DV_CHR,
361 UID_ROOT, GID_WHEEL, 0600,
362 "i4btel%d", i);
363 #endif
365 #else
366 switch(j)
368 case FUNCTEL: /* normal i4btel device */
369 make_dev(&i4btel_cdevsw, i,
370 UID_ROOT, GID_WHEEL,
371 0600, "i4btel%d", i);
372 break;
374 case FUNCDIAL: /* i4bteld dialout device */
375 make_dev(&i4btel_cdevsw, i+(1<<UNITBITS),
376 UID_ROOT, GID_WHEEL,
377 0600, "i4bteld%d", i);
378 break;
380 #endif
381 #endif
386 /*---------------------------------------------------------------------------*
387 * open tel device
388 *---------------------------------------------------------------------------*/
389 PDEVSTATIC int
390 isdntelopen(dev_t dev, int flag, int fmt,
391 struct lwp *l)
393 int unit = UNIT(dev);
394 int func = FUNC(dev);
396 tel_sc_t *sc;
398 if(unit >= NISDNTEL)
399 return(ENXIO);
401 sc = &tel_sc[unit][func];
403 if(sc->devstate & ST_ISOPEN)
404 return(EBUSY);
406 sc->devstate |= ST_ISOPEN;
408 if(func == FUNCDIAL)
410 sc->result = 0;
413 return(0);
416 /*---------------------------------------------------------------------------*
417 * close tel device
418 *---------------------------------------------------------------------------*/
419 PDEVSTATIC int
420 isdntelclose(dev_t dev, int flag, int fmt,
421 struct lwp *l)
423 int unit = UNIT(dev);
424 int func = FUNC(dev);
425 tel_sc_t *sc;
426 int error = 0;
427 int x;
429 if(unit > NISDNTEL)
430 return(ENXIO);
432 sc = &tel_sc[unit][func];
434 x = splnet();
435 sc->devstate &= ~ST_TONE;
436 if((func == FUNCTEL) &&
437 (sc->isdn_linktab != NULL && sc->isdn_linktab->tx_queue != NULL))
439 while(!(IF_QEMPTY(sc->isdn_linktab->tx_queue)))
441 sc->devstate |= ST_WRWAITEMPTY;
443 if((error = tsleep((void *) &sc->isdn_linktab->tx_queue,
444 TTIPRI | PCATCH, "wtcl", 0)) != 0)
446 break;
449 sc->devstate &= ~ST_WRWAITEMPTY;
452 sc->devstate &= ~ST_ISOPEN;
453 splx(x);
454 wakeup((void *) &sc->tones);
456 return(error);
459 /*---------------------------------------------------------------------------*
460 * i4btelioctl - device driver ioctl routine
461 *---------------------------------------------------------------------------*/
462 PDEVSTATIC int
463 isdntelioctl(dev_t dev, u_long cmd, void *data, int flag,
464 struct lwp *l)
466 int unit = UNIT(dev);
467 int func = FUNC(dev);
468 int error = 0;
469 struct mbuf *m;
470 int s;
472 tel_sc_t *sc = &tel_sc[unit][func];
474 if(func == FUNCTEL)
476 switch(cmd)
478 case I4B_TEL_GETAUDIOFMT:
479 *(int *)data = sc->audiofmt;
480 break;
482 case I4B_TEL_SETAUDIOFMT:
483 switch (*(int *)data)
485 case CVT_NONE:
486 sc->rcvttab = 0;
487 sc->wcvttab = 0;
488 break;
489 case CVT_ALAW2ULAW:
490 /* ISDN: A-law */
491 /* user: mu-law */
492 sc->rcvttab = a2u_tab;
493 sc->wcvttab = u2a_tab;
494 break;
495 case CVT_ULAW2ALAW:
496 /* ISDN: mu-law */
497 /* user: A-law */
498 sc->rcvttab = u2a_tab;
499 sc->wcvttab = a2u_tab;
500 break;
501 default:
502 error = ENODEV;
503 break;
505 if(error == 0)
506 sc->audiofmt = *(int *)data;
507 break;
509 case I4B_TEL_EMPTYINPUTQUEUE:
510 s = splnet();
511 while((sc->devstate & ST_CONNECTED) &&
512 (sc->devstate & ST_ISOPEN) &&
513 !IF_QEMPTY(sc->isdn_linktab->rx_queue))
515 IF_DEQUEUE(sc->isdn_linktab->rx_queue, m);
516 if(m)
517 i4b_Bfreembuf(m);
519 splx(s);
520 break;
522 case I4B_TEL_VR_REQ:
524 msg_vr_req_t *mvr;
526 mvr = (msg_vr_req_t *)data;
528 mvr->version = VERSION;
529 mvr->release = REL;
530 mvr->step = STEP;
531 break;
533 case I4B_TEL_TONES:
535 struct i4b_tel_tones *tt;
537 tt = (struct i4b_tel_tones *)data;
538 s = splnet();
539 while ((sc->devstate & ST_TONE) &&
540 sc->tones.duration[sc->toneidx] != 0) {
541 if((error = tsleep((void *) &sc->tones,
542 TTIPRI | PCATCH, "rtone", 0 )) != 0) {
543 splx(s);
544 return(error);
547 if(!(sc->devstate & ST_ISOPEN)) {
548 splx(s);
549 return (EIO);
551 if(!(sc->devstate & ST_CONNECTED)) {
552 splx(s);
553 return (EIO);
556 sc->tones = *tt;
557 sc->toneidx = 0;
558 sc->tonefreq = tt->frequency[0];
559 sc->devstate |= ST_TONE;
560 splx(s);
561 tel_tone(sc);
562 break;
565 default:
566 error = ENOTTY;
567 break;
570 else if(func == FUNCDIAL)
572 switch(cmd)
574 default:
575 error = ENOTTY;
576 break;
579 return(error);
582 /*---------------------------------------------------------------------------*
583 * read from tel device
584 *---------------------------------------------------------------------------*/
585 PDEVSTATIC int
586 isdntelread(dev_t dev, struct uio *uio, int ioflag)
588 int unit = UNIT(dev);
589 int func = FUNC(dev);
591 struct mbuf *m;
592 int s;
593 int error = 0;
595 tel_sc_t *sc = &tel_sc[unit][func];
597 if(!(sc->devstate & ST_ISOPEN))
598 return(EIO);
600 if(func == FUNCTEL)
602 s = splnet();
603 while((sc->devstate & ST_ISOPEN) &&
604 (sc->devstate & ST_CONNECTED) &&
605 IF_QEMPTY(sc->isdn_linktab->rx_queue))
607 sc->devstate |= ST_RDWAITDATA;
609 NDBGL4(L4_TELDBG, "i4btel%d, queue empty!", unit);
611 if((error = tsleep((void *) &sc->isdn_linktab->rx_queue,
612 TTIPRI | PCATCH,
613 "rtel", 0 )) != 0)
615 sc->devstate &= ~ST_RDWAITDATA;
616 splx(s);
617 return(error);
621 if(!(sc->devstate & ST_ISOPEN))
623 splx(s);
624 return(EIO);
627 if(!(sc->devstate & ST_CONNECTED))
629 splx(s);
630 return(EIO);
634 IF_DEQUEUE(sc->isdn_linktab->rx_queue, m);
636 if(m && m->m_len > 0)
638 register int i;
640 for(i = 0; i < m->m_len; i++)
642 /* always reverse bit order from line */
643 mtod(m,u_char *)[i] = bitreverse[mtod(m,u_char *)[i]];
645 /* convert if necessary */
646 if(sc->rcvttab)
647 mtod(m,u_char *)[i] = sc->rcvttab[mtod(m,u_char *)[i]];
649 error = uiomove(m->m_data, m->m_len, uio);
651 NDBGL4(L4_TELDBG, "i4btel%d, mbuf (%d bytes), uiomove %d!", unit, m->m_len, error);
653 else
655 NDBGL4(L4_TELDBG, "i4btel%d, empty mbuf from queue!", unit);
656 error = EIO;
659 if(m)
660 i4b_Bfreembuf(m);
662 splx(s);
664 else if(func == FUNCDIAL)
666 s = splnet();
667 while((sc->result == 0) && (sc->devstate & ST_ISOPEN))
669 sc->devstate |= ST_RDWAITDATA;
671 if((error = tsleep((void *) &sc->result,
672 TTIPRI | PCATCH,
673 "rtel1", 0 )) != 0)
675 sc->devstate &= ~ST_RDWAITDATA;
676 splx(s);
677 return(error);
681 if(!(sc->devstate & ST_ISOPEN))
683 splx(s);
684 return(EIO);
687 if(sc->result != 0)
689 error = uiomove(&sc->result, 1, uio);
690 sc->result = 0;
692 else
694 error = EIO;
697 splx(s);
699 return(error);
702 /*---------------------------------------------------------------------------*
703 * write to tel device
704 *---------------------------------------------------------------------------*/
705 PDEVSTATIC int
706 isdntelwrite(dev_t dev, struct uio * uio, int ioflag)
708 int unit = UNIT(dev);
709 int func = FUNC(dev);
710 struct mbuf *m;
711 int s;
712 int error = 0;
713 tel_sc_t *sc = &tel_sc[unit][func];
715 if(!(sc->devstate & ST_ISOPEN))
717 return(EIO);
720 if(func == FUNCTEL)
722 s = splnet();
724 if(!(sc->devstate & ST_CONNECTED)) {
725 splx(s);
726 return(EIO);
729 sc->devstate &= ~ST_TONE;
730 while((IF_QFULL(sc->isdn_linktab->tx_queue)) &&
731 (sc->devstate & ST_ISOPEN))
733 sc->devstate |= ST_WRWAITEMPTY;
735 if((error = tsleep((void *) &sc->isdn_linktab->tx_queue,
736 TTIPRI | PCATCH, "wtel", 0)) != 0)
738 sc->devstate &= ~ST_WRWAITEMPTY;
739 splx(s);
740 return(error);
744 if(!(sc->devstate & ST_ISOPEN))
746 splx(s);
747 return(EIO);
750 if(!(sc->devstate & ST_CONNECTED))
752 splx(s);
753 return(EIO);
756 if((m = i4b_Bgetmbuf(BCH_MAX_DATALEN)) != NULL)
758 register int i;
760 m->m_len = min(BCH_MAX_DATALEN, uio->uio_resid);
762 error = uiomove(m->m_data, m->m_len, uio);
764 for(i = 0; i < m->m_len; i++)
766 /* convert if necessary */
767 if(sc->wcvttab)
768 mtod(m,u_char *)[i] = sc->wcvttab[mtod(m,u_char *)[i]];
770 /* always reverse bitorder to line */
771 mtod(m,u_char *)[i] = bitreverse[mtod(m,u_char *)[i]];
774 if(IF_QFULL(sc->isdn_linktab->tx_queue))
776 m_freem(m);
778 else
780 IF_ENQUEUE(sc->isdn_linktab->tx_queue, m);
783 (*sc->isdn_linktab->bchannel_driver->bch_tx_start)(sc->isdn_linktab->l1token, sc->isdn_linktab->channel);
786 splx(s);
788 else if(func == FUNCDIAL)
790 tel_sc_t *telsc = &tel_sc[unit][FUNCTEL];
792 #define CMDBUFSIZ 80
793 char cmdbuf[CMDBUFSIZ];
794 int len = min(CMDBUFSIZ-1, uio->uio_resid);
796 error = uiomove(cmdbuf, len, uio);
798 if(cmdbuf[0] == CMD_DIAL)
800 i4b_l4_dialoutnumber(isdntel_driver_id, unit, len-1, &cmdbuf[1]);
802 else if(cmdbuf[0] == CMD_HUP)
804 if (!(telsc->devstate & ST_CONNECTED))
805 error = EIO;
806 else
807 i4b_l4_drvrdisc(telsc->cdp->cdid);
810 else
812 error = EIO;
815 return(error);
818 /*---------------------------------------------------------------------------*
820 *---------------------------------------------------------------------------*/
821 #define NTONESAMP 32
822 static void
823 tel_tone(tel_sc_t *sc)
825 struct mbuf *m;
826 u_char *p;
827 int i;
829 if((m = i4b_Bgetmbuf(NTONESAMP)) == NULL) {
830 printf("no mbuf in tel_tone\n");
831 return;
833 p = m->m_data;
834 m->m_len = 0;
835 for (i = 0; i < NTONESAMP && (sc->devstate & ST_TONE); i++) {
837 if (sc->tones.duration[sc->toneidx] > 0) {
838 if (--sc->tones.duration[sc->toneidx] == 0) {
839 sc->toneidx++;
840 if (sc->toneidx == I4B_TEL_MAXTONES) {
841 sc->devstate &= ~ST_TONE;
842 sc->toneomega = 0;
843 sc->tonefreq = 0;
844 } else if (sc->tones.frequency[sc->toneidx] == 0 &&
845 sc->tones.duration[sc->toneidx] == 0) {
846 sc->devstate &= ~ST_TONE;
847 sc->toneomega = 0;
848 sc->tonefreq = 0;
849 } else {
850 sc->tonefreq = sc->tones.frequency[sc->toneidx];
852 if (sc->tones.duration[sc->toneidx] == 0) {
853 wakeup((void *) &sc->tones);
858 sc->toneomega += sc->tonefreq;
859 if (sc->toneomega >= 8000)
860 sc->toneomega -= 8000;
861 *p++ = bitreverse[sinetab[sc->toneomega]];
862 m->m_len++;
864 IF_ENQUEUE(sc->isdn_linktab->tx_queue, m);
865 (*sc->isdn_linktab->bchannel_driver->bch_tx_start)(sc->isdn_linktab->l1token, sc->isdn_linktab->channel);
869 #ifdef OS_USES_POLL
870 /*---------------------------------------------------------------------------*
871 * device driver poll
872 *---------------------------------------------------------------------------*/
873 PDEVSTATIC int
874 isdntelpoll(dev_t dev, int events, struct lwp *l)
876 int revents = 0; /* Events we found */
877 int s;
878 int unit = UNIT(dev);
879 int func = FUNC(dev);
881 tel_sc_t *sc = &tel_sc[unit][func];
883 s = splhigh();
885 if(!(sc->devstate & ST_ISOPEN))
887 NDBGL4(L4_TELDBG, "i4btel%d, !ST_ISOPEN", unit);
888 splx(s);
889 return(0);
892 if(func == FUNCTEL)
895 * Writes are OK if we are connected and the
896 * transmit queue can take them
899 if((events & (POLLOUT|POLLWRNORM)) &&
900 (sc->devstate & ST_CONNECTED) &&
901 (sc->isdn_linktab != NULL) &&
902 (!IF_QFULL(sc->isdn_linktab->tx_queue)))
904 NDBGL4(L4_TELDBG, "i4btel%d, POLLOUT", unit);
905 revents |= (events & (POLLOUT|POLLWRNORM));
908 /* ... while reads are OK if we have any data */
910 if((events & (POLLIN|POLLRDNORM)) &&
911 (sc->devstate & ST_CONNECTED) &&
912 (sc->isdn_linktab != NULL) &&
913 (!IF_QEMPTY(sc->isdn_linktab->rx_queue)))
915 NDBGL4(L4_TELDBG, "i4btel%d, POLLIN", unit);
916 revents |= (events & (POLLIN|POLLRDNORM));
919 if(revents == 0)
921 NDBGL4(L4_TELDBG, "i4btel%d, selrecord", unit);
922 selrecord(l, &sc->selp);
925 else if(func == FUNCDIAL)
927 if(events & (POLLOUT|POLLWRNORM))
929 NDBGL4(L4_TELDBG, "i4bteld%d, POLLOUT", unit);
930 revents |= (events & (POLLOUT|POLLWRNORM));
933 if(events & (POLLIN|POLLRDNORM))
935 NDBGL4(L4_TELDBG, "i4bteld%d, POLLIN, result = %d", unit, sc->result);
936 if(sc->result != 0)
937 revents |= (events & (POLLIN|POLLRDNORM));
940 if(revents == 0)
942 NDBGL4(L4_TELDBG, "i4bteld%d, selrecord", unit);
943 selrecord(l, &sc->selp);
946 splx(s);
947 return(revents);
950 static void
951 filt_i4btel_detach(struct knote *kn)
953 tel_sc_t *sc = kn->kn_hook;
954 int s;
956 s = splhigh();
957 SLIST_REMOVE(&sc->selp.sel_klist, kn, knote, kn_selnext);
958 splx(s);
961 static int
962 filt_i4btel_telread(struct knote *kn, long hint)
964 tel_sc_t *sc = kn->kn_hook;
966 if ((sc->devstate & ST_CONNECTED) == 0)
967 return (0);
968 if (sc->isdn_linktab == NULL)
969 return (0);
970 if (IF_QEMPTY(sc->isdn_linktab->rx_queue))
971 return (0);
973 kn->kn_data = 0; /* XXXLUKEM (thorpej): what to put here? */
974 return (1);
977 static const struct filterops i4btel_telread_filtops =
978 { 1, NULL, filt_i4btel_detach, filt_i4btel_telread };
980 static int
981 filt_i4btel_telwrite(struct knote *kn, long hint)
983 tel_sc_t *sc = kn->kn_hook;
985 if ((sc->devstate & ST_CONNECTED) == 0)
986 return (0);
987 if (sc->isdn_linktab == NULL)
988 return (0);
989 if (IF_QFULL(sc->isdn_linktab->tx_queue))
990 return (0);
992 kn->kn_data = 0; /* XXXLUKEM (thorpej): what to put here? */
993 return (1);
996 static const struct filterops i4btel_telwrite_filtops =
997 { 1, NULL, filt_i4btel_detach, filt_i4btel_telwrite };
999 static int
1000 filt_i4btel_dialread(struct knote *kn, long hint)
1002 tel_sc_t *sc = kn->kn_hook;
1004 if (sc->result == 0)
1005 return (0);
1007 kn->kn_data = 0; /* XXXLUKEM (thorpej): what to put here? */
1008 return (1);
1011 static const struct filterops i4btel_dialread_filtops =
1012 { 1, NULL, filt_i4btel_detach, filt_i4btel_dialread };
1014 static const struct filterops i4btel_seltrue_filtops =
1015 { 1, NULL, filt_i4btel_detach, filt_seltrue };
1018 isdntelkqfilter(dev_t dev, struct knote *kn)
1020 int s;
1021 int unit = UNIT(dev);
1022 int func = FUNC(dev);
1024 struct klist *klist;
1025 tel_sc_t *sc = &tel_sc[unit][func];
1027 switch (kn->kn_filter) {
1028 case EVFILT_READ:
1029 klist = &sc->selp.sel_klist;
1030 if (func == FUNCTEL)
1031 kn->kn_fop = &i4btel_telread_filtops;
1032 else if (func == FUNCDIAL)
1033 kn->kn_fop = &i4btel_dialread_filtops;
1034 else
1035 return (ENXIO);
1036 break;
1038 case EVFILT_WRITE:
1039 klist = &sc->selp.sel_klist;
1040 if (func == FUNCTEL)
1041 kn->kn_fop = &i4btel_telwrite_filtops;
1042 else if (func == FUNCDIAL)
1043 kn->kn_fop = &i4btel_seltrue_filtops;
1044 else
1045 return (ENXIO);
1046 break;
1048 default:
1049 return (EINVAL);
1052 kn->kn_hook = sc;
1054 s = splhigh();
1055 SLIST_INSERT_HEAD(klist, kn, kn_selnext);
1056 splx(s);
1058 return (0);
1061 #else /* OS_USES_POLL */
1063 /*---------------------------------------------------------------------------*
1064 * device driver select
1065 *---------------------------------------------------------------------------*/
1066 PDEVSTATIC int
1067 i4btelsel(dev_t dev, int rw, struct lwp *l)
1069 int s;
1070 int unit = UNIT(dev);
1071 int func = FUNC(dev);
1073 tel_sc_t *sc = &tel_sc[unit][func];
1075 s = splhigh();
1077 if (!(sc->devstate & ST_ISOPEN))
1079 NDBGL4(L4_TELDBG, "i4btel%d, !ST_ISOPEN", unit);
1080 splx(s);
1081 return(0);
1084 if (func == FUNCTEL)
1086 /* Don't even bother if we're not connected */
1087 if (!(sc->devstate & ST_CONNECTED) || sc->isdn_linktab == NULL)
1089 splx(s);
1090 return 0;
1093 if (rw == FREAD)
1095 if (!IF_QEMPTY(sc->isdn_linktab->rx_queue))
1097 NDBGL4(L4_TELDBG, "i4btel%d, FREAD", unit);
1098 splx(s);
1099 return 1;
1102 else if (rw == FWRITE)
1104 if (!IF_QFULL(sc->isdn_linktab->tx_queue))
1106 NDBGL4(L4_TELDBG, "i4btel%d, FWRITE", unit);
1107 splx(s);
1108 return 1;
1112 else if (func == FUNCDIAL)
1114 if (rw == FWRITE)
1116 NDBGL4(L4_TELDBG, "i4bteld%d, FWRITE", unit);
1117 splx(s);
1118 return 1;
1121 if (rw == FREAD)
1123 NDBGL4(L4_TELDBG, "i4bteld%d, FREAD, result = %d", unit, sc->result);
1124 if (sc->result != 0)
1126 splx(s);
1127 return 1;
1132 NDBGL4(L4_TELDBG, "i4bteld%d, selrecord", unit);
1133 selrecord(l, &sc->selp);
1134 splx(s);
1135 return 0;
1138 #endif /* OS_USES_POLL */
1140 /*===========================================================================*
1141 * ISDN INTERFACE ROUTINES
1142 *===========================================================================*/
1144 /*---------------------------------------------------------------------------*
1145 * this routine is called from L4 handler at connect time
1146 *---------------------------------------------------------------------------*/
1147 static void
1148 tel_connect(void *softc, void *cdp)
1150 tel_sc_t *sc = softc;
1152 /* audio device */
1154 sc->cdp = (call_desc_t *)cdp;
1156 sc->devstate |= ST_CONNECTED;
1158 /* dialer device */
1160 sc = sc->dialer;
1162 if(sc->devstate == ST_ISOPEN)
1164 sc->result = RSP_CONN;
1166 if(sc->devstate & ST_RDWAITDATA)
1168 sc->devstate &= ~ST_RDWAITDATA;
1169 wakeup((void *) &sc->result);
1171 selnotify(&sc->selp, 0, 0);
1175 /*---------------------------------------------------------------------------*
1176 * this routine is called from L4 handler at disconnect time
1177 *---------------------------------------------------------------------------*/
1178 static void
1179 tel_disconnect(void *softc, void *cdp)
1181 tel_sc_t *sc = softc;
1183 /* audio device */
1185 sc->devstate &= ~ST_CONNECTED;
1187 if(sc->devstate & ST_RDWAITDATA)
1189 sc->devstate &= ~ST_RDWAITDATA;
1190 wakeup((void *) &sc->isdn_linktab->rx_queue);
1193 if(sc->devstate & ST_WRWAITEMPTY)
1195 sc->devstate &= ~ST_WRWAITEMPTY;
1196 wakeup((void *) &sc->isdn_linktab->tx_queue);
1199 /* dialer device */
1201 sc = sc->dialer;
1203 if(sc->devstate & ST_ISOPEN)
1205 sc->result = RSP_HUP;
1207 if(sc->devstate & ST_RDWAITDATA)
1209 sc->devstate &= ~ST_RDWAITDATA;
1210 wakeup((void *) &sc->result);
1212 selnotify(&sc->selp, 0, 0);
1214 if (sc->devstate & ST_TONE) {
1215 sc->devstate &= ~ST_TONE;
1216 wakeup((void *) &sc->tones);
1221 /*---------------------------------------------------------------------------*
1222 * feedback from daemon in case of dial problems
1223 *---------------------------------------------------------------------------*/
1224 static void
1225 tel_dialresponse(void *softc, int status, cause_t cause)
1227 tel_sc_t *sc = ((struct tel_softc*)softc)->dialer;
1229 NDBGL4(L4_TELDBG, "status=%d, cause=0x%4x", status, cause);
1231 if((sc->devstate == ST_ISOPEN) && status)
1233 sc->result = RSP_NOA;
1235 if(sc->devstate & ST_RDWAITDATA)
1237 sc->devstate &= ~ST_RDWAITDATA;
1238 wakeup((void *) &sc->result);
1240 selnotify(&sc->selp, 0, 0);
1244 /*---------------------------------------------------------------------------*
1245 * interface up/down
1246 *---------------------------------------------------------------------------*/
1247 static void
1248 tel_updown(void *softc, int updown)
1252 /*---------------------------------------------------------------------------*
1253 * this routine is called from the HSCX interrupt handler
1254 * when a new frame (mbuf) has been received and was put on
1255 * the rx queue.
1256 *---------------------------------------------------------------------------*/
1257 static void
1258 tel_rx_data_rdy(void *softc)
1260 tel_sc_t *sc = softc;
1262 if(sc->devstate & ST_RDWAITDATA)
1264 sc->devstate &= ~ST_RDWAITDATA;
1265 wakeup((void *) &sc->isdn_linktab->rx_queue);
1267 selnotify(&sc->selp, 0, 0);
1270 /*---------------------------------------------------------------------------*
1271 * this routine is called from the HSCX interrupt handler
1272 * when the last frame has been sent out and there is no
1273 * further frame (mbuf) in the tx queue.
1274 *---------------------------------------------------------------------------*/
1275 static void
1276 tel_tx_queue_empty(void *softc)
1278 tel_sc_t *sc = softc;
1280 if(sc->devstate & ST_WRWAITEMPTY)
1282 sc->devstate &= ~ST_WRWAITEMPTY;
1283 wakeup((void *) &sc->isdn_linktab->tx_queue);
1285 if(sc->devstate & ST_TONE) {
1286 tel_tone(sc);
1287 } else {
1288 selnotify(&sc->selp, 0, 0);
1292 /*---------------------------------------------------------------------------*
1293 * this routine is called from the HSCX interrupt handler
1294 * each time a packet is received or transmitted.
1295 *---------------------------------------------------------------------------*/
1296 static void
1297 tel_activity(void *softc, int rxtx)
1299 struct tel_softc *sc = softc;
1301 if(sc->cdp)
1302 sc->cdp->last_active_time = SECOND;
1305 /*---------------------------------------------------------------------------*
1306 * setup the isdn_linktab for this driver
1307 *---------------------------------------------------------------------------*/
1308 static void
1309 tel_set_linktab(void *softc, isdn_link_t *ilt)
1311 tel_sc_t *sc = softc;
1312 sc->isdn_linktab = ilt;
1315 /*---------------------------------------------------------------------------*
1316 * return the instance
1317 *---------------------------------------------------------------------------*/
1318 static void*
1319 tel_get_softc(int unit)
1321 return &tel_sc[unit][FUNCTEL];
1324 /*===========================================================================*
1325 * AUDIO FORMAT CONVERSION (produced by running g711conv)
1326 *===========================================================================*/
1328 /*---------------------------------------------------------------------------*
1329 * A-law to mu-law conversion
1330 *---------------------------------------------------------------------------*/
1331 static unsigned char a2u_tab[256] = {
1332 /* 00 */ 0x2a, 0x2b, 0x28, 0x29, 0x2e, 0x2f, 0x2c, 0x2d,
1333 /* 08 */ 0x22, 0x23, 0x20, 0x21, 0x26, 0x27, 0x24, 0x25,
1334 /* 10 */ 0x39, 0x3a, 0x37, 0x38, 0x3d, 0x3e, 0x3b, 0x3c,
1335 /* 18 */ 0x31, 0x32, 0x30, 0x30, 0x35, 0x36, 0x33, 0x34,
1336 /* 20 */ 0x0a, 0x0b, 0x08, 0x09, 0x0e, 0x0f, 0x0c, 0x0d,
1337 /* 28 */ 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05,
1338 /* 30 */ 0x1a, 0x1b, 0x18, 0x19, 0x1e, 0x1f, 0x1c, 0x1d,
1339 /* 38 */ 0x12, 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15,
1340 /* 40 */ 0x62, 0x63, 0x60, 0x61, 0x66, 0x67, 0x64, 0x65,
1341 /* 48 */ 0x5d, 0x5d, 0x5c, 0x5c, 0x5f, 0x5f, 0x5e, 0x5e,
1342 /* 50 */ 0x74, 0x76, 0x70, 0x72, 0x7c, 0x7e, 0x78, 0x7a,
1343 /* 58 */ 0x6a, 0x6b, 0x68, 0x69, 0x6e, 0x6f, 0x6c, 0x6d,
1344 /* 60 */ 0x48, 0x49, 0x46, 0x47, 0x4c, 0x4d, 0x4a, 0x4b,
1345 /* 68 */ 0x40, 0x41, 0x3f, 0x3f, 0x44, 0x45, 0x42, 0x43,
1346 /* 70 */ 0x56, 0x57, 0x54, 0x55, 0x5a, 0x5b, 0x58, 0x59,
1347 /* 78 */ 0x4f, 0x4f, 0x4e, 0x4e, 0x52, 0x53, 0x50, 0x51,
1348 /* 80 */ 0xaa, 0xab, 0xa8, 0xa9, 0xae, 0xaf, 0xac, 0xad,
1349 /* 88 */ 0xa2, 0xa3, 0xa0, 0xa1, 0xa6, 0xa7, 0xa4, 0xa5,
1350 /* 90 */ 0xb9, 0xba, 0xb7, 0xb8, 0xbd, 0xbe, 0xbb, 0xbc,
1351 /* 98 */ 0xb1, 0xb2, 0xb0, 0xb0, 0xb5, 0xb6, 0xb3, 0xb4,
1352 /* a0 */ 0x8a, 0x8b, 0x88, 0x89, 0x8e, 0x8f, 0x8c, 0x8d,
1353 /* a8 */ 0x82, 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85,
1354 /* b0 */ 0x9a, 0x9b, 0x98, 0x99, 0x9e, 0x9f, 0x9c, 0x9d,
1355 /* b8 */ 0x92, 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95,
1356 /* c0 */ 0xe2, 0xe3, 0xe0, 0xe1, 0xe6, 0xe7, 0xe4, 0xe5,
1357 /* c8 */ 0xdd, 0xdd, 0xdc, 0xdc, 0xdf, 0xdf, 0xde, 0xde,
1358 /* d0 */ 0xf4, 0xf6, 0xf0, 0xf2, 0xfc, 0xfe, 0xf8, 0xfa,
1359 /* d8 */ 0xea, 0xeb, 0xe8, 0xe9, 0xee, 0xef, 0xec, 0xed,
1360 /* e0 */ 0xc8, 0xc9, 0xc6, 0xc7, 0xcc, 0xcd, 0xca, 0xcb,
1361 /* e8 */ 0xc0, 0xc1, 0xbf, 0xbf, 0xc4, 0xc5, 0xc2, 0xc3,
1362 /* f0 */ 0xd6, 0xd7, 0xd4, 0xd5, 0xda, 0xdb, 0xd8, 0xd9,
1363 /* f8 */ 0xcf, 0xcf, 0xce, 0xce, 0xd2, 0xd3, 0xd0, 0xd1
1366 /*---------------------------------------------------------------------------*
1367 * mu-law to A-law conversion
1368 *---------------------------------------------------------------------------*/
1369 static unsigned char u2a_tab[256] = {
1370 /* 00 */ 0x2a, 0x2b, 0x28, 0x29, 0x2e, 0x2f, 0x2c, 0x2d,
1371 /* 08 */ 0x22, 0x23, 0x20, 0x21, 0x26, 0x27, 0x24, 0x25,
1372 /* 10 */ 0x3a, 0x3b, 0x38, 0x39, 0x3e, 0x3f, 0x3c, 0x3d,
1373 /* 18 */ 0x32, 0x33, 0x30, 0x31, 0x36, 0x37, 0x34, 0x35,
1374 /* 20 */ 0x0a, 0x0b, 0x08, 0x09, 0x0e, 0x0f, 0x0c, 0x0d,
1375 /* 28 */ 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05,
1376 /* 30 */ 0x1b, 0x18, 0x19, 0x1e, 0x1f, 0x1c, 0x1d, 0x12,
1377 /* 38 */ 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, 0x6a,
1378 /* 40 */ 0x68, 0x69, 0x6e, 0x6f, 0x6c, 0x6d, 0x62, 0x63,
1379 /* 48 */ 0x60, 0x61, 0x66, 0x67, 0x64, 0x65, 0x7a, 0x78,
1380 /* 50 */ 0x7e, 0x7f, 0x7c, 0x7d, 0x72, 0x73, 0x70, 0x71,
1381 /* 58 */ 0x76, 0x77, 0x74, 0x75, 0x4b, 0x49, 0x4f, 0x4d,
1382 /* 60 */ 0x42, 0x43, 0x40, 0x41, 0x46, 0x47, 0x44, 0x45,
1383 /* 68 */ 0x5a, 0x5b, 0x58, 0x59, 0x5e, 0x5f, 0x5c, 0x5d,
1384 /* 70 */ 0x52, 0x52, 0x53, 0x53, 0x50, 0x50, 0x51, 0x51,
1385 /* 78 */ 0x56, 0x56, 0x57, 0x57, 0x54, 0x54, 0x55, 0x55,
1386 /* 80 */ 0xaa, 0xab, 0xa8, 0xa9, 0xae, 0xaf, 0xac, 0xad,
1387 /* 88 */ 0xa2, 0xa3, 0xa0, 0xa1, 0xa6, 0xa7, 0xa4, 0xa5,
1388 /* 90 */ 0xba, 0xbb, 0xb8, 0xb9, 0xbe, 0xbf, 0xbc, 0xbd,
1389 /* 98 */ 0xb2, 0xb3, 0xb0, 0xb1, 0xb6, 0xb7, 0xb4, 0xb5,
1390 /* a0 */ 0x8a, 0x8b, 0x88, 0x89, 0x8e, 0x8f, 0x8c, 0x8d,
1391 /* a8 */ 0x82, 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85,
1392 /* b0 */ 0x9b, 0x98, 0x99, 0x9e, 0x9f, 0x9c, 0x9d, 0x92,
1393 /* b8 */ 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, 0xea,
1394 /* c0 */ 0xe8, 0xe9, 0xee, 0xef, 0xec, 0xed, 0xe2, 0xe3,
1395 /* c8 */ 0xe0, 0xe1, 0xe6, 0xe7, 0xe4, 0xe5, 0xfa, 0xf8,
1396 /* d0 */ 0xfe, 0xff, 0xfc, 0xfd, 0xf2, 0xf3, 0xf0, 0xf1,
1397 /* d8 */ 0xf6, 0xf7, 0xf4, 0xf5, 0xcb, 0xc9, 0xcf, 0xcd,
1398 /* e0 */ 0xc2, 0xc3, 0xc0, 0xc1, 0xc6, 0xc7, 0xc4, 0xc5,
1399 /* e8 */ 0xda, 0xdb, 0xd8, 0xd9, 0xde, 0xdf, 0xdc, 0xdd,
1400 /* f0 */ 0xd2, 0xd2, 0xd3, 0xd3, 0xd0, 0xd0, 0xd1, 0xd1,
1401 /* f8 */ 0xd6, 0xd6, 0xd7, 0xd7, 0xd4, 0xd4, 0xd5, 0xd5
1404 /*---------------------------------------------------------------------------*
1405 * reverse bits in a byte
1406 *---------------------------------------------------------------------------*/
1407 static unsigned char bitreverse[256] = {
1408 /* 00 */ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
1409 /* 08 */ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
1410 /* 10 */ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
1411 /* 18 */ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
1412 /* 20 */ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
1413 /* 28 */ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
1414 /* 30 */ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
1415 /* 38 */ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
1416 /* 40 */ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
1417 /* 48 */ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
1418 /* 50 */ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
1419 /* 58 */ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
1420 /* 60 */ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
1421 /* 68 */ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
1422 /* 70 */ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
1423 /* 78 */ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
1424 /* 80 */ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
1425 /* 88 */ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
1426 /* 90 */ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
1427 /* 98 */ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
1428 /* a0 */ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
1429 /* a8 */ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
1430 /* b0 */ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
1431 /* b8 */ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
1432 /* c0 */ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
1433 /* c8 */ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
1434 /* d0 */ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
1435 /* d8 */ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
1436 /* e0 */ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
1437 /* e8 */ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
1438 /* f0 */ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
1439 /* f8 */ 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
1442 static u_char sinetab[8000] = { 213, 213, 213, 213, 213, 213, 213, 212,
1443 212, 212, 212, 212, 212, 215, 215, 215, 215, 215, 215, 214, 214,
1444 214, 214, 214, 214, 209, 209, 209, 209, 209, 209, 209, 208, 208,
1445 208, 208, 208, 208, 211, 211, 211, 211, 211, 211, 210, 210, 210,
1446 210, 210, 210, 221, 221, 221, 221, 221, 221, 220, 220, 220, 220,
1447 220, 220, 220, 223, 223, 223, 223, 223, 223, 222, 222, 222, 222,
1448 222, 222, 217, 217, 217, 217, 217, 217, 216, 216, 216, 216, 216,
1449 216, 216, 219, 219, 219, 219, 219, 219, 218, 218, 218, 218, 218,
1450 218, 197, 197, 197, 197, 197, 197, 196, 196, 196, 196, 196, 196,
1451 196, 199, 199, 199, 199, 199, 199, 198, 198, 198, 198, 198, 198,
1452 193, 193, 193, 193, 193, 193, 192, 192, 192, 192, 192, 192, 192,
1453 195, 195, 195, 195, 195, 195, 194, 194, 194, 194, 194, 194, 205,
1454 205, 205, 205, 205, 205, 204, 204, 204, 204, 204, 204, 204, 207,
1455 207, 207, 207, 207, 207, 206, 206, 206, 206, 206, 206, 201, 201,
1456 201, 201, 201, 201, 200, 200, 200, 200, 200, 200, 200, 203, 203,
1457 203, 203, 203, 203, 202, 202, 202, 202, 202, 202, 245, 245, 245,
1458 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 244, 244, 244,
1459 244, 244, 244, 244, 244, 244, 244, 244, 244, 247, 247, 247, 247,
1460 247, 247, 247, 247, 247, 247, 247, 247, 247, 246, 246, 246, 246,
1461 246, 246, 246, 246, 246, 246, 246, 246, 246, 241, 241, 241, 241,
1462 241, 241, 241, 241, 241, 241, 241, 241, 240, 240, 240, 240, 240,
1463 240, 240, 240, 240, 240, 240, 240, 240, 243, 243, 243, 243, 243,
1464 243, 243, 243, 243, 243, 243, 243, 243, 242, 242, 242, 242, 242,
1465 242, 242, 242, 242, 242, 242, 242, 242, 253, 253, 253, 253, 253,
1466 253, 253, 253, 253, 253, 253, 253, 253, 252, 252, 252, 252, 252,
1467 252, 252, 252, 252, 252, 252, 252, 255, 255, 255, 255, 255, 255,
1468 255, 255, 255, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254,
1469 254, 254, 254, 254, 254, 254, 254, 249, 249, 249, 249, 249, 249,
1470 249, 249, 249, 249, 249, 249, 249, 248, 248, 248, 248, 248, 248,
1471 248, 248, 248, 248, 248, 248, 248, 251, 251, 251, 251, 251, 251,
1472 251, 251, 251, 251, 251, 251, 251, 250, 250, 250, 250, 250, 250,
1473 250, 250, 250, 250, 250, 250, 250, 229, 229, 229, 229, 229, 229,
1474 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229,
1475 229, 229, 229, 229, 229, 229, 229, 228, 228, 228, 228, 228, 228,
1476 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228,
1477 228, 228, 228, 228, 228, 228, 228, 228, 231, 231, 231, 231, 231,
1478 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
1479 231, 231, 231, 231, 231, 231, 231, 231, 231, 230, 230, 230, 230,
1480 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
1481 230, 230, 230, 230, 230, 230, 230, 230, 230, 225, 225, 225, 225,
1482 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
1483 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 224, 224,
1484 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1485 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 227,
1486 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
1487 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
1488 227, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
1489 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
1490 226, 226, 226, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
1491 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
1492 237, 237, 237, 237, 237, 236, 236, 236, 236, 236, 236, 236, 236,
1493 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
1494 236, 236, 236, 236, 236, 236, 236, 236, 239, 239, 239, 239, 239,
1495 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239,
1496 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 238, 238,
1497 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238,
1498 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238,
1499 238, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
1500 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
1501 233, 233, 233, 233, 233, 232, 232, 232, 232, 232, 232, 232, 232,
1502 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
1503 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 235, 235, 235,
1504 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
1505 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
1506 235, 235, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234,
1507 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234,
1508 234, 234, 234, 234, 234, 234, 234, 149, 149, 149, 149, 149, 149,
1509 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
1510 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
1511 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
1512 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
1513 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148,
1514 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
1515 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
1516 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
1517 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
1518 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 151, 151, 151,
1519 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
1520 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
1521 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
1522 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
1523 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
1524 151, 151, 151, 151, 150, 150, 150, 150, 150, 150, 150, 150, 150,
1525 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
1526 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
1527 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
1528 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
1529 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
1530 150, 150, 150, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1531 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1532 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1533 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1534 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1535 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1536 145, 145, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144,
1537 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
1538 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
1539 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
1540 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
1541 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
1542 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
1543 144, 144, 144, 144, 144, 144, 144, 144, 144, 147, 147, 147, 147,
1544 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1545 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1546 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1547 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1548 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1549 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1550 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1551 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 146, 146, 146,
1552 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1553 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1554 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1555 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1556 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1557 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1558 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1559 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1560 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1561 146, 146, 146, 146, 146, 146, 157, 157, 157, 157, 157, 157, 157,
1562 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1563 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1564 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1565 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1566 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1567 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1568 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1569 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1570 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1571 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1572 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1573 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1574 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1575 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1576 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1577 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1578 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1579 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1580 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1581 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1582 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1583 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1584 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1585 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1586 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1587 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1588 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1589 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1590 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1591 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1592 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1593 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1594 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1595 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1596 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1597 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1598 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1599 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1600 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1601 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1602 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1603 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1604 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1605 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1606 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1607 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1608 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1609 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1610 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1611 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1612 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1613 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1614 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1615 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1616 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1617 156, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157,
1618 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1619 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1620 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1621 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1622 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1623 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1624 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1625 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1626 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1627 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1628 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1629 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1630 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1631 157, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1632 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1633 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1634 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1635 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1636 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1637 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1638 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1639 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1640 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, 147, 147,
1641 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1642 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1643 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1644 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1645 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1646 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1647 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
1648 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 144, 144,
1649 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
1650 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
1651 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
1652 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
1653 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
1654 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
1655 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 145,
1656 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1657 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1658 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1659 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1660 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1661 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1662 145, 145, 145, 145, 150, 150, 150, 150, 150, 150, 150, 150, 150,
1663 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
1664 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
1665 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
1666 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
1667 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
1668 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
1669 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
1670 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
1671 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
1672 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
1673 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 148, 148, 148,
1674 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
1675 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
1676 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
1677 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
1678 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
1679 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
1680 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
1681 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
1682 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
1683 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
1684 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234,
1685 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234,
1686 234, 234, 234, 234, 234, 235, 235, 235, 235, 235, 235, 235, 235,
1687 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
1688 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 232, 232, 232,
1689 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
1690 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
1691 232, 232, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
1692 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
1693 233, 233, 233, 233, 233, 233, 238, 238, 238, 238, 238, 238, 238,
1694 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238,
1695 238, 238, 238, 238, 238, 238, 238, 238, 238, 239, 239, 239, 239,
1696 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239,
1697 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 236,
1698 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
1699 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
1700 236, 236, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
1701 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
1702 237, 237, 237, 237, 226, 226, 226, 226, 226, 226, 226, 226, 226,
1703 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
1704 226, 226, 226, 226, 226, 226, 227, 227, 227, 227, 227, 227, 227,
1705 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
1706 227, 227, 227, 227, 227, 227, 227, 227, 224, 224, 224, 224, 224,
1707 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1708 224, 224, 224, 224, 224, 224, 224, 224, 224, 225, 225, 225, 225,
1709 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
1710 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 230, 230,
1711 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
1712 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 231, 231,
1713 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
1714 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 228,
1715 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228,
1716 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228,
1717 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229,
1718 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229,
1719 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250,
1720 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
1721 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
1722 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249,
1723 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
1724 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
1725 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 253,
1726 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 242,
1727 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 243,
1728 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 240,
1729 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 241,
1730 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 246, 246,
1731 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 247, 247,
1732 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 244, 244,
1733 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 245, 245, 245,
1734 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 202, 202, 202,
1735 202, 202, 202, 203, 203, 203, 203, 203, 203, 200, 200, 200, 200,
1736 200, 200, 200, 201, 201, 201, 201, 201, 201, 206, 206, 206, 206,
1737 206, 206, 207, 207, 207, 207, 207, 207, 204, 204, 204, 204, 204,
1738 204, 204, 205, 205, 205, 205, 205, 205, 194, 194, 194, 194, 194,
1739 194, 195, 195, 195, 195, 195, 195, 192, 192, 192, 192, 192, 192,
1740 192, 193, 193, 193, 193, 193, 193, 198, 198, 198, 198, 198, 198,
1741 199, 199, 199, 199, 199, 199, 196, 196, 196, 196, 196, 196, 196,
1742 197, 197, 197, 197, 197, 197, 218, 218, 218, 218, 218, 218, 219,
1743 219, 219, 219, 219, 219, 216, 216, 216, 216, 216, 216, 216, 217,
1744 217, 217, 217, 217, 217, 222, 222, 222, 222, 222, 222, 223, 223,
1745 223, 223, 223, 223, 220, 220, 220, 220, 220, 220, 220, 221, 221,
1746 221, 221, 221, 221, 210, 210, 210, 210, 210, 210, 211, 211, 211,
1747 211, 211, 211, 208, 208, 208, 208, 208, 208, 209, 209, 209, 209,
1748 209, 209, 209, 214, 214, 214, 214, 214, 214, 215, 215, 215, 215,
1749 215, 215, 212, 212, 212, 212, 212, 212, 213, 213, 213, 213, 213,
1750 213, 213, 90, 90, 90, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, 84,
1751 84, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 86, 81, 81, 81,
1752 81, 81, 81, 81, 80, 80, 80, 80, 80, 80, 83, 83, 83, 83, 83, 83,
1753 82, 82, 82, 82, 82, 82, 93, 93, 93, 93, 93, 93, 93, 92, 92, 92,
1754 92, 92, 92, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 89,
1755 89, 89, 89, 89, 89, 88, 88, 88, 88, 88, 88, 88, 91, 91, 91, 91,
1756 91, 91, 90, 90, 90, 90, 90, 90, 69, 69, 69, 69, 69, 69, 68, 68,
1757 68, 68, 68, 68, 68, 71, 71, 71, 71, 71, 71, 70, 70, 70, 70, 70,
1758 70, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 67, 67,
1759 67, 67, 67, 67, 66, 66, 66, 66, 66, 66, 77, 77, 77, 77, 77, 77,
1760 76, 76, 76, 76, 76, 76, 76, 79, 79, 79, 79, 79, 79, 78, 78, 78,
1761 78, 78, 78, 73, 73, 73, 73, 73, 73, 73, 72, 72, 72, 72, 72, 72,
1762 75, 75, 75, 75, 75, 75, 74, 74, 74, 74, 74, 74, 117, 117, 117, 117,
1763 117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 116,
1764 116, 116, 116, 116, 116, 116, 116, 116, 116, 119, 119, 119, 119,
1765 119, 119, 119, 119, 119, 119, 119, 119, 118, 118, 118, 118, 118,
1766 118, 118, 118, 118, 118, 118, 118, 118, 113, 113, 113, 113, 113,
1767 113, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112,
1768 112, 112, 112, 112, 112, 112, 112, 115, 115, 115, 115, 115, 115,
1769 115, 115, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114,
1770 114, 114, 114, 114, 114, 114, 114, 125, 125, 125, 125, 125, 125,
1771 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124,
1772 124, 124, 124, 124, 124, 124, 124, 127, 127, 127, 127, 127, 127,
1773 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126,
1774 126, 126, 126, 126, 126, 126, 121, 121, 121, 121, 121, 121, 121,
1775 121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120,
1776 120, 120, 120, 120, 120, 120, 123, 123, 123, 123, 123, 123, 123,
1777 123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122,
1778 122, 122, 122, 122, 122, 122, 101, 101, 101, 101, 101, 101, 101,
1779 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101,
1780 101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100,
1781 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1782 100, 100, 100, 100, 100, 100, 100, 103, 103, 103, 103, 103, 103,
1783 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
1784 103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102,
1785 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
1786 102, 102, 102, 102, 102, 102, 102, 102, 102, 97, 97, 97, 97, 97,
1787 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
1788 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
1789 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
1790 96, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
1791 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98,
1792 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
1793 98, 98, 98, 98, 98, 98, 98, 98, 98, 109, 109, 109, 109, 109, 109,
1794 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109,
1795 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108,
1796 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
1797 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 111,
1798 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
1799 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
1800 111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
1801 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
1802 110, 110, 110, 110, 110, 110, 105, 105, 105, 105, 105, 105, 105,
1803 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
1804 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104,
1805 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
1806 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
1807 104, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
1808 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
1809 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106,
1810 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
1811 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 21,
1812 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
1813 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
1814 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
1815 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
1816 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
1817 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
1818 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
1819 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
1820 20, 20, 20, 20, 20, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
1821 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
1822 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
1823 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
1824 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 22, 22, 22,
1825 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
1826 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
1827 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
1828 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
1829 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 17, 17, 17, 17, 17, 17,
1830 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
1831 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
1832 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
1833 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
1834 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 16, 16,
1835 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1836 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1837 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1838 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1839 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1840 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 19, 19, 19, 19, 19, 19,
1841 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
1842 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
1843 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
1844 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
1845 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
1846 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
1847 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1848 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1849 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1850 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1851 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1852 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1853 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1854 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1855 18, 18, 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1856 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1857 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1858 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1859 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1860 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1861 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1862 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1863 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1864 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1865 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1866 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28,
1867 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1868 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1869 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1870 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1871 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1872 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1873 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1874 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1875 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1876 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1877 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1878 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1879 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1880 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1881 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1882 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1883 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1884 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1885 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1886 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1887 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1888 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1889 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1890 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1891 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1892 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1893 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1894 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1895 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1896 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1897 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1898 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
1899 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1900 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1901 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1902 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1903 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1904 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1905 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1906 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1907 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1908 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1909 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1910 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 18, 18, 18, 18, 18,
1911 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1912 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1913 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1914 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1915 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1916 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1917 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1918 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19,
1919 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
1920 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
1921 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
1922 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
1923 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
1924 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
1925 19, 19, 19, 19, 19, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1926 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1927 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1928 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1929 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1930 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1931 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
1932 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
1933 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
1934 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
1935 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
1936 17, 17, 17, 17, 17, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
1937 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
1938 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
1939 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
1940 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
1941 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
1942 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
1943 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
1944 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
1945 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 20, 20, 20, 20, 20, 20,
1946 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
1947 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
1948 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
1949 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21,
1950 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
1951 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
1952 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
1953 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
1954 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
1955 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
1956 106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 107,
1957 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
1958 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 104, 104,
1959 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
1960 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
1961 104, 104, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
1962 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
1963 105, 105, 105, 105, 105, 105, 110, 110, 110, 110, 110, 110, 110,
1964 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
1965 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 111, 111, 111,
1966 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
1967 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
1968 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
1969 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
1970 108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109,
1971 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109,
1972 109, 109, 109, 109, 109, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
1973 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
1974 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
1975 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 96, 96,
1976 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
1977 96, 96, 96, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 97,
1978 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
1979 97, 97, 97, 97, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
1980 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
1981 102, 102, 102, 102, 103, 103, 103, 103, 103, 103, 103, 103, 103,
1982 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
1983 103, 103, 103, 103, 103, 100, 100, 100, 100, 100, 100, 100, 100,
1984 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1985 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101,
1986 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101,
1987 101, 101, 101, 101, 101, 101, 122, 122, 122, 122, 122, 122, 122,
1988 122, 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, 123, 123,
1989 123, 123, 123, 123, 123, 123, 120, 120, 120, 120, 120, 120, 120,
1990 120, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121,
1991 121, 121, 121, 121, 121, 121, 126, 126, 126, 126, 126, 126, 126,
1992 126, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127,
1993 127, 127, 127, 127, 127, 124, 124, 124, 124, 124, 124, 124, 124,
1994 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 125,
1995 125, 125, 125, 125, 125, 114, 114, 114, 114, 114, 114, 114, 114,
1996 114, 114, 114, 114, 114, 115, 115, 115, 115, 115, 115, 115, 115,
1997 115, 115, 115, 115, 115, 112, 112, 112, 112, 112, 112, 112, 112,
1998 112, 112, 112, 112, 113, 113, 113, 113, 113, 113, 113, 113, 113,
1999 113, 113, 113, 113, 118, 118, 118, 118, 118, 118, 118, 118, 118,
2000 118, 118, 118, 118, 119, 119, 119, 119, 119, 119, 119, 119, 119,
2001 119, 119, 119, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116,
2002 116, 116, 116, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
2003 117, 117, 117, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 72,
2004 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 78, 78, 78, 78,
2005 78, 78, 79, 79, 79, 79, 79, 79, 76, 76, 76, 76, 76, 76, 76, 77,
2006 77, 77, 77, 77, 77, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67,
2007 67, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 70, 70,
2008 70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 68, 68, 68, 68, 68, 68,
2009 68, 69, 69, 69, 69, 69, 69, 90, 90, 90, 90, 90, 90, 91, 91, 91,
2010 91, 91, 91, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89,
2011 94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 92, 92, 92, 92,
2012 92, 92, 93, 93, 93, 93, 93, 93, 93, 82, 82, 82, 82, 82, 82, 83,
2013 83, 83, 83, 83, 83, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81,
2014 81, 81, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 84, 84,
2015 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 90, 90, 90 };
2017 /*===========================================================================*/
2019 #endif /* NISDNTEL > 0 */