diff options
author | Noe Rubinstein <nrubinstein@proformatique.com> | 2010-11-04 20:30:18 +0100 |
---|---|---|
committer | Noe Rubinstein <nrubinstein@proformatique.com> | 2010-11-04 20:30:18 +0100 |
commit | 6f99ae94d1b296c4d21d6c053eed65460fcd39c0 (patch) | |
tree | 7ee1221de6dae8a5600cf0a0e1189d17230b356b /xhfc/xhfc_st_state.c | |
parent | dbb36f23299b01dc54d5145aa51a971ced62842b (diff) |
expiry_T1, expiry_T3, set_st_state
Diffstat (limited to 'xhfc/xhfc_st_state.c')
-rw-r--r-- | xhfc/xhfc_st_state.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/xhfc/xhfc_st_state.c b/xhfc/xhfc_st_state.c index f52425d..ca4ade6 100644 --- a/xhfc/xhfc_st_state.c +++ b/xhfc/xhfc_st_state.c @@ -28,6 +28,8 @@ static void handle_state_change_te(struct xhfc_span* s); static void activate_request_nt(struct xhfc_span* s); static void activate_request_te(struct xhfc_span* s); +static void set_st_state(struct xhfc_span* s, int state); + static void print_current_state(struct xhfc_span* s); void handle_state_change(struct xhfc_span* s) @@ -66,6 +68,13 @@ static void handle_state_change_nt(struct xhfc_span* s) case G2: s->span.alarms = DAHDI_ALARM_YELLOW; if(s->prev_state != G3) + /* When setting the state to G4 by writing + * A_SU_WR_STA, is the T2 timer automatically + * started? I suppose so because I don't see + * any other way to start it and it is + * implemented in hardware. + */ + /* Start T1 */ ; break; case G3: @@ -113,7 +122,33 @@ static void handle_state_change_te(struct xhfc_span* s) s->span.alarms = DAHDI_ALARM_NONE; /* Stop T3 */ break; + } +} + +static void expiry_T1(struct xhfc_span* s) +{ + set_st_state(s, G4); +} + +static void expiry_T3(struct xhfc_span* s); +{ + set_st_state(s, F3); +} + +static void set_st_state(struct xhfc_span* s, int state) +{ + u8 a_su_wr_sta = 0; + SET_V_SU_SET_STA(a_su_wr_sta, state); + SET_V_SU_LD_STA(a_su_wr_sta, 1); + + write_xhfc(s->xhfc, R_SU_SEL, s->port); + write_xhfc(s->xhfc, A_SU_WR_STA, a_su_wr_sta); + + udelay(6); + SET_V_SU_LD_STA(a_su_wr_sta, 0); + write_xhfc(s->xhfc, R_SU_SEL, s->port); /* just in case. (XXX?) */ + write_xhfc(s->xhfc, A_SU_WR_STA, a_su_wr_sta); } static char *state_descriptions[2][16] = { |