source: rtems/cpukit/libnetworking/rtems/rtems_mii_ioctl.h @ 790a300

4.104.114.84.95
Last change on this file since 790a300 was 790a300, checked in by Joel Sherrill <joel.sherrill@…>, on 01/08/06 at 18:12:29

2006-01-08 Joel Sherrill <joel@…>

  • libnetworking/rtems/rtems_mii_ioctl.h: Fix formatting.
  • Property mode set to 100644
File size: 2.9 KB
Line 
1/* Simple (default) implementation for SIOCGIFMEDIA/SIOCSIFMEDIA
2 * to be used by ethernet drivers [from their ioctl].
3 *
4 * NOTE: This much simpler than the BSD ifmedia API
5 *
6 * Author: Till Straumann, <strauman@slac.stanford.edu>, 2005
7 *
8 *  $Id$
9 */
10
11#ifndef RTEMS_MII_IOCTL_H
12#define RTEMS_MII_IOCTL_H
13
14#include <dev/mii/mii.h>    /* MII register definitions                                */
15#include <net/if_media.h>   /* media word definitions; rest of API (ifmedia) unused!   */
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#if defined(_KERNEL) || defined(KERNEL) || \
22    defined(__KERNEL) || defined(__KERNEL__)
23/* mdio routines to be provided by driver */
24
25/* read mii register 'reg' at 'phy' (-1 meaning any/currently active)
26 * RETURNS 0 on success, -1 otherwise (e.g., illegal phy)
27 */
28typedef int (*rtems_mdio_read_func) (int phy, void *uarg, unsigned reg,
29                                     uint32_t * pval);
30
31/* write mii register 'reg' at 'phy' (-1 meaning any/currently active)
32 * RETURNS 0 on success, -1 otherwise (e.g., illegal phy)
33 */
34typedef int (*rtems_mdio_write_func) (int phy, void *uarg, unsigned reg,
35                                      uint32_t val);
36
37/* Values to this must be provided by the driver */
38struct rtems_mdio_info {
39  rtems_mdio_read_func mdio_r;
40  rtems_mdio_write_func mdio_w;
41  unsigned has_gmii:1;          /* supports gigabit */
42};
43
44/* Implement SIOCSIFMEDIA/SIOCGIFMEDIA; get/set the current media word. Note
45 * that this does NOT implement the full BSD 'ifmedia' API; also, it only
46 * implements IFM_ETHER...
47 *
48 * INPUT:
49 *    SIOCGIFMEDIA: the media word must set the phy instance (-1 for 'any')
50 *
51 */
52int
53rtems_mii_ioctl (struct rtems_mdio_info *info, void *uarg, int cmd,
54                 int *media);
55
56#endif
57
58/* The driver flags have the following meaning (SIOCGIFMEDIA only):
59 */
60#define IFM_LINK_OK             IFM_FLAG0
61#define IFM_ANEG_DIS    IFM_FLAG1       /* autoneg. disabled; media forced */
62
63/* convert a media word to a string;
64 *
65 * RETURNS: number of characters written to 'buf'
66 *
67 * INPUT:   if 'bufsz' is set to IFMEDIA2STR_PRINT_TO_FILE, 'buf' can be a FILE
68 *          pointer where the info is printed insted. This can be NULL in which
69 *          case 'stdout' is used.
70 */
71
72#define IFMEDIA2STR_PRINT_TO_FILE       0
73
74int rtems_ifmedia2str (int media, char *buf, int bufsz);
75
76/* convert a string to a media word
77 * RETURNS: 0 on failure (unrecognized or invalid mode);
78 *          valid results have always at least IFM_ETHER set.
79 *
80 * In addition to IFM_SUBTYPE_ETHERNET_DESCRIPTIONS and
81 * IFM_SUBTYPE_ETHERNET_ALIASES, the strings
82 *
83 *  '10' [ '0' [ '0' ]] 'b' [ 'ase' ] ( 't' | 'T' )
84 *           (* if 100bT [ 'x' | 'X' ] is required here *)
85 *
86 * are recognized (e.g., 10bT, 100bTX)
87 *
88 * if any of the strings 'full' or 'FDX' or 'fdx' is present, a full-duplex mode
89 * is selected (half-duplex otherwise).
90 *  e.g., '100bTx-full'
91 */
92
93int rtems_str2ifmedia (const char *str, int phy);
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif
Note: See TracBrowser for help on using the repository browser.