summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c')
-rw-r--r--c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c b/c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c
index 1b54688128..2a6b568403 100644
--- a/c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c
+++ b/c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c
@@ -1,17 +1,17 @@
-/*
+/*
* Authorship
* ----------
* This software ('mvme3100' RTEMS BSP) was created by
*
* Till Straumann <strauman@slac.stanford.edu>, 2005-2007,
* Stanford Linear Accelerator Center, Stanford University.
- *
+ *
* Acknowledgement of sponsorship
* ------------------------------
* The 'mvme3100' BSP was produced by
* the Stanford Linear Accelerator Center, Stanford University,
* under Contract DE-AC03-76SFO0515 with the Department of Energy.
- *
+ *
* Government disclaimer of liability
* ----------------------------------
* Neither the United States nor the United States Department of Energy,
@@ -20,18 +20,18 @@
* completeness, or usefulness of any data, apparatus, product, or process
* disclosed, or represents that its use would not infringe privately owned
* rights.
- *
+ *
* Stanford disclaimer of liability
* --------------------------------
* Stanford University makes no representations or warranties, express or
* implied, nor assumes any liability for the use of this software.
- *
+ *
* Stanford disclaimer of copyright
* --------------------------------
* Stanford University, owner of the copyright, hereby disclaims its
* copyright and all other rights in this software. Hence, anyone may
- * freely use it for any purpose without restriction.
- *
+ * freely use it for any purpose without restriction.
+ *
* Maintenance of notices
* ----------------------
* In the interest of clarity regarding the origin and status of this
@@ -40,9 +40,9 @@
* or distributed by the recipient and are to be affixed to any copy of
* software made or distributed by the recipient that contains a copy or
* derivative of this software.
- *
+ *
* ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
- */
+ */
#include <rtems.h>
#include <rtems/error.h>
@@ -219,7 +219,7 @@ void tsec_dump_rring(struct tsec_private *mp);
/*
* Misuse reserved bit 4 to flag link interrupts
* (which are totally external to the TSEC).
- * Because reading the MII is so slow we don't
+ * Because reading the MII is so slow we don't
* want to poll MII unnecessarily from RX/TX ISRs
*/
#define TSEC_LINK_INTR (1<<(31- 4))
@@ -232,7 +232,7 @@ void tsec_dump_rring(struct tsec_private *mp);
#define TSEC_IEVENT_TXF (1<<(31-11))
#define TSEC_IEVENT_LC (1<<(31-13))
#define TSEC_IEVENT_CRLXDA (1<<(31-14))
-#define TSEC_IEVENT_XFUN (1<<(31-15))
+#define TSEC_IEVENT_XFUN (1<<(31-15))
#define TSEC_IEVENT_RXB (1<<(31-16))
#define TSEC_IEVENT_GRSC (1<<(31-23))
#define TSEC_IEVENT_RXF (1<<(31-24))
@@ -264,7 +264,7 @@ void tsec_dump_rring(struct tsec_private *mp);
#define TSEC_IMASK_TXFEN (1<<(31-11))
#define TSEC_IMASK_LCEN (1<<(31-13))
#define TSEC_IMASK_CRLXDAEN (1<<(31-14))
-#define TSEC_IMASK_XFUNEN (1<<(31-15))
+#define TSEC_IMASK_XFUNEN (1<<(31-15))
#define TSEC_IMASK_RXBEN (1<<(31-16))
#define TSEC_IMASK_GRSCEN (1<<(31-23))
#define TSEC_IMASK_RXFEN (1<<(31-24))
@@ -341,7 +341,7 @@ void tsec_dump_rring(struct tsec_private *mp);
#define TSEC_IPGIFG 0x508
#define TSEC_HAFDUP 0x50c
#define TSEC_MAXFRM 0x510
-#define TSEC_MIIMCFG 0x520 /* TSEC only */
+#define TSEC_MIIMCFG 0x520 /* TSEC only */
#define TSEC_MIIMCOM 0x524 /* TSEC only */
#define TSEC_MIIMCOM_SCAN (1<<(31-30))
#define TSEC_MIIMCOM_READ (1<<(31-31))
@@ -532,7 +532,7 @@ static inline void st_be32(volatile uint32_t *a, uint32_t v)
#ifdef SW_COHERENCY
#error "SW_COHERENCY not implemented"
-/* Note: maintaining BD coherency in software is not trivial
+/* Note: maintaining BD coherency in software is not trivial
* because BDs are smaller than a cache line;
* we cannot pad a BD to the length of a cache line because
* the TSEC assumes BDs layed out sequentially in memory.
@@ -540,7 +540,7 @@ static inline void st_be32(volatile uint32_t *a, uint32_t v)
* line either because the manual says that the length
* field of a TX BD must not be zero.
*
- * We probably would need MMU resources to map BDs
+ * We probably would need MMU resources to map BDs
* as non-cachable.
*
* Maintaining buffer coherency would be easier:
@@ -659,7 +659,7 @@ struct tsec_private {
* connected to mii bus of 1st controller.
*/
unsigned phy; /* Phy address on mii bus */
- unsigned unit; /* Driver instance (one-based */
+ unsigned unit; /* Driver instance (one-based */
int isfec; /* Set if a FEC (not TSEC) controller */
struct tsec_softc *sc; /* Pointer to BSD driver struct */
TSEC_BD *ring_area; /* Not necessarily aligned */
@@ -727,12 +727,12 @@ typedef struct tsec_bsp_config {
/********** Global Variables ********************/
/* You may override base addresses
- * externally - but you must
+ * externally - but you must
* then also define TSEC_NUM_DRIVER_SLOTS.
*/
#ifndef TSEC_CONFIG
-static TsecBspConfig tsec_config[] =
+static TsecBspConfig tsec_config[] =
{
{
base: BSP_8540_CCSR_BASE + 0x24000,
@@ -896,7 +896,7 @@ FEC_Enet_Base b = mp->base;
* the PHY ISR is not hooked yet and there can be no
* interrupts...
*/
- if ( tsec_mtx )
+ if ( tsec_mtx )
#endif
phy_dis_irq_at_phy( mp );
@@ -918,7 +918,7 @@ FEC_Enet_Base b = mp->base;
/* wait for > 8ms */
rtems_task_wake_after(1);
-
+
/* set GRS if not already stopped */
if ( ! (TSEC_DMACTRL_GRS & fec_rd(b, TSEC_DMACTRL)) ) {
/* Make sure GRSC is clear */
@@ -947,7 +947,7 @@ install_remove_isrs(int install, struct tsec_private *mp, uint32_t irq_mask)
xxx.on = noop;
xxx.off = noop;
- xxx.isOn = nopf;
+ xxx.isOn = nopf;
xxx.handle = mp;
if ( irq_mask & TSEC_TXIRQ ) {
@@ -965,7 +965,7 @@ install_remove_isrs(int install, struct tsec_private *mp, uint32_t irq_mask)
if ( (line = TSEC_CONFIG[unit-1].rirq) < 0 && ! installed ) {
/* have no dedicated RX IRQ line; install TX ISR if not already done */
line = TSEC_CONFIG[unit-1].xirq;
- }
+ }
xxx.name = line;
xxx.hdl = tsec_risr;
if ( ! (install ?
@@ -979,7 +979,7 @@ install_remove_isrs(int install, struct tsec_private *mp, uint32_t irq_mask)
if ( (line = TSEC_CONFIG[unit-1].eirq) < 0 && ! installed ) {
/* have no dedicated RX IRQ line; install TX ISR if not already done */
line = TSEC_CONFIG[unit-1].xirq;
- }
+ }
xxx.name = line;
xxx.hdl = tsec_eisr;
if ( ! (install ?
@@ -1010,8 +1010,8 @@ install_remove_isrs(int install, struct tsec_private *mp, uint32_t irq_mask)
* by BSP_tsec_send_buf() earlier. The callback is passed 'cleanup_txbuf_arg'
* and a flag indicating whether the send had been successful.
* The driver no longer accesses 'user_buf' after invoking this callback.
- * CONTEXT: This callback is executed either by BSP_tsec_swipe_tx() or
- * BSP_tsec_send_buf(), BSP_tsec_init_hw(), BSP_tsec_stop_hw() (the latter
+ * CONTEXT: This callback is executed either by BSP_tsec_swipe_tx() or
+ * BSP_tsec_send_buf(), BSP_tsec_init_hw(), BSP_tsec_stop_hw() (the latter
* ones calling BSP_tsec_swipe_tx()).
* void *cleanup_txbuf_arg:
* Closure argument that is passed on to 'cleanup_txbuf()' callback;
@@ -1029,7 +1029,7 @@ install_remove_isrs(int install, struct tsec_private *mp, uint32_t irq_mask)
* instead of handing it out to 'consume_rxbuf()'.
* CONTEXT: Called when initializing the RX ring (BSP_tsec_init_hw()) or when
* swiping it (BSP_tsec_swipe_rx()).
- *
+ *
*
* void (*consume_rxbuf)(void *user_buf, void *consume_rxbuf_arg, int len);
* Pointer to user-supplied callback to pass a received buffer back to
@@ -1067,7 +1067,7 @@ tsec_setup_internal(
rtems_id driver_tid,
void (*isr)(void *),
void * isr_arg,
- void (*cleanup_txbuf)(void *user_buf, void *cleanup_txbuf_arg, int error_on_tx_occurred),
+ void (*cleanup_txbuf)(void *user_buf, void *cleanup_txbuf_arg, int error_on_tx_occurred),
void * cleanup_txbuf_arg,
void * (*alloc_rxbuf)(int *p_size, uintptr_t *p_data_addr),
void (*consume_rxbuf)(void *user_buf, void *consume_rxbuf_arg, int len),
@@ -1145,7 +1145,7 @@ struct ifnet *ifp;
M_DEVBUF,
M_WAIT );
assert( mp->tx_ring_user );
-
+
mp->rx_ring_user = mp->tx_ring_user + mp->tx_ring_size;
/* Initialize TX ring */
@@ -1208,7 +1208,7 @@ struct ifnet *ifp;
/* another task was faster installing the mutex */
rtems_semaphore_delete( new_mtx );
}
-
+
}
#endif
@@ -1228,7 +1228,7 @@ struct tsec_private *
BSP_tsec_setup(
int unit,
rtems_id driver_tid,
- void (*cleanup_txbuf)(void *user_buf, void *cleanup_txbuf_arg, int error_on_tx_occurred),
+ void (*cleanup_txbuf)(void *user_buf, void *cleanup_txbuf_arg, int error_on_tx_occurred),
void * cleanup_txbuf_arg,
void * (*alloc_rxbuf)(int *p_size, uintptr_t *p_data_addr),
void (*consume_rxbuf)(void *user_buf, void *consume_rxbuf_arg, int len),
@@ -1260,7 +1260,7 @@ BSP_tsec_setup_1(
int unit,
void (*isr)(void*),
void * isr_arg,
- void (*cleanup_txbuf)(void *user_buf, void *cleanup_txbuf_arg, int error_on_tx_occurred),
+ void (*cleanup_txbuf)(void *user_buf, void *cleanup_txbuf_arg, int error_on_tx_occurred),
void * cleanup_txbuf_arg,
void * (*alloc_rxbuf)(int *p_size, uintptr_t *p_data_addr),
void (*consume_rxbuf)(void *user_buf, void *consume_rxbuf_arg, int len),
@@ -1329,7 +1329,7 @@ int media = IFM_MAKEWORD(0, 0, 0, 0);
/*
* Initialize interface hardware
*
- * 'mp' handle obtained by from BSP_tsec_setup().
+ * 'mp' handle obtained by from BSP_tsec_setup().
* 'promisc' whether to set promiscuous flag.
* 'enaddr' pointer to six bytes with MAC address. Read
* from the device if NULL.
@@ -1360,7 +1360,7 @@ int sz;
}
if ( data_area & (RX_BUF_ALIGNMENT-1) )
rtems_panic(DRVNAME": RX buffers must be %i-byte aligned", RX_BUF_ALIGNMENT);
-
+
bd_wrbuf( &mp->rx_ring[i], data_area );
st_be16 ( &mp->rx_ring[i].len, sz );
bd_setfl( &mp->rx_ring[i], TSEC_RXBD_E | TSEC_RXBD_I );
@@ -1407,7 +1407,7 @@ int sz;
*/
fec_wr( b, TSEC_TXIC, 0);
}
- fec_wr( b, TSEC_OSTBD, 0 );
+ fec_wr( b, TSEC_OSTBD, 0 );
fec_wr( b, TSEC_RCTRL, (promisc ? TSEC_RCTRL_PROM : 0) );
fec_wr( b, TSEC_RSTAT, TSEC_RSTAT_QHLT );
if ( !mp->isfec ) {
@@ -1484,7 +1484,7 @@ int sz;
/* enable PHY irq (MII operation, slow) */
phy_en_irq_at_phy (mp );
}
-
+
BSP_tsec_enable_irq_mask( mp, mp->irq_mask );
}
@@ -1631,7 +1631,7 @@ unsigned i;
/* should be OK to clear all ownership flags */
for ( i=0; i<mp->tx_ring_size; i++ ) {
bd_clrfl( &mp->tx_ring[i], TSEC_TXBD_R );
- }
+ }
BSP_tsec_swipe_tx(mp);
#if DEBUG > 0
tsec_dump_tring(mp);
@@ -1835,7 +1835,7 @@ startover:
#endif
bd_wrbuf( bd, 0 );
bd_clrfl( bd, TSEC_TXBD_R | TSEC_TXBD_L );
-
+
mp->tx_avail++;
}
mp->tx_avail++;
@@ -1872,7 +1872,7 @@ startover:
if ( d == t ) {
tsec_dump_tring(mp);
printf("l %i, d %i, t %i, nmbs %i\n", l,d,t, nmbs);
- } else
+ } else
assert( d != t );
assert( ! bd_rdbuf( &mp->tx_ring[d] ) );
#endif
@@ -1949,7 +1949,7 @@ void *newbuf;
int sz;
uint16_t len;
uintptr_t baddr;
-
+
i = mp->rx_tail;
bd = mp->rx_ring + i;
flags = bd_rdfl( bd );
@@ -1994,7 +1994,7 @@ uintptr_t baddr;
rval++;
- i = NEXT_RXI( mp, i );
+ i = NEXT_RXI( mp, i );
bd = mp->rx_ring + i;
flags = bd_rdfl( bd );
}
@@ -2014,7 +2014,7 @@ union {
uint16_t s[2];
uint8_t c[4];
} x;
- st_le32( (volatile uint32_t *)(eaddr+2), fec_rd(mp->base, TSEC_MACSTNADDR1) );
+ st_le32( (volatile uint32_t *)(eaddr+2), fec_rd(mp->base, TSEC_MACSTNADDR1) );
x.u = fec_rd(mp->base, TSEC_MACSTNADDR2);
st_le16( (volatile uint16_t *)(eaddr), x.s[0]);
}
@@ -2401,7 +2401,7 @@ BSP_tsec_getp(unsigned index)
return & theTsecEths[index].pvt;
}
-/*
+/*
*
* Example driver task loop (note: no synchronization of
* buffer access shown!).
@@ -2462,7 +2462,7 @@ unsigned long l,o;
m->m_len = m->m_pkthdr.len = l;
*psz = m->m_len;
- *paddr = mtod(m, unsigned long);
+ *paddr = mtod(m, unsigned long);
return (void*) m;
}
@@ -2489,7 +2489,7 @@ struct mbuf *m = buf;
ifp->if_ipackets++;
ifp->if_ibytes += m->m_pkthdr.len;
-
+
/* send buffer upwards */
if (0) {
/* Low-level debugging */
@@ -2658,7 +2658,7 @@ int f;
case SIOCSIFMEDIA:
error = BSP_tsec_media_ioctl(&sc->pvt, cmd, &ifr->ifr_media);
break;
-
+
case SIOCADDMULTI:
case SIOCDELMULTI:
error = (cmd == SIOCADDMULTI)
@@ -2831,7 +2831,7 @@ struct ifnet *ifp;
/*
* While nonzero, the 'if->if_timer' is decremented
* (by the networking code) at a rate of IFNET_SLOWHZ (1hz) and 'if_watchdog'
- * is called when it expires.
+ * is called when it expires.
* If either of those fields is 0 the feature is disabled.
*/
ifp->if_watchdog = tsec_watchdog;
@@ -2947,7 +2947,7 @@ struct ifnet *ifp;
#define PHY_IRQS ( BCM54xx_IRQ_LNK | BCM54xx_IRQ_SPD | BCM54xx_IRQ_DUP )
-static void
+static void
phy_en_irq_at_phy( struct tsec_private *mp )
{
uint32_t ecr;
@@ -2959,7 +2959,7 @@ uint32_t ecr;
REGUNLOCK();
}
-static void
+static void
phy_dis_irq_at_phy( struct tsec_private *mp )
{
uint32_t ecr;
@@ -3109,7 +3109,7 @@ void cleanup_txbuf_test(void *u, void *a, int err)
{
printf("cleanup_txbuf_test (releasing buf 0x%8p)\n", u);
free(u);
- if ( err )
+ if ( err )
printf("cleanup_txbuf_test: an error was detected\n");
}
@@ -3135,7 +3135,7 @@ uintptr_t d = (uintptr_t)ALIGNTO(user_buf,RX_BUF_ALIGNMENT);
/* PRIxPTR is still broken */
printf("consuming rx buf 0x%8p (data@ 0x%08"PRIx32")\n",user_buf, (uint32_t)d);
- if ( len > 32 )
+ if ( len > 32 )
len = 32;
if ( len < 0 )
printf("consume_rxbuf_test: ERROR occurred: 0x%x\n", len);
@@ -3158,7 +3158,7 @@ void * tsec_up()
struct tsec_private *tsec =
BSP_tsec_setup( 1, 0,
cleanup_txbuf_test, 0,
- alloc_rxbuf_test,
+ alloc_rxbuf_test,
consume_rxbuf_test, 0,
2,
2,