source: rtems/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c @ 8d830fae

4.11
Last change on this file since 8d830fae was 8d830fae, checked in by Radu <radustoma@…>, on Dec 2, 2013 at 8:07:35 PM

leon2_doxygen_1

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 * @file
3 * @ingroup sparc_leon2
4 * @brief SMC91111 Driver
5 */
6
7#include <rtems.h>
8
9#include <bsp.h>
10#include <rtems/bspIo.h>
11
12#include <stdlib.h>
13#include <stdio.h>
14#include <stdarg.h>
15#include <rtems/error.h>
16#include <rtems/rtems_bsdnet.h>
17
18#include <sys/param.h>
19#include <sys/mbuf.h>
20
21#include <sys/socket.h>
22#include <sys/sockio.h>
23#include <net/if.h>
24#include <netinet/in.h>
25#include <netinet/if_ether.h>
26
27#include <libchip/smc91111exp.h>
28
29
30#define SMC91111_BASE_ADDR (void*)0x20000300
31#define SMC91111_BASE_IRQ  4
32#define SMC91111_BASE_PIO  4
33
34scmv91111_configuration_t leon_scmv91111_configuration = {
35  SMC91111_BASE_ADDR, /* base address */
36  SMC91111_BASE_IRQ,  /* IRQ number (on LEON vector is irq) */
37  SMC91111_BASE_PIO,  /* PIO */
38  100,                /* 100b */
39  1,                  /* fulldx */
40  1                   /* autoneg */
41};
42
43int _rtems_smc91111_driver_attach(
44  struct rtems_bsdnet_ifconfig *config,
45  scmv91111_configuration_t    *scm_config
46);
47
48/*
49 * Attach an SMC91111 driver to the system
50 */
51int rtems_smc91111_driver_attach_leon2(struct rtems_bsdnet_ifconfig *config)
52{
53
54  /* activate io area */
55  printk("Activating Leon2 io port\n");
56  /*configure pio */
57  *((volatile unsigned int *)0x80000000) |= 0x10f80000;
58  *((volatile unsigned int *)0x800000A8) |=
59    (0xe0 | leon_scmv91111_configuration.pio)
60      << (8 * (leon_scmv91111_configuration.vector - 4)); /* vector = irq-no */
61
62  return _rtems_smc91111_driver_attach(config,&leon_scmv91111_configuration);
63}
Note: See TracBrowser for help on using the repository browser.