Commit a4426b1f authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: New timer handling for ttyI NO CARRIER response

Again, use a per ttyI timer handler for NO CARRIER messages, only
activated when used.
parent 5673f7e9
......@@ -1153,8 +1153,6 @@ isdn_dc2minor(int di, int ch)
return -1;
}
static int isdn_timer_cnt2 = 0;
static void
isdn_timer_funct(ulong dummy)
{
......@@ -1165,13 +1163,6 @@ isdn_timer_funct(ulong dummy)
if (tf & ISDN_TIMER_MODEMXMIT)
isdn_tty_modem_xmit();
}
if (tf & ISDN_TIMER_SLOW) {
if (++isdn_timer_cnt2 >= ISDN_TIMER_1SEC) {
isdn_timer_cnt2 = 0;
if (tf & ISDN_TIMER_CARRIER)
isdn_tty_carrier_timeout();
}
}
if (tf)
{
unsigned long flags;
......@@ -1191,10 +1182,6 @@ isdn_timer_ctrl(int tf, int onoff)
save_flags(flags);
cli();
if ((tf & ISDN_TIMER_SLOW) && (!(dev->tflags & ISDN_TIMER_SLOW))) {
/* If the slow-timer wasn't activated until now */
isdn_timer_cnt2 = 0;
}
old_tflags = dev->tflags;
if (onoff)
dev->tflags |= tf;
......
......@@ -29,6 +29,7 @@
static int isdn_tty_edit_at(const char *, int, modem_info *, int);
static void isdn_tty_escape_timer(unsigned long data);
static void isdn_tty_ring_timer(unsigned long data);
static void isdn_tty_connect_timer(unsigned long data);
static void isdn_tty_check_esc(struct modem_info *info,
const unsigned char *p, int count);
static void isdn_tty_modem_reset_regs(modem_info *, int);
......@@ -785,9 +786,8 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m)
}
#endif
info->dialing = 1;
info->emu.carrierwait = 0;
isdn_slot_dial(info->isdn_slot, &dial);
isdn_timer_ctrl(ISDN_TIMER_CARRIER, 1);
mod_timer(&info->connect_timer, jiffies + info->emu.mdmreg[REG_WAITC] * HZ);
}
}
......@@ -974,7 +974,7 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
// strcpy(dev->num[i], n);
isdn_info_update();
isdn_slot_command(info->isdn_slot, CAPI_PUT_MESSAGE, &cmd);
isdn_timer_ctrl(ISDN_TIMER_CARRIER, 1);
mod_timer(&info->connect_timer, jiffies + info->emu.mdmreg[REG_WAITC] * HZ);
}
}
......@@ -2138,6 +2138,9 @@ isdn_tty_init(void)
init_timer(&info->ring_timer);
info->ring_timer.data = (unsigned long) info;
info->ring_timer.function = isdn_tty_ring_timer;
init_timer(&info->connect_timer);
info->connect_timer.data = (unsigned long) info;
info->connect_timer.function = isdn_tty_connect_timer;
skb_queue_head_init(&info->rpqueue);
info->xmit_size = ISDN_SERIAL_XMIT_SIZE;
skb_queue_head_init(&info->xmit_queue);
......@@ -3313,9 +3316,8 @@ isdn_tty_cmd_ATA(modem_info * info)
#endif
isdn_slot_command(info->isdn_slot, ISDN_CMD_SETL3, &cmd);
info->dialing = 16;
info->emu.carrierwait = 0;
isdn_slot_command(info->isdn_slot, ISDN_CMD_ACCEPTD, &cmd);
isdn_timer_ctrl(ISDN_TIMER_CARRIER, 1);
mod_timer(&info->connect_timer, jiffies + info->emu.mdmreg[REG_WAITC] * HZ);
} else
isdn_tty_modem_result(RESULT_NO_ANSWER, info);
}
......@@ -4018,27 +4020,14 @@ isdn_tty_modem_xmit(void)
isdn_timer_ctrl(ISDN_TIMER_MODEMXMIT, ton);
}
/*
* Check all channels if we have a 'no carrier' timeout.
* Timeout value is set by Register S7.
*/
void
isdn_tty_carrier_timeout(void)
static void
isdn_tty_connect_timer(unsigned long data)
{
int ton = 0;
int i;
struct modem_info *info = (struct modem_info *) data;
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
modem_info *info = &isdn_mdm.info[i];
if (info->dialing) {
if (info->emu.carrierwait++ > info->emu.mdmreg[REG_WAITC]) {
info->dialing = 0;
isdn_tty_modem_result(RESULT_NO_CARRIER, info);
isdn_tty_modem_hup(info, 1);
}
else
ton = 1;
}
if (info->dialing) {
info->dialing = 0;
isdn_tty_modem_result(RESULT_NO_CARRIER, info);
isdn_tty_modem_hup(info, 1);
}
isdn_timer_ctrl(ISDN_TIMER_CARRIER, ton);
}
......@@ -98,7 +98,6 @@
((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \
(info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS2))
extern void isdn_tty_carrier_timeout(void);
extern void isdn_tty_modem_xmit(void);
extern int isdn_tty_init(void);
extern void isdn_tty_readmodem(void);
......
......@@ -237,13 +237,9 @@ typedef struct {
/* Timer-delays and scheduling-flags */
#define ISDN_TIMER_RES 4 /* Main Timer-Resolution */
#define ISDN_TIMER_02SEC (HZ/ISDN_TIMER_RES/5) /* Slow-Timer1 .2 sec */
#define ISDN_TIMER_1SEC (HZ/ISDN_TIMER_RES) /* Slow-Timer2 1 sec */
#define ISDN_TIMER_MODEMREAD 1
#define ISDN_TIMER_MODEMXMIT 8
#define ISDN_TIMER_CARRIER 256 /* Wait for Carrier */
#define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMXMIT)
#define ISDN_TIMER_SLOW (ISDN_TIMER_CARRIER)
/* GLOBAL_FLAGS */
#define ISDN_GLOBAL_STOPPED 1
......@@ -300,7 +296,6 @@ typedef struct atemu {
int mdmcmdl; /* Length of Modem-Commandbuffer */
int pluscount; /* Counter for +++ sequence */
int lastplus; /* Timestamp of last + */
int carrierwait; /* Seconds of carrier waiting */
char mdmcmd[255]; /* Modem-Commandbuffer */
unsigned int charge; /* Charge units of current connection */
} atemu;
......@@ -360,6 +355,7 @@ typedef struct modem_info {
atemu emu; /* AT-emulator data */
struct timer_list escape_timer; /* to recognize +++ escape */
struct timer_list ring_timer; /* for writing 'RING' responses */
struct timer_list connect_timer; /* waiting for CONNECT */
struct termios normal_termios; /* For saving termios structs */
struct termios callout_termios;
wait_queue_head_t open_wait, close_wait;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment