2 * Copyright (C) 2016 CSI Project. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
25 #define CSI_ETH_VERSION_MAJOR_MINOR(major,minor) (((major) << 8) | (minor))
30 typedef struct csi_driver_version {
31 uint16_t api; ///< API version
32 uint16_t drv; ///< Driver version
35 /* General return codes */
36 #define CSI_ETH_OK 0 ///< Operation succeeded
37 #define CSI_ETH_ERROR CSI_DRV_ERRNO_ETH_BASE+1 ///< Unspecified error
38 #define CSI_ETH_ERROR_BUSY CSI_DRV_ERRNO_ETH_BASE+2 ///< Driver is busy
39 #define CSI_ETH_ERROR_TIMEOUT CSI_DRV_ERRNO_ETH_BASE+3 ///< Timeout occurred
40 #define CSI_ETH_ERROR_UNSUPPORTED CSI_DRV_ERRNO_ETH_BASE+4 ///< Operation not supported
41 #define CSI_ETH_ERROR_PARAMETER CSI_DRV_ERRNO_ETH_BASE+5 ///< Parameter error
42 #define CSI_ETH_ERROR_SPECIFIC CSI_DRV_ERRNO_ETH_BASE+6 ///< Start of driver specific errors
45 \brief General power states
47 typedef enum eth_power_state {
48 CSI_ETH_POWER_OFF, ///< Power off: no operation possible
49 CSI_ETH_POWER_LOW, ///< Low Power mode: retain state, detect and signal wake-up events
50 CSI_ETH_POWER_FULL ///< Power on: full operation at maximum performance
54 \brief Ethernet Media Interface type
56 #define CSI_ETH_INTERFACE_MII (0) ///< Media Independent Interface (MII)
57 #define CSI_ETH_INTERFACE_RMII (1) ///< Reduced Media Independent Interface (RMII)
58 #define CSI_ETH_INTERFACE_SMII (2) ///< Serial Media Independent Interface (SMII)
61 \brief Ethernet link speed
63 #define CSI_ETH_SPEED_10M (0) ///< 10 Mbps link speed
64 #define CSI_ETH_SPEED_100M (1) ///< 100 Mbps link speed
65 #define CSI_ETH_SPEED_1G (2) ///< 1 Gpbs link speed
68 \brief Ethernet duplex mode
70 #define CSI_ETH_DUPLEX_HALF (0) ///< Half duplex link
71 #define CSI_ETH_DUPLEX_FULL (1) ///< Full duplex link
74 \brief Ethernet link state
76 typedef enum eth_link_state {
77 ETH_LINK_DOWN, ///< Link is down
78 ETH_LINK_UP ///< Link is up
82 \brief Ethernet link information
84 typedef volatile struct eth_link_info {
85 uint32_t speed : 2; ///< Link speed: 0= 10 MBit, 1= 100 MBit, 2= 1 GBit
86 uint32_t duplex : 1; ///< Duplex mode: 0= Half, 1= Full
87 uint32_t Autonegotiation : 1; ///< Set the interface to Auto Negotiation mode of transmission parameters
88 uint32_t Loopback : 1; ///< Set the interface into a Loop-back test mode
89 uint32_t Isolation : 1; ///< Set to indicate electrical isolation of PHY interface from MII/RMII interface
90 uint32_t reserved : 26;
94 \brief Ethernet MAC Address
96 typedef struct eth_mac_addr {
97 uint8_t b[6]; ///< MAC Address (6 bytes), MSB first
104 #endif /* CSI_NET_H_ */