ETHFW API Guide
ethfw.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2020 Texas Instruments Incorporated
4  *
5  * All rights reserved not granted herein.
6  *
7  * Limited License.
8  *
9  * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10  * license under copyrights and patents it now or hereafter owns or controls to make,
11  * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12  * terms herein. With respect to the foregoing patent license, such license is granted
13  * solely to the extent that any such patent is necessary to Utilize the software alone.
14  * The patent license shall not apply to any combinations which include this software,
15  * other than combinations with devices manufactured by or for TI ("TI Devices").
16  * No hardware patent is licensed hereunder.
17  *
18  * Redistributions must preserve existing copyright notices and reproduce this license
19  * (including the above copyright notice and the disclaimer and (if applicable) source
20  * code license limitations below) in the documentation and/or other materials provided
21  * with the distribution
22  *
23  * Redistribution and use in binary form, without modification, are permitted provided
24  * that the following conditions are met:
25  *
26  * * No reverse engineering, decompilation, or disassembly of this software is
27  * permitted with respect to any software provided in binary form.
28  *
29  * * any redistribution and use are licensed by TI for use only with TI Devices.
30  *
31  * * Nothing shall obligate TI to provide you with source code for the software
32  * licensed and provided to you in object code.
33  *
34  * If software source code is provided to you, modification and redistribution of the
35  * source code are permitted provided that the following conditions are met:
36  *
37  * * any redistribution and use of the source code, including any resulting derivative
38  * works, are licensed by TI for use only with TI Devices.
39  *
40  * * any redistribution and use of any object code compiled from the source code
41  * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42  *
43  * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44  *
45  * may be used to endorse or promote products derived from this software without
46  * specific prior written permission.
47  *
48  * DISCLAIMER.
49  *
50  * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53  * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59  * OF THE POSSIBILITY OF SUCH DAMAGE.
60  *
61  */
62 
69 #ifndef ETHFW_H_
70 #define ETHFW_H_
71 
72 /* ========================================================================== */
73 /* Include Files */
74 /* ========================================================================== */
75 
76 #include <ti/drv/enet/enet.h>
77 #include <ti/drv/enet/include/per/cpsw.h>
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
94 /* @} */
95 
101 /* ========================================================================== */
102 /* Macros */
103 /* ========================================================================== */
104 
106 #define ETHFW_VERSION_YEARLEN (4)
107 
109 #define ETHFW_VERSION_MONTHLEN (3)
110 
112 #define ETHFW_VERSION_DATELEN (2)
113 
115 #define ETHFW_VERSION_HOURLEN (2)
116 
118 #define ETHFW_VERSION_MINLEN (2)
119 
121 #define ETHFW_VERSION_SECLEN (2)
122 
124 #define ETHFW_VERSION_COMMITSHALEN (8)
125 
127 #define ETHFW_REMOTE_CLIENT_MAX (ETHREMOTECFG_SERVER_MAX_INSTANCES)
128 
130 #define ETHFW_SHARED_MCAST_LIST_LEN (8U)
131 
133 #define ETHFW_RSVD_MCAST_LIST_LEN (4U)
134 
135 /* ========================================================================== */
136 /* Structures and Enums */
137 /* ========================================================================== */
138 
144 typedef struct EthFw_Version_s
145 {
147  uint32_t major;
148 
150  uint32_t minor;
151 
153  uint32_t rev;
154 
157 
160 
163 
165  int8_t hour[ETHFW_VERSION_HOURLEN + 1U];
166 
168  int8_t min[ETHFW_VERSION_MINLEN + 1U];
169 
171  int8_t sec[ETHFW_VERSION_SECLEN + 1U];
172 
174  int8_t commitHash[ETHFW_VERSION_COMMITSHALEN + 1U];
175 } EthFw_Version;
176 
182 typedef struct EthFw_VirtPortCfg_s
183 {
186 
188  uint32_t remoteCoreId;
190 
200 typedef void (*EthFw_FilterAddMacSharedCb)(const uint8_t *macAddr,
201  const uint8_t coreId);
202 
212 typedef void (*EthFw_FilterDelMacSharedCb)(const uint8_t *macAddr,
213  const uint8_t coreId);
214 
220 typedef struct EthFw_SharedMcastCfg_s
221 {
223  uint8_t macAddrList[ETHFW_SHARED_MCAST_LIST_LEN][ENET_MAC_ADDR_LEN];
224 
227  uint32_t numMacAddr;
228 
231 
235 
242 typedef struct EthFw_RsvdMcastCfg_s
243 {
245  uint8_t macAddrList[ETHFW_RSVD_MCAST_LIST_LEN][ENET_MAC_ADDR_LEN];
246 
249  uint32_t numMacAddr;
251 
254 typedef int32_t (*EthFw_setPortCfg)(Enet_MacPort macPort,
255  CpswMacPort_Cfg *macCfg,
256  EnetMacPort_Interface *mii,
257  EnetPhy_Cfg *phyCfg,
258  EnetMacPort_LinkCfg *linkCfg);
259 
261 typedef void (*EthFw_configPtpCb)(void *arg);
262 
268 typedef struct EthFw_Config_s
269 {
271  Cpsw_Cfg cpswCfg;
272 
275  Enet_MacPort *ports;
276 
279  uint32_t numPorts;
280 
284 
286  uint32_t numVirtPorts;
287 
290 
294 
297 
300 
303 
306 
310 
313 
316 
317 } EthFw_Config;
318 
324 typedef struct EthFw_Obj_s *EthFw_Handle;
325 
326 /* ========================================================================== */
327 /* Global Variables Declarations */
328 /* ========================================================================== */
329 
330 /* None */
331 
332 /* ========================================================================== */
333 /* Function Declarations */
334 /* ========================================================================== */
335 
349 void EthFw_initConfigParams(Enet_Type enetType,
350  EthFw_Config *config);
351 
365 EthFw_Handle EthFw_init(Enet_Type enetType,
366  const EthFw_Config *config);
367 
375 void EthFw_deinit(EthFw_Handle hEthFw);
376 
388 int32_t EthFw_initRemoteConfig(EthFw_Handle hEthFw);
389 
405 int32_t EthFw_lateAnnounce(EthFw_Handle hEthFw,
406  uint32_t procId);
407 
417 void EthFw_getVersion(EthFw_Handle hEthFw,
418  EthFw_Version *version);
419 
432 int32_t EthFw_initTimeSyncPtp(const uint8_t *hostMacAddr,
433  uint32_t portMask);
434 
435 /* ========================================================================== */
436 /* Deprecated Function Declarations */
437 /* ========================================================================== */
438 
439 /* None */
440 
441 /* @} */
442 
443 #ifdef __cplusplus
444 }
445 #endif
446 
447 #endif /* ETHFW_H_ */
void(* EthFw_FilterDelMacSharedCb)(const uint8_t *macAddr, const uint8_t coreId)
Filter delete shared multicast callback.
Definition: ethfw.h:212
char date[RPMSG_KDRV_TP_ETHSWITCH_DATELEN]
Definition: rpmsg-kdrv-transport-ethswitch.h:110
uint32_t rev
Definition: ethfw.h:153
int32_t(* EthFw_setPortCfg)(Enet_MacPort macPort, CpswMacPort_Cfg *macCfg, EnetMacPort_Interface *mii, EnetPhy_Cfg *phyCfg, EnetMacPort_LinkCfg *linkCfg)
Definition: ethfw.h:254
Ethernet Firmware reserved multicast configuration.
Definition: ethfw.h:242
Ethernet Firmware configuration.
Definition: ethfw.h:268
#define ETHFW_VERSION_YEARLEN
Definition: ethfw.h:106
struct EthFw_Obj_s * EthFw_Handle
Ethernet Firmware handle.
Definition: ethfw.h:324
EthFw_setPortCfg setPortCfg
Definition: ethfw.h:309
#define ETHFW_VERSION_COMMITSHALEN
Definition: ethfw.h:124
EthFw_FilterDelMacSharedCb filterDelMacSharedCb
Definition: ethfw.h:233
EthFw_FilterAddMacSharedCb filterAddMacSharedCb
Definition: ethfw.h:230
Cpsw_Cfg cpswCfg
Definition: ethfw.h:271
uint16_t dfltVlanIdMacOnlyPorts
Definition: ethfw.h:302
uint32_t numPorts
Definition: ethfw.h:279
void EthFw_getVersion(EthFw_Handle hEthFw, EthFw_Version *version)
Get EthFw version.
uint32_t numMacAddr
Definition: ethfw.h:249
void(* EthFw_FilterAddMacSharedCb)(const uint8_t *macAddr, const uint8_t coreId)
Filter &#39;add&#39; shared multicast callback.
Definition: ethfw.h:200
int32_t EthFw_lateAnnounce(EthFw_Handle hEthFw, uint32_t procId)
Late announce to remote processor.
Ethernet Firmware virtual port configuration.
Definition: ethfw.h:182
uint32_t numAutosarVirtPorts
Definition: ethfw.h:293
#define ETHFW_VERSION_DATELEN
Definition: ethfw.h:112
int32_t EthFw_initRemoteConfig(EthFw_Handle hEthFw)
Initialize remote configuration server.
void EthFw_deinit(EthFw_Handle hEthFw)
De-initialize EthFw.
Ethernet Firmware shared multicast fanout configuration.
Definition: ethfw.h:220
#define ETHFW_VERSION_MONTHLEN
Definition: ethfw.h:109
EthFw_SharedMcastCfg sharedMcastCfg
Definition: ethfw.h:296
uint16_t dfltVlanIdSwitchPorts
Definition: ethfw.h:305
char month[RPMSG_KDRV_TP_ETHSWITCH_MONTHLEN]
Definition: rpmsg-kdrv-transport-ethswitch.h:108
void * configPtpCbArg
Definition: ethfw.h:315
#define ETHFW_VERSION_MINLEN
Definition: ethfw.h:118
EthRemoteCfg_VirtPort
Virtual port id.
Definition: ethremotecfg_virtport.h:97
EthFw_Handle EthFw_init(Enet_Type enetType, const EthFw_Config *config)
Initialize EthFw.
uint32_t numMacAddr
Definition: ethfw.h:227
EthRemoteCfg_VirtPort portId
Definition: ethfw.h:185
uint32_t major
Definition: ethfw.h:147
#define ETHFW_SHARED_MCAST_LIST_LEN
Definition: ethfw.h:130
void(* EthFw_configPtpCb)(void *arg)
Definition: ethfw.h:261
uint32_t minor
Definition: ethfw.h:150
#define ETHFW_VERSION_SECLEN
Definition: ethfw.h:121
uint32_t remoteCoreId
Definition: ethfw.h:188
int32_t EthFw_initTimeSyncPtp(const uint8_t *hostMacAddr, uint32_t portMask)
Initialize and enable EthFw gPTP stack.
#define ETHFW_RSVD_MCAST_LIST_LEN
Definition: ethfw.h:133
Enet_MacPort * ports
Definition: ethfw.h:275
#define ETHFW_VERSION_HOURLEN
Definition: ethfw.h:115
EthFw_VirtPortCfg * virtPortCfg
Definition: ethfw.h:283
EthFw_VirtPortCfg * autosarVirtPortCfg
Definition: ethfw.h:289
void EthFw_initConfigParams(Enet_Type enetType, EthFw_Config *config)
Set EthFw configuration parameters to default values.
Ethernet Firmware version.
Definition: ethfw.h:144
uint32_t numVirtPorts
Definition: ethfw.h:286
EthFw_configPtpCb configPtpCb
Definition: ethfw.h:312
This file contains the type definitions and helper macros for Ethernet Firmware&#39;s Virtual Port...
EthFw_RsvdMcastCfg rsvdMcastCfg
Definition: ethfw.h:299
char year[RPMSG_KDRV_TP_ETHSWITCH_YEARLEN]
Definition: rpmsg-kdrv-transport-ethswitch.h:106