forked from Imagelibrary/rtems
2011-08-30 Peter Dufault <dufault@hda.com>
* libchip/network/smc91111.c: Modify to support the MPC5554 using new exceptions. Fix where the networking status is being dumped to a single thousand-character line. Add support for when the chip loaded it's MAC address from a serial chip at reset (the SMC91111_ENADDR_IS_SETUP option). Call lan91cxx_start() every time the the device is initialized. Without this change the chip can not be "upped" once it has been downed. * c/src/libchip/network/smc91111.h: Change the "#ifdef expression" to "#if expression". * c/src/libchip/network/smc91111exp.h: Add support for new exceptions.
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
2011-08-30 Peter Dufault <dufault@hda.com>
|
||||
|
||||
* libchip/network/smc91111.c: Modify to support the MPC5554 using new
|
||||
exceptions. Fix where the networking status is being dumped to a
|
||||
single thousand-character line. Add support for when the chip loaded
|
||||
it's MAC address from a serial chip at reset (the
|
||||
SMC91111_ENADDR_IS_SETUP option). Call lan91cxx_start() every time
|
||||
the the device is initialized. Without this change the chip can not
|
||||
be "upped" once it has been downed.
|
||||
* c/src/libchip/network/smc91111.h: Change the "#ifdef expression" to
|
||||
"#if expression".
|
||||
* c/src/libchip/network/smc91111exp.h: Add support for new exceptions.
|
||||
|
||||
2011-07-11 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* libchip/serial/ns16550_p.h, libchip/serial/ns16550.c: Remove
|
||||
|
||||
@@ -5,28 +5,28 @@
|
||||
#include <rtems.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
/*
|
||||
* This driver currently only supports architectures with the old style
|
||||
* exception processing. The following checks try to keep this
|
||||
* from being compiled on systems which can't support this driver.
|
||||
* This driver currently only supports SPARC with the old style
|
||||
* exception processing and the Phytec Phycore MPC5554.
|
||||
* This test keeps it from being compiled on systems which haven't been
|
||||
* tested.
|
||||
*
|
||||
* NOTE: As of 28 September 2005, this has only been tested on the SPARC,
|
||||
* so that is all it is enabled for.
|
||||
*/
|
||||
|
||||
#if defined(__sparc__)
|
||||
#if defined(__sparc__) || defined(HAS_SMC91111)
|
||||
#define SMC91111_SUPPORTED
|
||||
#endif
|
||||
|
||||
#if defined(SMC91111_SUPPORTED)
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <rtems/error.h>
|
||||
#include <rtems/rtems_bsdnet.h>
|
||||
#include <rtems/irq-extension.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mbuf.h>
|
||||
@@ -54,15 +54,20 @@
|
||||
/*#define DEBUG (-1)*/
|
||||
/*#define DEBUG (-1 & ~(16))*/
|
||||
#define DEBUG (0)
|
||||
/*#define DEBUG (1)*/
|
||||
|
||||
#include "smc91111config.h"
|
||||
#include <libchip/smc91111.h>
|
||||
|
||||
#ifdef _OLD_EXCEPTIONS
|
||||
#if defined(__m68k__)
|
||||
extern m68k_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int );
|
||||
#else
|
||||
extern rtems_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int );
|
||||
#endif
|
||||
#else
|
||||
#include <rtems/irq-extension.h>
|
||||
#endif
|
||||
|
||||
struct lan91cxx_priv_data smc91111;
|
||||
|
||||
@@ -795,33 +800,33 @@ static void lan91cxx_finish_sent(struct lan91cxx_priv_data *cpd)
|
||||
*/
|
||||
static void smc91111_stats(struct lan91cxx_priv_data *priv)
|
||||
{
|
||||
printf("tx_good :%-8d", priv->stats.tx_good);
|
||||
printf("tx_max_collisions :%-8d", priv->stats.tx_max_collisions);
|
||||
printf("tx_late_collisions :%-8d", priv->stats.tx_late_collisions);
|
||||
printf("tx_underrun :%-8d", priv->stats.tx_underrun);
|
||||
printf("tx_carrier_loss :%-8d", priv->stats.tx_carrier_loss);
|
||||
printf("tx_deferred :%-8d", priv->stats.tx_deferred);
|
||||
printf("tx_sqetesterrors :%-8d", priv->stats.tx_sqetesterrors);
|
||||
printf("tx_single_collisions:%-8d", priv->stats.tx_single_collisions);
|
||||
printf("tx_mult_collisions :%-8d", priv->stats.tx_mult_collisions);
|
||||
printf("tx_total_collisions :%-8d", priv->stats.tx_total_collisions);
|
||||
printf("rx_good :%-8d", priv->stats.rx_good);
|
||||
printf("rx_crc_errors :%-8d", priv->stats.rx_crc_errors);
|
||||
printf("rx_align_errors :%-8d", priv->stats.rx_align_errors);
|
||||
printf("rx_resource_errors :%-8d", priv->stats.rx_resource_errors);
|
||||
printf("rx_overrun_errors :%-8d", priv->stats.rx_overrun_errors);
|
||||
printf("rx_collisions :%-8d", priv->stats.rx_collisions);
|
||||
printf("rx_short_frames :%-8d", priv->stats.rx_short_frames);
|
||||
printf("rx_too_long_frames :%-8d", priv->stats.rx_too_long_frames);
|
||||
printf("rx_symbol_errors :%-8d", priv->stats.rx_symbol_errors);
|
||||
printf("interrupts :%-8d", priv->stats.interrupts);
|
||||
printf("rx_count :%-8d", priv->stats.rx_count);
|
||||
printf("rx_deliver :%-8d", priv->stats.rx_deliver);
|
||||
printf("rx_resource :%-8d", priv->stats.rx_resource);
|
||||
printf("rx_restart :%-8d", priv->stats.rx_restart);
|
||||
printf("tx_count :%-8d", priv->stats.tx_count);
|
||||
printf("tx_complete :%-8d", priv->stats.tx_complete);
|
||||
printf("tx_dropped :%-8d", priv->stats.tx_dropped);
|
||||
printf("tx_good :%-8d\n", priv->stats.tx_good);
|
||||
printf("tx_max_collisions :%-8d\n", priv->stats.tx_max_collisions);
|
||||
printf("tx_late_collisions :%-8d\n", priv->stats.tx_late_collisions);
|
||||
printf("tx_underrun :%-8d\n", priv->stats.tx_underrun);
|
||||
printf("tx_carrier_loss :%-8d\n", priv->stats.tx_carrier_loss);
|
||||
printf("tx_deferred :%-8d\n", priv->stats.tx_deferred);
|
||||
printf("tx_sqetesterrors :%-8d\n", priv->stats.tx_sqetesterrors);
|
||||
printf("tx_single_collisions:%-8d\n", priv->stats.tx_single_collisions);
|
||||
printf("tx_mult_collisions :%-8d\n", priv->stats.tx_mult_collisions);
|
||||
printf("tx_total_collisions :%-8d\n", priv->stats.tx_total_collisions);
|
||||
printf("rx_good :%-8d\n", priv->stats.rx_good);
|
||||
printf("rx_crc_errors :%-8d\n", priv->stats.rx_crc_errors);
|
||||
printf("rx_align_errors :%-8d\n", priv->stats.rx_align_errors);
|
||||
printf("rx_resource_errors :%-8d\n", priv->stats.rx_resource_errors);
|
||||
printf("rx_overrun_errors :%-8d\n", priv->stats.rx_overrun_errors);
|
||||
printf("rx_collisions :%-8d\n", priv->stats.rx_collisions);
|
||||
printf("rx_short_frames :%-8d\n", priv->stats.rx_short_frames);
|
||||
printf("rx_too_long_frames :%-8d\n", priv->stats.rx_too_long_frames);
|
||||
printf("rx_symbol_errors :%-8d\n", priv->stats.rx_symbol_errors);
|
||||
printf("interrupts :%-8d\n", priv->stats.interrupts);
|
||||
printf("rx_count :%-8d\n", priv->stats.rx_count);
|
||||
printf("rx_deliver :%-8d\n", priv->stats.rx_deliver);
|
||||
printf("rx_resource :%-8d\n", priv->stats.rx_resource);
|
||||
printf("rx_restart :%-8d\n", priv->stats.rx_restart);
|
||||
printf("tx_count :%-8d\n", priv->stats.tx_count);
|
||||
printf("tx_complete :%-8d\n", priv->stats.tx_complete);
|
||||
printf("tx_dropped :%-8d\n", priv->stats.tx_dropped);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -948,6 +953,15 @@ int _rtems_smc91111_driver_attach (struct rtems_bsdnet_ifconfig *config,
|
||||
if (config->hardware_address) {
|
||||
memcpy(cpd->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN);
|
||||
} else {
|
||||
#ifdef SMC91111_ENADDR_IS_SETUP
|
||||
/* The address was put in the chip at reset time. Retrieve it. */
|
||||
int i;
|
||||
for (i = 0; i < sizeof(cpd->enaddr); i += 2) {
|
||||
unsigned short r = get_reg(cpd, LAN91CXX_IA01 + i / 2);
|
||||
cpd->arpcom.ac_enaddr[i] = r;
|
||||
cpd->arpcom.ac_enaddr[i+1] = r >> 8;
|
||||
}
|
||||
#else
|
||||
/* dummy default address */
|
||||
cpd->arpcom.ac_enaddr[0] = 0x12;
|
||||
cpd->arpcom.ac_enaddr[1] = 0x13;
|
||||
@@ -955,6 +969,7 @@ int _rtems_smc91111_driver_attach (struct rtems_bsdnet_ifconfig *config,
|
||||
cpd->arpcom.ac_enaddr[3] = 0x15;
|
||||
cpd->arpcom.ac_enaddr[4] = 0x16;
|
||||
cpd->arpcom.ac_enaddr[5] = 0x17;
|
||||
#endif
|
||||
}
|
||||
|
||||
cpd->enaddr[0] = cpd->arpcom.ac_enaddr[0];
|
||||
@@ -1020,6 +1035,8 @@ static void smc91111_init(void *arg)
|
||||
smc91111_rxDaemon, cpd);
|
||||
cpd->txDaemonTid =
|
||||
rtems_bsdnet_newproc("DCtx", 4096, smc91111_txDaemon, cpd);
|
||||
} else {
|
||||
lan91cxx_start(ifp);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1055,8 +1072,22 @@ int lan91cxx_hardware_init(struct lan91cxx_priv_data *cpd)
|
||||
cpd->txbusy = cpd->within_send = 0;
|
||||
|
||||
/* install interrupt vector */
|
||||
#ifdef _OLD_EXCEPTIONS
|
||||
db_printf("Install lan91cxx irqvector at %d\n", cpd->config.vector);
|
||||
set_vector(lan91cxx_interrupt_handler, cpd->config.vector, 1);
|
||||
#else
|
||||
{
|
||||
int r;
|
||||
if ((r = rtems_interrupt_handler_install(cpd->config.vector,
|
||||
cpd->config.info,
|
||||
cpd->config.options,
|
||||
cpd->config.interrupt_wrapper,
|
||||
cpd->config.arg) )) {
|
||||
printf("rtems_interrupt_handler_install returned %d.\n", r);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Reset chip */
|
||||
put_reg(cpd, LAN91CXX_RCR, LAN91CXX_RCR_SOFT_RST);
|
||||
@@ -1622,8 +1653,6 @@ lan91cxx_write_phy(struct lan91cxx_priv_data *cpd, uint8_t phyaddr,
|
||||
db16_printf("phy_write: %d : %04x\n", phyreg, value);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
void lan91cxx_print_bank(int bank){
|
||||
struct lan91cxx_priv_data *cpd = &smc91111;
|
||||
@@ -1644,3 +1673,5 @@ void lan91cxx_print_bank(int bank){
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -451,7 +451,7 @@ get_reg(struct lan91cxx_priv_data *cpd, int regno)
|
||||
|
||||
/*rtems_interrupt_enable(Irql);*/
|
||||
|
||||
#ifdef DEBUG & 32
|
||||
#if DEBUG & 32
|
||||
while ((c = dbg->reg) != -1) {
|
||||
if (c == regno) {
|
||||
db_printf("%sread reg [%d:%x] -> 0x%04x (%-20s)\n", dbg_prefix, regno>>3,(regno&0x7)*2, val, dbg->name);
|
||||
@@ -474,7 +474,7 @@ put_reg(struct lan91cxx_priv_data *cpd, int regno, unsigned short val)
|
||||
debug_regs_pair *dbg = debug_regs; int c;
|
||||
uint32_t Irql;
|
||||
|
||||
#ifdef DEBUG & 32
|
||||
#if DEBUG & 32
|
||||
while ((c = dbg->reg) != -1) {
|
||||
if (c == regno) {
|
||||
db_printf("%swrite reg [%d:%x] <- 0x%04x (%-20s)\n", dbg_prefix, regno>>3, (regno&0x07)*2, val, dbg->name);
|
||||
|
||||
@@ -12,6 +12,14 @@ typedef struct scmv91111_configuration {
|
||||
unsigned int ctl_rspeed;
|
||||
unsigned int ctl_rfduplx;
|
||||
unsigned int ctl_autoneg;
|
||||
#ifndef _OLD_EXCEPTIONS
|
||||
/* New arguments for the Interrupt Manager Extension:
|
||||
*/
|
||||
const char * info;
|
||||
rtems_option options;
|
||||
rtems_interrupt_handler interrupt_wrapper;
|
||||
void * arg;
|
||||
#endif
|
||||
} scmv91111_configuration_t;
|
||||
|
||||
#endif /* _SMC_91111_EXP_H_ */
|
||||
|
||||
Reference in New Issue
Block a user