Commit 5673f7e9 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: New timer handling for ttyI RING response

Again, use a per ttyI timer handler for RING messages, only activated
when used.
parent 91267c94
...@@ -226,7 +226,7 @@ isdn_ciscohdlck_connected(isdn_net_dev *idev) ...@@ -226,7 +226,7 @@ isdn_ciscohdlck_connected(isdn_net_dev *idev)
cisco->myseq = 0; cisco->myseq = 0;
cisco->mineseen = 0; cisco->mineseen = 0;
cisco->yourseq = 0; cisco->yourseq = 0;
cisco->keepalive_period = ISDN_TIMER_KEEPINT; cisco->keepalive_period = 10;
cisco->last_slarp_in = 0; cisco->last_slarp_in = 0;
cisco->line_state = 0; cisco->line_state = 0;
cisco->debserint = 0; cisco->debserint = 0;
......
...@@ -1154,7 +1154,6 @@ isdn_dc2minor(int di, int ch) ...@@ -1154,7 +1154,6 @@ isdn_dc2minor(int di, int ch)
} }
static int isdn_timer_cnt2 = 0; static int isdn_timer_cnt2 = 0;
static int isdn_timer_cnt3 = 0;
static void static void
isdn_timer_funct(ulong dummy) isdn_timer_funct(ulong dummy)
...@@ -1169,11 +1168,6 @@ isdn_timer_funct(ulong dummy) ...@@ -1169,11 +1168,6 @@ isdn_timer_funct(ulong dummy)
if (tf & ISDN_TIMER_SLOW) { if (tf & ISDN_TIMER_SLOW) {
if (++isdn_timer_cnt2 >= ISDN_TIMER_1SEC) { if (++isdn_timer_cnt2 >= ISDN_TIMER_1SEC) {
isdn_timer_cnt2 = 0; isdn_timer_cnt2 = 0;
if (++isdn_timer_cnt3 >= ISDN_TIMER_RINGING) {
isdn_timer_cnt3 = 0;
if (tf & ISDN_TIMER_MODEMRING)
isdn_tty_modem_ring();
}
if (tf & ISDN_TIMER_CARRIER) if (tf & ISDN_TIMER_CARRIER)
isdn_tty_carrier_timeout(); isdn_tty_carrier_timeout();
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define VBUFX (VBUF/16) #define VBUFX (VBUF/16)
#endif #endif
#define RING_TIMEOUT (5*HZ) /* repeat RING every 5 secs */
#define FIX_FILE_TRANSFER #define FIX_FILE_TRANSFER
#define DUMMY_HAYES_AT #define DUMMY_HAYES_AT
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
static int isdn_tty_edit_at(const char *, int, modem_info *, int); 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_escape_timer(unsigned long data);
static void isdn_tty_ring_timer(unsigned long data);
static void isdn_tty_check_esc(struct modem_info *info, static void isdn_tty_check_esc(struct modem_info *info,
const unsigned char *p, int count); const unsigned char *p, int count);
static void isdn_tty_modem_reset_regs(modem_info *, int); static void isdn_tty_modem_reset_regs(modem_info *, int);
...@@ -2133,6 +2135,9 @@ isdn_tty_init(void) ...@@ -2133,6 +2135,9 @@ isdn_tty_init(void)
init_timer(&info->escape_timer); init_timer(&info->escape_timer);
info->escape_timer.data = (unsigned long) info; info->escape_timer.data = (unsigned long) info;
info->escape_timer.function = isdn_tty_escape_timer; info->escape_timer.function = isdn_tty_escape_timer;
init_timer(&info->ring_timer);
info->ring_timer.data = (unsigned long) info;
info->ring_timer.function = isdn_tty_ring_timer;
skb_queue_head_init(&info->rpqueue); skb_queue_head_init(&info->rpqueue);
info->xmit_size = ISDN_SERIAL_XMIT_SIZE; info->xmit_size = ISDN_SERIAL_XMIT_SIZE;
skb_queue_head_init(&info->xmit_queue); skb_queue_head_init(&info->xmit_queue);
...@@ -2315,7 +2320,7 @@ isdn_tty_find_icall(struct isdn_slot *slot, setup_parm *setup) ...@@ -2315,7 +2320,7 @@ isdn_tty_find_icall(struct isdn_slot *slot, setup_parm *setup)
info->line); info->line);
info->msr |= UART_MSR_RI; info->msr |= UART_MSR_RI;
isdn_tty_modem_result(RESULT_RING, info); isdn_tty_modem_result(RESULT_RING, info);
isdn_timer_ctrl(ISDN_TIMER_MODEMRING, 1); mod_timer(&info->ring_timer, jiffies + RING_TIMEOUT);
return 1; return 1;
} }
} }
...@@ -3980,25 +3985,16 @@ isdn_tty_edit_at(const char *p, int count, modem_info * info, int user) ...@@ -3980,25 +3985,16 @@ isdn_tty_edit_at(const char *p, int count, modem_info * info, int user)
return total; return total;
} }
/* static void
* Put a RING-message to all modem-channels who have the RI-bit set. isdn_tty_ring_timer(unsigned long data)
* This function is called every second via timer-interrupt from within
* timer-dispatcher isdn_timer_function()
*/
void
isdn_tty_modem_ring(void)
{ {
int ton = 0; struct modem_info *info = (struct modem_info *) data;
int i;
if (!(info->msr & UART_MSR_RI))
return;
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
modem_info *info = &isdn_mdm.info[i];
if (info->msr & UART_MSR_RI) {
ton = 1;
isdn_tty_modem_result(RESULT_RING, info); isdn_tty_modem_result(RESULT_RING, info);
} mod_timer(&info->ring_timer, jiffies + RING_TIMEOUT);
}
isdn_timer_ctrl(ISDN_TIMER_MODEMRING, ton);
} }
/* /*
......
...@@ -98,7 +98,6 @@ ...@@ -98,7 +98,6 @@
((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \ ((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \
(info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS2)) (info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS2))
extern void isdn_tty_modem_ring(void);
extern void isdn_tty_carrier_timeout(void); extern void isdn_tty_carrier_timeout(void);
extern void isdn_tty_modem_xmit(void); extern void isdn_tty_modem_xmit(void);
extern int isdn_tty_init(void); extern int isdn_tty_init(void);
......
...@@ -239,14 +239,11 @@ typedef struct { ...@@ -239,14 +239,11 @@ typedef struct {
#define ISDN_TIMER_RES 4 /* Main Timer-Resolution */ #define ISDN_TIMER_RES 4 /* Main Timer-Resolution */
#define ISDN_TIMER_02SEC (HZ/ISDN_TIMER_RES/5) /* Slow-Timer1 .2 sec */ #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_1SEC (HZ/ISDN_TIMER_RES) /* Slow-Timer2 1 sec */
#define ISDN_TIMER_RINGING 5 /* tty RINGs = ISDN_TIMER_1SEC * this factor */
#define ISDN_TIMER_KEEPINT 10 /* Cisco-Keepalive = ISDN_TIMER_1SEC * this factor */
#define ISDN_TIMER_MODEMREAD 1 #define ISDN_TIMER_MODEMREAD 1
#define ISDN_TIMER_MODEMRING 4
#define ISDN_TIMER_MODEMXMIT 8 #define ISDN_TIMER_MODEMXMIT 8
#define ISDN_TIMER_CARRIER 256 /* Wait for Carrier */ #define ISDN_TIMER_CARRIER 256 /* Wait for Carrier */
#define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMXMIT) #define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMXMIT)
#define ISDN_TIMER_SLOW (ISDN_TIMER_MODEMRING | ISDN_TIMER_CARRIER) #define ISDN_TIMER_SLOW (ISDN_TIMER_CARRIER)
/* GLOBAL_FLAGS */ /* GLOBAL_FLAGS */
#define ISDN_GLOBAL_STOPPED 1 #define ISDN_GLOBAL_STOPPED 1
...@@ -362,6 +359,7 @@ typedef struct modem_info { ...@@ -362,6 +359,7 @@ typedef struct modem_info {
struct tty_struct *tty; /* Pointer to corresponding tty */ struct tty_struct *tty; /* Pointer to corresponding tty */
atemu emu; /* AT-emulator data */ atemu emu; /* AT-emulator data */
struct timer_list escape_timer; /* to recognize +++ escape */ struct timer_list escape_timer; /* to recognize +++ escape */
struct timer_list ring_timer; /* for writing 'RING' responses */
struct termios normal_termios; /* For saving termios structs */ struct termios normal_termios; /* For saving termios structs */
struct termios callout_termios; struct termios callout_termios;
wait_queue_head_t open_wait, close_wait; 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