diff options
author | Noe Rubinstein <nrubinstein@proformatique.com> | 2010-11-05 18:36:53 +0100 |
---|---|---|
committer | Noe Rubinstein <nrubinstein@proformatique.com> | 2010-11-05 18:36:53 +0100 |
commit | 0765bf9a051d735855f9617cbe2a54d231a56ba9 (patch) | |
tree | a0d51513e35c1b0345baf7b1d770df477c792ea7 /xhfc/xhfc_st_state.c | |
parent | 010a04ebd7bfedf7e715d4977f42b55ff95ffc04 (diff) |
more
Diffstat (limited to 'xhfc/xhfc_st_state.c')
-rw-r--r-- | xhfc/xhfc_st_state.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/xhfc/xhfc_st_state.c b/xhfc/xhfc_st_state.c index 3cd1cbf..809d80f 100644 --- a/xhfc/xhfc_st_state.c +++ b/xhfc/xhfc_st_state.c @@ -11,7 +11,12 @@ #define T3_MS 30000 /* TE activation timer. according to I.430 "the value depends on the subscriber loop transmission technique. The worst - case value is 30s." */ + case value is 30s." + XXX in DAHDI's mess, this was 500ms on the first + time, and then the worst-case value of 30s, which I + guess makes sense. Try to see if any document says + to do that and maybe do the same here? Can't seem to + understand how mISDN handles the matter. */ #define F6_F7_MS 2 /* Wait before signalling the change to F7. This is done because the XHFC might go to F7 for a short time during a F6->F3 transition when @@ -25,7 +30,7 @@ enum nt_state { G0, G1, G2, G3 }; void activate_request(struct xhfc_span* s); void deactivate_request(struct xhfc_span* s); void handle_state_change(struct xhfc_span* s); -void handle_timers(struct xhfc_span* s) +void handle_st_timers(struct xhfc_span* s) static void expiry_T1(struct xhfc_span* s); static void expiry_T3(struct xhfc_span* s); @@ -39,6 +44,18 @@ static void set_st_state(struct xhfc_span* s, int state); static void print_current_state(struct xhfc_span* s); +void activate_request(struct xhfc_span* s) +{ + u8 a_su_wr_sta = 0; + SET_V_SU_ACT(a_su_wr_sta, V_SU_ACT_ACTIVATE); + + write_xhfc(s->xhfc, R_SU_SEL, s->port); + write_xhfc(s->xhfc, A_SU_WR_STA, a_su_wr_sta); + + if(s->nt) s->t1++; + else s->t3++; +} + void handle_state_change(struct xhfc_span* s) { struct xhfc* x = s->xhfc; @@ -48,7 +65,7 @@ void handle_state_change(struct xhfc_span* s) write_xhfc(x, R_SU_SEL, s->port); s->state = read_xhfc(x, A_SU_RD_STA); - if(debug & DEBUG_ST_STATE) //XXX only place where this is used + if(DBG_ST) print_state(s); if(s->prev_state == s->state) { @@ -82,7 +99,7 @@ static void handle_state_change_nt(struct xhfc_span* s) * implemented in hardware. */ - s->t1 = T1_TICKS; + s->t1++; break; case G3: s->span.alarms = DAHDI_ALARM_NONE; @@ -119,7 +136,7 @@ static void handle_state_change_te(struct xhfc_span* s) * hard) is assumed. */ - s->t3 = T3_TICKS; + s->t3++; /* Fall through */ case F5: @@ -131,7 +148,7 @@ static void handle_state_change_te(struct xhfc_span* s) if ( GET_V_SU_STA(s->prev_state) == F6 && GET_V_SU_INFO0(s->state)) { - s->f6_f7_transition = F6_F7_MS; + s->f6_f7_transition++; break; } @@ -144,9 +161,9 @@ static void handle_state_change_te(struct xhfc_span* s) void handle_st_timers(struct xhfc_span* s) { - if(s->t1 != NOT_RUNNING && !--t1) expiry_T1(s); - if(s->t3 != NOT_RUNNING && !--t3) expiry_T3(s); - if(s->f6_f7_transition != NOT_RUNNING && !--f6_f7_transition) + if(s->t1 && ++t1 > T1_MS) expiry_T1(s); + if(s->t3 && ++t3 > T3_MS) expiry_T3(s); + if(s->f6_f7_transition && ++f6_f7_transition > F6_F7_MS) signal_f7_transition(s); } |