diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2006-01-09 10:36:06 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2006-01-09 10:36:06 +0000 |
commit | bec7ba52314ce3beb962b6dae7131ff59ce3a76b (patch) | |
tree | d4519d9d6d802ae19767af216538fad1c5029c87 /c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c | |
parent | 2006-01-09 Ralf Corsepius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-bec7ba52314ce3beb962b6dae7131ff59ce3a76b.tar.bz2 |
Backport from rtems-4-6-branch.
Diffstat (limited to 'c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c')
-rw-r--r-- | c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c b/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c new file mode 100644 index 0000000000..6862b194cb --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c @@ -0,0 +1,66 @@ +/* + * $Id$ + */ + +#include <rtems.h> + +#include <bsp.h> +#include <stdio.h> + +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <rtems/error.h> +#include <rtems/rtems_bsdnet.h> + +#include <sys/param.h> +#include <sys/mbuf.h> + +#include <sys/socket.h> +#include <sys/sockio.h> +#include <net/if.h> +#include <netinet/in.h> +#include <netinet/if_ether.h> + +#include <libchip/smc91111exp.h> + + +#define SMC91111_BASE_ADDR (void*)0x20000300 +#define SMC91111_BASE_IRQ LEON_TRAP_TYPE(4) +#define SMC91111_BASE_PIO 4 + +scmv91111_configuration_t leon_scmv91111_configuration = { + SMC91111_BASE_ADDR, /* base address */ + SMC91111_BASE_IRQ, /* vector number */ + SMC91111_BASE_PIO, /* PIO */ + 10, /* 10b */ + 1, /* fulldx */ + 1 /* autoneg */ +}; + +int _rtems_smc91111_driver_attach( + struct rtems_bsdnet_ifconfig *config, + scmv91111_configuration_t *scm_config +); + +/* + * Attach an SMC91111 driver to the system + */ +int rtems_smc91111_driver_attach_leon2(struct rtems_bsdnet_ifconfig *config) +{ + + if (LEON_REG.Scaler_Reload >= 49) + leon_scmv91111_configuration.ctl_rspeed = 100; + + /* activate io area */ + DEBUG_puts("Activating Leon2 io port\n"); + /*configure pio */ + *((volatile unsigned int *)0x80000000) |= 0x10f80000; + *((volatile unsigned int *)0x800000A8) |= + (0xe0 | leon_scmv91111_configuration.vector) + << (8 * (leon_scmv91111_configuration.pio - 4)); + + return _rtems_smc91111_driver_attach(config,&leon_scmv91111_configuration); + +}; + |