summaryrefslogtreecommitdiff
path: root/xhfc
diff options
context:
space:
mode:
authorNoe Rubinstein <nrubinstein@proformatique.com>2010-11-05 18:36:53 +0100
committerNoe Rubinstein <nrubinstein@proformatique.com>2010-11-05 18:36:53 +0100
commit0765bf9a051d735855f9617cbe2a54d231a56ba9 (patch)
treea0d51513e35c1b0345baf7b1d770df477c792ea7 /xhfc
parent010a04ebd7bfedf7e715d4977f42b55ff95ffc04 (diff)
more
Diffstat (limited to 'xhfc')
-rw-r--r--xhfc/xhfc.c2
-rw-r--r--xhfc/xhfc.h8
-rw-r--r--xhfc/xhfc_st_state.c35
3 files changed, 32 insertions, 13 deletions
diff --git a/xhfc/xhfc.c b/xhfc/xhfc.c
index cb442ca..606770e 100644
--- a/xhfc/xhfc.c
+++ b/xhfc/xhfc.c
@@ -623,7 +623,7 @@ irqreturn_t xhfc_interrupt(int irq, void *dev_id, struct pt_regs* ptregs)
if (r_su_irq & (1 << i)/* || 2 == xhfc->ticks /* bootstrap XXX WTF*/)
handle_state_change(&xhfc->spans[i]);
- hfc_update_st_timers(xhfc);
+ handle_timers(xhfc);
}
return IRQ_HANDLED;
diff --git a/xhfc/xhfc.h b/xhfc/xhfc.h
index 0b4fe00..4709c10 100644
--- a/xhfc/xhfc.h
+++ b/xhfc/xhfc.h
@@ -74,7 +74,6 @@ enum { XHFC_T1, XHFC_T2, XHFC_T3, XHFC_T4 };
#define DBG_SPANFILTER ((1 << xhfc_span->port) & dbg_spanfilter)
#define CORRUPTED_FRAME (-1)
-#define USE_FIFO_IRQ 0
#define HDLC_BUF_LEN 128 /* "arbitrary", or so say DAHDI's drivers */
@@ -85,7 +84,10 @@ enum { XHFC_T1, XHFC_T2, XHFC_T3, XHFC_T4 };
# define MIN(a, b) (((a) < (b))? (a) : (b))
#endif
-#define NOT_RUNNING UINT_MAX
+#define V_SU_ACT_ACTIVATE 3
+#define V_SU_ACT_DEACTIVATE 2
+
+#define NOT_RUNNING 0
enum data_dir { TRANSMIT = 0, RECEIVE = 1 };
@@ -123,7 +125,7 @@ struct xhfc_span {
struct dahdi_chan* sigchan;
int sigactive;
- unsigned int t1, t3, f6_f7_transition;
+ unsigned int t1, t3, f6_f7_transition; // timers; 0 when deactivated
unsigned long non_rx_cnt;
};
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);
}