diff options
author | Noe Rubinstein <nrubinstein@proformatique.com> | 2010-11-12 18:38:43 +0100 |
---|---|---|
committer | Noe Rubinstein <nrubinstein@proformatique.com> | 2010-11-12 18:38:43 +0100 |
commit | 1db6c85bb230f118efa3fee7ff8f2d2afe7c094d (patch) | |
tree | 6fe22cfd55a750465c084e4440d9d8ce1d5b2218 /xhfc | |
parent | a80aeaabdcd15d5ec68adc80a7fb92eb41378e7b (diff) |
compiles; panics.
Diffstat (limited to 'xhfc')
-rw-r--r-- | xhfc/Makefile | 2 | ||||
-rw-r--r-- | xhfc/xhfc.c | 19 | ||||
-rw-r--r-- | xhfc/xhfc.h | 2 | ||||
-rw-r--r-- | xhfc/xhfc_st_state.c | 36 |
4 files changed, 31 insertions, 28 deletions
diff --git a/xhfc/Makefile b/xhfc/Makefile index 62626f1..a7c8833 100644 --- a/xhfc/Makefile +++ b/xhfc/Makefile @@ -6,7 +6,7 @@ CFLAGS_MODULE += -I$(DAHDI_INCLUDE) -I$(abspath $(src)/../) -DUSE_GPIO obj-m := xhfcdm.o -xhfcdm-objs := xhfc.o xhfc_leb.o xhfc_timers_state.o +xhfcdm-objs := xhfc.o xhfc_leb.o xhfc_st_state.o modules: modules modules_install clean: diff --git a/xhfc/xhfc.c b/xhfc/xhfc.c index 67168ac..8a6b49f 100644 --- a/xhfc/xhfc.c +++ b/xhfc/xhfc.c @@ -463,9 +463,11 @@ static int hdlc_tx_frame(struct xhfc_span *xhfc_span) int dbglen; /* ignoring TE red alarms: if TE and we are in alarm, restart the - * S/T state machine ???*/ - if (!xhfc_span->nt && (xhfc_span->newalarm != 0)) { - hfc_start_st(xhfc_span); + * S/T state machine... + * XXX Why is this here? Is activate_request sufficient here or should + * more resetting work be done? */ + if (!xhfc_span->nt && (xhfc_span->span.alarms != 0)) { + activate_request(xhfc_span); } fifo = dchan_fifo(xhfc_span); @@ -619,11 +621,10 @@ irqreturn_t xhfc_interrupt(int irq, void *dev_id, struct pt_regs* ptregs) r_su_irq = read_xhfc(xhfc, R_SU_IRQ); - for (i = 0; i < ARRAY_SIZE(xhfc->spans); i++) + for (i = 0; i < SPANS_PER_CHIP; i++) handle_st_timers(&xhfc->spans[i]); - if (r_su_irq & (1 << i)/* || 2 == xhfc->ticks /* bootstrap XXX WTF*/) + if (r_su_irq & (1 << i) || 2 == xhfc->ticks /* bootstrap XXX WTF*/) handle_state_change(&xhfc->spans[i]); - } return IRQ_HANDLED; @@ -862,7 +863,7 @@ void init_spans(struct xhfc* x) struct dahdi_chan *chan; /* for each span on the card */ - for (i=0; i < SPANS_PER_CHIP; i++) { + for (i = 0; i < SPANS_PER_CHIP; i++) { xhfc_span = &x->spans[i]; dahdi_span = &xhfc_span->span; @@ -873,8 +874,6 @@ void init_spans(struct xhfc* x) xhfc_span->sigchan = NULL; /* conf'd in chanconfig (xref1) */ xhfc_span_set_ntte(xhfc_span, ntte & (1 << i)); /* reconf'd in spanconfig (xref2) */ - xhfc_span->newalarm = DAHDI_ALARM_RED; - /* All the timer stuff is done in the timer and state * functions, not here. */ @@ -898,6 +897,8 @@ void init_spans(struct xhfc* x) x->pi->pci_dev->bus->number, PCI_SLOT(x->pi->pci_dev->devfn) + 1); + dahdi_span->alarms = DAHDI_ALARM_RED; + init_waitqueue_head(&dahdi_span->maintq); /* kinda everyone does this */ diff --git a/xhfc/xhfc.h b/xhfc/xhfc.h index 0fb1375..7ee0ea5 100644 --- a/xhfc/xhfc.h +++ b/xhfc/xhfc.h @@ -175,7 +175,7 @@ int xhfc_cfg_pcm(struct xhfc * xhfc, __u8 pcm); void activate_request(struct xhfc_span* s); void deactivate_request(struct xhfc_span* s); void handle_state_change(struct xhfc_span* s); -void handle_st_timers(struct xhfc_span* s) +void handle_st_timers(struct xhfc_span* s); int __devinit xhfc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); void __devexit xhfc_remove_one(struct pci_dev *pdev); diff --git a/xhfc/xhfc_st_state.c b/xhfc/xhfc_st_state.c index 9f3f6e6..58b24b2 100644 --- a/xhfc/xhfc_st_state.c +++ b/xhfc/xhfc_st_state.c @@ -25,19 +25,18 @@ wait will be long enough. */ enum te_state { F0, F1, F2, F3, F4, F5, F6, F7, F8 }; -enum nt_state { G0, G1, G2, G3 }; +enum nt_state { G0, G1, G2, G3, G4 }; static void expiry_T1(struct xhfc_span* s); static void expiry_T3(struct xhfc_span* s); +static void signal_f7_transition(struct xhfc_span* s); static void handle_state_change_nt(struct xhfc_span* s); 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); +static void print_state(struct xhfc_span* s); void activate_request(struct xhfc_span* s) { @@ -46,15 +45,16 @@ void activate_request(struct xhfc_span* s) if(DBG_ST && DBG_SPAN(s)) printk(KERN_DEBUG DRIVER_NAME ": activate on port %d\n", - xhfc_span->port); + s->port); 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++; + s->t1 = s->t3 = 0; + + /* timer activation done by state change handler (xref3) */ } void deactivate_request(struct xhfc_span* s) /* XXX not called */ @@ -65,7 +65,7 @@ void deactivate_request(struct xhfc_span* s) /* XXX not called */ if(DBG_ST && DBG_SPAN(s)) printk(KERN_DEBUG DRIVER_NAME ": deactivate on port %d\n", - xhfc_span->port); + s->port); if(s->nt && (sta == G2 || sta == G3)) set_st_state(s, G4); @@ -73,8 +73,10 @@ void deactivate_request(struct xhfc_span* s) /* XXX not called */ void handle_state_change(struct xhfc_span* s) { - struct xhfc* x = s->xhfc; - + struct xhfc* x; + + x = s->xhfc; + s->prev_state = s->state; write_xhfc(x, R_SU_SEL, s->port); @@ -114,7 +116,7 @@ static void handle_state_change_nt(struct xhfc_span* s) * implemented in hardware. */ - s->t1++; + s->t1++; /* xref3 */ break; case G3: s->span.alarms = DAHDI_ALARM_NONE; @@ -151,7 +153,7 @@ static void handle_state_change_te(struct xhfc_span* s) * hard) is assumed. */ - s->t3++; + s->t3++; /* xref3 */ /* Fall through */ case F5: @@ -175,9 +177,9 @@ static void handle_state_change_te(struct xhfc_span* s) void handle_st_timers(struct xhfc_span* s) { - if(unlikely(s->t1 && ++t1 > T1_MS)) expiry_T1(s); - if(unlikely(s->t3 && ++t3 > T3_MS)) expiry_T3(s); - if(unlikely(s->f6_f7_transition && ++f6_f7_transition > F6_F7_MS)) + if(unlikely(s->t1 && ++s->t1 > T1_MS)) expiry_T1(s); + if(unlikely(s->t3 && ++s->t3 > T3_MS)) expiry_T3(s); + if(unlikely(s->f6_f7_transition && ++s->f6_f7_transition > F6_F7_MS)) signal_f7_transition(s); } @@ -201,7 +203,7 @@ static void expiry_T1(struct xhfc_span* s) s->t1 = NOT_RUNNING; } -static void expiry_T3(struct xhfc_span* s); +static void expiry_T3(struct xhfc_span* s) { if(DBG_ST && DBG_SPAN(s)) printk(KERN_INFO DRIVER_NAME ": TE activation timeout" @@ -237,7 +239,7 @@ static void set_st_state(struct xhfc_span* s, int state) write_xhfc(s->xhfc, A_SU_WR_STA, a_su_wr_sta); } -static char *state_descriptions[2][16] = { +static char *state_description[2][16] = { { /* TE */ /* F0 */ "reset", /* F1 */ "inactive", |