/******************************************************************** * Copyright (C) 2018-2020 Texas Instruments Incorporated. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /** * @file emac_ioctl.h * * @brief EMAC driver IOCTL API inteface specification * @note IOCTL API is only supported for am65xx SOC * * This API header file should be included in an application as follows: * @code * #include * @endcode * */ #ifndef EMAC_IOCTL_H #define EMAC_IOCTL_H #include #ifdef __cplusplus extern "C" { #endif /*! * @cond NODOC * Internally used by the driver, used for classifier config */ #define EMAC_NUM_CLASSIFIERS ((uint32_t)16U) #define EMAC_CLASS_CFG1_OFF (CSL_ICSS_G_PR1_MII_RT_PR1_MII_RT_G_CFG_REGS_G_RX_CLASS_CFG1_PRU0-CSL_ICSS_G_PR1_MII_RT_PR1_MII_RT_G_CFG_REGS_G_RX_CLASS0_AND_EN_PRU0) #define EMAC_CLASS_CFG2_OFF ((uint32_t)4U) /* from EMAC_CLASS_CFG1_OFF */ #define EMAC_CLASS_GATE_OFF ((uint32_t)8U) /* from EMAC_CLASS_CFG1_OFF */ #define EMAC_CLASS_AND_EN_OFF ((uint32_t)0U) #define EMAC_CLASS_OR_EN_OFF ((uint32_t)4U) #define EMAC_IOCTL_PRIO_MAX ((uint32_t)8U) #define EMAC_FW_MGMT_CMD_HEADER ((uint32_t)0x81U) #define EMAC_FW_MGMT_FDB_CMD_TYPE ((uint32_t)0x03U) #define EMAC_FW_MGMT_SPEED_DUPLEXITY_CMD_TYPE ((uint32_t)0x02U) #define EMAC_FW_MGMT_CMD_TYPE ((uint32_t)0x04U) #define EMAC_FW_MGMT_PKT ((uint32_t)0x80000000u) /*! @endcond */ /*! * @cond NODOC * Internally used by the driver for filter 3 configuration */ typedef struct EMAC_FILTER3_CONFIG_S { uint32_t ft3Start; uint32_t ft3StartAuto; uint32_t ft3StartOffset; uint32_t ft3JmpOffset; uint32_t ft3Len; uint32_t ft3Config; uint32_t ft3Type; uint32_t ft3TypeMask; uint32_t ft3PatternLow; uint32_t ft3PatternHigh; uint32_t ft3PatternMaskLow; uint32_t ft3PatternMaskHigh; } EMAC_FILTER3_CONFIG; /*! @endcond */ /*! * @cond NODOC * Internally used by the driver, used to send CMD to ICSSG FW */ /* local to the driver, used to send CMD to ICSSG FW*/ typedef struct EMAC_IOCTL_CMD_S { /* Optional parameter for TX to FW, ERROR code for RX from FW */ uint8_t commandParam; uint8_t seqNumber; /* Command Type */ uint8_t commandType; /* Command Header */ uint8_t commandHeader; uint32_t spare[3]; } __attribute__((packed)) EMAC_IOCTL_CMD_T; /*! @endcond */ /** * @brief Max number of entries in VLAN TABLE */ #define EMAC_VLAN_TBL_MAX_ENTRIES ((uint32_t)4096U) /** * @defgroup EMAC_IOCTL_VLAN_CTRL Vlan Control sub-commands * @ingroup emaclld_api_ioctl_macros * @{ * * @name EMAC_IOCTL_VLAN_CTRL sub-commands * @details The following macros are sub-commands that to be used when issueing * emac_ioctl with EMAC_IOCTL_CMD set to EMAC_IOCTL_VLAN_CTRL * */ /*@{*/ /** * @def EMAC_IOCTL_VLAN_SET_DEFAULT_TBL * Populate VLAN table with default vlan entry configuration */ #define EMAC_IOCTL_VLAN_SET_DEFAULT_TBL ((uint32_t)1U) /** * @def EMAC_IOCTL_VLAN_SET_ENTRY * Update a VLAN TABLE entry */ #define EMAC_IOCTL_VLAN_SET_ENTRY ((uint32_t)2U) /** * @def EMAC_IOCTL_VLAN_SET_DEFAULT_VLAN_ID * Sets the default VLAN id for specified switch/host port */ #define EMAC_IOCTL_VLAN_SET_DEFAULT_VLAN_ID ((uint32_t)3U) /** * @def EMAC_IOCTL_VLAN_GET_ENTRY * Get vlan entry from vlan table for requested vlan id */ #define EMAC_IOCTL_VLAN_GET_ENTRY ((uint32_t)4U) /*@}*/ /** @} */ /** * @brief VLAN FID entry parameters definition for EMAC_IOCTL_VLAN_SET_DEFAULT_TBL sub-command */ typedef struct EMAC_IOCTL_VLAN_FID_PARAMS_S { uint8_t fid; /**< filtering identifier field, this 8 bit field is included in SA and DA hashes as part of FDB function */ uint8_t hostMember; /**< if set, forward to the host port */ uint8_t p1Member; /**< if set, forware to physical port 1 of the switch */ uint8_t p2Member; /**< if set, forware to physical port 2 of the switch */ uint8_t hostTagged; /**< if set, VLAN tag should be added to host port packet being transmitted, if not set, then strip VLAN tag*/ uint8_t p1Tagged; /**< if set, VLAN tag should be added to phsyical port 1 packet being transmitted, if not set, then strip VLAN tag*/ uint8_t p2Tagged; /**< if set, VLAN tag should be added to physical port 2 packet being transmitted, if not set, then strip VLAN tag*/ uint8_t streamVid; /**< if set, VLAN is part of stream FDB, Bypass UC/MC FDB */ uint8_t floodToHost; /**< if set, send un-registered MC packet to host port*/ }EMAC_IOCTL_VLAN_FID_PARAMS; /** * @brief VLAN FID table entry definition for EMAC_IOCTL_VLAN_SET_ENTRY sub-command */ typedef struct EMAC_IOCTL_VLAN_FID_ENTRY_S { uint16_t vlanId; /**< Index into VLAN fid table, range from 0 to 4095 entries */ EMAC_IOCTL_VLAN_FID_PARAMS vlanFidPrams; /**