]> begriffs open source - cmsis/blob - CMSIS/Driver/DriverTemplates/Driver_ETH_PHY.c
Update workflows and build scripts
[cmsis] / CMSIS / Driver / DriverTemplates / Driver_ETH_PHY.c
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  
19 #include "Driver_ETH_PHY.h"
20
21 #define ARM_ETH_PHY_DRV_VERSION    ARM_DRIVER_VERSION_MAJOR_MINOR(1, 0) /* driver version */
22
23 /* Driver Version */
24 static const ARM_DRIVER_VERSION DriverVersion = {
25     ARM_ETH_PHY_API_VERSION,
26     ARM_ETH_PHY_DRV_VERSION
27 };
28
29 //
30 // Functions
31 //
32
33 static ARM_DRIVER_VERSION ARM_ETH_PHY_GetVersion(void)
34 {
35   return DriverVersion;
36 }
37
38 static int32_t ARM_ETH_PHY_Initialize(ARM_ETH_PHY_Read_t fn_read, ARM_ETH_PHY_Write_t fn_write)
39 {
40 }
41
42 static int32_t ARM_ETH_PHY_Uninitialize(void)
43 {
44 }
45
46 static int32_t ARM_ETH_PHY_PowerControl(ARM_POWER_STATE state)
47 {
48     switch (state)
49     {
50     case ARM_POWER_OFF:
51         break;
52
53     case ARM_POWER_LOW:
54         break;
55
56     case ARM_POWER_FULL:
57         break;
58     }
59     return ARM_DRIVER_OK;
60 }
61
62 static int32_t ARM_ETH_PHY_SetInterface(uint32_t interface)
63 {
64     switch (interface)
65     {
66     case ARM_ETH_INTERFACE_MII:
67         break;
68     case ARM_ETH_INTERFACE_RMII:
69         break;
70     default:
71         return ARM_DRIVER_ERROR_UNSUPPORTED;
72     }
73 }
74
75 static int32_t ARM_ETH_PHY_SetMode(uint32_t mode)
76 {
77     switch (mode & ARM_ETH_PHY_SPEED_Msk)
78     {
79     case ARM_ETH_PHY_SPEED_10M:
80         break;
81     case ARM_ETH_PHY_SPEED_100M:
82         break;
83     default:
84         return ARM_DRIVER_ERROR_UNSUPPORTED;
85     }
86
87     switch (mode & ARM_ETH_PHY_DUPLEX_Msk)
88     {
89     case ARM_ETH_PHY_DUPLEX_HALF:
90         break;
91     case ARM_ETH_PHY_DUPLEX_FULL:
92         break;
93     }
94
95     if (mode & ARM_ETH_PHY_AUTO_NEGOTIATE)
96     {
97     }
98
99     if (mode & ARM_ETH_PHY_LOOPBACK)
100     {
101     }
102
103     if (mode & ARM_ETH_PHY_ISOLATE)
104     {
105     }
106 }
107
108 static ARM_ETH_LINK_STATE ARM_ETH_PHY_GetLinkState(void)
109 {
110 }
111
112 static ARM_ETH_LINK_INFO ARM_ETH_PHY_GetLinkInfo(void)
113 {
114 }
115
116 extern \
117 ARM_DRIVER_ETH_PHY Driver_ETH_PHY0;
118 ARM_DRIVER_ETH_PHY Driver_ETH_PHY0 =
119 {
120     ARM_ETH_PHY_GetVersion,
121     ARM_ETH_PHY_Initialize,
122     ARM_ETH_PHY_Uninitialize,
123     ARM_ETH_PHY_PowerControl,
124     ARM_ETH_PHY_SetInterface,
125     ARM_ETH_PHY_SetMode,
126     ARM_ETH_PHY_GetLinkState,
127     ARM_ETH_PHY_GetLinkInfo,
128 };