• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
3  * This file contains confidential and proprietary information of
4  * OSWare Technology Co., Ltd
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://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,
14  * WITHOUT 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 "nxpeth_mac.h"
20 #include "osal_mem.h"
21 
NxpethMacCoreInit(void)22 void NxpethMacCoreInit(void)
23 {
24     return;
25 }
26 
NxpethPortReset(struct EthDevice * ethDevice)27 int32_t NxpethPortReset(struct EthDevice *ethDevice)
28 {
29     return HDF_SUCCESS;
30 }
31 
NxpethPortInit(struct EthDevice * ethDevice)32 int32_t NxpethPortInit(struct EthDevice *ethDevice)
33 {
34     return HDF_SUCCESS;
35 }
36 
37 static struct EthMacOps g_macOps = {
38     .MacInit = NxpethMacCoreInit,
39     .PortReset = NxpethPortReset,
40     .PortInit = NxpethPortInit,
41 };
42 
BuildNxpMacDriver(void)43 struct HdfEthMacChipDriver *BuildNxpMacDriver(void)
44 {
45     HDF_LOGE("BuildNxpMacDriver start !!!!!!!!!!!!\n");
46     struct HdfEthMacChipDriver *macChipDriver = (struct HdfEthMacChipDriver *)OsalMemCalloc(
47         sizeof(struct HdfEthMacChipDriver));
48 
49     if (macChipDriver == NULL) {
50         HDF_LOGE("%s fail: OsalMemCalloc fail!", __func__);
51         return NULL;
52     }
53     macChipDriver->ethMacOps = &g_macOps;
54     return macChipDriver;
55 }
56 
ReleaseNxpMacDriver(struct HdfEthMacChipDriver * chipDriver)57 void ReleaseNxpMacDriver(struct HdfEthMacChipDriver *chipDriver)
58 {
59     if (chipDriver == NULL) {
60         HDF_LOGE("%s fail: chipDriver == NULL!", __func__);
61         return;
62     }
63     OsalMemFree(chipDriver);
64 }
65 
GetNxpEthMacChipDriver(const struct NetDevice * netDev)66 struct HdfEthMacChipDriver *GetNxpEthMacChipDriver(const struct NetDevice *netDev)
67 {
68     struct HdfEthNetDeviceData *data = GetEthNetDeviceData(netDev);
69     if (data != NULL) {
70         return data->macChipDriver;
71     }
72     return NULL;
73 }
74 
EthNxpRandomAddr(uint8_t * addr,int32_t len)75 void EthNxpRandomAddr(uint8_t *addr, int32_t len)
76 {
77     nxp_fec_get_mac(addr);
78 
79     return;
80 }
81 
82