summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2016-03-22 15:51:13 +0100
committerDaniel Hellstrom <daniel@gaisler.com>2017-03-06 07:54:55 +0100
commitac7da5bcb00abcd2f424118fdabe231cf5520d00 (patch)
tree8f6b3008788381807f958f1891f411bd14632bce /c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c
parentleon, grspw_pkt: added link_ctrl options (diff)
downloadrtems-ac7da5bcb00abcd2f424118fdabe231cf5520d00.tar.bz2
leon, grspw_pkt: Manual handling of link status events
Added functionality for manual handling of link status events, configurable via grspw_link_ctrl. Added statistics counter for disconnect error.
Diffstat (limited to 'c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c')
-rw-r--r--c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c b/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c
index 1827fbd744..22fcda3724 100644
--- a/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c
+++ b/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c
@@ -472,6 +472,9 @@ struct grspw_priv {
/* Bit mask representing events which shall cause link disable. */
unsigned int dis_link_on_err;
+ /* Bit mask for link status bits to clear by ISR */
+ unsigned int stscfg;
+
/* "Core Global" Statistics gathered, not dependent on DMA channel */
struct grspw_core_stats stats;
};
@@ -538,6 +541,7 @@ void *grspw_open(int dev_no)
priv->tcisr_arg = NULL;
priv->icisr = NULL;
priv->icisr_arg = NULL;
+ priv->stscfg = LINKSTS_MASK;
grspw_stats_clr(priv);
@@ -745,7 +749,7 @@ static inline int grspw_is_irqsource_set(unsigned int ctrl, unsigned int icctrl)
/* options and clkdiv [in/out]: set to -1 to only read current config */
-void grspw_link_ctrl(void *d, int *options, int *clkdiv)
+void grspw_link_ctrl(void *d, int *options, int *stscfg, int *clkdiv)
{
struct grspw_priv *priv = d;
struct grspw_regs *regs = priv->regs;
@@ -782,6 +786,12 @@ void grspw_link_ctrl(void *d, int *options, int *clkdiv)
SPIN_UNLOCK_IRQ(&priv->devlock, irqflags);
*options = (ctrl & GRSPW_LINK_CFG) | priv->dis_link_on_err;
}
+ if (stscfg) {
+ if (*stscfg != -1) {
+ priv->stscfg = *stscfg & LINKSTS_MASK;
+ }
+ *stscfg = priv->stscfg;
+ }
}
/* Generate Tick-In (increment Time Counter, Send Time Code) */
@@ -2494,7 +2504,7 @@ STATIC void grspw_isr(void *data)
/* Get Status from Hardware */
stat = REG_READ(&priv->regs->status);
- stat_clrmsk = stat & (GRSPW_STS_TO | GRSPW_STAT_ERROR);
+ stat_clrmsk = stat & (GRSPW_STS_TO | GRSPW_STAT_ERROR) & priv->stscfg;
/* Make sure to put the timecode handling first in order to get the
* smallest possible interrupt latency
@@ -2550,6 +2560,9 @@ STATIC void grspw_isr(void *data)
if (stat & GRSPW_STS_PE)
priv->stats.err_parity++;
+ if (stat & GRSPW_STS_DE)
+ priv->stats.err_disconnect++;
+
if (stat & GRSPW_STS_ER)
priv->stats.err_escape++;