This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
KS32C5000 ethernet driver poll mode correction
- From: "Chris Garry" <cgarry at sweeneydesign dot co dot uk>
- To: "eCos-Patches" <ecos-patches at sources dot redhat dot com>
- Date: Mon, 28 Oct 2002 20:55:06 -0000
- Subject: KS32C5000 ethernet driver poll mode correction
- Organization: Sweeney Design
- Reply-to: "Chris Garry" <cgarry at sweeneydesign dot co dot uk>
This patch allows the KS32C5000 ethernet driver to work correctly when used
in Redboot (in GDB stubs) with networking enabled. Also included in the diff are
my changes for little endian support (submitted 18-Oct-2002).
Comment:
Added call to BDMA Rx isr routine in ks32c5000_eth_poll() function.
--
Chris
Index: devs/eth/arm/ks32c5000/current/src/ks5000_ether.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c,v
retrieving revision 1.6
diff -u -5 -p -r1.6 ks5000_ether.c
--- devs/eth/arm/ks32c5000/current/src/ks5000_ether.c 14 Oct 2002 15:33:26 -0000 1.6
+++ devs/eth/arm/ks32c5000/current/src/ks5000_ether.c 28 Oct 2002 20:42:30 -0000
@@ -63,10 +63,12 @@
// need to prvide fake values for errno
#define EIO 1
#define EINVAL 2
#endif
+#include <cyg/infra/cyg_type.h> // Common type definitions and support
+ // including endian-ness
#include <cyg/infra/diag.h>
#include <cyg/io/eth/netdev.h>
#include <cyg/io/eth/eth_drv.h>
#include <cyg/io/eth/eth_drv_stats.h>
#include <cyg/hal/hal_intr.h>
@@ -250,19 +252,32 @@ static volatile U32 BDMATxConfigVar =
#define BDMARXCON_ALIGN BDMARXCON_WA11
#else
#error "EtherFramePadding must be 0,1,2 or 3"
#endif
+#if (CYG_BYTEORDER == CYG_MSBFIRST) // Big endian
static volatile U32 BDMARxConfigVar =
BDMARXCON_DIE |
BDMARXCON_EN |
BDMARXCON_BIG |
BDMARXCON_MA_INC |
BDMARXCON_NOIE |
BDMARXCON_ALIGN |
BDMARXCON_STP_SKP |
15; /* burst size - 1 */
+
+#else // Little endian
+static volatile U32 BDMARxConfigVar =
+ BDMARXCON_DIE |
+ BDMARXCON_EN |
+ BDMARXCON_LITTLE |
+ BDMARXCON_MA_INC |
+ BDMARXCON_NOIE |
+ BDMARXCON_ALIGN |
+ BDMARXCON_STP_SKP |
+ 15; /* burst size - 1 */
+#endif
/* Global variables For BDMA Error Report */
static BDMA_TX_ERR BDMATxErrCnt = {0,0,0};
@@ -486,13 +501,19 @@ static int ks32c5000_eth_buffer_send(tEt
MAC_Tx_Pkts += 1;
MAC_Tx_Octets += buf->length;
// fill in the packet descriptor
+#if (CYG_BYTEORDER == CYG_MSBFIRST) // Big endian
txWritePointer->Reserved = (TXFDCON_PADDING_MODE | TXFDCON_CRC_MODE |
TXFDCON_SRC_ADDR_INC | TXFDCON_BIG_ENDIAN |
TXFDCON_WIDGET_ALIGN00 | TXFDCON_MAC_TX_INT_EN);
+#else // Little endian
+ txWritePointer->Reserved = (TXFDCON_PADDING_MODE | TXFDCON_CRC_MODE |
+ TXFDCON_SRC_ADDR_INC | TXFDCON_LITTLE_ENDIAN |
+ TXFDCON_WIDGET_ALIGN00 | TXFDCON_MAC_TX_INT_EN);
+#endif
txWritePointer->StatusAndFrameLength = buf->length;
txWritePointer->FrameDataPtr = ((unsigned)buf | FRM_OWNERSHIP_BDMA);
txWritePointer = txWritePointer->NextFD;
@@ -1304,10 +1325,11 @@ static void ks32c5000_eth_recv(struct et
}
// routine called to handle ethernet controller in polled mode
static void ks32c5000_eth_poll(struct eth_drv_sc *sc)
{
+ BDMA_Rx_isr(CYGNUM_HAL_INTERRUPT_ETH_BDMA_RX, 0); // Call ISR routine
ks32c5000_eth_deliver(sc); // handle rx frames
ks32c5000_handle_tx_complete();
}
static int ks32c5000_eth_int_vector(struct eth_drv_sc *sc)