#sccs "@(#)uts/kern/sys:ph.h 1.3" /* created 4/25/84 C. Liu */ #include "sys/proc.h" #include "sys/tty.h" #define YES 1 #define NO 0 #define POLL 1 #define NOPOLL 0 #define UNUSED 0x7f /* to mark resources unused */ #define MS_TICK (1000/HZ) /* msec per tick */ #define T_50MS 0x04 /* 4 ticks */ #define T_70MS 0x05 /* 5 ticks */ #define T_100MS 0x08 /* 10 ticks */ /* ------------------------------------------------------------------------- | phone line control structure | ------------------------------------------------------------------------- */ /* p_flags values */ #define PF_OPEN 0x01 /* line in use */ #define PF_PENDONHOOK 0x02 /* set when hanging up from kbd, waiting for onhook */ /*#define PF_VOICE 0x02 /* line used for voice */ /*#define PF_DATA 0x04 /* line used with modem */ /* p_statemch */ #define PL_IDLE 0x00 /* line idle */ #define PL_OFFHOOK 0x01 /* handset picked up */ #define PL_WAITDIALTONE 0x02 /* waiting for dialtone */ #define PL_DIALTONE 0x03 /* dialtone */ #define PL_DIALLING 0x04 /* tone or pulsing */ #define PL_HOOKFLASH 0x05 /* generate hook flash */ #define PL_WAITRINGBACK 0x06 /* dialling complete */ #define PL_RINGBACK 0x07 /* ringback detected */ #define PL_BADTONESTATE 0x08 /* busy or congestion */ #define PL_CONNECTED 0x09 /* call complete */ #define PL_ONHOLD 0x0A /* call on hold */ #define PL_RNGON 0x0B /* ring detect high */ #define PL_RNGOFF 0x0C /* ring detect off */ #define PL_INITRNG 0x0D /* first ring transition*/ /* p_resource */ #define PR_DIALER 0x01 /* line owns dialer */ #define PR_MODEM 0x02 /* line owns modem */ /* p_hookstatus */ #define PH_OPENED 0x00 /* onhook */ #define PH_CLOSED 0xff /* offhook */ /* p_linestatus */ /* values used are defined in phone.h */ #define TONEMASK 0x00f8 /* mask for tone */ struct phdef { unsigned char p_flags; /* state and param info */ unsigned char p_line; /* line 0 or 1 */ unsigned char p_statemch; /* line contrl state machine */ unsigned char p_resource; /* resource owned by the line */ unsigned char p_digit; /* current digit being dialed */ unsigned char p_hookstatus; /* status of hook relay */ unsigned char p_ringdetected; /* YES if ring detected and */ /* reported. */ unsigned char p_ringcnt; /* used to count ring cycles */ unsigned char p_waitdialtone; /* wait for dialtone in sec */ unsigned char p_oldringstat; /* t-1 state of ring detect */ ushort p_lineselect; /* select handset to the line */ ushort p_dnconnect; /* dial network connect value */ ushort p_feedback; /* used for controlling ringer */ ushort p_linestatus; /* status of line and tone */ ushort p_waitflash; /* flash duration in msec */ ushort *p_modemconnect;/* address to connect modem */ ushort *p_hookrelay; /* pointer to hook relay */ ushort *p_aleadrelay; /* pointer to a-lead relay */ ushort *p_holdrelay; /* pointer to hold relay */ struct proc *p_procp; /* pointer to owner process */ struct tty *p_tp; /* tty pointer */ int p_lineparam; /* user specified line control */ char p_opencnt; /* pulse counter used for */ char p_closecnt; /* pulse dialling. */ }; /* ------------------------------------------------------------------------- | call progress detection control structure | ------------------------------------------------------------------------- */ struct progdef { char p_fenergy; /* if 0 => waiting for first energy level to go high. if 1 => energy level already detected. */ char p_onlevelcnt; /* number of times high was detected */ char p_offlevelcnt; /* number of times low was detected */ char p_spare; ushort p_gottone; /* actual tone detected */ ushort p_onofftickcnt; /* number of ticks since counting on/off level count */ ushort p_tickcnt; /* not to exceed p_timeout */ ushort p_timeout; /* 60 hz ticks, return error */ struct phdef *p_ph; /* pointer to the line struct */ }; /* ------------------------------------------------------------------------- | Message Waiting detection control structure | ------------------------------------------------------------------------- */ struct msgwdef { unsigned char mw_state; /* current state */ unsigned char mw_prevstate; /* previous stable state */ unsigned char mw_oncnt; /* count of on state */ unsigned char mw_offcnt; /* count of off state */ unsigned char mw_tickcnt; /* not to exceed mw_timeout */ unsigned char mw_timeout; /* scan duration, tick = 48 ms */ /* currently set to 6 seconds */ }; #define MW_IDLE 0 /* nothing's happening */ #define MW_MSGON 1 /* msg wait confirmed */ #define MW_SCAN 2 /* detecting signal */ #define MW_GLITCH 3 /* detecting line ring */ /* ------------------------------------------------------------------------- | modem control parameters | ------------------------------------------------------------------------- */ #define MDOPEN 0x01 /* modem in use */ #define MDINCMNG 0x02 /* modem will answer incoming calls */ #define MDOUTGO 0x04 /* modem is used for outgoing */ #define MDHIGHSPEED 0x08 /* use 1200 baud */ #define MD_IDLE 0 /* initial state */ #define MD_ATTACH 1 /* connect the modem */ #define MD_RESET 2 /* reset the modem */ #define MD_WAITREADY 3 /* after offhook, wait modem ready */ #define MD_WAITHANDCOMP 4 /* wait handshake complete */ #define MD_HANGUPWAIT 5 /* wait for hangup */ #define MD_LOSTSIGNAL 6 /* line signal lost, possible hangup */ #define MD_CONNWAIT 7 /* wait for answer tone on outgoing */ #define MD_CONNCOMP 8 /* wait handshake complete on outgoing */ struct mddef { char m_flags; /* state and param info */ char m_line; /* current user of the modem */ char m_state; /* modem state machine */ char m_timeout; /* timeout count */ struct tty *m_tp; /* pointer to tty struct */ struct phdef *m_ph; /* pointer to line descriptor */ }; /* ------------------------------------------------------------------------- | dial network control structure | ------------------------------------------------------------------------- */ #define DN_OPEN 0x01 /* dialer in use */ #define DN_FEEDBK 0x02 /* speaker used for monitoring */ #define DN_SOFT 0x04 /* soft speaker volume */ #define DN_NORMAL 0x08 /* normal speaker volume */ #define DN_LOUD 0x0c /* loud speaker volume */ #define DN_CASS 0x10 /* allow cassette voice path */ struct dndef { char d_flags; /* state and param info */ char d_line; /* current user of dialer */ ushort d_lastcmd; /* copy of the last control word*/ ushort d_feedback; /* dial network control */ };