source: rtems/c/src/lib/libbsp/powerpc/beatnik/network/if_em/if_em_rtems.c @ 6273201

4.115
Last change on this file since 6273201 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 3.4 KB
Line 
1#include "if_xxx_rtems.c"
2#include <bsp/early_enet_link_status.h>
3#include <bsp/if_em_pub.h>
4
5/* Provide a routine to check link status early,
6 * i.e., before the network is really running.
7 * In case someone wants to decide whether to use/configure
8 * this interface at all :-)
9 *
10 * NOTE: this routine tries to enable autonegotiation!
11 *
12 * unit: unit number starting with 1 (usual BSDNET convention)
13 *
14 * RETURNS: Phy status register contents (1<<2 means link up).
15 *          or -1 on error.
16 */
17
18/*
19 * Authorship
20 * ----------
21 * This software ('beatnik' RTEMS BSP for MVME6100 and MVME5500) was
22 *     created by Till Straumann <strauman@slac.stanford.edu>, 2005-2007,
23 *         Stanford Linear Accelerator Center, Stanford University.
24 *
25 * Acknowledgement of sponsorship
26 * ------------------------------
27 * The 'beatnik' BSP was produced by
28 *     the Stanford Linear Accelerator Center, Stanford University,
29 *         under Contract DE-AC03-76SFO0515 with the Department of Energy.
30 *
31 * Government disclaimer of liability
32 * ----------------------------------
33 * Neither the United States nor the United States Department of Energy,
34 * nor any of their employees, makes any warranty, express or implied, or
35 * assumes any legal liability or responsibility for the accuracy,
36 * completeness, or usefulness of any data, apparatus, product, or process
37 * disclosed, or represents that its use would not infringe privately owned
38 * rights.
39 *
40 * Stanford disclaimer of liability
41 * --------------------------------
42 * Stanford University makes no representations or warranties, express or
43 * implied, nor assumes any liability for the use of this software.
44 *
45 * Stanford disclaimer of copyright
46 * --------------------------------
47 * Stanford University, owner of the copyright, hereby disclaims its
48 * copyright and all other rights in this software.  Hence, anyone may
49 * freely use it for any purpose without restriction. 
50 *
51 * Maintenance of notices
52 * ----------------------
53 * In the interest of clarity regarding the origin and status of this
54 * SLAC software, this and all the preceding Stanford University notices
55 * are to remain affixed to any copy or derivative of this software made
56 * or distributed by the recipient and are to be affixed to any copy of
57 * software made or distributed by the recipient that contains a copy or
58 * derivative of this software.
59 *
60 * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
61 */
62
63static int
64em_early_init(int idx)
65{
66        if ( idx < 0 || idx >= NETDRIVER_SLOTS )
67                return -1;
68        return em_hw_early_init(&the_em_devs[idx]);
69}
70
71static int
72em_early_read_phy(int idx, unsigned reg)
73{
74unsigned short data;
75        if ( idx < 0 || idx >= NETDRIVER_SLOTS )
76                return -1;
77        /* Bizarre - I always have to read PHY_STATUS twice until a good link
78         * status is read
79         */     
80        if ( em_read_phy_reg(&the_em_devs[idx].d_softc.hw, reg, &data) )
81                return -1;
82        if ( PHY_STATUS == reg ) {
83                /* read again */
84                if ( em_read_phy_reg(&the_em_devs[idx].d_softc.hw, PHY_STATUS, &data) )
85                        return -1;
86        }
87        return data;
88}
89
90static int
91em_early_write_phy(int idx, unsigned reg, unsigned val)
92{
93        if ( idx < 0 || idx >= NETDRIVER_SLOTS )
94                return -1;
95        return em_write_phy_reg(&the_em_devs[idx].d_softc.hw, reg, val);
96}
97
98rtems_bsdnet_early_link_check_ops
99rtems_em_early_link_check_ops = {
100        init:           em_early_init,
101        read_phy:       em_early_read_phy,
102        write_phy:      em_early_write_phy,
103        name:           NETDRIVER,
104        num_slots:      NETDRIVER_SLOTS
105};
Note: See TracBrowser for help on using the repository browser.