1 /*
2  * Copyright (c) 2013-2020 ARM Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Licensed under the Apache License, Version 2.0 (the License); you may
7  * not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * $Date:        24. January 2020
19  * $Revision:    V2.2
20  *
21  * Project:      Ethernet PHY and MAC Driver common definitions
22  */
23 
24 /* History:
25  *  Version 2.2
26  *    Removed volatile from ARM_ETH_LINK_INFO
27  *  Version 2.1
28  *    ARM_ETH_LINK_INFO made volatile
29  *  Version 2.0
30  *    Removed ARM_ETH_STATUS enumerator
31  *    Removed ARM_ETH_MODE enumerator
32  *  Version 1.10
33  *    Namespace prefix ARM_ added
34  *  Version 1.00
35  *    Initial release
36  */
37 
38 #ifndef DRIVER_ETH_H_
39 #define DRIVER_ETH_H_
40 
41 #include "Driver_Common.h"
42 
43 /**
44 \brief Ethernet Media Interface type
45 */
46 #define ARM_ETH_INTERFACE_MII           (0U)    ///< Media Independent Interface (MII)
47 #define ARM_ETH_INTERFACE_RMII          (1U)    ///< Reduced Media Independent Interface (RMII)
48 #define ARM_ETH_INTERFACE_SMII          (2U)    ///< Serial Media Independent Interface (SMII)
49 
50 /**
51 \brief Ethernet link speed
52 */
53 #define ARM_ETH_SPEED_10M               (0U)    ///< 10 Mbps link speed
54 #define ARM_ETH_SPEED_100M              (1U)    ///< 100 Mbps link speed
55 #define ARM_ETH_SPEED_1G                (2U)    ///< 1 Gpbs link speed
56 
57 /**
58 \brief Ethernet duplex mode
59 */
60 #define ARM_ETH_DUPLEX_HALF             (0U)    ///< Half duplex link
61 #define ARM_ETH_DUPLEX_FULL             (1U)    ///< Full duplex link
62 
63 /**
64 \brief Ethernet link state
65 */
66 typedef enum _ARM_ETH_LINK_STATE {
67   ARM_ETH_LINK_DOWN,                    ///< Link is down
68   ARM_ETH_LINK_UP                       ///< Link is up
69 } ARM_ETH_LINK_STATE;
70 
71 /**
72 \brief Ethernet link information
73 */
74 typedef struct _ARM_ETH_LINK_INFO {
75   uint32_t speed    : 2;                ///< Link speed: 0= 10 MBit, 1= 100 MBit, 2= 1 GBit
76   uint32_t duplex   : 1;                ///< Duplex mode: 0= Half, 1= Full
77   uint32_t reserved : 29;
78 } ARM_ETH_LINK_INFO;
79 
80 /**
81 \brief Ethernet MAC Address
82 */
83 typedef struct _ARM_ETH_MAC_ADDR {
84   uint8_t b[6];                         ///< MAC Address (6 bytes), MSB first
85 } ARM_ETH_MAC_ADDR;
86 
87 #endif /* DRIVER_ETH_H_ */
88