annotate packages/devs/eth/phy/current/include/eth_phy.h @ 1170:719dd033d039

New API for handling ethernet PHY devices
author gthomas
date Tue, 19 Aug 2003 17:26:48 +0000
parents
children 0832585993c1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1170
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
1 #ifndef CYGONCE_DEVS_ETH_PHY_H_
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
2 #define CYGONCE_DEVS_ETH_PHY_H_
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
3 //==========================================================================
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
4 //
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
5 // eth_phy.h
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
6 //
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
7 // API for ethernet transciever (PHY) support
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
8 //
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
9 //==========================================================================
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
10 //####ECOSGPLCOPYRIGHTBEGIN####
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
11 // -------------------------------------------
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
12 // This file is part of eCos, the Embedded Configurable Operating System.
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
13 // Copyright (C) 2003 Gary Thomas
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
14 //
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
15 // eCos is free software; you can redistribute it and/or modify it under
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
16 // the terms of the GNU General Public License as published by the Free
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
17 // Software Foundation; either version 2 or (at your option) any later version.
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
18 //
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
19 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
20 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
21 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
22 // for more details.
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
23 //
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
24 // You should have received a copy of the GNU General Public License along
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
25 // with eCos; if not, write to the Free Software Foundation, Inc.,
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
26 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
27 //
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
28 // As a special exception, if other files instantiate templates or use macros
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
29 // or inline functions from this file, or you compile this file and link it
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
30 // with other works to produce a work based on this file, this file does not
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
31 // by itself cause the resulting work to be covered by the GNU General Public
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
32 // License. However the source code for this file must still be made available
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
33 // in accordance with section (3) of the GNU General Public License.
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
34 //
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
35 // This exception does not invalidate any other reasons why a work based on
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
36 // this file might be covered by the GNU General Public License.
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
37 //
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
38 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
39 // at http://sources.redhat.com/ecos/ecos-license/
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
40 // -------------------------------------------
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
41 //####ECOSGPLCOPYRIGHTEND####
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
42 //==========================================================================
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
43 //#####DESCRIPTIONBEGIN####
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
44 //
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
45 // Author(s): gthomas
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
46 // Contributors: gthomas
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
47 // Date: 2003-08-01
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
48 // Purpose:
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
49 // Description:
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
50 //
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
51 //####DESCRIPTIONEND####
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
52 //
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
53 //==========================================================================
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
54
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
55
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
56 // Transceiver mode
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
57 #define PHY_BMCR 0x00 // Register number
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
58 #define PHY_BMCR_RESET 0x8000
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
59 #define PHY_BMCR_LOOPBACK 0x4000
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
60 #define PHY_BMCR_100MB 0x2000
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
61 #define PHY_BMCR_AUTO_NEG 0x1000
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
62 #define PHY_BMCR_POWER_DOWN 0x0800
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
63 #define PHY_BMCR_ISOLATE 0x0400
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
64 #define PHY_BMCR_RESTART 0x0200
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
65 #define PHY_BMCR_FULL_DUPLEX 0x0100
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
66 #define PHY_BMCR_COLL_TEST 0x0080
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
67
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
68 #define PHY_BMSR 0x01 // Status register
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
69 #define PHY_BMSR_AUTO_NEG 0x0020
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
70 #define PHY_BMSR_LINK 0x0004
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
71
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
72 // Physical device access - defined by hardware instance
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
73 typedef struct {
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
74 void (*init)(void);
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
75 void (*set_data)(int);
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
76 int (*get_data)(void);
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
77 void (*set_clock)(int);
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
78 void (*set_dir)(int);
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
79 } eth_phy_access_t;
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
80
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
81 #define ETH_PHY_ACCESS_FUNS(_l,_init,_set_data,_get_data,_set_clock,_set_dir) \
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
82 static eth_phy_access_t _l = {_init, _set_data, _get_data, _set_clock, _set_dir}
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
83
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
84 externC void _eth_phy_init(eth_phy_access_t *f);
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
85 externC void _eth_phy_write(eth_phy_access_t *f, int reg, int unit, unsigned short data);
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
86 externC bool _eth_phy_read(eth_phy_access_t *f, int reg, int unit, unsigned short *val);
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
87
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
88 #endif // CYGONCE_DEVS_ETH_PHY_H_
719dd033d039 New API for handling ethernet PHY devices
gthomas
parents:
diff changeset
89 // ------------------------------------------------------------------------