source: rtems/bsps/sparc/leon2/net/leon_smc91111.c @ cb68253

5
Last change on this file since cb68253 was cb68253, checked in by Sebastian Huber <sebastian.huber@…>, on 09/07/18 at 04:19:02

network: Use kernel/user space header files

Add and use <machine/rtems-bsd-kernel-space.h> and
<machine/rtems-bsd-user-space.h> similar to the libbsd to avoid command
line defines and defines scattered throught the code base.

Simplify cpukit/libnetworking/Makefile.am.

Update #3375.

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