Mercurial > ecos
annotate packages/devs/eth/phy/current/include/eth_phy.h @ 3292:7f8e529b4d82 default tip
Fix FREESCALE_EDMA_NBYTES_MLOFFYES_MLOFF() so it works with negative offsets.
| author | vae |
|---|---|
| date | Wed, 29 Apr 2015 23:31:48 +0000 |
| parents | 31c9ab39babe |
| children |
| rev | line source |
|---|---|
| 1170 | 1 #ifndef CYGONCE_DEVS_ETH_PHY_H_ |
| 2 #define CYGONCE_DEVS_ETH_PHY_H_ | |
| 3 //========================================================================== | |
| 4 // | |
| 5 // eth_phy.h | |
| 6 // | |
| 1178 | 7 // User API for ethernet transciever (PHY) support |
| 1170 | 8 // |
| 9 //========================================================================== | |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
10 // ####ECOSGPLCOPYRIGHTBEGIN#### |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
11 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
12 // This file is part of eCos, the Embedded Configurable Operating System. |
|
2960
31c9ab39babe
* doc/eth_phy.sgml, include/eth_phy.h: Add Ethernet Gigabit Mode
jld
parents:
2729
diff
changeset
|
13 // Copyright (C) 2003, 2010 Free Software Foundation, Inc. |
| 1170 | 14 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
15 // eCos is free software; you can redistribute it and/or modify it under |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
16 // the terms of the GNU General Public License as published by the Free |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
17 // Software Foundation; either version 2 or (at your option) any later |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
18 // version. |
| 1170 | 19 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
20 // eCos is distributed in the hope that it will be useful, but WITHOUT |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
21 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
22 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
23 // for more details. |
| 1170 | 24 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
25 // You should have received a copy of the GNU General Public License |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
26 // along with eCos; if not, write to the Free Software Foundation, Inc., |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
27 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 1170 | 28 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
29 // As a special exception, if other files instantiate templates or use |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
30 // macros or inline functions from this file, or you compile this file |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
31 // and link it with other works to produce a work based on this file, |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
32 // this file does not by itself cause the resulting work to be covered by |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
33 // the GNU General Public License. However the source code for this file |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
34 // must still be made available in accordance with section (3) of the GNU |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
35 // General Public License v2. |
| 1170 | 36 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
37 // This exception does not invalidate any other reasons why a work based |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
38 // on this file might be covered by the GNU General Public License. |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
39 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2177
diff
changeset
|
40 // ####ECOSGPLCOPYRIGHTEND#### |
| 1170 | 41 //========================================================================== |
| 42 //#####DESCRIPTIONBEGIN#### | |
| 43 // | |
| 44 // Author(s): gthomas | |
| 45 // Contributors: gthomas | |
| 46 // Date: 2003-08-01 | |
| 47 // Purpose: | |
| 48 // Description: | |
| 49 // | |
| 50 //####DESCRIPTIONEND#### | |
| 51 // | |
| 52 //========================================================================== | |
| 53 | |
| 1178 | 54 #define PHY_BIT_LEVEL_ACCESS_TYPE 0 |
| 55 #define PHY_REG_LEVEL_ACCESS_TYPE 1 | |
| 1170 | 56 |
| 57 // Physical device access - defined by hardware instance | |
| 58 typedef struct { | |
| 1178 | 59 int ops_type; // 0 => bit level, 1 => register level |
| 60 bool init_done; | |
| 1170 | 61 void (*init)(void); |
| 1178 | 62 void (*reset)(void); |
| 63 union { | |
| 64 struct { | |
| 65 void (*set_data)(int); | |
| 66 int (*get_data)(void); | |
| 67 void (*set_clock)(int); | |
| 68 void (*set_dir)(int); | |
| 69 } bit_level_ops; | |
| 70 struct { | |
| 71 void (*put_reg)(int reg, int unit, unsigned short data); | |
| 72 bool (*get_reg)(int reg, int unit, unsigned short *data); | |
| 73 } reg_level_ops; | |
| 74 } ops; | |
| 75 int phy_addr; | |
| 76 struct _eth_phy_dev_entry *dev; // Chip access functions | |
| 1170 | 77 } eth_phy_access_t; |
| 78 | |
| 1178 | 79 #define ETH_PHY_BIT_LEVEL_ACCESS_FUNS(_l,_init,_reset,_set_data,_get_data,_set_clock,_set_dir) \ |
| 80 static eth_phy_access_t _l = {PHY_BIT_LEVEL_ACCESS_TYPE, false, _init, _reset, \ | |
| 81 {.bit_level_ops = {_set_data, _get_data, _set_clock, _set_dir}}} | |
| 82 | |
| 83 #define ETH_PHY_REG_LEVEL_ACCESS_FUNS(_l,_init,_reset,_put_reg,_get_reg) \ | |
| 84 static eth_phy_access_t _l = {PHY_REG_LEVEL_ACCESS_TYPE, false, _init, _reset, \ | |
| 85 {.reg_level_ops = {_put_reg, _get_reg}}} | |
| 1170 | 86 |
|
2960
31c9ab39babe
* doc/eth_phy.sgml, include/eth_phy.h: Add Ethernet Gigabit Mode
jld
parents:
2729
diff
changeset
|
87 #define ETH_PHY_STAT_LINK 0x0001 // Link up/down |
|
31c9ab39babe
* doc/eth_phy.sgml, include/eth_phy.h: Add Ethernet Gigabit Mode
jld
parents:
2729
diff
changeset
|
88 #define ETH_PHY_STAT_100MB 0x0002 // Connection is 100Mb/10Mb |
|
31c9ab39babe
* doc/eth_phy.sgml, include/eth_phy.h: Add Ethernet Gigabit Mode
jld
parents:
2729
diff
changeset
|
89 #define ETH_PHY_STAT_FDX 0x0004 // Connection is full/half duplex |
|
31c9ab39babe
* doc/eth_phy.sgml, include/eth_phy.h: Add Ethernet Gigabit Mode
jld
parents:
2729
diff
changeset
|
90 #define ETH_PHY_STAT_1000MB 0x0008 // Connection is 1Gb |
| 1178 | 91 |
| 92 externC bool _eth_phy_init(eth_phy_access_t *f); | |
| 93 externC void _eth_phy_reset(eth_phy_access_t *f); | |
| 94 externC int _eth_phy_state(eth_phy_access_t *f); | |
| 95 externC int _eth_phy_cfg(eth_phy_access_t *f, int mode); | |
|
2177
970f455a2397
Add support for ICS189X, better debug handling - from Jay Foster
gthomas
parents:
1211
diff
changeset
|
96 #define ETH_PHY_MODE_DEFAULT 0 |
|
970f455a2397
Add support for ICS189X, better debug handling - from Jay Foster
gthomas
parents:
1211
diff
changeset
|
97 |
| 1178 | 98 // Internal routines |
| 1170 | 99 externC void _eth_phy_write(eth_phy_access_t *f, int reg, int unit, unsigned short data); |
| 100 externC bool _eth_phy_read(eth_phy_access_t *f, int reg, int unit, unsigned short *val); | |
| 101 | |
| 102 #endif // CYGONCE_DEVS_ETH_PHY_H_ | |
| 103 // ------------------------------------------------------------------------ |
