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

4.115
Last change on this file since 8d830fae was 8d830fae, checked in by Radu <radustoma@…>, on 12/02/13 at 20:07:35

leon2_doxygen_1

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[8d830fae]1/**
2 * @file
3 * @ingroup sparc_leon2
4 * @brief SMC91111 Driver
5 */
6
[bec7ba52]7#include <rtems.h>
8
9#include <bsp.h>
[3734192]10#include <rtems/bspIo.h>
[bec7ba52]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
[0f04edd]31#define SMC91111_BASE_IRQ  4
[bec7ba52]32#define SMC91111_BASE_PIO  4
33
34scmv91111_configuration_t leon_scmv91111_configuration = {
[44b06ca]35  SMC91111_BASE_ADDR, /* base address */
[0f04edd]36  SMC91111_BASE_IRQ,  /* IRQ number (on LEON vector is irq) */
[44b06ca]37  SMC91111_BASE_PIO,  /* PIO */
[47b29ac]38  100,                /* 100b */
[bec7ba52]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 */
[94bbe857]55  printk("Activating Leon2 io port\n");
[bec7ba52]56  /*configure pio */
57  *((volatile unsigned int *)0x80000000) |= 0x10f80000;
58  *((volatile unsigned int *)0x800000A8) |=
[47b29ac]59    (0xe0 | leon_scmv91111_configuration.pio)
[0f04edd]60      << (8 * (leon_scmv91111_configuration.vector - 4)); /* vector = irq-no */
[44b06ca]61
[bec7ba52]62  return _rtems_smc91111_driver_attach(config,&leon_scmv91111_configuration);
[0f04edd]63}
Note: See TracBrowser for help on using the repository browser.