Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Nov 25 13:21:40 2015 +0000
Revision:
110:165afa46840b
Release 110  of the mbed library

Changes:
- new platforms - STM32F410R, DISCO_F429ZI, DISCO_F469NI
- Nucleo L476 - gcc and uvision template
- k22,k64f targets - ADC channels A addition
- EFM32 - bugfixes in sleep, serial and spi
- Delta DFCM NNN40 - pinnames update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 110:165afa46840b 1 /**
Kojto 110:165afa46840b 2 ******************************************************************************
Kojto 110:165afa46840b 3 * @file stm32f4xx_hal_eth.h
Kojto 110:165afa46840b 4 * @author MCD Application Team
Kojto 110:165afa46840b 5 * @version V1.4.1
Kojto 110:165afa46840b 6 * @date 09-October-2015
Kojto 110:165afa46840b 7 * @brief Header file of ETH HAL module.
Kojto 110:165afa46840b 8 ******************************************************************************
Kojto 110:165afa46840b 9 * @attention
Kojto 110:165afa46840b 10 *
Kojto 110:165afa46840b 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 110:165afa46840b 12 *
Kojto 110:165afa46840b 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 110:165afa46840b 14 * are permitted provided that the following conditions are met:
Kojto 110:165afa46840b 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 110:165afa46840b 16 * this list of conditions and the following disclaimer.
Kojto 110:165afa46840b 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 110:165afa46840b 18 * this list of conditions and the following disclaimer in the documentation
Kojto 110:165afa46840b 19 * and/or other materials provided with the distribution.
Kojto 110:165afa46840b 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 110:165afa46840b 21 * may be used to endorse or promote products derived from this software
Kojto 110:165afa46840b 22 * without specific prior written permission.
Kojto 110:165afa46840b 23 *
Kojto 110:165afa46840b 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 110:165afa46840b 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 110:165afa46840b 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 110:165afa46840b 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 110:165afa46840b 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 110:165afa46840b 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 110:165afa46840b 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 110:165afa46840b 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 110:165afa46840b 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 110:165afa46840b 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 110:165afa46840b 34 *
Kojto 110:165afa46840b 35 ******************************************************************************
Kojto 110:165afa46840b 36 */
Kojto 110:165afa46840b 37
Kojto 110:165afa46840b 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 110:165afa46840b 39 #ifndef __STM32F4xx_HAL_ETH_H
Kojto 110:165afa46840b 40 #define __STM32F4xx_HAL_ETH_H
Kojto 110:165afa46840b 41
Kojto 110:165afa46840b 42 #ifdef __cplusplus
Kojto 110:165afa46840b 43 extern "C" {
Kojto 110:165afa46840b 44 #endif
Kojto 110:165afa46840b 45
Kojto 110:165afa46840b 46 #if defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) ||\
Kojto 110:165afa46840b 47 defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
Kojto 110:165afa46840b 48 /* Includes ------------------------------------------------------------------*/
Kojto 110:165afa46840b 49 #include "stm32f4xx_hal_def.h"
Kojto 110:165afa46840b 50
Kojto 110:165afa46840b 51 /** @addtogroup STM32F4xx_HAL_Driver
Kojto 110:165afa46840b 52 * @{
Kojto 110:165afa46840b 53 */
Kojto 110:165afa46840b 54
Kojto 110:165afa46840b 55 /** @addtogroup ETH
Kojto 110:165afa46840b 56 * @{
Kojto 110:165afa46840b 57 */
Kojto 110:165afa46840b 58
Kojto 110:165afa46840b 59 /** @addtogroup ETH_Private_Macros
Kojto 110:165afa46840b 60 * @{
Kojto 110:165afa46840b 61 */
Kojto 110:165afa46840b 62 #define IS_ETH_PHY_ADDRESS(ADDRESS) ((ADDRESS) <= 0x20)
Kojto 110:165afa46840b 63 #define IS_ETH_AUTONEGOTIATION(CMD) (((CMD) == ETH_AUTONEGOTIATION_ENABLE) || \
Kojto 110:165afa46840b 64 ((CMD) == ETH_AUTONEGOTIATION_DISABLE))
Kojto 110:165afa46840b 65 #define IS_ETH_SPEED(SPEED) (((SPEED) == ETH_SPEED_10M) || \
Kojto 110:165afa46840b 66 ((SPEED) == ETH_SPEED_100M))
Kojto 110:165afa46840b 67 #define IS_ETH_DUPLEX_MODE(MODE) (((MODE) == ETH_MODE_FULLDUPLEX) || \
Kojto 110:165afa46840b 68 ((MODE) == ETH_MODE_HALFDUPLEX))
Kojto 110:165afa46840b 69 #define IS_ETH_RX_MODE(MODE) (((MODE) == ETH_RXPOLLING_MODE) || \
Kojto 110:165afa46840b 70 ((MODE) == ETH_RXINTERRUPT_MODE))
Kojto 110:165afa46840b 71 #define IS_ETH_CHECKSUM_MODE(MODE) (((MODE) == ETH_CHECKSUM_BY_HARDWARE) || \
Kojto 110:165afa46840b 72 ((MODE) == ETH_CHECKSUM_BY_SOFTWARE))
Kojto 110:165afa46840b 73 #define IS_ETH_MEDIA_INTERFACE(MODE) (((MODE) == ETH_MEDIA_INTERFACE_MII) || \
Kojto 110:165afa46840b 74 ((MODE) == ETH_MEDIA_INTERFACE_RMII))
Kojto 110:165afa46840b 75 #define IS_ETH_WATCHDOG(CMD) (((CMD) == ETH_WATCHDOG_ENABLE) || \
Kojto 110:165afa46840b 76 ((CMD) == ETH_WATCHDOG_DISABLE))
Kojto 110:165afa46840b 77 #define IS_ETH_JABBER(CMD) (((CMD) == ETH_JABBER_ENABLE) || \
Kojto 110:165afa46840b 78 ((CMD) == ETH_JABBER_DISABLE))
Kojto 110:165afa46840b 79 #define IS_ETH_INTER_FRAME_GAP(GAP) (((GAP) == ETH_INTERFRAMEGAP_96BIT) || \
Kojto 110:165afa46840b 80 ((GAP) == ETH_INTERFRAMEGAP_88BIT) || \
Kojto 110:165afa46840b 81 ((GAP) == ETH_INTERFRAMEGAP_80BIT) || \
Kojto 110:165afa46840b 82 ((GAP) == ETH_INTERFRAMEGAP_72BIT) || \
Kojto 110:165afa46840b 83 ((GAP) == ETH_INTERFRAMEGAP_64BIT) || \
Kojto 110:165afa46840b 84 ((GAP) == ETH_INTERFRAMEGAP_56BIT) || \
Kojto 110:165afa46840b 85 ((GAP) == ETH_INTERFRAMEGAP_48BIT) || \
Kojto 110:165afa46840b 86 ((GAP) == ETH_INTERFRAMEGAP_40BIT))
Kojto 110:165afa46840b 87 #define IS_ETH_CARRIER_SENSE(CMD) (((CMD) == ETH_CARRIERSENCE_ENABLE) || \
Kojto 110:165afa46840b 88 ((CMD) == ETH_CARRIERSENCE_DISABLE))
Kojto 110:165afa46840b 89 #define IS_ETH_RECEIVE_OWN(CMD) (((CMD) == ETH_RECEIVEOWN_ENABLE) || \
Kojto 110:165afa46840b 90 ((CMD) == ETH_RECEIVEOWN_DISABLE))
Kojto 110:165afa46840b 91 #define IS_ETH_LOOPBACK_MODE(CMD) (((CMD) == ETH_LOOPBACKMODE_ENABLE) || \
Kojto 110:165afa46840b 92 ((CMD) == ETH_LOOPBACKMODE_DISABLE))
Kojto 110:165afa46840b 93 #define IS_ETH_CHECKSUM_OFFLOAD(CMD) (((CMD) == ETH_CHECKSUMOFFLAOD_ENABLE) || \
Kojto 110:165afa46840b 94 ((CMD) == ETH_CHECKSUMOFFLAOD_DISABLE))
Kojto 110:165afa46840b 95 #define IS_ETH_RETRY_TRANSMISSION(CMD) (((CMD) == ETH_RETRYTRANSMISSION_ENABLE) || \
Kojto 110:165afa46840b 96 ((CMD) == ETH_RETRYTRANSMISSION_DISABLE))
Kojto 110:165afa46840b 97 #define IS_ETH_AUTOMATIC_PADCRC_STRIP(CMD) (((CMD) == ETH_AUTOMATICPADCRCSTRIP_ENABLE) || \
Kojto 110:165afa46840b 98 ((CMD) == ETH_AUTOMATICPADCRCSTRIP_DISABLE))
Kojto 110:165afa46840b 99 #define IS_ETH_BACKOFF_LIMIT(LIMIT) (((LIMIT) == ETH_BACKOFFLIMIT_10) || \
Kojto 110:165afa46840b 100 ((LIMIT) == ETH_BACKOFFLIMIT_8) || \
Kojto 110:165afa46840b 101 ((LIMIT) == ETH_BACKOFFLIMIT_4) || \
Kojto 110:165afa46840b 102 ((LIMIT) == ETH_BACKOFFLIMIT_1))
Kojto 110:165afa46840b 103 #define IS_ETH_DEFERRAL_CHECK(CMD) (((CMD) == ETH_DEFFERRALCHECK_ENABLE) || \
Kojto 110:165afa46840b 104 ((CMD) == ETH_DEFFERRALCHECK_DISABLE))
Kojto 110:165afa46840b 105 #define IS_ETH_RECEIVE_ALL(CMD) (((CMD) == ETH_RECEIVEALL_ENABLE) || \
Kojto 110:165afa46840b 106 ((CMD) == ETH_RECEIVEAll_DISABLE))
Kojto 110:165afa46840b 107 #define IS_ETH_SOURCE_ADDR_FILTER(CMD) (((CMD) == ETH_SOURCEADDRFILTER_NORMAL_ENABLE) || \
Kojto 110:165afa46840b 108 ((CMD) == ETH_SOURCEADDRFILTER_INVERSE_ENABLE) || \
Kojto 110:165afa46840b 109 ((CMD) == ETH_SOURCEADDRFILTER_DISABLE))
Kojto 110:165afa46840b 110 #define IS_ETH_CONTROL_FRAMES(PASS) (((PASS) == ETH_PASSCONTROLFRAMES_BLOCKALL) || \
Kojto 110:165afa46840b 111 ((PASS) == ETH_PASSCONTROLFRAMES_FORWARDALL) || \
Kojto 110:165afa46840b 112 ((PASS) == ETH_PASSCONTROLFRAMES_FORWARDPASSEDADDRFILTER))
Kojto 110:165afa46840b 113 #define IS_ETH_BROADCAST_FRAMES_RECEPTION(CMD) (((CMD) == ETH_BROADCASTFRAMESRECEPTION_ENABLE) || \
Kojto 110:165afa46840b 114 ((CMD) == ETH_BROADCASTFRAMESRECEPTION_DISABLE))
Kojto 110:165afa46840b 115 #define IS_ETH_DESTINATION_ADDR_FILTER(FILTER) (((FILTER) == ETH_DESTINATIONADDRFILTER_NORMAL) || \
Kojto 110:165afa46840b 116 ((FILTER) == ETH_DESTINATIONADDRFILTER_INVERSE))
Kojto 110:165afa46840b 117 #define IS_ETH_PROMISCUOUS_MODE(CMD) (((CMD) == ETH_PROMISCUOUS_MODE_ENABLE) || \
Kojto 110:165afa46840b 118 ((CMD) == ETH_PROMISCUOUS_MODE_DISABLE))
Kojto 110:165afa46840b 119 #define IS_ETH_MULTICAST_FRAMES_FILTER(FILTER) (((FILTER) == ETH_MULTICASTFRAMESFILTER_PERFECTHASHTABLE) || \
Kojto 110:165afa46840b 120 ((FILTER) == ETH_MULTICASTFRAMESFILTER_HASHTABLE) || \
Kojto 110:165afa46840b 121 ((FILTER) == ETH_MULTICASTFRAMESFILTER_PERFECT) || \
Kojto 110:165afa46840b 122 ((FILTER) == ETH_MULTICASTFRAMESFILTER_NONE))
Kojto 110:165afa46840b 123 #define IS_ETH_UNICAST_FRAMES_FILTER(FILTER) (((FILTER) == ETH_UNICASTFRAMESFILTER_PERFECTHASHTABLE) || \
Kojto 110:165afa46840b 124 ((FILTER) == ETH_UNICASTFRAMESFILTER_HASHTABLE) || \
Kojto 110:165afa46840b 125 ((FILTER) == ETH_UNICASTFRAMESFILTER_PERFECT))
Kojto 110:165afa46840b 126 #define IS_ETH_PAUSE_TIME(TIME) ((TIME) <= 0xFFFF)
Kojto 110:165afa46840b 127 #define IS_ETH_ZEROQUANTA_PAUSE(CMD) (((CMD) == ETH_ZEROQUANTAPAUSE_ENABLE) || \
Kojto 110:165afa46840b 128 ((CMD) == ETH_ZEROQUANTAPAUSE_DISABLE))
Kojto 110:165afa46840b 129 #define IS_ETH_PAUSE_LOW_THRESHOLD(THRESHOLD) (((THRESHOLD) == ETH_PAUSELOWTHRESHOLD_MINUS4) || \
Kojto 110:165afa46840b 130 ((THRESHOLD) == ETH_PAUSELOWTHRESHOLD_MINUS28) || \
Kojto 110:165afa46840b 131 ((THRESHOLD) == ETH_PAUSELOWTHRESHOLD_MINUS144) || \
Kojto 110:165afa46840b 132 ((THRESHOLD) == ETH_PAUSELOWTHRESHOLD_MINUS256))
Kojto 110:165afa46840b 133 #define IS_ETH_UNICAST_PAUSE_FRAME_DETECT(CMD) (((CMD) == ETH_UNICASTPAUSEFRAMEDETECT_ENABLE) || \
Kojto 110:165afa46840b 134 ((CMD) == ETH_UNICASTPAUSEFRAMEDETECT_DISABLE))
Kojto 110:165afa46840b 135 #define IS_ETH_RECEIVE_FLOWCONTROL(CMD) (((CMD) == ETH_RECEIVEFLOWCONTROL_ENABLE) || \
Kojto 110:165afa46840b 136 ((CMD) == ETH_RECEIVEFLOWCONTROL_DISABLE))
Kojto 110:165afa46840b 137 #define IS_ETH_TRANSMIT_FLOWCONTROL(CMD) (((CMD) == ETH_TRANSMITFLOWCONTROL_ENABLE) || \
Kojto 110:165afa46840b 138 ((CMD) == ETH_TRANSMITFLOWCONTROL_DISABLE))
Kojto 110:165afa46840b 139 #define IS_ETH_VLAN_TAG_COMPARISON(COMPARISON) (((COMPARISON) == ETH_VLANTAGCOMPARISON_12BIT) || \
Kojto 110:165afa46840b 140 ((COMPARISON) == ETH_VLANTAGCOMPARISON_16BIT))
Kojto 110:165afa46840b 141 #define IS_ETH_VLAN_TAG_IDENTIFIER(IDENTIFIER) ((IDENTIFIER) <= 0xFFFF)
Kojto 110:165afa46840b 142 #define IS_ETH_MAC_ADDRESS0123(ADDRESS) (((ADDRESS) == ETH_MAC_ADDRESS0) || \
Kojto 110:165afa46840b 143 ((ADDRESS) == ETH_MAC_ADDRESS1) || \
Kojto 110:165afa46840b 144 ((ADDRESS) == ETH_MAC_ADDRESS2) || \
Kojto 110:165afa46840b 145 ((ADDRESS) == ETH_MAC_ADDRESS3))
Kojto 110:165afa46840b 146 #define IS_ETH_MAC_ADDRESS123(ADDRESS) (((ADDRESS) == ETH_MAC_ADDRESS1) || \
Kojto 110:165afa46840b 147 ((ADDRESS) == ETH_MAC_ADDRESS2) || \
Kojto 110:165afa46840b 148 ((ADDRESS) == ETH_MAC_ADDRESS3))
Kojto 110:165afa46840b 149 #define IS_ETH_MAC_ADDRESS_FILTER(FILTER) (((FILTER) == ETH_MAC_ADDRESSFILTER_SA) || \
Kojto 110:165afa46840b 150 ((FILTER) == ETH_MAC_ADDRESSFILTER_DA))
Kojto 110:165afa46840b 151 #define IS_ETH_MAC_ADDRESS_MASK(MASK) (((MASK) == ETH_MAC_ADDRESSMASK_BYTE6) || \
Kojto 110:165afa46840b 152 ((MASK) == ETH_MAC_ADDRESSMASK_BYTE5) || \
Kojto 110:165afa46840b 153 ((MASK) == ETH_MAC_ADDRESSMASK_BYTE4) || \
Kojto 110:165afa46840b 154 ((MASK) == ETH_MAC_ADDRESSMASK_BYTE3) || \
Kojto 110:165afa46840b 155 ((MASK) == ETH_MAC_ADDRESSMASK_BYTE2) || \
Kojto 110:165afa46840b 156 ((MASK) == ETH_MAC_ADDRESSMASK_BYTE1))
Kojto 110:165afa46840b 157 #define IS_ETH_DROP_TCPIP_CHECKSUM_FRAME(CMD) (((CMD) == ETH_DROPTCPIPCHECKSUMERRORFRAME_ENABLE) || \
Kojto 110:165afa46840b 158 ((CMD) == ETH_DROPTCPIPCHECKSUMERRORFRAME_DISABLE))
Kojto 110:165afa46840b 159 #define IS_ETH_RECEIVE_STORE_FORWARD(CMD) (((CMD) == ETH_RECEIVESTOREFORWARD_ENABLE) || \
Kojto 110:165afa46840b 160 ((CMD) == ETH_RECEIVESTOREFORWARD_DISABLE))
Kojto 110:165afa46840b 161 #define IS_ETH_FLUSH_RECEIVE_FRAME(CMD) (((CMD) == ETH_FLUSHRECEIVEDFRAME_ENABLE) || \
Kojto 110:165afa46840b 162 ((CMD) == ETH_FLUSHRECEIVEDFRAME_DISABLE))
Kojto 110:165afa46840b 163 #define IS_ETH_TRANSMIT_STORE_FORWARD(CMD) (((CMD) == ETH_TRANSMITSTOREFORWARD_ENABLE) || \
Kojto 110:165afa46840b 164 ((CMD) == ETH_TRANSMITSTOREFORWARD_DISABLE))
Kojto 110:165afa46840b 165 #define IS_ETH_TRANSMIT_THRESHOLD_CONTROL(THRESHOLD) (((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_64BYTES) || \
Kojto 110:165afa46840b 166 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_128BYTES) || \
Kojto 110:165afa46840b 167 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_192BYTES) || \
Kojto 110:165afa46840b 168 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_256BYTES) || \
Kojto 110:165afa46840b 169 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_40BYTES) || \
Kojto 110:165afa46840b 170 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_32BYTES) || \
Kojto 110:165afa46840b 171 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_24BYTES) || \
Kojto 110:165afa46840b 172 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_16BYTES))
Kojto 110:165afa46840b 173 #define IS_ETH_FORWARD_ERROR_FRAMES(CMD) (((CMD) == ETH_FORWARDERRORFRAMES_ENABLE) || \
Kojto 110:165afa46840b 174 ((CMD) == ETH_FORWARDERRORFRAMES_DISABLE))
Kojto 110:165afa46840b 175 #define IS_ETH_FORWARD_UNDERSIZED_GOOD_FRAMES(CMD) (((CMD) == ETH_FORWARDUNDERSIZEDGOODFRAMES_ENABLE) || \
Kojto 110:165afa46840b 176 ((CMD) == ETH_FORWARDUNDERSIZEDGOODFRAMES_DISABLE))
Kojto 110:165afa46840b 177 #define IS_ETH_RECEIVE_THRESHOLD_CONTROL(THRESHOLD) (((THRESHOLD) == ETH_RECEIVEDTHRESHOLDCONTROL_64BYTES) || \
Kojto 110:165afa46840b 178 ((THRESHOLD) == ETH_RECEIVEDTHRESHOLDCONTROL_32BYTES) || \
Kojto 110:165afa46840b 179 ((THRESHOLD) == ETH_RECEIVEDTHRESHOLDCONTROL_96BYTES) || \
Kojto 110:165afa46840b 180 ((THRESHOLD) == ETH_RECEIVEDTHRESHOLDCONTROL_128BYTES))
Kojto 110:165afa46840b 181 #define IS_ETH_SECOND_FRAME_OPERATE(CMD) (((CMD) == ETH_SECONDFRAMEOPERARTE_ENABLE) || \
Kojto 110:165afa46840b 182 ((CMD) == ETH_SECONDFRAMEOPERARTE_DISABLE))
Kojto 110:165afa46840b 183 #define IS_ETH_ADDRESS_ALIGNED_BEATS(CMD) (((CMD) == ETH_ADDRESSALIGNEDBEATS_ENABLE) || \
Kojto 110:165afa46840b 184 ((CMD) == ETH_ADDRESSALIGNEDBEATS_DISABLE))
Kojto 110:165afa46840b 185 #define IS_ETH_FIXED_BURST(CMD) (((CMD) == ETH_FIXEDBURST_ENABLE) || \
Kojto 110:165afa46840b 186 ((CMD) == ETH_FIXEDBURST_DISABLE))
Kojto 110:165afa46840b 187 #define IS_ETH_RXDMA_BURST_LENGTH(LENGTH) (((LENGTH) == ETH_RXDMABURSTLENGTH_1BEAT) || \
Kojto 110:165afa46840b 188 ((LENGTH) == ETH_RXDMABURSTLENGTH_2BEAT) || \
Kojto 110:165afa46840b 189 ((LENGTH) == ETH_RXDMABURSTLENGTH_4BEAT) || \
Kojto 110:165afa46840b 190 ((LENGTH) == ETH_RXDMABURSTLENGTH_8BEAT) || \
Kojto 110:165afa46840b 191 ((LENGTH) == ETH_RXDMABURSTLENGTH_16BEAT) || \
Kojto 110:165afa46840b 192 ((LENGTH) == ETH_RXDMABURSTLENGTH_32BEAT) || \
Kojto 110:165afa46840b 193 ((LENGTH) == ETH_RXDMABURSTLENGTH_4XPBL_4BEAT) || \
Kojto 110:165afa46840b 194 ((LENGTH) == ETH_RXDMABURSTLENGTH_4XPBL_8BEAT) || \
Kojto 110:165afa46840b 195 ((LENGTH) == ETH_RXDMABURSTLENGTH_4XPBL_16BEAT) || \
Kojto 110:165afa46840b 196 ((LENGTH) == ETH_RXDMABURSTLENGTH_4XPBL_32BEAT) || \
Kojto 110:165afa46840b 197 ((LENGTH) == ETH_RXDMABURSTLENGTH_4XPBL_64BEAT) || \
Kojto 110:165afa46840b 198 ((LENGTH) == ETH_RXDMABURSTLENGTH_4XPBL_128BEAT))
Kojto 110:165afa46840b 199 #define IS_ETH_TXDMA_BURST_LENGTH(LENGTH) (((LENGTH) == ETH_TXDMABURSTLENGTH_1BEAT) || \
Kojto 110:165afa46840b 200 ((LENGTH) == ETH_TXDMABURSTLENGTH_2BEAT) || \
Kojto 110:165afa46840b 201 ((LENGTH) == ETH_TXDMABURSTLENGTH_4BEAT) || \
Kojto 110:165afa46840b 202 ((LENGTH) == ETH_TXDMABURSTLENGTH_8BEAT) || \
Kojto 110:165afa46840b 203 ((LENGTH) == ETH_TXDMABURSTLENGTH_16BEAT) || \
Kojto 110:165afa46840b 204 ((LENGTH) == ETH_TXDMABURSTLENGTH_32BEAT) || \
Kojto 110:165afa46840b 205 ((LENGTH) == ETH_TXDMABURSTLENGTH_4XPBL_4BEAT) || \
Kojto 110:165afa46840b 206 ((LENGTH) == ETH_TXDMABURSTLENGTH_4XPBL_8BEAT) || \
Kojto 110:165afa46840b 207 ((LENGTH) == ETH_TXDMABURSTLENGTH_4XPBL_16BEAT) || \
Kojto 110:165afa46840b 208 ((LENGTH) == ETH_TXDMABURSTLENGTH_4XPBL_32BEAT) || \
Kojto 110:165afa46840b 209 ((LENGTH) == ETH_TXDMABURSTLENGTH_4XPBL_64BEAT) || \
Kojto 110:165afa46840b 210 ((LENGTH) == ETH_TXDMABURSTLENGTH_4XPBL_128BEAT))
Kojto 110:165afa46840b 211 #define IS_ETH_DMA_DESC_SKIP_LENGTH(LENGTH) ((LENGTH) <= 0x1F)
Kojto 110:165afa46840b 212 #define IS_ETH_DMA_ARBITRATION_ROUNDROBIN_RXTX(RATIO) (((RATIO) == ETH_DMAARBITRATION_ROUNDROBIN_RXTX_1_1) || \
Kojto 110:165afa46840b 213 ((RATIO) == ETH_DMAARBITRATION_ROUNDROBIN_RXTX_2_1) || \
Kojto 110:165afa46840b 214 ((RATIO) == ETH_DMAARBITRATION_ROUNDROBIN_RXTX_3_1) || \
Kojto 110:165afa46840b 215 ((RATIO) == ETH_DMAARBITRATION_ROUNDROBIN_RXTX_4_1) || \
Kojto 110:165afa46840b 216 ((RATIO) == ETH_DMAARBITRATION_RXPRIORTX))
Kojto 110:165afa46840b 217 #define IS_ETH_DMATXDESC_GET_FLAG(FLAG) (((FLAG) == ETH_DMATXDESC_OWN) || \
Kojto 110:165afa46840b 218 ((FLAG) == ETH_DMATXDESC_IC) || \
Kojto 110:165afa46840b 219 ((FLAG) == ETH_DMATXDESC_LS) || \
Kojto 110:165afa46840b 220 ((FLAG) == ETH_DMATXDESC_FS) || \
Kojto 110:165afa46840b 221 ((FLAG) == ETH_DMATXDESC_DC) || \
Kojto 110:165afa46840b 222 ((FLAG) == ETH_DMATXDESC_DP) || \
Kojto 110:165afa46840b 223 ((FLAG) == ETH_DMATXDESC_TTSE) || \
Kojto 110:165afa46840b 224 ((FLAG) == ETH_DMATXDESC_TER) || \
Kojto 110:165afa46840b 225 ((FLAG) == ETH_DMATXDESC_TCH) || \
Kojto 110:165afa46840b 226 ((FLAG) == ETH_DMATXDESC_TTSS) || \
Kojto 110:165afa46840b 227 ((FLAG) == ETH_DMATXDESC_IHE) || \
Kojto 110:165afa46840b 228 ((FLAG) == ETH_DMATXDESC_ES) || \
Kojto 110:165afa46840b 229 ((FLAG) == ETH_DMATXDESC_JT) || \
Kojto 110:165afa46840b 230 ((FLAG) == ETH_DMATXDESC_FF) || \
Kojto 110:165afa46840b 231 ((FLAG) == ETH_DMATXDESC_PCE) || \
Kojto 110:165afa46840b 232 ((FLAG) == ETH_DMATXDESC_LCA) || \
Kojto 110:165afa46840b 233 ((FLAG) == ETH_DMATXDESC_NC) || \
Kojto 110:165afa46840b 234 ((FLAG) == ETH_DMATXDESC_LCO) || \
Kojto 110:165afa46840b 235 ((FLAG) == ETH_DMATXDESC_EC) || \
Kojto 110:165afa46840b 236 ((FLAG) == ETH_DMATXDESC_VF) || \
Kojto 110:165afa46840b 237 ((FLAG) == ETH_DMATXDESC_CC) || \
Kojto 110:165afa46840b 238 ((FLAG) == ETH_DMATXDESC_ED) || \
Kojto 110:165afa46840b 239 ((FLAG) == ETH_DMATXDESC_UF) || \
Kojto 110:165afa46840b 240 ((FLAG) == ETH_DMATXDESC_DB))
Kojto 110:165afa46840b 241 #define IS_ETH_DMA_TXDESC_SEGMENT(SEGMENT) (((SEGMENT) == ETH_DMATXDESC_LASTSEGMENTS) || \
Kojto 110:165afa46840b 242 ((SEGMENT) == ETH_DMATXDESC_FIRSTSEGMENT))
Kojto 110:165afa46840b 243 #define IS_ETH_DMA_TXDESC_CHECKSUM(CHECKSUM) (((CHECKSUM) == ETH_DMATXDESC_CHECKSUMBYPASS) || \
Kojto 110:165afa46840b 244 ((CHECKSUM) == ETH_DMATXDESC_CHECKSUMIPV4HEADER) || \
Kojto 110:165afa46840b 245 ((CHECKSUM) == ETH_DMATXDESC_CHECKSUMTCPUDPICMPSEGMENT) || \
Kojto 110:165afa46840b 246 ((CHECKSUM) == ETH_DMATXDESC_CHECKSUMTCPUDPICMPFULL))
Kojto 110:165afa46840b 247 #define IS_ETH_DMATXDESC_BUFFER_SIZE(SIZE) ((SIZE) <= 0x1FFF)
Kojto 110:165afa46840b 248 #define IS_ETH_DMARXDESC_GET_FLAG(FLAG) (((FLAG) == ETH_DMARXDESC_OWN) || \
Kojto 110:165afa46840b 249 ((FLAG) == ETH_DMARXDESC_AFM) || \
Kojto 110:165afa46840b 250 ((FLAG) == ETH_DMARXDESC_ES) || \
Kojto 110:165afa46840b 251 ((FLAG) == ETH_DMARXDESC_DE) || \
Kojto 110:165afa46840b 252 ((FLAG) == ETH_DMARXDESC_SAF) || \
Kojto 110:165afa46840b 253 ((FLAG) == ETH_DMARXDESC_LE) || \
Kojto 110:165afa46840b 254 ((FLAG) == ETH_DMARXDESC_OE) || \
Kojto 110:165afa46840b 255 ((FLAG) == ETH_DMARXDESC_VLAN) || \
Kojto 110:165afa46840b 256 ((FLAG) == ETH_DMARXDESC_FS) || \
Kojto 110:165afa46840b 257 ((FLAG) == ETH_DMARXDESC_LS) || \
Kojto 110:165afa46840b 258 ((FLAG) == ETH_DMARXDESC_IPV4HCE) || \
Kojto 110:165afa46840b 259 ((FLAG) == ETH_DMARXDESC_LC) || \
Kojto 110:165afa46840b 260 ((FLAG) == ETH_DMARXDESC_FT) || \
Kojto 110:165afa46840b 261 ((FLAG) == ETH_DMARXDESC_RWT) || \
Kojto 110:165afa46840b 262 ((FLAG) == ETH_DMARXDESC_RE) || \
Kojto 110:165afa46840b 263 ((FLAG) == ETH_DMARXDESC_DBE) || \
Kojto 110:165afa46840b 264 ((FLAG) == ETH_DMARXDESC_CE) || \
Kojto 110:165afa46840b 265 ((FLAG) == ETH_DMARXDESC_MAMPCE))
Kojto 110:165afa46840b 266 #define IS_ETH_DMA_RXDESC_BUFFER(BUFFER) (((BUFFER) == ETH_DMARXDESC_BUFFER1) || \
Kojto 110:165afa46840b 267 ((BUFFER) == ETH_DMARXDESC_BUFFER2))
Kojto 110:165afa46840b 268 #define IS_ETH_PMT_GET_FLAG(FLAG) (((FLAG) == ETH_PMT_FLAG_WUFR) || \
Kojto 110:165afa46840b 269 ((FLAG) == ETH_PMT_FLAG_MPR))
Kojto 110:165afa46840b 270 #define IS_ETH_DMA_FLAG(FLAG) ((((FLAG) & (uint32_t)0xC7FE1800) == 0x00) && ((FLAG) != 0x00))
Kojto 110:165afa46840b 271 #define IS_ETH_DMA_GET_FLAG(FLAG) (((FLAG) == ETH_DMA_FLAG_TST) || ((FLAG) == ETH_DMA_FLAG_PMT) || \
Kojto 110:165afa46840b 272 ((FLAG) == ETH_DMA_FLAG_MMC) || ((FLAG) == ETH_DMA_FLAG_DATATRANSFERERROR) || \
Kojto 110:165afa46840b 273 ((FLAG) == ETH_DMA_FLAG_READWRITEERROR) || ((FLAG) == ETH_DMA_FLAG_ACCESSERROR) || \
Kojto 110:165afa46840b 274 ((FLAG) == ETH_DMA_FLAG_NIS) || ((FLAG) == ETH_DMA_FLAG_AIS) || \
Kojto 110:165afa46840b 275 ((FLAG) == ETH_DMA_FLAG_ER) || ((FLAG) == ETH_DMA_FLAG_FBE) || \
Kojto 110:165afa46840b 276 ((FLAG) == ETH_DMA_FLAG_ET) || ((FLAG) == ETH_DMA_FLAG_RWT) || \
Kojto 110:165afa46840b 277 ((FLAG) == ETH_DMA_FLAG_RPS) || ((FLAG) == ETH_DMA_FLAG_RBU) || \
Kojto 110:165afa46840b 278 ((FLAG) == ETH_DMA_FLAG_R) || ((FLAG) == ETH_DMA_FLAG_TU) || \
Kojto 110:165afa46840b 279 ((FLAG) == ETH_DMA_FLAG_RO) || ((FLAG) == ETH_DMA_FLAG_TJT) || \
Kojto 110:165afa46840b 280 ((FLAG) == ETH_DMA_FLAG_TBU) || ((FLAG) == ETH_DMA_FLAG_TPS) || \
Kojto 110:165afa46840b 281 ((FLAG) == ETH_DMA_FLAG_T))
Kojto 110:165afa46840b 282 #define IS_ETH_MAC_IT(IT) ((((IT) & (uint32_t)0xFFFFFDF1) == 0x00) && ((IT) != 0x00))
Kojto 110:165afa46840b 283 #define IS_ETH_MAC_GET_IT(IT) (((IT) == ETH_MAC_IT_TST) || ((IT) == ETH_MAC_IT_MMCT) || \
Kojto 110:165afa46840b 284 ((IT) == ETH_MAC_IT_MMCR) || ((IT) == ETH_MAC_IT_MMC) || \
Kojto 110:165afa46840b 285 ((IT) == ETH_MAC_IT_PMT))
Kojto 110:165afa46840b 286 #define IS_ETH_MAC_GET_FLAG(FLAG) (((FLAG) == ETH_MAC_FLAG_TST) || ((FLAG) == ETH_MAC_FLAG_MMCT) || \
Kojto 110:165afa46840b 287 ((FLAG) == ETH_MAC_FLAG_MMCR) || ((FLAG) == ETH_MAC_FLAG_MMC) || \
Kojto 110:165afa46840b 288 ((FLAG) == ETH_MAC_FLAG_PMT))
Kojto 110:165afa46840b 289 #define IS_ETH_DMA_IT(IT) ((((IT) & (uint32_t)0xC7FE1800) == 0x00) && ((IT) != 0x00))
Kojto 110:165afa46840b 290 #define IS_ETH_DMA_GET_IT(IT) (((IT) == ETH_DMA_IT_TST) || ((IT) == ETH_DMA_IT_PMT) || \
Kojto 110:165afa46840b 291 ((IT) == ETH_DMA_IT_MMC) || ((IT) == ETH_DMA_IT_NIS) || \
Kojto 110:165afa46840b 292 ((IT) == ETH_DMA_IT_AIS) || ((IT) == ETH_DMA_IT_ER) || \
Kojto 110:165afa46840b 293 ((IT) == ETH_DMA_IT_FBE) || ((IT) == ETH_DMA_IT_ET) || \
Kojto 110:165afa46840b 294 ((IT) == ETH_DMA_IT_RWT) || ((IT) == ETH_DMA_IT_RPS) || \
Kojto 110:165afa46840b 295 ((IT) == ETH_DMA_IT_RBU) || ((IT) == ETH_DMA_IT_R) || \
Kojto 110:165afa46840b 296 ((IT) == ETH_DMA_IT_TU) || ((IT) == ETH_DMA_IT_RO) || \
Kojto 110:165afa46840b 297 ((IT) == ETH_DMA_IT_TJT) || ((IT) == ETH_DMA_IT_TBU) || \
Kojto 110:165afa46840b 298 ((IT) == ETH_DMA_IT_TPS) || ((IT) == ETH_DMA_IT_T))
Kojto 110:165afa46840b 299 #define IS_ETH_DMA_GET_OVERFLOW(OVERFLOW) (((OVERFLOW) == ETH_DMA_OVERFLOW_RXFIFOCOUNTER) || \
Kojto 110:165afa46840b 300 ((OVERFLOW) == ETH_DMA_OVERFLOW_MISSEDFRAMECOUNTER))
Kojto 110:165afa46840b 301 #define IS_ETH_MMC_IT(IT) (((((IT) & (uint32_t)0xFFDF3FFF) == 0x00) || (((IT) & (uint32_t)0xEFFDFF9F) == 0x00)) && \
Kojto 110:165afa46840b 302 ((IT) != 0x00))
Kojto 110:165afa46840b 303 #define IS_ETH_MMC_GET_IT(IT) (((IT) == ETH_MMC_IT_TGF) || ((IT) == ETH_MMC_IT_TGFMSC) || \
Kojto 110:165afa46840b 304 ((IT) == ETH_MMC_IT_TGFSC) || ((IT) == ETH_MMC_IT_RGUF) || \
Kojto 110:165afa46840b 305 ((IT) == ETH_MMC_IT_RFAE) || ((IT) == ETH_MMC_IT_RFCE))
Kojto 110:165afa46840b 306 #define IS_ETH_ENHANCED_DESCRIPTOR_FORMAT(CMD) (((CMD) == ETH_DMAENHANCEDDESCRIPTOR_ENABLE) || \
Kojto 110:165afa46840b 307 ((CMD) == ETH_DMAENHANCEDDESCRIPTOR_DISABLE))
Kojto 110:165afa46840b 308
Kojto 110:165afa46840b 309
Kojto 110:165afa46840b 310 /**
Kojto 110:165afa46840b 311 * @}
Kojto 110:165afa46840b 312 */
Kojto 110:165afa46840b 313
Kojto 110:165afa46840b 314 /** @addtogroup ETH_Private_Defines
Kojto 110:165afa46840b 315 * @{
Kojto 110:165afa46840b 316 */
Kojto 110:165afa46840b 317 /* Delay to wait when writing to some Ethernet registers */
Kojto 110:165afa46840b 318 #define ETH_REG_WRITE_DELAY ((uint32_t)0x00000001)
Kojto 110:165afa46840b 319
Kojto 110:165afa46840b 320 /* ETHERNET Errors */
Kojto 110:165afa46840b 321 #define ETH_SUCCESS ((uint32_t)0)
Kojto 110:165afa46840b 322 #define ETH_ERROR ((uint32_t)1)
Kojto 110:165afa46840b 323
Kojto 110:165afa46840b 324 /* ETHERNET DMA Tx descriptors Collision Count Shift */
Kojto 110:165afa46840b 325 #define ETH_DMATXDESC_COLLISION_COUNTSHIFT ((uint32_t)3)
Kojto 110:165afa46840b 326
Kojto 110:165afa46840b 327 /* ETHERNET DMA Tx descriptors Buffer2 Size Shift */
Kojto 110:165afa46840b 328 #define ETH_DMATXDESC_BUFFER2_SIZESHIFT ((uint32_t)16)
Kojto 110:165afa46840b 329
Kojto 110:165afa46840b 330 /* ETHERNET DMA Rx descriptors Frame Length Shift */
Kojto 110:165afa46840b 331 #define ETH_DMARXDESC_FRAME_LENGTHSHIFT ((uint32_t)16)
Kojto 110:165afa46840b 332
Kojto 110:165afa46840b 333 /* ETHERNET DMA Rx descriptors Buffer2 Size Shift */
Kojto 110:165afa46840b 334 #define ETH_DMARXDESC_BUFFER2_SIZESHIFT ((uint32_t)16)
Kojto 110:165afa46840b 335
Kojto 110:165afa46840b 336 /* ETHERNET DMA Rx descriptors Frame length Shift */
Kojto 110:165afa46840b 337 #define ETH_DMARXDESC_FRAMELENGTHSHIFT ((uint32_t)16)
Kojto 110:165afa46840b 338
Kojto 110:165afa46840b 339 /* ETHERNET MAC address offsets */
Kojto 110:165afa46840b 340 #define ETH_MAC_ADDR_HBASE (uint32_t)(ETH_MAC_BASE + (uint32_t)0x40) /* ETHERNET MAC address high offset */
Kojto 110:165afa46840b 341 #define ETH_MAC_ADDR_LBASE (uint32_t)(ETH_MAC_BASE + (uint32_t)0x44) /* ETHERNET MAC address low offset */
Kojto 110:165afa46840b 342
Kojto 110:165afa46840b 343 /* ETHERNET MACMIIAR register Mask */
Kojto 110:165afa46840b 344 #define ETH_MACMIIAR_CR_MASK ((uint32_t)0xFFFFFFE3)
Kojto 110:165afa46840b 345
Kojto 110:165afa46840b 346 /* ETHERNET MACCR register Mask */
Kojto 110:165afa46840b 347 #define ETH_MACCR_CLEAR_MASK ((uint32_t)0xFF20810F)
Kojto 110:165afa46840b 348
Kojto 110:165afa46840b 349 /* ETHERNET MACFCR register Mask */
Kojto 110:165afa46840b 350 #define ETH_MACFCR_CLEAR_MASK ((uint32_t)0x0000FF41)
Kojto 110:165afa46840b 351
Kojto 110:165afa46840b 352 /* ETHERNET DMAOMR register Mask */
Kojto 110:165afa46840b 353 #define ETH_DMAOMR_CLEAR_MASK ((uint32_t)0xF8DE3F23)
Kojto 110:165afa46840b 354
Kojto 110:165afa46840b 355 /* ETHERNET Remote Wake-up frame register length */
Kojto 110:165afa46840b 356 #define ETH_WAKEUP_REGISTER_LENGTH 8
Kojto 110:165afa46840b 357
Kojto 110:165afa46840b 358 /* ETHERNET Missed frames counter Shift */
Kojto 110:165afa46840b 359 #define ETH_DMA_RX_OVERFLOW_MISSEDFRAMES_COUNTERSHIFT 17
Kojto 110:165afa46840b 360 /**
Kojto 110:165afa46840b 361 * @}
Kojto 110:165afa46840b 362 */
Kojto 110:165afa46840b 363
Kojto 110:165afa46840b 364 /* Exported types ------------------------------------------------------------*/
Kojto 110:165afa46840b 365 /** @defgroup ETH_Exported_Types ETH Exported Types
Kojto 110:165afa46840b 366 * @{
Kojto 110:165afa46840b 367 */
Kojto 110:165afa46840b 368
Kojto 110:165afa46840b 369 /**
Kojto 110:165afa46840b 370 * @brief HAL State structures definition
Kojto 110:165afa46840b 371 */
Kojto 110:165afa46840b 372 typedef enum
Kojto 110:165afa46840b 373 {
Kojto 110:165afa46840b 374 HAL_ETH_STATE_RESET = 0x00, /*!< Peripheral not yet Initialized or disabled */
Kojto 110:165afa46840b 375 HAL_ETH_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
Kojto 110:165afa46840b 376 HAL_ETH_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
Kojto 110:165afa46840b 377 HAL_ETH_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
Kojto 110:165afa46840b 378 HAL_ETH_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
Kojto 110:165afa46840b 379 HAL_ETH_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */
Kojto 110:165afa46840b 380 HAL_ETH_STATE_BUSY_WR = 0x42, /*!< Write process is ongoing */
Kojto 110:165afa46840b 381 HAL_ETH_STATE_BUSY_RD = 0x82, /*!< Read process is ongoing */
Kojto 110:165afa46840b 382 HAL_ETH_STATE_TIMEOUT = 0x03, /*!< Timeout state */
Kojto 110:165afa46840b 383 HAL_ETH_STATE_ERROR = 0x04 /*!< Reception process is ongoing */
Kojto 110:165afa46840b 384 }HAL_ETH_StateTypeDef;
Kojto 110:165afa46840b 385
Kojto 110:165afa46840b 386 /**
Kojto 110:165afa46840b 387 * @brief ETH Init Structure definition
Kojto 110:165afa46840b 388 */
Kojto 110:165afa46840b 389
Kojto 110:165afa46840b 390 typedef struct
Kojto 110:165afa46840b 391 {
Kojto 110:165afa46840b 392 uint32_t AutoNegotiation; /*!< Selects or not the AutoNegotiation mode for the external PHY
Kojto 110:165afa46840b 393 The AutoNegotiation allows an automatic setting of the Speed (10/100Mbps)
Kojto 110:165afa46840b 394 and the mode (half/full-duplex).
Kojto 110:165afa46840b 395 This parameter can be a value of @ref ETH_AutoNegotiation */
Kojto 110:165afa46840b 396
Kojto 110:165afa46840b 397 uint32_t Speed; /*!< Sets the Ethernet speed: 10/100 Mbps.
Kojto 110:165afa46840b 398 This parameter can be a value of @ref ETH_Speed */
Kojto 110:165afa46840b 399
Kojto 110:165afa46840b 400 uint32_t DuplexMode; /*!< Selects the MAC duplex mode: Half-Duplex or Full-Duplex mode
Kojto 110:165afa46840b 401 This parameter can be a value of @ref ETH_Duplex_Mode */
Kojto 110:165afa46840b 402
Kojto 110:165afa46840b 403 uint16_t PhyAddress; /*!< Ethernet PHY address.
Kojto 110:165afa46840b 404 This parameter must be a number between Min_Data = 0 and Max_Data = 32 */
Kojto 110:165afa46840b 405
Kojto 110:165afa46840b 406 uint8_t *MACAddr; /*!< MAC Address of used Hardware: must be pointer on an array of 6 bytes */
Kojto 110:165afa46840b 407
Kojto 110:165afa46840b 408 uint32_t RxMode; /*!< Selects the Ethernet Rx mode: Polling mode, Interrupt mode.
Kojto 110:165afa46840b 409 This parameter can be a value of @ref ETH_Rx_Mode */
Kojto 110:165afa46840b 410
Kojto 110:165afa46840b 411 uint32_t ChecksumMode; /*!< Selects if the checksum is check by hardware or by software.
Kojto 110:165afa46840b 412 This parameter can be a value of @ref ETH_Checksum_Mode */
Kojto 110:165afa46840b 413
Kojto 110:165afa46840b 414 uint32_t MediaInterface ; /*!< Selects the media-independent interface or the reduced media-independent interface.
Kojto 110:165afa46840b 415 This parameter can be a value of @ref ETH_Media_Interface */
Kojto 110:165afa46840b 416
Kojto 110:165afa46840b 417 } ETH_InitTypeDef;
Kojto 110:165afa46840b 418
Kojto 110:165afa46840b 419
Kojto 110:165afa46840b 420 /**
Kojto 110:165afa46840b 421 * @brief ETH MAC Configuration Structure definition
Kojto 110:165afa46840b 422 */
Kojto 110:165afa46840b 423
Kojto 110:165afa46840b 424 typedef struct
Kojto 110:165afa46840b 425 {
Kojto 110:165afa46840b 426 uint32_t Watchdog; /*!< Selects or not the Watchdog timer
Kojto 110:165afa46840b 427 When enabled, the MAC allows no more then 2048 bytes to be received.
Kojto 110:165afa46840b 428 When disabled, the MAC can receive up to 16384 bytes.
Kojto 110:165afa46840b 429 This parameter can be a value of @ref ETH_Watchdog */
Kojto 110:165afa46840b 430
Kojto 110:165afa46840b 431 uint32_t Jabber; /*!< Selects or not Jabber timer
Kojto 110:165afa46840b 432 When enabled, the MAC allows no more then 2048 bytes to be sent.
Kojto 110:165afa46840b 433 When disabled, the MAC can send up to 16384 bytes.
Kojto 110:165afa46840b 434 This parameter can be a value of @ref ETH_Jabber */
Kojto 110:165afa46840b 435
Kojto 110:165afa46840b 436 uint32_t InterFrameGap; /*!< Selects the minimum IFG between frames during transmission.
Kojto 110:165afa46840b 437 This parameter can be a value of @ref ETH_Inter_Frame_Gap */
Kojto 110:165afa46840b 438
Kojto 110:165afa46840b 439 uint32_t CarrierSense; /*!< Selects or not the Carrier Sense.
Kojto 110:165afa46840b 440 This parameter can be a value of @ref ETH_Carrier_Sense */
Kojto 110:165afa46840b 441
Kojto 110:165afa46840b 442 uint32_t ReceiveOwn; /*!< Selects or not the ReceiveOwn,
Kojto 110:165afa46840b 443 ReceiveOwn allows the reception of frames when the TX_EN signal is asserted
Kojto 110:165afa46840b 444 in Half-Duplex mode.
Kojto 110:165afa46840b 445 This parameter can be a value of @ref ETH_Receive_Own */
Kojto 110:165afa46840b 446
Kojto 110:165afa46840b 447 uint32_t LoopbackMode; /*!< Selects or not the internal MAC MII Loopback mode.
Kojto 110:165afa46840b 448 This parameter can be a value of @ref ETH_Loop_Back_Mode */
Kojto 110:165afa46840b 449
Kojto 110:165afa46840b 450 uint32_t ChecksumOffload; /*!< Selects or not the IPv4 checksum checking for received frame payloads' TCP/UDP/ICMP headers.
Kojto 110:165afa46840b 451 This parameter can be a value of @ref ETH_Checksum_Offload */
Kojto 110:165afa46840b 452
Kojto 110:165afa46840b 453 uint32_t RetryTransmission; /*!< Selects or not the MAC attempt retries transmission, based on the settings of BL,
Kojto 110:165afa46840b 454 when a collision occurs (Half-Duplex mode).
Kojto 110:165afa46840b 455 This parameter can be a value of @ref ETH_Retry_Transmission */
Kojto 110:165afa46840b 456
Kojto 110:165afa46840b 457 uint32_t AutomaticPadCRCStrip; /*!< Selects or not the Automatic MAC Pad/CRC Stripping.
Kojto 110:165afa46840b 458 This parameter can be a value of @ref ETH_Automatic_Pad_CRC_Strip */
Kojto 110:165afa46840b 459
Kojto 110:165afa46840b 460 uint32_t BackOffLimit; /*!< Selects the BackOff limit value.
Kojto 110:165afa46840b 461 This parameter can be a value of @ref ETH_Back_Off_Limit */
Kojto 110:165afa46840b 462
Kojto 110:165afa46840b 463 uint32_t DeferralCheck; /*!< Selects or not the deferral check function (Half-Duplex mode).
Kojto 110:165afa46840b 464 This parameter can be a value of @ref ETH_Deferral_Check */
Kojto 110:165afa46840b 465
Kojto 110:165afa46840b 466 uint32_t ReceiveAll; /*!< Selects or not all frames reception by the MAC (No filtering).
Kojto 110:165afa46840b 467 This parameter can be a value of @ref ETH_Receive_All */
Kojto 110:165afa46840b 468
Kojto 110:165afa46840b 469 uint32_t SourceAddrFilter; /*!< Selects the Source Address Filter mode.
Kojto 110:165afa46840b 470 This parameter can be a value of @ref ETH_Source_Addr_Filter */
Kojto 110:165afa46840b 471
Kojto 110:165afa46840b 472 uint32_t PassControlFrames; /*!< Sets the forwarding mode of the control frames (including unicast and multicast PAUSE frames)
Kojto 110:165afa46840b 473 This parameter can be a value of @ref ETH_Pass_Control_Frames */
Kojto 110:165afa46840b 474
Kojto 110:165afa46840b 475 uint32_t BroadcastFramesReception; /*!< Selects or not the reception of Broadcast Frames.
Kojto 110:165afa46840b 476 This parameter can be a value of @ref ETH_Broadcast_Frames_Reception */
Kojto 110:165afa46840b 477
Kojto 110:165afa46840b 478 uint32_t DestinationAddrFilter; /*!< Sets the destination filter mode for both unicast and multicast frames.
Kojto 110:165afa46840b 479 This parameter can be a value of @ref ETH_Destination_Addr_Filter */
Kojto 110:165afa46840b 480
Kojto 110:165afa46840b 481 uint32_t PromiscuousMode; /*!< Selects or not the Promiscuous Mode
Kojto 110:165afa46840b 482 This parameter can be a value of @ref ETH_Promiscuous_Mode */
Kojto 110:165afa46840b 483
Kojto 110:165afa46840b 484 uint32_t MulticastFramesFilter; /*!< Selects the Multicast Frames filter mode: None/HashTableFilter/PerfectFilter/PerfectHashTableFilter.
Kojto 110:165afa46840b 485 This parameter can be a value of @ref ETH_Multicast_Frames_Filter */
Kojto 110:165afa46840b 486
Kojto 110:165afa46840b 487 uint32_t UnicastFramesFilter; /*!< Selects the Unicast Frames filter mode: HashTableFilter/PerfectFilter/PerfectHashTableFilter.
Kojto 110:165afa46840b 488 This parameter can be a value of @ref ETH_Unicast_Frames_Filter */
Kojto 110:165afa46840b 489
Kojto 110:165afa46840b 490 uint32_t HashTableHigh; /*!< This field holds the higher 32 bits of Hash table.
Kojto 110:165afa46840b 491 This parameter must be a number between Min_Data = 0x0 and Max_Data = 0xFFFFFFFF */
Kojto 110:165afa46840b 492
Kojto 110:165afa46840b 493 uint32_t HashTableLow; /*!< This field holds the lower 32 bits of Hash table.
Kojto 110:165afa46840b 494 This parameter must be a number between Min_Data = 0x0 and Max_Data = 0xFFFFFFFF */
Kojto 110:165afa46840b 495
Kojto 110:165afa46840b 496 uint32_t PauseTime; /*!< This field holds the value to be used in the Pause Time field in the transmit control frame.
Kojto 110:165afa46840b 497 This parameter must be a number between Min_Data = 0x0 and Max_Data = 0xFFFF */
Kojto 110:165afa46840b 498
Kojto 110:165afa46840b 499 uint32_t ZeroQuantaPause; /*!< Selects or not the automatic generation of Zero-Quanta Pause Control frames.
Kojto 110:165afa46840b 500 This parameter can be a value of @ref ETH_Zero_Quanta_Pause */
Kojto 110:165afa46840b 501
Kojto 110:165afa46840b 502 uint32_t PauseLowThreshold; /*!< This field configures the threshold of the PAUSE to be checked for
Kojto 110:165afa46840b 503 automatic retransmission of PAUSE Frame.
Kojto 110:165afa46840b 504 This parameter can be a value of @ref ETH_Pause_Low_Threshold */
Kojto 110:165afa46840b 505
Kojto 110:165afa46840b 506 uint32_t UnicastPauseFrameDetect; /*!< Selects or not the MAC detection of the Pause frames (with MAC Address0
Kojto 110:165afa46840b 507 unicast address and unique multicast address).
Kojto 110:165afa46840b 508 This parameter can be a value of @ref ETH_Unicast_Pause_Frame_Detect */
Kojto 110:165afa46840b 509
Kojto 110:165afa46840b 510 uint32_t ReceiveFlowControl; /*!< Enables or disables the MAC to decode the received Pause frame and
Kojto 110:165afa46840b 511 disable its transmitter for a specified time (Pause Time)
Kojto 110:165afa46840b 512 This parameter can be a value of @ref ETH_Receive_Flow_Control */
Kojto 110:165afa46840b 513
Kojto 110:165afa46840b 514 uint32_t TransmitFlowControl; /*!< Enables or disables the MAC to transmit Pause frames (Full-Duplex mode)
Kojto 110:165afa46840b 515 or the MAC back-pressure operation (Half-Duplex mode)
Kojto 110:165afa46840b 516 This parameter can be a value of @ref ETH_Transmit_Flow_Control */
Kojto 110:165afa46840b 517
Kojto 110:165afa46840b 518 uint32_t VLANTagComparison; /*!< Selects the 12-bit VLAN identifier or the complete 16-bit VLAN tag for
Kojto 110:165afa46840b 519 comparison and filtering.
Kojto 110:165afa46840b 520 This parameter can be a value of @ref ETH_VLAN_Tag_Comparison */
Kojto 110:165afa46840b 521
Kojto 110:165afa46840b 522 uint32_t VLANTagIdentifier; /*!< Holds the VLAN tag identifier for receive frames */
Kojto 110:165afa46840b 523
Kojto 110:165afa46840b 524 } ETH_MACInitTypeDef;
Kojto 110:165afa46840b 525
Kojto 110:165afa46840b 526
Kojto 110:165afa46840b 527 /**
Kojto 110:165afa46840b 528 * @brief ETH DMA Configuration Structure definition
Kojto 110:165afa46840b 529 */
Kojto 110:165afa46840b 530
Kojto 110:165afa46840b 531 typedef struct
Kojto 110:165afa46840b 532 {
Kojto 110:165afa46840b 533 uint32_t DropTCPIPChecksumErrorFrame; /*!< Selects or not the Dropping of TCP/IP Checksum Error Frames.
Kojto 110:165afa46840b 534 This parameter can be a value of @ref ETH_Drop_TCP_IP_Checksum_Error_Frame */
Kojto 110:165afa46840b 535
Kojto 110:165afa46840b 536 uint32_t ReceiveStoreForward; /*!< Enables or disables the Receive store and forward mode.
Kojto 110:165afa46840b 537 This parameter can be a value of @ref ETH_Receive_Store_Forward */
Kojto 110:165afa46840b 538
Kojto 110:165afa46840b 539 uint32_t FlushReceivedFrame; /*!< Enables or disables the flushing of received frames.
Kojto 110:165afa46840b 540 This parameter can be a value of @ref ETH_Flush_Received_Frame */
Kojto 110:165afa46840b 541
Kojto 110:165afa46840b 542 uint32_t TransmitStoreForward; /*!< Enables or disables Transmit store and forward mode.
Kojto 110:165afa46840b 543 This parameter can be a value of @ref ETH_Transmit_Store_Forward */
Kojto 110:165afa46840b 544
Kojto 110:165afa46840b 545 uint32_t TransmitThresholdControl; /*!< Selects or not the Transmit Threshold Control.
Kojto 110:165afa46840b 546 This parameter can be a value of @ref ETH_Transmit_Threshold_Control */
Kojto 110:165afa46840b 547
Kojto 110:165afa46840b 548 uint32_t ForwardErrorFrames; /*!< Selects or not the forward to the DMA of erroneous frames.
Kojto 110:165afa46840b 549 This parameter can be a value of @ref ETH_Forward_Error_Frames */
Kojto 110:165afa46840b 550
Kojto 110:165afa46840b 551 uint32_t ForwardUndersizedGoodFrames; /*!< Enables or disables the Rx FIFO to forward Undersized frames (frames with no Error
Kojto 110:165afa46840b 552 and length less than 64 bytes) including pad-bytes and CRC)
Kojto 110:165afa46840b 553 This parameter can be a value of @ref ETH_Forward_Undersized_Good_Frames */
Kojto 110:165afa46840b 554
Kojto 110:165afa46840b 555 uint32_t ReceiveThresholdControl; /*!< Selects the threshold level of the Receive FIFO.
Kojto 110:165afa46840b 556 This parameter can be a value of @ref ETH_Receive_Threshold_Control */
Kojto 110:165afa46840b 557
Kojto 110:165afa46840b 558 uint32_t SecondFrameOperate; /*!< Selects or not the Operate on second frame mode, which allows the DMA to process a second
Kojto 110:165afa46840b 559 frame of Transmit data even before obtaining the status for the first frame.
Kojto 110:165afa46840b 560 This parameter can be a value of @ref ETH_Second_Frame_Operate */
Kojto 110:165afa46840b 561
Kojto 110:165afa46840b 562 uint32_t AddressAlignedBeats; /*!< Enables or disables the Address Aligned Beats.
Kojto 110:165afa46840b 563 This parameter can be a value of @ref ETH_Address_Aligned_Beats */
Kojto 110:165afa46840b 564
Kojto 110:165afa46840b 565 uint32_t FixedBurst; /*!< Enables or disables the AHB Master interface fixed burst transfers.
Kojto 110:165afa46840b 566 This parameter can be a value of @ref ETH_Fixed_Burst */
Kojto 110:165afa46840b 567
Kojto 110:165afa46840b 568 uint32_t RxDMABurstLength; /*!< Indicates the maximum number of beats to be transferred in one Rx DMA transaction.
Kojto 110:165afa46840b 569 This parameter can be a value of @ref ETH_Rx_DMA_Burst_Length */
Kojto 110:165afa46840b 570
Kojto 110:165afa46840b 571 uint32_t TxDMABurstLength; /*!< Indicates the maximum number of beats to be transferred in one Tx DMA transaction.
Kojto 110:165afa46840b 572 This parameter can be a value of @ref ETH_Tx_DMA_Burst_Length */
Kojto 110:165afa46840b 573
Kojto 110:165afa46840b 574 uint32_t EnhancedDescriptorFormat; /*!< Enables the enhanced descriptor format.
Kojto 110:165afa46840b 575 This parameter can be a value of @ref ETH_DMA_Enhanced_descriptor_format */
Kojto 110:165afa46840b 576
Kojto 110:165afa46840b 577 uint32_t DescriptorSkipLength; /*!< Specifies the number of word to skip between two unchained descriptors (Ring mode)
Kojto 110:165afa46840b 578 This parameter must be a number between Min_Data = 0 and Max_Data = 32 */
Kojto 110:165afa46840b 579
Kojto 110:165afa46840b 580 uint32_t DMAArbitration; /*!< Selects the DMA Tx/Rx arbitration.
Kojto 110:165afa46840b 581 This parameter can be a value of @ref ETH_DMA_Arbitration */
Kojto 110:165afa46840b 582 } ETH_DMAInitTypeDef;
Kojto 110:165afa46840b 583
Kojto 110:165afa46840b 584
Kojto 110:165afa46840b 585 /**
Kojto 110:165afa46840b 586 * @brief ETH DMA Descriptors data structure definition
Kojto 110:165afa46840b 587 */
Kojto 110:165afa46840b 588
Kojto 110:165afa46840b 589 typedef struct
Kojto 110:165afa46840b 590 {
Kojto 110:165afa46840b 591 __IO uint32_t Status; /*!< Status */
Kojto 110:165afa46840b 592
Kojto 110:165afa46840b 593 uint32_t ControlBufferSize; /*!< Control and Buffer1, Buffer2 lengths */
Kojto 110:165afa46840b 594
Kojto 110:165afa46840b 595 uint32_t Buffer1Addr; /*!< Buffer1 address pointer */
Kojto 110:165afa46840b 596
Kojto 110:165afa46840b 597 uint32_t Buffer2NextDescAddr; /*!< Buffer2 or next descriptor address pointer */
Kojto 110:165afa46840b 598
Kojto 110:165afa46840b 599 /*!< Enhanced ETHERNET DMA PTP Descriptors */
Kojto 110:165afa46840b 600 uint32_t ExtendedStatus; /*!< Extended status for PTP receive descriptor */
Kojto 110:165afa46840b 601
Kojto 110:165afa46840b 602 uint32_t Reserved1; /*!< Reserved */
Kojto 110:165afa46840b 603
Kojto 110:165afa46840b 604 uint32_t TimeStampLow; /*!< Time Stamp Low value for transmit and receive */
Kojto 110:165afa46840b 605
Kojto 110:165afa46840b 606 uint32_t TimeStampHigh; /*!< Time Stamp High value for transmit and receive */
Kojto 110:165afa46840b 607
Kojto 110:165afa46840b 608 } ETH_DMADescTypeDef;
Kojto 110:165afa46840b 609
Kojto 110:165afa46840b 610
Kojto 110:165afa46840b 611 /**
Kojto 110:165afa46840b 612 * @brief Received Frame Informations structure definition
Kojto 110:165afa46840b 613 */
Kojto 110:165afa46840b 614 typedef struct
Kojto 110:165afa46840b 615 {
Kojto 110:165afa46840b 616 ETH_DMADescTypeDef *FSRxDesc; /*!< First Segment Rx Desc */
Kojto 110:165afa46840b 617
Kojto 110:165afa46840b 618 ETH_DMADescTypeDef *LSRxDesc; /*!< Last Segment Rx Desc */
Kojto 110:165afa46840b 619
Kojto 110:165afa46840b 620 uint32_t SegCount; /*!< Segment count */
Kojto 110:165afa46840b 621
Kojto 110:165afa46840b 622 uint32_t length; /*!< Frame length */
Kojto 110:165afa46840b 623
Kojto 110:165afa46840b 624 uint32_t buffer; /*!< Frame buffer */
Kojto 110:165afa46840b 625
Kojto 110:165afa46840b 626 } ETH_DMARxFrameInfos;
Kojto 110:165afa46840b 627
Kojto 110:165afa46840b 628
Kojto 110:165afa46840b 629 /**
Kojto 110:165afa46840b 630 * @brief ETH Handle Structure definition
Kojto 110:165afa46840b 631 */
Kojto 110:165afa46840b 632
Kojto 110:165afa46840b 633 typedef struct
Kojto 110:165afa46840b 634 {
Kojto 110:165afa46840b 635 ETH_TypeDef *Instance; /*!< Register base address */
Kojto 110:165afa46840b 636
Kojto 110:165afa46840b 637 ETH_InitTypeDef Init; /*!< Ethernet Init Configuration */
Kojto 110:165afa46840b 638
Kojto 110:165afa46840b 639 uint32_t LinkStatus; /*!< Ethernet link status */
Kojto 110:165afa46840b 640
Kojto 110:165afa46840b 641 ETH_DMADescTypeDef *RxDesc; /*!< Rx descriptor to Get */
Kojto 110:165afa46840b 642
Kojto 110:165afa46840b 643 ETH_DMADescTypeDef *TxDesc; /*!< Tx descriptor to Set */
Kojto 110:165afa46840b 644
Kojto 110:165afa46840b 645 ETH_DMARxFrameInfos RxFrameInfos; /*!< last Rx frame infos */
Kojto 110:165afa46840b 646
Kojto 110:165afa46840b 647 __IO HAL_ETH_StateTypeDef State; /*!< ETH communication state */
Kojto 110:165afa46840b 648
Kojto 110:165afa46840b 649 HAL_LockTypeDef Lock; /*!< ETH Lock */
Kojto 110:165afa46840b 650
Kojto 110:165afa46840b 651 } ETH_HandleTypeDef;
Kojto 110:165afa46840b 652
Kojto 110:165afa46840b 653 /**
Kojto 110:165afa46840b 654 * @}
Kojto 110:165afa46840b 655 */
Kojto 110:165afa46840b 656
Kojto 110:165afa46840b 657 /* Exported constants --------------------------------------------------------*/
Kojto 110:165afa46840b 658 /** @defgroup ETH_Exported_Constants ETH Exported Constants
Kojto 110:165afa46840b 659 * @{
Kojto 110:165afa46840b 660 */
Kojto 110:165afa46840b 661
Kojto 110:165afa46840b 662 /** @defgroup ETH_Buffers_setting ETH Buffers setting
Kojto 110:165afa46840b 663 * @{
Kojto 110:165afa46840b 664 */
Kojto 110:165afa46840b 665 #define ETH_MAX_PACKET_SIZE ((uint32_t)1524) /*!< ETH_HEADER + ETH_EXTRA + ETH_VLAN_TAG + ETH_MAX_ETH_PAYLOAD + ETH_CRC */
Kojto 110:165afa46840b 666 #define ETH_HEADER ((uint32_t)14) /*!< 6 byte Dest addr, 6 byte Src addr, 2 byte length/type */
Kojto 110:165afa46840b 667 #define ETH_CRC ((uint32_t)4) /*!< Ethernet CRC */
Kojto 110:165afa46840b 668 #define ETH_EXTRA ((uint32_t)2) /*!< Extra bytes in some cases */
Kojto 110:165afa46840b 669 #define ETH_VLAN_TAG ((uint32_t)4) /*!< optional 802.1q VLAN Tag */
Kojto 110:165afa46840b 670 #define ETH_MIN_ETH_PAYLOAD ((uint32_t)46) /*!< Minimum Ethernet payload size */
Kojto 110:165afa46840b 671 #define ETH_MAX_ETH_PAYLOAD ((uint32_t)1500) /*!< Maximum Ethernet payload size */
Kojto 110:165afa46840b 672 #define ETH_JUMBO_FRAME_PAYLOAD ((uint32_t)9000) /*!< Jumbo frame payload size */
Kojto 110:165afa46840b 673
Kojto 110:165afa46840b 674 /* Ethernet driver receive buffers are organized in a chained linked-list, when
Kojto 110:165afa46840b 675 an ethernet packet is received, the Rx-DMA will transfer the packet from RxFIFO
Kojto 110:165afa46840b 676 to the driver receive buffers memory.
Kojto 110:165afa46840b 677
Kojto 110:165afa46840b 678 Depending on the size of the received ethernet packet and the size of
Kojto 110:165afa46840b 679 each ethernet driver receive buffer, the received packet can take one or more
Kojto 110:165afa46840b 680 ethernet driver receive buffer.
Kojto 110:165afa46840b 681
Kojto 110:165afa46840b 682 In below are defined the size of one ethernet driver receive buffer ETH_RX_BUF_SIZE
Kojto 110:165afa46840b 683 and the total count of the driver receive buffers ETH_RXBUFNB.
Kojto 110:165afa46840b 684
Kojto 110:165afa46840b 685 The configured value for ETH_RX_BUF_SIZE and ETH_RXBUFNB are only provided as
Kojto 110:165afa46840b 686 example, they can be reconfigured in the application layer to fit the application
Kojto 110:165afa46840b 687 needs */
Kojto 110:165afa46840b 688
Kojto 110:165afa46840b 689 /* Here we configure each Ethernet driver receive buffer to fit the Max size Ethernet
Kojto 110:165afa46840b 690 packet */
Kojto 110:165afa46840b 691 #ifndef ETH_RX_BUF_SIZE
Kojto 110:165afa46840b 692 #define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE
Kojto 110:165afa46840b 693 #endif
Kojto 110:165afa46840b 694
Kojto 110:165afa46840b 695 /* 5 Ethernet driver receive buffers are used (in a chained linked list)*/
Kojto 110:165afa46840b 696 #ifndef ETH_RXBUFNB
Kojto 110:165afa46840b 697 #define ETH_RXBUFNB ((uint32_t)5 /* 5 Rx buffers of size ETH_RX_BUF_SIZE */
Kojto 110:165afa46840b 698 #endif
Kojto 110:165afa46840b 699
Kojto 110:165afa46840b 700
Kojto 110:165afa46840b 701 /* Ethernet driver transmit buffers are organized in a chained linked-list, when
Kojto 110:165afa46840b 702 an ethernet packet is transmitted, Tx-DMA will transfer the packet from the
Kojto 110:165afa46840b 703 driver transmit buffers memory to the TxFIFO.
Kojto 110:165afa46840b 704
Kojto 110:165afa46840b 705 Depending on the size of the Ethernet packet to be transmitted and the size of
Kojto 110:165afa46840b 706 each ethernet driver transmit buffer, the packet to be transmitted can take
Kojto 110:165afa46840b 707 one or more ethernet driver transmit buffer.
Kojto 110:165afa46840b 708
Kojto 110:165afa46840b 709 In below are defined the size of one ethernet driver transmit buffer ETH_TX_BUF_SIZE
Kojto 110:165afa46840b 710 and the total count of the driver transmit buffers ETH_TXBUFNB.
Kojto 110:165afa46840b 711
Kojto 110:165afa46840b 712 The configured value for ETH_TX_BUF_SIZE and ETH_TXBUFNB are only provided as
Kojto 110:165afa46840b 713 example, they can be reconfigured in the application layer to fit the application
Kojto 110:165afa46840b 714 needs */
Kojto 110:165afa46840b 715
Kojto 110:165afa46840b 716 /* Here we configure each Ethernet driver transmit buffer to fit the Max size Ethernet
Kojto 110:165afa46840b 717 packet */
Kojto 110:165afa46840b 718 #ifndef ETH_TX_BUF_SIZE
Kojto 110:165afa46840b 719 #define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE
Kojto 110:165afa46840b 720 #endif
Kojto 110:165afa46840b 721
Kojto 110:165afa46840b 722 /* 5 ethernet driver transmit buffers are used (in a chained linked list)*/
Kojto 110:165afa46840b 723 #ifndef ETH_TXBUFNB
Kojto 110:165afa46840b 724 #define ETH_TXBUFNB ((uint32_t)5 /* 5 Tx buffers of size ETH_TX_BUF_SIZE */
Kojto 110:165afa46840b 725 #endif
Kojto 110:165afa46840b 726
Kojto 110:165afa46840b 727 /**
Kojto 110:165afa46840b 728 * @}
Kojto 110:165afa46840b 729 */
Kojto 110:165afa46840b 730
Kojto 110:165afa46840b 731 /** @defgroup ETH_DMA_TX_Descriptor ETH DMA TX Descriptor
Kojto 110:165afa46840b 732 * @{
Kojto 110:165afa46840b 733 */
Kojto 110:165afa46840b 734
Kojto 110:165afa46840b 735 /*
Kojto 110:165afa46840b 736 DMA Tx Descriptor
Kojto 110:165afa46840b 737 -----------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 738 TDES0 | OWN(31) | CTRL[30:26] | Reserved[25:24] | CTRL[23:20] | Reserved[19:17] | Status[16:0] |
Kojto 110:165afa46840b 739 -----------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 740 TDES1 | Reserved[31:29] | Buffer2 ByteCount[28:16] | Reserved[15:13] | Buffer1 ByteCount[12:0] |
Kojto 110:165afa46840b 741 -----------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 742 TDES2 | Buffer1 Address [31:0] |
Kojto 110:165afa46840b 743 -----------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 744 TDES3 | Buffer2 Address [31:0] / Next Descriptor Address [31:0] |
Kojto 110:165afa46840b 745 -----------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 746 */
Kojto 110:165afa46840b 747
Kojto 110:165afa46840b 748 /**
Kojto 110:165afa46840b 749 * @brief Bit definition of TDES0 register: DMA Tx descriptor status register
Kojto 110:165afa46840b 750 */
Kojto 110:165afa46840b 751 #define ETH_DMATXDESC_OWN ((uint32_t)0x80000000) /*!< OWN bit: descriptor is owned by DMA engine */
Kojto 110:165afa46840b 752 #define ETH_DMATXDESC_IC ((uint32_t)0x40000000) /*!< Interrupt on Completion */
Kojto 110:165afa46840b 753 #define ETH_DMATXDESC_LS ((uint32_t)0x20000000) /*!< Last Segment */
Kojto 110:165afa46840b 754 #define ETH_DMATXDESC_FS ((uint32_t)0x10000000) /*!< First Segment */
Kojto 110:165afa46840b 755 #define ETH_DMATXDESC_DC ((uint32_t)0x08000000) /*!< Disable CRC */
Kojto 110:165afa46840b 756 #define ETH_DMATXDESC_DP ((uint32_t)0x04000000) /*!< Disable Padding */
Kojto 110:165afa46840b 757 #define ETH_DMATXDESC_TTSE ((uint32_t)0x02000000) /*!< Transmit Time Stamp Enable */
Kojto 110:165afa46840b 758 #define ETH_DMATXDESC_CIC ((uint32_t)0x00C00000) /*!< Checksum Insertion Control: 4 cases */
Kojto 110:165afa46840b 759 #define ETH_DMATXDESC_CIC_BYPASS ((uint32_t)0x00000000) /*!< Do Nothing: Checksum Engine is bypassed */
Kojto 110:165afa46840b 760 #define ETH_DMATXDESC_CIC_IPV4HEADER ((uint32_t)0x00400000) /*!< IPV4 header Checksum Insertion */
Kojto 110:165afa46840b 761 #define ETH_DMATXDESC_CIC_TCPUDPICMP_SEGMENT ((uint32_t)0x00800000) /*!< TCP/UDP/ICMP Checksum Insertion calculated over segment only */
Kojto 110:165afa46840b 762 #define ETH_DMATXDESC_CIC_TCPUDPICMP_FULL ((uint32_t)0x00C00000) /*!< TCP/UDP/ICMP Checksum Insertion fully calculated */
Kojto 110:165afa46840b 763 #define ETH_DMATXDESC_TER ((uint32_t)0x00200000) /*!< Transmit End of Ring */
Kojto 110:165afa46840b 764 #define ETH_DMATXDESC_TCH ((uint32_t)0x00100000) /*!< Second Address Chained */
Kojto 110:165afa46840b 765 #define ETH_DMATXDESC_TTSS ((uint32_t)0x00020000) /*!< Tx Time Stamp Status */
Kojto 110:165afa46840b 766 #define ETH_DMATXDESC_IHE ((uint32_t)0x00010000) /*!< IP Header Error */
Kojto 110:165afa46840b 767 #define ETH_DMATXDESC_ES ((uint32_t)0x00008000) /*!< Error summary: OR of the following bits: UE || ED || EC || LCO || NC || LCA || FF || JT */
Kojto 110:165afa46840b 768 #define ETH_DMATXDESC_JT ((uint32_t)0x00004000) /*!< Jabber Timeout */
Kojto 110:165afa46840b 769 #define ETH_DMATXDESC_FF ((uint32_t)0x00002000) /*!< Frame Flushed: DMA/MTL flushed the frame due to SW flush */
Kojto 110:165afa46840b 770 #define ETH_DMATXDESC_PCE ((uint32_t)0x00001000) /*!< Payload Checksum Error */
Kojto 110:165afa46840b 771 #define ETH_DMATXDESC_LCA ((uint32_t)0x00000800) /*!< Loss of Carrier: carrier lost during transmission */
Kojto 110:165afa46840b 772 #define ETH_DMATXDESC_NC ((uint32_t)0x00000400) /*!< No Carrier: no carrier signal from the transceiver */
Kojto 110:165afa46840b 773 #define ETH_DMATXDESC_LCO ((uint32_t)0x00000200) /*!< Late Collision: transmission aborted due to collision */
Kojto 110:165afa46840b 774 #define ETH_DMATXDESC_EC ((uint32_t)0x00000100) /*!< Excessive Collision: transmission aborted after 16 collisions */
Kojto 110:165afa46840b 775 #define ETH_DMATXDESC_VF ((uint32_t)0x00000080) /*!< VLAN Frame */
Kojto 110:165afa46840b 776 #define ETH_DMATXDESC_CC ((uint32_t)0x00000078) /*!< Collision Count */
Kojto 110:165afa46840b 777 #define ETH_DMATXDESC_ED ((uint32_t)0x00000004) /*!< Excessive Deferral */
Kojto 110:165afa46840b 778 #define ETH_DMATXDESC_UF ((uint32_t)0x00000002) /*!< Underflow Error: late data arrival from the memory */
Kojto 110:165afa46840b 779 #define ETH_DMATXDESC_DB ((uint32_t)0x00000001) /*!< Deferred Bit */
Kojto 110:165afa46840b 780
Kojto 110:165afa46840b 781 /**
Kojto 110:165afa46840b 782 * @brief Bit definition of TDES1 register
Kojto 110:165afa46840b 783 */
Kojto 110:165afa46840b 784 #define ETH_DMATXDESC_TBS2 ((uint32_t)0x1FFF0000) /*!< Transmit Buffer2 Size */
Kojto 110:165afa46840b 785 #define ETH_DMATXDESC_TBS1 ((uint32_t)0x00001FFF) /*!< Transmit Buffer1 Size */
Kojto 110:165afa46840b 786
Kojto 110:165afa46840b 787 /**
Kojto 110:165afa46840b 788 * @brief Bit definition of TDES2 register
Kojto 110:165afa46840b 789 */
Kojto 110:165afa46840b 790 #define ETH_DMATXDESC_B1AP ((uint32_t)0xFFFFFFFF) /*!< Buffer1 Address Pointer */
Kojto 110:165afa46840b 791
Kojto 110:165afa46840b 792 /**
Kojto 110:165afa46840b 793 * @brief Bit definition of TDES3 register
Kojto 110:165afa46840b 794 */
Kojto 110:165afa46840b 795 #define ETH_DMATXDESC_B2AP ((uint32_t)0xFFFFFFFF) /*!< Buffer2 Address Pointer */
Kojto 110:165afa46840b 796
Kojto 110:165afa46840b 797 /*---------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 798 TDES6 | Transmit Time Stamp Low [31:0] |
Kojto 110:165afa46840b 799 -----------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 800 TDES7 | Transmit Time Stamp High [31:0] |
Kojto 110:165afa46840b 801 ----------------------------------------------------------------------------------------------*/
Kojto 110:165afa46840b 802
Kojto 110:165afa46840b 803 /* Bit definition of TDES6 register */
Kojto 110:165afa46840b 804 #define ETH_DMAPTPTXDESC_TTSL ((uint32_t)0xFFFFFFFF) /* Transmit Time Stamp Low */
Kojto 110:165afa46840b 805
Kojto 110:165afa46840b 806 /* Bit definition of TDES7 register */
Kojto 110:165afa46840b 807 #define ETH_DMAPTPTXDESC_TTSH ((uint32_t)0xFFFFFFFF) /* Transmit Time Stamp High */
Kojto 110:165afa46840b 808
Kojto 110:165afa46840b 809 /**
Kojto 110:165afa46840b 810 * @}
Kojto 110:165afa46840b 811 */
Kojto 110:165afa46840b 812 /** @defgroup ETH_DMA_RX_Descriptor ETH DMA RX Descriptor
Kojto 110:165afa46840b 813 * @{
Kojto 110:165afa46840b 814 */
Kojto 110:165afa46840b 815
Kojto 110:165afa46840b 816 /*
Kojto 110:165afa46840b 817 DMA Rx Descriptor
Kojto 110:165afa46840b 818 --------------------------------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 819 RDES0 | OWN(31) | Status [30:0] |
Kojto 110:165afa46840b 820 ---------------------------------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 821 RDES1 | CTRL(31) | Reserved[30:29] | Buffer2 ByteCount[28:16] | CTRL[15:14] | Reserved(13) | Buffer1 ByteCount[12:0] |
Kojto 110:165afa46840b 822 ---------------------------------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 823 RDES2 | Buffer1 Address [31:0] |
Kojto 110:165afa46840b 824 ---------------------------------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 825 RDES3 | Buffer2 Address [31:0] / Next Descriptor Address [31:0] |
Kojto 110:165afa46840b 826 ---------------------------------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 827 */
Kojto 110:165afa46840b 828
Kojto 110:165afa46840b 829 /**
Kojto 110:165afa46840b 830 * @brief Bit definition of RDES0 register: DMA Rx descriptor status register
Kojto 110:165afa46840b 831 */
Kojto 110:165afa46840b 832 #define ETH_DMARXDESC_OWN ((uint32_t)0x80000000) /*!< OWN bit: descriptor is owned by DMA engine */
Kojto 110:165afa46840b 833 #define ETH_DMARXDESC_AFM ((uint32_t)0x40000000) /*!< DA Filter Fail for the rx frame */
Kojto 110:165afa46840b 834 #define ETH_DMARXDESC_FL ((uint32_t)0x3FFF0000) /*!< Receive descriptor frame length */
Kojto 110:165afa46840b 835 #define ETH_DMARXDESC_ES ((uint32_t)0x00008000) /*!< Error summary: OR of the following bits: DE || OE || IPC || LC || RWT || RE || CE */
Kojto 110:165afa46840b 836 #define ETH_DMARXDESC_DE ((uint32_t)0x00004000) /*!< Descriptor error: no more descriptors for receive frame */
Kojto 110:165afa46840b 837 #define ETH_DMARXDESC_SAF ((uint32_t)0x00002000) /*!< SA Filter Fail for the received frame */
Kojto 110:165afa46840b 838 #define ETH_DMARXDESC_LE ((uint32_t)0x00001000) /*!< Frame size not matching with length field */
Kojto 110:165afa46840b 839 #define ETH_DMARXDESC_OE ((uint32_t)0x00000800) /*!< Overflow Error: Frame was damaged due to buffer overflow */
Kojto 110:165afa46840b 840 #define ETH_DMARXDESC_VLAN ((uint32_t)0x00000400) /*!< VLAN Tag: received frame is a VLAN frame */
Kojto 110:165afa46840b 841 #define ETH_DMARXDESC_FS ((uint32_t)0x00000200) /*!< First descriptor of the frame */
Kojto 110:165afa46840b 842 #define ETH_DMARXDESC_LS ((uint32_t)0x00000100) /*!< Last descriptor of the frame */
Kojto 110:165afa46840b 843 #define ETH_DMARXDESC_IPV4HCE ((uint32_t)0x00000080) /*!< IPC Checksum Error: Rx Ipv4 header checksum error */
Kojto 110:165afa46840b 844 #define ETH_DMARXDESC_LC ((uint32_t)0x00000040) /*!< Late collision occurred during reception */
Kojto 110:165afa46840b 845 #define ETH_DMARXDESC_FT ((uint32_t)0x00000020) /*!< Frame type - Ethernet, otherwise 802.3 */
Kojto 110:165afa46840b 846 #define ETH_DMARXDESC_RWT ((uint32_t)0x00000010) /*!< Receive Watchdog Timeout: watchdog timer expired during reception */
Kojto 110:165afa46840b 847 #define ETH_DMARXDESC_RE ((uint32_t)0x00000008) /*!< Receive error: error reported by MII interface */
Kojto 110:165afa46840b 848 #define ETH_DMARXDESC_DBE ((uint32_t)0x00000004) /*!< Dribble bit error: frame contains non int multiple of 8 bits */
Kojto 110:165afa46840b 849 #define ETH_DMARXDESC_CE ((uint32_t)0x00000002) /*!< CRC error */
Kojto 110:165afa46840b 850 #define ETH_DMARXDESC_MAMPCE ((uint32_t)0x00000001) /*!< Rx MAC Address/Payload Checksum Error: Rx MAC address matched/ Rx Payload Checksum Error */
Kojto 110:165afa46840b 851
Kojto 110:165afa46840b 852 /**
Kojto 110:165afa46840b 853 * @brief Bit definition of RDES1 register
Kojto 110:165afa46840b 854 */
Kojto 110:165afa46840b 855 #define ETH_DMARXDESC_DIC ((uint32_t)0x80000000) /*!< Disable Interrupt on Completion */
Kojto 110:165afa46840b 856 #define ETH_DMARXDESC_RBS2 ((uint32_t)0x1FFF0000) /*!< Receive Buffer2 Size */
Kojto 110:165afa46840b 857 #define ETH_DMARXDESC_RER ((uint32_t)0x00008000) /*!< Receive End of Ring */
Kojto 110:165afa46840b 858 #define ETH_DMARXDESC_RCH ((uint32_t)0x00004000) /*!< Second Address Chained */
Kojto 110:165afa46840b 859 #define ETH_DMARXDESC_RBS1 ((uint32_t)0x00001FFF) /*!< Receive Buffer1 Size */
Kojto 110:165afa46840b 860
Kojto 110:165afa46840b 861 /**
Kojto 110:165afa46840b 862 * @brief Bit definition of RDES2 register
Kojto 110:165afa46840b 863 */
Kojto 110:165afa46840b 864 #define ETH_DMARXDESC_B1AP ((uint32_t)0xFFFFFFFF) /*!< Buffer1 Address Pointer */
Kojto 110:165afa46840b 865
Kojto 110:165afa46840b 866 /**
Kojto 110:165afa46840b 867 * @brief Bit definition of RDES3 register
Kojto 110:165afa46840b 868 */
Kojto 110:165afa46840b 869 #define ETH_DMARXDESC_B2AP ((uint32_t)0xFFFFFFFF) /*!< Buffer2 Address Pointer */
Kojto 110:165afa46840b 870
Kojto 110:165afa46840b 871 /*---------------------------------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 872 RDES4 | Reserved[31:15] | Extended Status [14:0] |
Kojto 110:165afa46840b 873 ---------------------------------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 874 RDES5 | Reserved[31:0] |
Kojto 110:165afa46840b 875 ---------------------------------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 876 RDES6 | Receive Time Stamp Low [31:0] |
Kojto 110:165afa46840b 877 ---------------------------------------------------------------------------------------------------------------------
Kojto 110:165afa46840b 878 RDES7 | Receive Time Stamp High [31:0] |
Kojto 110:165afa46840b 879 --------------------------------------------------------------------------------------------------------------------*/
Kojto 110:165afa46840b 880
Kojto 110:165afa46840b 881 /* Bit definition of RDES4 register */
Kojto 110:165afa46840b 882 #define ETH_DMAPTPRXDESC_PTPV ((uint32_t)0x00002000) /* PTP Version */
Kojto 110:165afa46840b 883 #define ETH_DMAPTPRXDESC_PTPFT ((uint32_t)0x00001000) /* PTP Frame Type */
Kojto 110:165afa46840b 884 #define ETH_DMAPTPRXDESC_PTPMT ((uint32_t)0x00000F00) /* PTP Message Type */
Kojto 110:165afa46840b 885 #define ETH_DMAPTPRXDESC_PTPMT_SYNC ((uint32_t)0x00000100) /* SYNC message (all clock types) */
Kojto 110:165afa46840b 886 #define ETH_DMAPTPRXDESC_PTPMT_FOLLOWUP ((uint32_t)0x00000200) /* FollowUp message (all clock types) */
Kojto 110:165afa46840b 887 #define ETH_DMAPTPRXDESC_PTPMT_DELAYREQ ((uint32_t)0x00000300) /* DelayReq message (all clock types) */
Kojto 110:165afa46840b 888 #define ETH_DMAPTPRXDESC_PTPMT_DELAYRESP ((uint32_t)0x00000400) /* DelayResp message (all clock types) */
Kojto 110:165afa46840b 889 #define ETH_DMAPTPRXDESC_PTPMT_PDELAYREQ_ANNOUNCE ((uint32_t)0x00000500) /* PdelayReq message (peer-to-peer transparent clock) or Announce message (Ordinary or Boundary clock) */
Kojto 110:165afa46840b 890 #define ETH_DMAPTPRXDESC_PTPMT_PDELAYRESP_MANAG ((uint32_t)0x00000600) /* PdelayResp message (peer-to-peer transparent clock) or Management message (Ordinary or Boundary clock) */
Kojto 110:165afa46840b 891 #define ETH_DMAPTPRXDESC_PTPMT_PDELAYRESPFOLLOWUP_SIGNAL ((uint32_t)0x00000700) /* PdelayRespFollowUp message (peer-to-peer transparent clock) or Signaling message (Ordinary or Boundary clock) */
Kojto 110:165afa46840b 892 #define ETH_DMAPTPRXDESC_IPV6PR ((uint32_t)0x00000080) /* IPv6 Packet Received */
Kojto 110:165afa46840b 893 #define ETH_DMAPTPRXDESC_IPV4PR ((uint32_t)0x00000040) /* IPv4 Packet Received */
Kojto 110:165afa46840b 894 #define ETH_DMAPTPRXDESC_IPCB ((uint32_t)0x00000020) /* IP Checksum Bypassed */
Kojto 110:165afa46840b 895 #define ETH_DMAPTPRXDESC_IPPE ((uint32_t)0x00000010) /* IP Payload Error */
Kojto 110:165afa46840b 896 #define ETH_DMAPTPRXDESC_IPHE ((uint32_t)0x00000008) /* IP Header Error */
Kojto 110:165afa46840b 897 #define ETH_DMAPTPRXDESC_IPPT ((uint32_t)0x00000007) /* IP Payload Type */
Kojto 110:165afa46840b 898 #define ETH_DMAPTPRXDESC_IPPT_UDP ((uint32_t)0x00000001) /* UDP payload encapsulated in the IP datagram */
Kojto 110:165afa46840b 899 #define ETH_DMAPTPRXDESC_IPPT_TCP ((uint32_t)0x00000002) /* TCP payload encapsulated in the IP datagram */
Kojto 110:165afa46840b 900 #define ETH_DMAPTPRXDESC_IPPT_ICMP ((uint32_t)0x00000003) /* ICMP payload encapsulated in the IP datagram */
Kojto 110:165afa46840b 901
Kojto 110:165afa46840b 902 /* Bit definition of RDES6 register */
Kojto 110:165afa46840b 903 #define ETH_DMAPTPRXDESC_RTSL ((uint32_t)0xFFFFFFFF) /* Receive Time Stamp Low */
Kojto 110:165afa46840b 904
Kojto 110:165afa46840b 905 /* Bit definition of RDES7 register */
Kojto 110:165afa46840b 906 #define ETH_DMAPTPRXDESC_RTSH ((uint32_t)0xFFFFFFFF) /* Receive Time Stamp High */
Kojto 110:165afa46840b 907 /**
Kojto 110:165afa46840b 908 * @}
Kojto 110:165afa46840b 909 */
Kojto 110:165afa46840b 910 /** @defgroup ETH_AutoNegotiation ETH AutoNegotiation
Kojto 110:165afa46840b 911 * @{
Kojto 110:165afa46840b 912 */
Kojto 110:165afa46840b 913 #define ETH_AUTONEGOTIATION_ENABLE ((uint32_t)0x00000001)
Kojto 110:165afa46840b 914 #define ETH_AUTONEGOTIATION_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 915
Kojto 110:165afa46840b 916 /**
Kojto 110:165afa46840b 917 * @}
Kojto 110:165afa46840b 918 */
Kojto 110:165afa46840b 919 /** @defgroup ETH_Speed ETH Speed
Kojto 110:165afa46840b 920 * @{
Kojto 110:165afa46840b 921 */
Kojto 110:165afa46840b 922 #define ETH_SPEED_10M ((uint32_t)0x00000000)
Kojto 110:165afa46840b 923 #define ETH_SPEED_100M ((uint32_t)0x00004000)
Kojto 110:165afa46840b 924
Kojto 110:165afa46840b 925 /**
Kojto 110:165afa46840b 926 * @}
Kojto 110:165afa46840b 927 */
Kojto 110:165afa46840b 928 /** @defgroup ETH_Duplex_Mode ETH Duplex Mode
Kojto 110:165afa46840b 929 * @{
Kojto 110:165afa46840b 930 */
Kojto 110:165afa46840b 931 #define ETH_MODE_FULLDUPLEX ((uint32_t)0x00000800)
Kojto 110:165afa46840b 932 #define ETH_MODE_HALFDUPLEX ((uint32_t)0x00000000)
Kojto 110:165afa46840b 933 /**
Kojto 110:165afa46840b 934 * @}
Kojto 110:165afa46840b 935 */
Kojto 110:165afa46840b 936 /** @defgroup ETH_Rx_Mode ETH Rx Mode
Kojto 110:165afa46840b 937 * @{
Kojto 110:165afa46840b 938 */
Kojto 110:165afa46840b 939 #define ETH_RXPOLLING_MODE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 940 #define ETH_RXINTERRUPT_MODE ((uint32_t)0x00000001)
Kojto 110:165afa46840b 941 /**
Kojto 110:165afa46840b 942 * @}
Kojto 110:165afa46840b 943 */
Kojto 110:165afa46840b 944
Kojto 110:165afa46840b 945 /** @defgroup ETH_Checksum_Mode ETH Checksum Mode
Kojto 110:165afa46840b 946 * @{
Kojto 110:165afa46840b 947 */
Kojto 110:165afa46840b 948 #define ETH_CHECKSUM_BY_HARDWARE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 949 #define ETH_CHECKSUM_BY_SOFTWARE ((uint32_t)0x00000001)
Kojto 110:165afa46840b 950 /**
Kojto 110:165afa46840b 951 * @}
Kojto 110:165afa46840b 952 */
Kojto 110:165afa46840b 953
Kojto 110:165afa46840b 954 /** @defgroup ETH_Media_Interface ETH Media Interface
Kojto 110:165afa46840b 955 * @{
Kojto 110:165afa46840b 956 */
Kojto 110:165afa46840b 957 #define ETH_MEDIA_INTERFACE_MII ((uint32_t)0x00000000)
Kojto 110:165afa46840b 958 #define ETH_MEDIA_INTERFACE_RMII ((uint32_t)SYSCFG_PMC_MII_RMII_SEL)
Kojto 110:165afa46840b 959 /**
Kojto 110:165afa46840b 960 * @}
Kojto 110:165afa46840b 961 */
Kojto 110:165afa46840b 962
Kojto 110:165afa46840b 963 /** @defgroup ETH_Watchdog ETH Watchdog
Kojto 110:165afa46840b 964 * @{
Kojto 110:165afa46840b 965 */
Kojto 110:165afa46840b 966 #define ETH_WATCHDOG_ENABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 967 #define ETH_WATCHDOG_DISABLE ((uint32_t)0x00800000)
Kojto 110:165afa46840b 968 /**
Kojto 110:165afa46840b 969 * @}
Kojto 110:165afa46840b 970 */
Kojto 110:165afa46840b 971
Kojto 110:165afa46840b 972 /** @defgroup ETH_Jabber ETH Jabber
Kojto 110:165afa46840b 973 * @{
Kojto 110:165afa46840b 974 */
Kojto 110:165afa46840b 975 #define ETH_JABBER_ENABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 976 #define ETH_JABBER_DISABLE ((uint32_t)0x00400000)
Kojto 110:165afa46840b 977 /**
Kojto 110:165afa46840b 978 * @}
Kojto 110:165afa46840b 979 */
Kojto 110:165afa46840b 980
Kojto 110:165afa46840b 981 /** @defgroup ETH_Inter_Frame_Gap ETH Inter Frame Gap
Kojto 110:165afa46840b 982 * @{
Kojto 110:165afa46840b 983 */
Kojto 110:165afa46840b 984 #define ETH_INTERFRAMEGAP_96BIT ((uint32_t)0x00000000) /*!< minimum IFG between frames during transmission is 96Bit */
Kojto 110:165afa46840b 985 #define ETH_INTERFRAMEGAP_88BIT ((uint32_t)0x00020000) /*!< minimum IFG between frames during transmission is 88Bit */
Kojto 110:165afa46840b 986 #define ETH_INTERFRAMEGAP_80BIT ((uint32_t)0x00040000) /*!< minimum IFG between frames during transmission is 80Bit */
Kojto 110:165afa46840b 987 #define ETH_INTERFRAMEGAP_72BIT ((uint32_t)0x00060000) /*!< minimum IFG between frames during transmission is 72Bit */
Kojto 110:165afa46840b 988 #define ETH_INTERFRAMEGAP_64BIT ((uint32_t)0x00080000) /*!< minimum IFG between frames during transmission is 64Bit */
Kojto 110:165afa46840b 989 #define ETH_INTERFRAMEGAP_56BIT ((uint32_t)0x000A0000) /*!< minimum IFG between frames during transmission is 56Bit */
Kojto 110:165afa46840b 990 #define ETH_INTERFRAMEGAP_48BIT ((uint32_t)0x000C0000) /*!< minimum IFG between frames during transmission is 48Bit */
Kojto 110:165afa46840b 991 #define ETH_INTERFRAMEGAP_40BIT ((uint32_t)0x000E0000) /*!< minimum IFG between frames during transmission is 40Bit */
Kojto 110:165afa46840b 992 /**
Kojto 110:165afa46840b 993 * @}
Kojto 110:165afa46840b 994 */
Kojto 110:165afa46840b 995
Kojto 110:165afa46840b 996 /** @defgroup ETH_Carrier_Sense ETH Carrier Sense
Kojto 110:165afa46840b 997 * @{
Kojto 110:165afa46840b 998 */
Kojto 110:165afa46840b 999 #define ETH_CARRIERSENCE_ENABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1000 #define ETH_CARRIERSENCE_DISABLE ((uint32_t)0x00010000)
Kojto 110:165afa46840b 1001 /**
Kojto 110:165afa46840b 1002 * @}
Kojto 110:165afa46840b 1003 */
Kojto 110:165afa46840b 1004
Kojto 110:165afa46840b 1005 /** @defgroup ETH_Receive_Own ETH Receive Own
Kojto 110:165afa46840b 1006 * @{
Kojto 110:165afa46840b 1007 */
Kojto 110:165afa46840b 1008 #define ETH_RECEIVEOWN_ENABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1009 #define ETH_RECEIVEOWN_DISABLE ((uint32_t)0x00002000)
Kojto 110:165afa46840b 1010 /**
Kojto 110:165afa46840b 1011 * @}
Kojto 110:165afa46840b 1012 */
Kojto 110:165afa46840b 1013
Kojto 110:165afa46840b 1014 /** @defgroup ETH_Loop_Back_Mode ETH Loop Back Mode
Kojto 110:165afa46840b 1015 * @{
Kojto 110:165afa46840b 1016 */
Kojto 110:165afa46840b 1017 #define ETH_LOOPBACKMODE_ENABLE ((uint32_t)0x00001000)
Kojto 110:165afa46840b 1018 #define ETH_LOOPBACKMODE_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1019 /**
Kojto 110:165afa46840b 1020 * @}
Kojto 110:165afa46840b 1021 */
Kojto 110:165afa46840b 1022
Kojto 110:165afa46840b 1023 /** @defgroup ETH_Checksum_Offload ETH Checksum Offload
Kojto 110:165afa46840b 1024 * @{
Kojto 110:165afa46840b 1025 */
Kojto 110:165afa46840b 1026 #define ETH_CHECKSUMOFFLAOD_ENABLE ((uint32_t)0x00000400)
Kojto 110:165afa46840b 1027 #define ETH_CHECKSUMOFFLAOD_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1028 /**
Kojto 110:165afa46840b 1029 * @}
Kojto 110:165afa46840b 1030 */
Kojto 110:165afa46840b 1031
Kojto 110:165afa46840b 1032 /** @defgroup ETH_Retry_Transmission ETH Retry Transmission
Kojto 110:165afa46840b 1033 * @{
Kojto 110:165afa46840b 1034 */
Kojto 110:165afa46840b 1035 #define ETH_RETRYTRANSMISSION_ENABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1036 #define ETH_RETRYTRANSMISSION_DISABLE ((uint32_t)0x00000200)
Kojto 110:165afa46840b 1037 /**
Kojto 110:165afa46840b 1038 * @}
Kojto 110:165afa46840b 1039 */
Kojto 110:165afa46840b 1040
Kojto 110:165afa46840b 1041 /** @defgroup ETH_Automatic_Pad_CRC_Strip ETH Automatic Pad CRC Strip
Kojto 110:165afa46840b 1042 * @{
Kojto 110:165afa46840b 1043 */
Kojto 110:165afa46840b 1044 #define ETH_AUTOMATICPADCRCSTRIP_ENABLE ((uint32_t)0x00000080)
Kojto 110:165afa46840b 1045 #define ETH_AUTOMATICPADCRCSTRIP_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1046 /**
Kojto 110:165afa46840b 1047 * @}
Kojto 110:165afa46840b 1048 */
Kojto 110:165afa46840b 1049
Kojto 110:165afa46840b 1050 /** @defgroup ETH_Back_Off_Limit ETH Back Off Limit
Kojto 110:165afa46840b 1051 * @{
Kojto 110:165afa46840b 1052 */
Kojto 110:165afa46840b 1053 #define ETH_BACKOFFLIMIT_10 ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1054 #define ETH_BACKOFFLIMIT_8 ((uint32_t)0x00000020)
Kojto 110:165afa46840b 1055 #define ETH_BACKOFFLIMIT_4 ((uint32_t)0x00000040)
Kojto 110:165afa46840b 1056 #define ETH_BACKOFFLIMIT_1 ((uint32_t)0x00000060)
Kojto 110:165afa46840b 1057 /**
Kojto 110:165afa46840b 1058 * @}
Kojto 110:165afa46840b 1059 */
Kojto 110:165afa46840b 1060
Kojto 110:165afa46840b 1061 /** @defgroup ETH_Deferral_Check ETH Deferral Check
Kojto 110:165afa46840b 1062 * @{
Kojto 110:165afa46840b 1063 */
Kojto 110:165afa46840b 1064 #define ETH_DEFFERRALCHECK_ENABLE ((uint32_t)0x00000010)
Kojto 110:165afa46840b 1065 #define ETH_DEFFERRALCHECK_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1066 /**
Kojto 110:165afa46840b 1067 * @}
Kojto 110:165afa46840b 1068 */
Kojto 110:165afa46840b 1069
Kojto 110:165afa46840b 1070 /** @defgroup ETH_Receive_All ETH Receive All
Kojto 110:165afa46840b 1071 * @{
Kojto 110:165afa46840b 1072 */
Kojto 110:165afa46840b 1073 #define ETH_RECEIVEALL_ENABLE ((uint32_t)0x80000000)
Kojto 110:165afa46840b 1074 #define ETH_RECEIVEAll_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1075 /**
Kojto 110:165afa46840b 1076 * @}
Kojto 110:165afa46840b 1077 */
Kojto 110:165afa46840b 1078
Kojto 110:165afa46840b 1079 /** @defgroup ETH_Source_Addr_Filter ETH Source Addr Filter
Kojto 110:165afa46840b 1080 * @{
Kojto 110:165afa46840b 1081 */
Kojto 110:165afa46840b 1082 #define ETH_SOURCEADDRFILTER_NORMAL_ENABLE ((uint32_t)0x00000200)
Kojto 110:165afa46840b 1083 #define ETH_SOURCEADDRFILTER_INVERSE_ENABLE ((uint32_t)0x00000300)
Kojto 110:165afa46840b 1084 #define ETH_SOURCEADDRFILTER_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1085 /**
Kojto 110:165afa46840b 1086 * @}
Kojto 110:165afa46840b 1087 */
Kojto 110:165afa46840b 1088
Kojto 110:165afa46840b 1089 /** @defgroup ETH_Pass_Control_Frames ETH Pass Control Frames
Kojto 110:165afa46840b 1090 * @{
Kojto 110:165afa46840b 1091 */
Kojto 110:165afa46840b 1092 #define ETH_PASSCONTROLFRAMES_BLOCKALL ((uint32_t)0x00000040) /*!< MAC filters all control frames from reaching the application */
Kojto 110:165afa46840b 1093 #define ETH_PASSCONTROLFRAMES_FORWARDALL ((uint32_t)0x00000080) /*!< MAC forwards all control frames to application even if they fail the Address Filter */
Kojto 110:165afa46840b 1094 #define ETH_PASSCONTROLFRAMES_FORWARDPASSEDADDRFILTER ((uint32_t)0x000000C0) /*!< MAC forwards control frames that pass the Address Filter. */
Kojto 110:165afa46840b 1095 /**
Kojto 110:165afa46840b 1096 * @}
Kojto 110:165afa46840b 1097 */
Kojto 110:165afa46840b 1098
Kojto 110:165afa46840b 1099 /** @defgroup ETH_Broadcast_Frames_Reception ETH Broadcast Frames Reception
Kojto 110:165afa46840b 1100 * @{
Kojto 110:165afa46840b 1101 */
Kojto 110:165afa46840b 1102 #define ETH_BROADCASTFRAMESRECEPTION_ENABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1103 #define ETH_BROADCASTFRAMESRECEPTION_DISABLE ((uint32_t)0x00000020)
Kojto 110:165afa46840b 1104 /**
Kojto 110:165afa46840b 1105 * @}
Kojto 110:165afa46840b 1106 */
Kojto 110:165afa46840b 1107
Kojto 110:165afa46840b 1108 /** @defgroup ETH_Destination_Addr_Filter ETH Destination Addr Filter
Kojto 110:165afa46840b 1109 * @{
Kojto 110:165afa46840b 1110 */
Kojto 110:165afa46840b 1111 #define ETH_DESTINATIONADDRFILTER_NORMAL ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1112 #define ETH_DESTINATIONADDRFILTER_INVERSE ((uint32_t)0x00000008)
Kojto 110:165afa46840b 1113 /**
Kojto 110:165afa46840b 1114 * @}
Kojto 110:165afa46840b 1115 */
Kojto 110:165afa46840b 1116
Kojto 110:165afa46840b 1117 /** @defgroup ETH_Promiscuous_Mode ETH Promiscuous Mode
Kojto 110:165afa46840b 1118 * @{
Kojto 110:165afa46840b 1119 */
Kojto 110:165afa46840b 1120 #define ETH_PROMISCUOUS_MODE_ENABLE ((uint32_t)0x00000001)
Kojto 110:165afa46840b 1121 #define ETH_PROMISCUOUS_MODE_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1122 /**
Kojto 110:165afa46840b 1123 * @}
Kojto 110:165afa46840b 1124 */
Kojto 110:165afa46840b 1125
Kojto 110:165afa46840b 1126 /** @defgroup ETH_Multicast_Frames_Filter ETH Multicast Frames Filter
Kojto 110:165afa46840b 1127 * @{
Kojto 110:165afa46840b 1128 */
Kojto 110:165afa46840b 1129 #define ETH_MULTICASTFRAMESFILTER_PERFECTHASHTABLE ((uint32_t)0x00000404)
Kojto 110:165afa46840b 1130 #define ETH_MULTICASTFRAMESFILTER_HASHTABLE ((uint32_t)0x00000004)
Kojto 110:165afa46840b 1131 #define ETH_MULTICASTFRAMESFILTER_PERFECT ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1132 #define ETH_MULTICASTFRAMESFILTER_NONE ((uint32_t)0x00000010)
Kojto 110:165afa46840b 1133 /**
Kojto 110:165afa46840b 1134 * @}
Kojto 110:165afa46840b 1135 */
Kojto 110:165afa46840b 1136
Kojto 110:165afa46840b 1137 /** @defgroup ETH_Unicast_Frames_Filter ETH Unicast Frames Filter
Kojto 110:165afa46840b 1138 * @{
Kojto 110:165afa46840b 1139 */
Kojto 110:165afa46840b 1140 #define ETH_UNICASTFRAMESFILTER_PERFECTHASHTABLE ((uint32_t)0x00000402)
Kojto 110:165afa46840b 1141 #define ETH_UNICASTFRAMESFILTER_HASHTABLE ((uint32_t)0x00000002)
Kojto 110:165afa46840b 1142 #define ETH_UNICASTFRAMESFILTER_PERFECT ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1143 /**
Kojto 110:165afa46840b 1144 * @}
Kojto 110:165afa46840b 1145 */
Kojto 110:165afa46840b 1146
Kojto 110:165afa46840b 1147 /** @defgroup ETH_Zero_Quanta_Pause ETH Zero Quanta Pause
Kojto 110:165afa46840b 1148 * @{
Kojto 110:165afa46840b 1149 */
Kojto 110:165afa46840b 1150 #define ETH_ZEROQUANTAPAUSE_ENABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1151 #define ETH_ZEROQUANTAPAUSE_DISABLE ((uint32_t)0x00000080)
Kojto 110:165afa46840b 1152 /**
Kojto 110:165afa46840b 1153 * @}
Kojto 110:165afa46840b 1154 */
Kojto 110:165afa46840b 1155
Kojto 110:165afa46840b 1156 /** @defgroup ETH_Pause_Low_Threshold ETH Pause Low Threshold
Kojto 110:165afa46840b 1157 * @{
Kojto 110:165afa46840b 1158 */
Kojto 110:165afa46840b 1159 #define ETH_PAUSELOWTHRESHOLD_MINUS4 ((uint32_t)0x00000000) /*!< Pause time minus 4 slot times */
Kojto 110:165afa46840b 1160 #define ETH_PAUSELOWTHRESHOLD_MINUS28 ((uint32_t)0x00000010) /*!< Pause time minus 28 slot times */
Kojto 110:165afa46840b 1161 #define ETH_PAUSELOWTHRESHOLD_MINUS144 ((uint32_t)0x00000020) /*!< Pause time minus 144 slot times */
Kojto 110:165afa46840b 1162 #define ETH_PAUSELOWTHRESHOLD_MINUS256 ((uint32_t)0x00000030) /*!< Pause time minus 256 slot times */
Kojto 110:165afa46840b 1163 /**
Kojto 110:165afa46840b 1164 * @}
Kojto 110:165afa46840b 1165 */
Kojto 110:165afa46840b 1166
Kojto 110:165afa46840b 1167 /** @defgroup ETH_Unicast_Pause_Frame_Detect ETH Unicast Pause Frame Detect
Kojto 110:165afa46840b 1168 * @{
Kojto 110:165afa46840b 1169 */
Kojto 110:165afa46840b 1170 #define ETH_UNICASTPAUSEFRAMEDETECT_ENABLE ((uint32_t)0x00000008)
Kojto 110:165afa46840b 1171 #define ETH_UNICASTPAUSEFRAMEDETECT_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1172 /**
Kojto 110:165afa46840b 1173 * @}
Kojto 110:165afa46840b 1174 */
Kojto 110:165afa46840b 1175
Kojto 110:165afa46840b 1176 /** @defgroup ETH_Receive_Flow_Control ETH Receive Flow Control
Kojto 110:165afa46840b 1177 * @{
Kojto 110:165afa46840b 1178 */
Kojto 110:165afa46840b 1179 #define ETH_RECEIVEFLOWCONTROL_ENABLE ((uint32_t)0x00000004)
Kojto 110:165afa46840b 1180 #define ETH_RECEIVEFLOWCONTROL_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1181 /**
Kojto 110:165afa46840b 1182 * @}
Kojto 110:165afa46840b 1183 */
Kojto 110:165afa46840b 1184
Kojto 110:165afa46840b 1185 /** @defgroup ETH_Transmit_Flow_Control ETH Transmit Flow Control
Kojto 110:165afa46840b 1186 * @{
Kojto 110:165afa46840b 1187 */
Kojto 110:165afa46840b 1188 #define ETH_TRANSMITFLOWCONTROL_ENABLE ((uint32_t)0x00000002)
Kojto 110:165afa46840b 1189 #define ETH_TRANSMITFLOWCONTROL_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1190 /**
Kojto 110:165afa46840b 1191 * @}
Kojto 110:165afa46840b 1192 */
Kojto 110:165afa46840b 1193
Kojto 110:165afa46840b 1194 /** @defgroup ETH_VLAN_Tag_Comparison ETH VLAN Tag Comparison
Kojto 110:165afa46840b 1195 * @{
Kojto 110:165afa46840b 1196 */
Kojto 110:165afa46840b 1197 #define ETH_VLANTAGCOMPARISON_12BIT ((uint32_t)0x00010000)
Kojto 110:165afa46840b 1198 #define ETH_VLANTAGCOMPARISON_16BIT ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1199 /**
Kojto 110:165afa46840b 1200 * @}
Kojto 110:165afa46840b 1201 */
Kojto 110:165afa46840b 1202
Kojto 110:165afa46840b 1203 /** @defgroup ETH_MAC_addresses ETH MAC addresses
Kojto 110:165afa46840b 1204 * @{
Kojto 110:165afa46840b 1205 */
Kojto 110:165afa46840b 1206 #define ETH_MAC_ADDRESS0 ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1207 #define ETH_MAC_ADDRESS1 ((uint32_t)0x00000008)
Kojto 110:165afa46840b 1208 #define ETH_MAC_ADDRESS2 ((uint32_t)0x00000010)
Kojto 110:165afa46840b 1209 #define ETH_MAC_ADDRESS3 ((uint32_t)0x00000018)
Kojto 110:165afa46840b 1210 /**
Kojto 110:165afa46840b 1211 * @}
Kojto 110:165afa46840b 1212 */
Kojto 110:165afa46840b 1213
Kojto 110:165afa46840b 1214 /** @defgroup ETH_MAC_addresses_filter_SA_DA ETH MAC addresses filter SA DA
Kojto 110:165afa46840b 1215 * @{
Kojto 110:165afa46840b 1216 */
Kojto 110:165afa46840b 1217 #define ETH_MAC_ADDRESSFILTER_SA ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1218 #define ETH_MAC_ADDRESSFILTER_DA ((uint32_t)0x00000008)
Kojto 110:165afa46840b 1219 /**
Kojto 110:165afa46840b 1220 * @}
Kojto 110:165afa46840b 1221 */
Kojto 110:165afa46840b 1222
Kojto 110:165afa46840b 1223 /** @defgroup ETH_MAC_addresses_filter_Mask_bytes ETH MAC addresses filter Mask bytes
Kojto 110:165afa46840b 1224 * @{
Kojto 110:165afa46840b 1225 */
Kojto 110:165afa46840b 1226 #define ETH_MAC_ADDRESSMASK_BYTE6 ((uint32_t)0x20000000) /*!< Mask MAC Address high reg bits [15:8] */
Kojto 110:165afa46840b 1227 #define ETH_MAC_ADDRESSMASK_BYTE5 ((uint32_t)0x10000000) /*!< Mask MAC Address high reg bits [7:0] */
Kojto 110:165afa46840b 1228 #define ETH_MAC_ADDRESSMASK_BYTE4 ((uint32_t)0x08000000) /*!< Mask MAC Address low reg bits [31:24] */
Kojto 110:165afa46840b 1229 #define ETH_MAC_ADDRESSMASK_BYTE3 ((uint32_t)0x04000000) /*!< Mask MAC Address low reg bits [23:16] */
Kojto 110:165afa46840b 1230 #define ETH_MAC_ADDRESSMASK_BYTE2 ((uint32_t)0x02000000) /*!< Mask MAC Address low reg bits [15:8] */
Kojto 110:165afa46840b 1231 #define ETH_MAC_ADDRESSMASK_BYTE1 ((uint32_t)0x01000000) /*!< Mask MAC Address low reg bits [70] */
Kojto 110:165afa46840b 1232 /**
Kojto 110:165afa46840b 1233 * @}
Kojto 110:165afa46840b 1234 */
Kojto 110:165afa46840b 1235
Kojto 110:165afa46840b 1236 /** @defgroup ETH_MAC_Debug_flags ETH MAC Debug flags
Kojto 110:165afa46840b 1237 * @{
Kojto 110:165afa46840b 1238 */
Kojto 110:165afa46840b 1239 #define ETH_MAC_TXFIFO_FULL ((uint32_t)0x02000000) /* Tx FIFO full */
Kojto 110:165afa46840b 1240 #define ETH_MAC_TXFIFONOT_EMPTY ((uint32_t)0x01000000) /* Tx FIFO not empty */
Kojto 110:165afa46840b 1241 #define ETH_MAC_TXFIFO_WRITE_ACTIVE ((uint32_t)0x00400000) /* Tx FIFO write active */
Kojto 110:165afa46840b 1242 #define ETH_MAC_TXFIFO_IDLE ((uint32_t)0x00000000) /* Tx FIFO read status: Idle */
Kojto 110:165afa46840b 1243 #define ETH_MAC_TXFIFO_READ ((uint32_t)0x00100000) /* Tx FIFO read status: Read (transferring data to the MAC transmitter) */
Kojto 110:165afa46840b 1244 #define ETH_MAC_TXFIFO_WAITING ((uint32_t)0x00200000) /* Tx FIFO read status: Waiting for TxStatus from MAC transmitter */
Kojto 110:165afa46840b 1245 #define ETH_MAC_TXFIFO_WRITING ((uint32_t)0x00300000) /* Tx FIFO read status: Writing the received TxStatus or flushing the TxFIFO */
Kojto 110:165afa46840b 1246 #define ETH_MAC_TRANSMISSION_PAUSE ((uint32_t)0x00080000) /* MAC transmitter in pause */
Kojto 110:165afa46840b 1247 #define ETH_MAC_TRANSMITFRAMECONTROLLER_IDLE ((uint32_t)0x00000000) /* MAC transmit frame controller: Idle */
Kojto 110:165afa46840b 1248 #define ETH_MAC_TRANSMITFRAMECONTROLLER_WAITING ((uint32_t)0x00020000) /* MAC transmit frame controller: Waiting for Status of previous frame or IFG/backoff period to be over */
Kojto 110:165afa46840b 1249 #define ETH_MAC_TRANSMITFRAMECONTROLLER_GENRATING_PCF ((uint32_t)0x00040000) /* MAC transmit frame controller: Generating and transmitting a Pause control frame (in full duplex mode) */
Kojto 110:165afa46840b 1250 #define ETH_MAC_TRANSMITFRAMECONTROLLER_TRANSFERRING ((uint32_t)0x00060000) /* MAC transmit frame controller: Transferring input frame for transmission */
Kojto 110:165afa46840b 1251 #define ETH_MAC_MII_TRANSMIT_ACTIVE ((uint32_t)0x00010000) /* MAC MII transmit engine active */
Kojto 110:165afa46840b 1252 #define ETH_MAC_RXFIFO_EMPTY ((uint32_t)0x00000000) /* Rx FIFO fill level: empty */
Kojto 110:165afa46840b 1253 #define ETH_MAC_RXFIFO_BELOW_THRESHOLD ((uint32_t)0x00000100) /* Rx FIFO fill level: fill-level below flow-control de-activate threshold */
Kojto 110:165afa46840b 1254 #define ETH_MAC_RXFIFO_ABOVE_THRESHOLD ((uint32_t)0x00000200) /* Rx FIFO fill level: fill-level above flow-control activate threshold */
Kojto 110:165afa46840b 1255 #define ETH_MAC_RXFIFO_FULL ((uint32_t)0x00000300) /* Rx FIFO fill level: full */
Kojto 110:165afa46840b 1256 #define ETH_MAC_READCONTROLLER_IDLE ((uint32_t)0x00000000) /* Rx FIFO read controller IDLE state */
Kojto 110:165afa46840b 1257 #define ETH_MAC_READCONTROLLER_READING_DATA ((uint32_t)0x00000020) /* Rx FIFO read controller Reading frame data */
Kojto 110:165afa46840b 1258 #define ETH_MAC_READCONTROLLER_READING_STATUS ((uint32_t)0x00000040) /* Rx FIFO read controller Reading frame status (or time-stamp) */
Kojto 110:165afa46840b 1259 #define ETH_MAC_READCONTROLLER_FLUSHING ((uint32_t)0x00000060) /* Rx FIFO read controller Flushing the frame data and status */
Kojto 110:165afa46840b 1260 #define ETH_MAC_RXFIFO_WRITE_ACTIVE ((uint32_t)0x00000010) /* Rx FIFO write controller active */
Kojto 110:165afa46840b 1261 #define ETH_MAC_SMALL_FIFO_NOTACTIVE ((uint32_t)0x00000000) /* MAC small FIFO read / write controllers not active */
Kojto 110:165afa46840b 1262 #define ETH_MAC_SMALL_FIFO_READ_ACTIVE ((uint32_t)0x00000002) /* MAC small FIFO read controller active */
Kojto 110:165afa46840b 1263 #define ETH_MAC_SMALL_FIFO_WRITE_ACTIVE ((uint32_t)0x00000004) /* MAC small FIFO write controller active */
Kojto 110:165afa46840b 1264 #define ETH_MAC_SMALL_FIFO_RW_ACTIVE ((uint32_t)0x00000006) /* MAC small FIFO read / write controllers active */
Kojto 110:165afa46840b 1265 #define ETH_MAC_MII_RECEIVE_PROTOCOL_ACTIVE ((uint32_t)0x00000001) /* MAC MII receive protocol engine active */
Kojto 110:165afa46840b 1266 /**
Kojto 110:165afa46840b 1267 * @}
Kojto 110:165afa46840b 1268 */
Kojto 110:165afa46840b 1269
Kojto 110:165afa46840b 1270 /** @defgroup ETH_Drop_TCP_IP_Checksum_Error_Frame ETH Drop TCP IP Checksum Error Frame
Kojto 110:165afa46840b 1271 * @{
Kojto 110:165afa46840b 1272 */
Kojto 110:165afa46840b 1273 #define ETH_DROPTCPIPCHECKSUMERRORFRAME_ENABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1274 #define ETH_DROPTCPIPCHECKSUMERRORFRAME_DISABLE ((uint32_t)0x04000000)
Kojto 110:165afa46840b 1275 /**
Kojto 110:165afa46840b 1276 * @}
Kojto 110:165afa46840b 1277 */
Kojto 110:165afa46840b 1278
Kojto 110:165afa46840b 1279 /** @defgroup ETH_Receive_Store_Forward ETH Receive Store Forward
Kojto 110:165afa46840b 1280 * @{
Kojto 110:165afa46840b 1281 */
Kojto 110:165afa46840b 1282 #define ETH_RECEIVESTOREFORWARD_ENABLE ((uint32_t)0x02000000)
Kojto 110:165afa46840b 1283 #define ETH_RECEIVESTOREFORWARD_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1284 /**
Kojto 110:165afa46840b 1285 * @}
Kojto 110:165afa46840b 1286 */
Kojto 110:165afa46840b 1287
Kojto 110:165afa46840b 1288 /** @defgroup ETH_Flush_Received_Frame ETH Flush Received Frame
Kojto 110:165afa46840b 1289 * @{
Kojto 110:165afa46840b 1290 */
Kojto 110:165afa46840b 1291 #define ETH_FLUSHRECEIVEDFRAME_ENABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1292 #define ETH_FLUSHRECEIVEDFRAME_DISABLE ((uint32_t)0x01000000)
Kojto 110:165afa46840b 1293 /**
Kojto 110:165afa46840b 1294 * @}
Kojto 110:165afa46840b 1295 */
Kojto 110:165afa46840b 1296
Kojto 110:165afa46840b 1297 /** @defgroup ETH_Transmit_Store_Forward ETH Transmit Store Forward
Kojto 110:165afa46840b 1298 * @{
Kojto 110:165afa46840b 1299 */
Kojto 110:165afa46840b 1300 #define ETH_TRANSMITSTOREFORWARD_ENABLE ((uint32_t)0x00200000)
Kojto 110:165afa46840b 1301 #define ETH_TRANSMITSTOREFORWARD_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1302 /**
Kojto 110:165afa46840b 1303 * @}
Kojto 110:165afa46840b 1304 */
Kojto 110:165afa46840b 1305
Kojto 110:165afa46840b 1306 /** @defgroup ETH_Transmit_Threshold_Control ETH Transmit Threshold Control
Kojto 110:165afa46840b 1307 * @{
Kojto 110:165afa46840b 1308 */
Kojto 110:165afa46840b 1309 #define ETH_TRANSMITTHRESHOLDCONTROL_64BYTES ((uint32_t)0x00000000) /*!< threshold level of the MTL Transmit FIFO is 64 Bytes */
Kojto 110:165afa46840b 1310 #define ETH_TRANSMITTHRESHOLDCONTROL_128BYTES ((uint32_t)0x00004000) /*!< threshold level of the MTL Transmit FIFO is 128 Bytes */
Kojto 110:165afa46840b 1311 #define ETH_TRANSMITTHRESHOLDCONTROL_192BYTES ((uint32_t)0x00008000) /*!< threshold level of the MTL Transmit FIFO is 192 Bytes */
Kojto 110:165afa46840b 1312 #define ETH_TRANSMITTHRESHOLDCONTROL_256BYTES ((uint32_t)0x0000C000) /*!< threshold level of the MTL Transmit FIFO is 256 Bytes */
Kojto 110:165afa46840b 1313 #define ETH_TRANSMITTHRESHOLDCONTROL_40BYTES ((uint32_t)0x00010000) /*!< threshold level of the MTL Transmit FIFO is 40 Bytes */
Kojto 110:165afa46840b 1314 #define ETH_TRANSMITTHRESHOLDCONTROL_32BYTES ((uint32_t)0x00014000) /*!< threshold level of the MTL Transmit FIFO is 32 Bytes */
Kojto 110:165afa46840b 1315 #define ETH_TRANSMITTHRESHOLDCONTROL_24BYTES ((uint32_t)0x00018000) /*!< threshold level of the MTL Transmit FIFO is 24 Bytes */
Kojto 110:165afa46840b 1316 #define ETH_TRANSMITTHRESHOLDCONTROL_16BYTES ((uint32_t)0x0001C000) /*!< threshold level of the MTL Transmit FIFO is 16 Bytes */
Kojto 110:165afa46840b 1317 /**
Kojto 110:165afa46840b 1318 * @}
Kojto 110:165afa46840b 1319 */
Kojto 110:165afa46840b 1320
Kojto 110:165afa46840b 1321 /** @defgroup ETH_Forward_Error_Frames ETH Forward Error Frames
Kojto 110:165afa46840b 1322 * @{
Kojto 110:165afa46840b 1323 */
Kojto 110:165afa46840b 1324 #define ETH_FORWARDERRORFRAMES_ENABLE ((uint32_t)0x00000080)
Kojto 110:165afa46840b 1325 #define ETH_FORWARDERRORFRAMES_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1326 /**
Kojto 110:165afa46840b 1327 * @}
Kojto 110:165afa46840b 1328 */
Kojto 110:165afa46840b 1329
Kojto 110:165afa46840b 1330 /** @defgroup ETH_Forward_Undersized_Good_Frames ETH Forward Undersized Good Frames
Kojto 110:165afa46840b 1331 * @{
Kojto 110:165afa46840b 1332 */
Kojto 110:165afa46840b 1333 #define ETH_FORWARDUNDERSIZEDGOODFRAMES_ENABLE ((uint32_t)0x00000040)
Kojto 110:165afa46840b 1334 #define ETH_FORWARDUNDERSIZEDGOODFRAMES_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1335 /**
Kojto 110:165afa46840b 1336 * @}
Kojto 110:165afa46840b 1337 */
Kojto 110:165afa46840b 1338
Kojto 110:165afa46840b 1339 /** @defgroup ETH_Receive_Threshold_Control ETH Receive Threshold Control
Kojto 110:165afa46840b 1340 * @{
Kojto 110:165afa46840b 1341 */
Kojto 110:165afa46840b 1342 #define ETH_RECEIVEDTHRESHOLDCONTROL_64BYTES ((uint32_t)0x00000000) /*!< threshold level of the MTL Receive FIFO is 64 Bytes */
Kojto 110:165afa46840b 1343 #define ETH_RECEIVEDTHRESHOLDCONTROL_32BYTES ((uint32_t)0x00000008) /*!< threshold level of the MTL Receive FIFO is 32 Bytes */
Kojto 110:165afa46840b 1344 #define ETH_RECEIVEDTHRESHOLDCONTROL_96BYTES ((uint32_t)0x00000010) /*!< threshold level of the MTL Receive FIFO is 96 Bytes */
Kojto 110:165afa46840b 1345 #define ETH_RECEIVEDTHRESHOLDCONTROL_128BYTES ((uint32_t)0x00000018) /*!< threshold level of the MTL Receive FIFO is 128 Bytes */
Kojto 110:165afa46840b 1346 /**
Kojto 110:165afa46840b 1347 * @}
Kojto 110:165afa46840b 1348 */
Kojto 110:165afa46840b 1349
Kojto 110:165afa46840b 1350 /** @defgroup ETH_Second_Frame_Operate ETH Second Frame Operate
Kojto 110:165afa46840b 1351 * @{
Kojto 110:165afa46840b 1352 */
Kojto 110:165afa46840b 1353 #define ETH_SECONDFRAMEOPERARTE_ENABLE ((uint32_t)0x00000004)
Kojto 110:165afa46840b 1354 #define ETH_SECONDFRAMEOPERARTE_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1355 /**
Kojto 110:165afa46840b 1356 * @}
Kojto 110:165afa46840b 1357 */
Kojto 110:165afa46840b 1358
Kojto 110:165afa46840b 1359 /** @defgroup ETH_Address_Aligned_Beats ETH Address Aligned Beats
Kojto 110:165afa46840b 1360 * @{
Kojto 110:165afa46840b 1361 */
Kojto 110:165afa46840b 1362 #define ETH_ADDRESSALIGNEDBEATS_ENABLE ((uint32_t)0x02000000)
Kojto 110:165afa46840b 1363 #define ETH_ADDRESSALIGNEDBEATS_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1364 /**
Kojto 110:165afa46840b 1365 * @}
Kojto 110:165afa46840b 1366 */
Kojto 110:165afa46840b 1367
Kojto 110:165afa46840b 1368 /** @defgroup ETH_Fixed_Burst ETH Fixed Burst
Kojto 110:165afa46840b 1369 * @{
Kojto 110:165afa46840b 1370 */
Kojto 110:165afa46840b 1371 #define ETH_FIXEDBURST_ENABLE ((uint32_t)0x00010000)
Kojto 110:165afa46840b 1372 #define ETH_FIXEDBURST_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1373 /**
Kojto 110:165afa46840b 1374 * @}
Kojto 110:165afa46840b 1375 */
Kojto 110:165afa46840b 1376
Kojto 110:165afa46840b 1377 /** @defgroup ETH_Rx_DMA_Burst_Length ETH Rx DMA Burst Length
Kojto 110:165afa46840b 1378 * @{
Kojto 110:165afa46840b 1379 */
Kojto 110:165afa46840b 1380 #define ETH_RXDMABURSTLENGTH_1BEAT ((uint32_t)0x00020000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 1 */
Kojto 110:165afa46840b 1381 #define ETH_RXDMABURSTLENGTH_2BEAT ((uint32_t)0x00040000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 2 */
Kojto 110:165afa46840b 1382 #define ETH_RXDMABURSTLENGTH_4BEAT ((uint32_t)0x00080000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 4 */
Kojto 110:165afa46840b 1383 #define ETH_RXDMABURSTLENGTH_8BEAT ((uint32_t)0x00100000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 8 */
Kojto 110:165afa46840b 1384 #define ETH_RXDMABURSTLENGTH_16BEAT ((uint32_t)0x00200000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 16 */
Kojto 110:165afa46840b 1385 #define ETH_RXDMABURSTLENGTH_32BEAT ((uint32_t)0x00400000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 32 */
Kojto 110:165afa46840b 1386 #define ETH_RXDMABURSTLENGTH_4XPBL_4BEAT ((uint32_t)0x01020000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 4 */
Kojto 110:165afa46840b 1387 #define ETH_RXDMABURSTLENGTH_4XPBL_8BEAT ((uint32_t)0x01040000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 8 */
Kojto 110:165afa46840b 1388 #define ETH_RXDMABURSTLENGTH_4XPBL_16BEAT ((uint32_t)0x01080000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 16 */
Kojto 110:165afa46840b 1389 #define ETH_RXDMABURSTLENGTH_4XPBL_32BEAT ((uint32_t)0x01100000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 32 */
Kojto 110:165afa46840b 1390 #define ETH_RXDMABURSTLENGTH_4XPBL_64BEAT ((uint32_t)0x01200000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 64 */
Kojto 110:165afa46840b 1391 #define ETH_RXDMABURSTLENGTH_4XPBL_128BEAT ((uint32_t)0x01400000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 128 */
Kojto 110:165afa46840b 1392 /**
Kojto 110:165afa46840b 1393 * @}
Kojto 110:165afa46840b 1394 */
Kojto 110:165afa46840b 1395
Kojto 110:165afa46840b 1396 /** @defgroup ETH_Tx_DMA_Burst_Length ETH Tx DMA Burst Length
Kojto 110:165afa46840b 1397 * @{
Kojto 110:165afa46840b 1398 */
Kojto 110:165afa46840b 1399 #define ETH_TXDMABURSTLENGTH_1BEAT ((uint32_t)0x00000100) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 1 */
Kojto 110:165afa46840b 1400 #define ETH_TXDMABURSTLENGTH_2BEAT ((uint32_t)0x00000200) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 2 */
Kojto 110:165afa46840b 1401 #define ETH_TXDMABURSTLENGTH_4BEAT ((uint32_t)0x00000400) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */
Kojto 110:165afa46840b 1402 #define ETH_TXDMABURSTLENGTH_8BEAT ((uint32_t)0x00000800) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */
Kojto 110:165afa46840b 1403 #define ETH_TXDMABURSTLENGTH_16BEAT ((uint32_t)0x00001000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */
Kojto 110:165afa46840b 1404 #define ETH_TXDMABURSTLENGTH_32BEAT ((uint32_t)0x00002000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */
Kojto 110:165afa46840b 1405 #define ETH_TXDMABURSTLENGTH_4XPBL_4BEAT ((uint32_t)0x01000100) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */
Kojto 110:165afa46840b 1406 #define ETH_TXDMABURSTLENGTH_4XPBL_8BEAT ((uint32_t)0x01000200) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */
Kojto 110:165afa46840b 1407 #define ETH_TXDMABURSTLENGTH_4XPBL_16BEAT ((uint32_t)0x01000400) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */
Kojto 110:165afa46840b 1408 #define ETH_TXDMABURSTLENGTH_4XPBL_32BEAT ((uint32_t)0x01000800) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */
Kojto 110:165afa46840b 1409 #define ETH_TXDMABURSTLENGTH_4XPBL_64BEAT ((uint32_t)0x01001000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 64 */
Kojto 110:165afa46840b 1410 #define ETH_TXDMABURSTLENGTH_4XPBL_128BEAT ((uint32_t)0x01002000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 128 */
Kojto 110:165afa46840b 1411 /**
Kojto 110:165afa46840b 1412 * @}
Kojto 110:165afa46840b 1413 */
Kojto 110:165afa46840b 1414
Kojto 110:165afa46840b 1415 /** @defgroup ETH_DMA_Enhanced_descriptor_format ETH DMA Enhanced descriptor format
Kojto 110:165afa46840b 1416 * @{
Kojto 110:165afa46840b 1417 */
Kojto 110:165afa46840b 1418 #define ETH_DMAENHANCEDDESCRIPTOR_ENABLE ((uint32_t)0x00000080)
Kojto 110:165afa46840b 1419 #define ETH_DMAENHANCEDDESCRIPTOR_DISABLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1420 /**
Kojto 110:165afa46840b 1421 * @}
Kojto 110:165afa46840b 1422 */
Kojto 110:165afa46840b 1423
Kojto 110:165afa46840b 1424 /** @defgroup ETH_DMA_Arbitration ETH DMA Arbitration
Kojto 110:165afa46840b 1425 * @{
Kojto 110:165afa46840b 1426 */
Kojto 110:165afa46840b 1427 #define ETH_DMAARBITRATION_ROUNDROBIN_RXTX_1_1 ((uint32_t)0x00000000)
Kojto 110:165afa46840b 1428 #define ETH_DMAARBITRATION_ROUNDROBIN_RXTX_2_1 ((uint32_t)0x00004000)
Kojto 110:165afa46840b 1429 #define ETH_DMAARBITRATION_ROUNDROBIN_RXTX_3_1 ((uint32_t)0x00008000)
Kojto 110:165afa46840b 1430 #define ETH_DMAARBITRATION_ROUNDROBIN_RXTX_4_1 ((uint32_t)0x0000C000)
Kojto 110:165afa46840b 1431 #define ETH_DMAARBITRATION_RXPRIORTX ((uint32_t)0x00000002)
Kojto 110:165afa46840b 1432 /**
Kojto 110:165afa46840b 1433 * @}
Kojto 110:165afa46840b 1434 */
Kojto 110:165afa46840b 1435
Kojto 110:165afa46840b 1436 /** @defgroup ETH_DMA_Tx_descriptor_segment ETH DMA Tx descriptor segment
Kojto 110:165afa46840b 1437 * @{
Kojto 110:165afa46840b 1438 */
Kojto 110:165afa46840b 1439 #define ETH_DMATXDESC_LASTSEGMENTS ((uint32_t)0x40000000) /*!< Last Segment */
Kojto 110:165afa46840b 1440 #define ETH_DMATXDESC_FIRSTSEGMENT ((uint32_t)0x20000000) /*!< First Segment */
Kojto 110:165afa46840b 1441 /**
Kojto 110:165afa46840b 1442 * @}
Kojto 110:165afa46840b 1443 */
Kojto 110:165afa46840b 1444
Kojto 110:165afa46840b 1445 /** @defgroup ETH_DMA_Tx_descriptor_Checksum_Insertion_Control ETH DMA Tx descriptor Checksum Insertion Control
Kojto 110:165afa46840b 1446 * @{
Kojto 110:165afa46840b 1447 */
Kojto 110:165afa46840b 1448 #define ETH_DMATXDESC_CHECKSUMBYPASS ((uint32_t)0x00000000) /*!< Checksum engine bypass */
Kojto 110:165afa46840b 1449 #define ETH_DMATXDESC_CHECKSUMIPV4HEADER ((uint32_t)0x00400000) /*!< IPv4 header checksum insertion */
Kojto 110:165afa46840b 1450 #define ETH_DMATXDESC_CHECKSUMTCPUDPICMPSEGMENT ((uint32_t)0x00800000) /*!< TCP/UDP/ICMP checksum insertion. Pseudo header checksum is assumed to be present */
Kojto 110:165afa46840b 1451 #define ETH_DMATXDESC_CHECKSUMTCPUDPICMPFULL ((uint32_t)0x00C00000) /*!< TCP/UDP/ICMP checksum fully in hardware including pseudo header */
Kojto 110:165afa46840b 1452 /**
Kojto 110:165afa46840b 1453 * @}
Kojto 110:165afa46840b 1454 */
Kojto 110:165afa46840b 1455
Kojto 110:165afa46840b 1456 /** @defgroup ETH_DMA_Rx_descriptor_buffers ETH DMA Rx descriptor buffers
Kojto 110:165afa46840b 1457 * @{
Kojto 110:165afa46840b 1458 */
Kojto 110:165afa46840b 1459 #define ETH_DMARXDESC_BUFFER1 ((uint32_t)0x00000000) /*!< DMA Rx Desc Buffer1 */
Kojto 110:165afa46840b 1460 #define ETH_DMARXDESC_BUFFER2 ((uint32_t)0x00000001) /*!< DMA Rx Desc Buffer2 */
Kojto 110:165afa46840b 1461 /**
Kojto 110:165afa46840b 1462 * @}
Kojto 110:165afa46840b 1463 */
Kojto 110:165afa46840b 1464
Kojto 110:165afa46840b 1465 /** @defgroup ETH_PMT_Flags ETH PMT Flags
Kojto 110:165afa46840b 1466 * @{
Kojto 110:165afa46840b 1467 */
Kojto 110:165afa46840b 1468 #define ETH_PMT_FLAG_WUFFRPR ((uint32_t)0x80000000) /*!< Wake-Up Frame Filter Register Pointer Reset */
Kojto 110:165afa46840b 1469 #define ETH_PMT_FLAG_WUFR ((uint32_t)0x00000040) /*!< Wake-Up Frame Received */
Kojto 110:165afa46840b 1470 #define ETH_PMT_FLAG_MPR ((uint32_t)0x00000020) /*!< Magic Packet Received */
Kojto 110:165afa46840b 1471 /**
Kojto 110:165afa46840b 1472 * @}
Kojto 110:165afa46840b 1473 */
Kojto 110:165afa46840b 1474
Kojto 110:165afa46840b 1475 /** @defgroup ETH_MMC_Tx_Interrupts ETH MMC Tx Interrupts
Kojto 110:165afa46840b 1476 * @{
Kojto 110:165afa46840b 1477 */
Kojto 110:165afa46840b 1478 #define ETH_MMC_IT_TGF ((uint32_t)0x00200000) /*!< When Tx good frame counter reaches half the maximum value */
Kojto 110:165afa46840b 1479 #define ETH_MMC_IT_TGFMSC ((uint32_t)0x00008000) /*!< When Tx good multi col counter reaches half the maximum value */
Kojto 110:165afa46840b 1480 #define ETH_MMC_IT_TGFSC ((uint32_t)0x00004000) /*!< When Tx good single col counter reaches half the maximum value */
Kojto 110:165afa46840b 1481 /**
Kojto 110:165afa46840b 1482 * @}
Kojto 110:165afa46840b 1483 */
Kojto 110:165afa46840b 1484
Kojto 110:165afa46840b 1485 /** @defgroup ETH_MMC_Rx_Interrupts ETH MMC Rx Interrupts
Kojto 110:165afa46840b 1486 * @{
Kojto 110:165afa46840b 1487 */
Kojto 110:165afa46840b 1488 #define ETH_MMC_IT_RGUF ((uint32_t)0x10020000) /*!< When Rx good unicast frames counter reaches half the maximum value */
Kojto 110:165afa46840b 1489 #define ETH_MMC_IT_RFAE ((uint32_t)0x10000040) /*!< When Rx alignment error counter reaches half the maximum value */
Kojto 110:165afa46840b 1490 #define ETH_MMC_IT_RFCE ((uint32_t)0x10000020) /*!< When Rx crc error counter reaches half the maximum value */
Kojto 110:165afa46840b 1491 /**
Kojto 110:165afa46840b 1492 * @}
Kojto 110:165afa46840b 1493 */
Kojto 110:165afa46840b 1494
Kojto 110:165afa46840b 1495 /** @defgroup ETH_MAC_Flags ETH MAC Flags
Kojto 110:165afa46840b 1496 * @{
Kojto 110:165afa46840b 1497 */
Kojto 110:165afa46840b 1498 #define ETH_MAC_FLAG_TST ((uint32_t)0x00000200) /*!< Time stamp trigger flag (on MAC) */
Kojto 110:165afa46840b 1499 #define ETH_MAC_FLAG_MMCT ((uint32_t)0x00000040) /*!< MMC transmit flag */
Kojto 110:165afa46840b 1500 #define ETH_MAC_FLAG_MMCR ((uint32_t)0x00000020) /*!< MMC receive flag */
Kojto 110:165afa46840b 1501 #define ETH_MAC_FLAG_MMC ((uint32_t)0x00000010) /*!< MMC flag (on MAC) */
Kojto 110:165afa46840b 1502 #define ETH_MAC_FLAG_PMT ((uint32_t)0x00000008) /*!< PMT flag (on MAC) */
Kojto 110:165afa46840b 1503 /**
Kojto 110:165afa46840b 1504 * @}
Kojto 110:165afa46840b 1505 */
Kojto 110:165afa46840b 1506
Kojto 110:165afa46840b 1507 /** @defgroup ETH_DMA_Flags ETH DMA Flags
Kojto 110:165afa46840b 1508 * @{
Kojto 110:165afa46840b 1509 */
Kojto 110:165afa46840b 1510 #define ETH_DMA_FLAG_TST ((uint32_t)0x20000000) /*!< Time-stamp trigger interrupt (on DMA) */
Kojto 110:165afa46840b 1511 #define ETH_DMA_FLAG_PMT ((uint32_t)0x10000000) /*!< PMT interrupt (on DMA) */
Kojto 110:165afa46840b 1512 #define ETH_DMA_FLAG_MMC ((uint32_t)0x08000000) /*!< MMC interrupt (on DMA) */
Kojto 110:165afa46840b 1513 #define ETH_DMA_FLAG_DATATRANSFERERROR ((uint32_t)0x00800000) /*!< Error bits 0-Rx DMA, 1-Tx DMA */
Kojto 110:165afa46840b 1514 #define ETH_DMA_FLAG_READWRITEERROR ((uint32_t)0x01000000) /*!< Error bits 0-write transfer, 1-read transfer */
Kojto 110:165afa46840b 1515 #define ETH_DMA_FLAG_ACCESSERROR ((uint32_t)0x02000000) /*!< Error bits 0-data buffer, 1-desc. access */
Kojto 110:165afa46840b 1516 #define ETH_DMA_FLAG_NIS ((uint32_t)0x00010000) /*!< Normal interrupt summary flag */
Kojto 110:165afa46840b 1517 #define ETH_DMA_FLAG_AIS ((uint32_t)0x00008000) /*!< Abnormal interrupt summary flag */
Kojto 110:165afa46840b 1518 #define ETH_DMA_FLAG_ER ((uint32_t)0x00004000) /*!< Early receive flag */
Kojto 110:165afa46840b 1519 #define ETH_DMA_FLAG_FBE ((uint32_t)0x00002000) /*!< Fatal bus error flag */
Kojto 110:165afa46840b 1520 #define ETH_DMA_FLAG_ET ((uint32_t)0x00000400) /*!< Early transmit flag */
Kojto 110:165afa46840b 1521 #define ETH_DMA_FLAG_RWT ((uint32_t)0x00000200) /*!< Receive watchdog timeout flag */
Kojto 110:165afa46840b 1522 #define ETH_DMA_FLAG_RPS ((uint32_t)0x00000100) /*!< Receive process stopped flag */
Kojto 110:165afa46840b 1523 #define ETH_DMA_FLAG_RBU ((uint32_t)0x00000080) /*!< Receive buffer unavailable flag */
Kojto 110:165afa46840b 1524 #define ETH_DMA_FLAG_R ((uint32_t)0x00000040) /*!< Receive flag */
Kojto 110:165afa46840b 1525 #define ETH_DMA_FLAG_TU ((uint32_t)0x00000020) /*!< Underflow flag */
Kojto 110:165afa46840b 1526 #define ETH_DMA_FLAG_RO ((uint32_t)0x00000010) /*!< Overflow flag */
Kojto 110:165afa46840b 1527 #define ETH_DMA_FLAG_TJT ((uint32_t)0x00000008) /*!< Transmit jabber timeout flag */
Kojto 110:165afa46840b 1528 #define ETH_DMA_FLAG_TBU ((uint32_t)0x00000004) /*!< Transmit buffer unavailable flag */
Kojto 110:165afa46840b 1529 #define ETH_DMA_FLAG_TPS ((uint32_t)0x00000002) /*!< Transmit process stopped flag */
Kojto 110:165afa46840b 1530 #define ETH_DMA_FLAG_T ((uint32_t)0x00000001) /*!< Transmit flag */
Kojto 110:165afa46840b 1531 /**
Kojto 110:165afa46840b 1532 * @}
Kojto 110:165afa46840b 1533 */
Kojto 110:165afa46840b 1534
Kojto 110:165afa46840b 1535 /** @defgroup ETH_MAC_Interrupts ETH MAC Interrupts
Kojto 110:165afa46840b 1536 * @{
Kojto 110:165afa46840b 1537 */
Kojto 110:165afa46840b 1538 #define ETH_MAC_IT_TST ((uint32_t)0x00000200) /*!< Time stamp trigger interrupt (on MAC) */
Kojto 110:165afa46840b 1539 #define ETH_MAC_IT_MMCT ((uint32_t)0x00000040) /*!< MMC transmit interrupt */
Kojto 110:165afa46840b 1540 #define ETH_MAC_IT_MMCR ((uint32_t)0x00000020) /*!< MMC receive interrupt */
Kojto 110:165afa46840b 1541 #define ETH_MAC_IT_MMC ((uint32_t)0x00000010) /*!< MMC interrupt (on MAC) */
Kojto 110:165afa46840b 1542 #define ETH_MAC_IT_PMT ((uint32_t)0x00000008) /*!< PMT interrupt (on MAC) */
Kojto 110:165afa46840b 1543 /**
Kojto 110:165afa46840b 1544 * @}
Kojto 110:165afa46840b 1545 */
Kojto 110:165afa46840b 1546
Kojto 110:165afa46840b 1547 /** @defgroup ETH_DMA_Interrupts ETH DMA Interrupts
Kojto 110:165afa46840b 1548 * @{
Kojto 110:165afa46840b 1549 */
Kojto 110:165afa46840b 1550 #define ETH_DMA_IT_TST ((uint32_t)0x20000000) /*!< Time-stamp trigger interrupt (on DMA) */
Kojto 110:165afa46840b 1551 #define ETH_DMA_IT_PMT ((uint32_t)0x10000000) /*!< PMT interrupt (on DMA) */
Kojto 110:165afa46840b 1552 #define ETH_DMA_IT_MMC ((uint32_t)0x08000000) /*!< MMC interrupt (on DMA) */
Kojto 110:165afa46840b 1553 #define ETH_DMA_IT_NIS ((uint32_t)0x00010000) /*!< Normal interrupt summary */
Kojto 110:165afa46840b 1554 #define ETH_DMA_IT_AIS ((uint32_t)0x00008000) /*!< Abnormal interrupt summary */
Kojto 110:165afa46840b 1555 #define ETH_DMA_IT_ER ((uint32_t)0x00004000) /*!< Early receive interrupt */
Kojto 110:165afa46840b 1556 #define ETH_DMA_IT_FBE ((uint32_t)0x00002000) /*!< Fatal bus error interrupt */
Kojto 110:165afa46840b 1557 #define ETH_DMA_IT_ET ((uint32_t)0x00000400) /*!< Early transmit interrupt */
Kojto 110:165afa46840b 1558 #define ETH_DMA_IT_RWT ((uint32_t)0x00000200) /*!< Receive watchdog timeout interrupt */
Kojto 110:165afa46840b 1559 #define ETH_DMA_IT_RPS ((uint32_t)0x00000100) /*!< Receive process stopped interrupt */
Kojto 110:165afa46840b 1560 #define ETH_DMA_IT_RBU ((uint32_t)0x00000080) /*!< Receive buffer unavailable interrupt */
Kojto 110:165afa46840b 1561 #define ETH_DMA_IT_R ((uint32_t)0x00000040) /*!< Receive interrupt */
Kojto 110:165afa46840b 1562 #define ETH_DMA_IT_TU ((uint32_t)0x00000020) /*!< Underflow interrupt */
Kojto 110:165afa46840b 1563 #define ETH_DMA_IT_RO ((uint32_t)0x00000010) /*!< Overflow interrupt */
Kojto 110:165afa46840b 1564 #define ETH_DMA_IT_TJT ((uint32_t)0x00000008) /*!< Transmit jabber timeout interrupt */
Kojto 110:165afa46840b 1565 #define ETH_DMA_IT_TBU ((uint32_t)0x00000004) /*!< Transmit buffer unavailable interrupt */
Kojto 110:165afa46840b 1566 #define ETH_DMA_IT_TPS ((uint32_t)0x00000002) /*!< Transmit process stopped interrupt */
Kojto 110:165afa46840b 1567 #define ETH_DMA_IT_T ((uint32_t)0x00000001) /*!< Transmit interrupt */
Kojto 110:165afa46840b 1568 /**
Kojto 110:165afa46840b 1569 * @}
Kojto 110:165afa46840b 1570 */
Kojto 110:165afa46840b 1571
Kojto 110:165afa46840b 1572 /** @defgroup ETH_DMA_transmit_process_state ETH DMA transmit process state
Kojto 110:165afa46840b 1573 * @{
Kojto 110:165afa46840b 1574 */
Kojto 110:165afa46840b 1575 #define ETH_DMA_TRANSMITPROCESS_STOPPED ((uint32_t)0x00000000) /*!< Stopped - Reset or Stop Tx Command issued */
Kojto 110:165afa46840b 1576 #define ETH_DMA_TRANSMITPROCESS_FETCHING ((uint32_t)0x00100000) /*!< Running - fetching the Tx descriptor */
Kojto 110:165afa46840b 1577 #define ETH_DMA_TRANSMITPROCESS_WAITING ((uint32_t)0x00200000) /*!< Running - waiting for status */
Kojto 110:165afa46840b 1578 #define ETH_DMA_TRANSMITPROCESS_READING ((uint32_t)0x00300000) /*!< Running - reading the data from host memory */
Kojto 110:165afa46840b 1579 #define ETH_DMA_TRANSMITPROCESS_SUSPENDED ((uint32_t)0x00600000) /*!< Suspended - Tx Descriptor unavailable */
Kojto 110:165afa46840b 1580 #define ETH_DMA_TRANSMITPROCESS_CLOSING ((uint32_t)0x00700000) /*!< Running - closing Rx descriptor */
Kojto 110:165afa46840b 1581
Kojto 110:165afa46840b 1582 /**
Kojto 110:165afa46840b 1583 * @}
Kojto 110:165afa46840b 1584 */
Kojto 110:165afa46840b 1585
Kojto 110:165afa46840b 1586
Kojto 110:165afa46840b 1587 /** @defgroup ETH_DMA_receive_process_state ETH DMA receive process state
Kojto 110:165afa46840b 1588 * @{
Kojto 110:165afa46840b 1589 */
Kojto 110:165afa46840b 1590 #define ETH_DMA_RECEIVEPROCESS_STOPPED ((uint32_t)0x00000000) /*!< Stopped - Reset or Stop Rx Command issued */
Kojto 110:165afa46840b 1591 #define ETH_DMA_RECEIVEPROCESS_FETCHING ((uint32_t)0x00020000) /*!< Running - fetching the Rx descriptor */
Kojto 110:165afa46840b 1592 #define ETH_DMA_RECEIVEPROCESS_WAITING ((uint32_t)0x00060000) /*!< Running - waiting for packet */
Kojto 110:165afa46840b 1593 #define ETH_DMA_RECEIVEPROCESS_SUSPENDED ((uint32_t)0x00080000) /*!< Suspended - Rx Descriptor unavailable */
Kojto 110:165afa46840b 1594 #define ETH_DMA_RECEIVEPROCESS_CLOSING ((uint32_t)0x000A0000) /*!< Running - closing descriptor */
Kojto 110:165afa46840b 1595 #define ETH_DMA_RECEIVEPROCESS_QUEUING ((uint32_t)0x000E0000) /*!< Running - queuing the receive frame into host memory */
Kojto 110:165afa46840b 1596
Kojto 110:165afa46840b 1597 /**
Kojto 110:165afa46840b 1598 * @}
Kojto 110:165afa46840b 1599 */
Kojto 110:165afa46840b 1600
Kojto 110:165afa46840b 1601 /** @defgroup ETH_DMA_overflow ETH DMA overflow
Kojto 110:165afa46840b 1602 * @{
Kojto 110:165afa46840b 1603 */
Kojto 110:165afa46840b 1604 #define ETH_DMA_OVERFLOW_RXFIFOCOUNTER ((uint32_t)0x10000000) /*!< Overflow bit for FIFO overflow counter */
Kojto 110:165afa46840b 1605 #define ETH_DMA_OVERFLOW_MISSEDFRAMECOUNTER ((uint32_t)0x00010000) /*!< Overflow bit for missed frame counter */
Kojto 110:165afa46840b 1606 /**
Kojto 110:165afa46840b 1607 * @}
Kojto 110:165afa46840b 1608 */
Kojto 110:165afa46840b 1609
Kojto 110:165afa46840b 1610 /** @defgroup ETH_EXTI_LINE_WAKEUP ETH EXTI LINE WAKEUP
Kojto 110:165afa46840b 1611 * @{
Kojto 110:165afa46840b 1612 */
Kojto 110:165afa46840b 1613 #define ETH_EXTI_LINE_WAKEUP ((uint32_t)0x00080000) /*!< External interrupt line 19 Connected to the ETH EXTI Line */
Kojto 110:165afa46840b 1614
Kojto 110:165afa46840b 1615 /**
Kojto 110:165afa46840b 1616 * @}
Kojto 110:165afa46840b 1617 */
Kojto 110:165afa46840b 1618
Kojto 110:165afa46840b 1619 /**
Kojto 110:165afa46840b 1620 * @}
Kojto 110:165afa46840b 1621 */
Kojto 110:165afa46840b 1622
Kojto 110:165afa46840b 1623 /* Exported macro ------------------------------------------------------------*/
Kojto 110:165afa46840b 1624 /** @defgroup ETH_Exported_Macros ETH Exported Macros
Kojto 110:165afa46840b 1625 * @brief macros to handle interrupts and specific clock configurations
Kojto 110:165afa46840b 1626 * @{
Kojto 110:165afa46840b 1627 */
Kojto 110:165afa46840b 1628
Kojto 110:165afa46840b 1629 /** @brief Reset ETH handle state
Kojto 110:165afa46840b 1630 * @param __HANDLE__: specifies the ETH handle.
Kojto 110:165afa46840b 1631 * @retval None
Kojto 110:165afa46840b 1632 */
Kojto 110:165afa46840b 1633 #define __HAL_ETH_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_ETH_STATE_RESET)
Kojto 110:165afa46840b 1634
Kojto 110:165afa46840b 1635 /**
Kojto 110:165afa46840b 1636 * @brief Checks whether the specified ETHERNET DMA Tx Desc flag is set or not.
Kojto 110:165afa46840b 1637 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1638 * @param __FLAG__: specifies the flag of TDES0 to check.
Kojto 110:165afa46840b 1639 * @retval the ETH_DMATxDescFlag (SET or RESET).
Kojto 110:165afa46840b 1640 */
Kojto 110:165afa46840b 1641 #define __HAL_ETH_DMATXDESC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->TxDesc->Status & (__FLAG__) == (__FLAG__))
Kojto 110:165afa46840b 1642
Kojto 110:165afa46840b 1643 /**
Kojto 110:165afa46840b 1644 * @brief Checks whether the specified ETHERNET DMA Rx Desc flag is set or not.
Kojto 110:165afa46840b 1645 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1646 * @param __FLAG__: specifies the flag of RDES0 to check.
Kojto 110:165afa46840b 1647 * @retval the ETH_DMATxDescFlag (SET or RESET).
Kojto 110:165afa46840b 1648 */
Kojto 110:165afa46840b 1649 #define __HAL_ETH_DMARXDESC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->RxDesc->Status & (__FLAG__) == (__FLAG__))
Kojto 110:165afa46840b 1650
Kojto 110:165afa46840b 1651 /**
Kojto 110:165afa46840b 1652 * @brief Enables the specified DMA Rx Desc receive interrupt.
Kojto 110:165afa46840b 1653 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1654 * @retval None
Kojto 110:165afa46840b 1655 */
Kojto 110:165afa46840b 1656 #define __HAL_ETH_DMARXDESC_ENABLE_IT(__HANDLE__) ((__HANDLE__)->RxDesc->ControlBufferSize &=(~(uint32_t)ETH_DMARXDESC_DIC))
Kojto 110:165afa46840b 1657
Kojto 110:165afa46840b 1658 /**
Kojto 110:165afa46840b 1659 * @brief Disables the specified DMA Rx Desc receive interrupt.
Kojto 110:165afa46840b 1660 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1661 * @retval None
Kojto 110:165afa46840b 1662 */
Kojto 110:165afa46840b 1663 #define __HAL_ETH_DMARXDESC_DISABLE_IT(__HANDLE__) ((__HANDLE__)->RxDesc->ControlBufferSize |= ETH_DMARXDESC_DIC)
Kojto 110:165afa46840b 1664
Kojto 110:165afa46840b 1665 /**
Kojto 110:165afa46840b 1666 * @brief Set the specified DMA Rx Desc Own bit.
Kojto 110:165afa46840b 1667 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1668 * @retval None
Kojto 110:165afa46840b 1669 */
Kojto 110:165afa46840b 1670 #define __HAL_ETH_DMARXDESC_SET_OWN_BIT(__HANDLE__) ((__HANDLE__)->RxDesc->Status |= ETH_DMARXDESC_OWN)
Kojto 110:165afa46840b 1671
Kojto 110:165afa46840b 1672 /**
Kojto 110:165afa46840b 1673 * @brief Returns the specified ETHERNET DMA Tx Desc collision count.
Kojto 110:165afa46840b 1674 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1675 * @retval The Transmit descriptor collision counter value.
Kojto 110:165afa46840b 1676 */
Kojto 110:165afa46840b 1677 #define __HAL_ETH_DMATXDESC_GET_COLLISION_COUNT(__HANDLE__) (((__HANDLE__)->TxDesc->Status & ETH_DMATXDESC_CC) >> ETH_DMATXDESC_COLLISION_COUNTSHIFT)
Kojto 110:165afa46840b 1678
Kojto 110:165afa46840b 1679 /**
Kojto 110:165afa46840b 1680 * @brief Set the specified DMA Tx Desc Own bit.
Kojto 110:165afa46840b 1681 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1682 * @retval None
Kojto 110:165afa46840b 1683 */
Kojto 110:165afa46840b 1684 #define __HAL_ETH_DMATXDESC_SET_OWN_BIT(__HANDLE__) ((__HANDLE__)->TxDesc->Status |= ETH_DMATXDESC_OWN)
Kojto 110:165afa46840b 1685
Kojto 110:165afa46840b 1686 /**
Kojto 110:165afa46840b 1687 * @brief Enables the specified DMA Tx Desc Transmit interrupt.
Kojto 110:165afa46840b 1688 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1689 * @retval None
Kojto 110:165afa46840b 1690 */
Kojto 110:165afa46840b 1691 #define __HAL_ETH_DMATXDESC_ENABLE_IT(__HANDLE__) ((__HANDLE__)->TxDesc->Status |= ETH_DMATXDESC_IC)
Kojto 110:165afa46840b 1692
Kojto 110:165afa46840b 1693 /**
Kojto 110:165afa46840b 1694 * @brief Disables the specified DMA Tx Desc Transmit interrupt.
Kojto 110:165afa46840b 1695 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1696 * @retval None
Kojto 110:165afa46840b 1697 */
Kojto 110:165afa46840b 1698 #define __HAL_ETH_DMATXDESC_DISABLE_IT(__HANDLE__) ((__HANDLE__)->TxDesc->Status &= ~ETH_DMATXDESC_IC)
Kojto 110:165afa46840b 1699
Kojto 110:165afa46840b 1700 /**
Kojto 110:165afa46840b 1701 * @brief Selects the specified ETHERNET DMA Tx Desc Checksum Insertion.
Kojto 110:165afa46840b 1702 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1703 * @param __CHECKSUM__: specifies is the DMA Tx desc checksum insertion.
Kojto 110:165afa46840b 1704 * This parameter can be one of the following values:
Kojto 110:165afa46840b 1705 * @arg ETH_DMATXDESC_CHECKSUMBYPASS : Checksum bypass
Kojto 110:165afa46840b 1706 * @arg ETH_DMATXDESC_CHECKSUMIPV4HEADER : IPv4 header checksum
Kojto 110:165afa46840b 1707 * @arg ETH_DMATXDESC_CHECKSUMTCPUDPICMPSEGMENT : TCP/UDP/ICMP checksum. Pseudo header checksum is assumed to be present
Kojto 110:165afa46840b 1708 * @arg ETH_DMATXDESC_CHECKSUMTCPUDPICMPFULL : TCP/UDP/ICMP checksum fully in hardware including pseudo header
Kojto 110:165afa46840b 1709 * @retval None
Kojto 110:165afa46840b 1710 */
Kojto 110:165afa46840b 1711 #define __HAL_ETH_DMATXDESC_CHECKSUM_INSERTION(__HANDLE__, __CHECKSUM__) ((__HANDLE__)->TxDesc->Status |= (__CHECKSUM__))
Kojto 110:165afa46840b 1712
Kojto 110:165afa46840b 1713 /**
Kojto 110:165afa46840b 1714 * @brief Enables the DMA Tx Desc CRC.
Kojto 110:165afa46840b 1715 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1716 * @retval None
Kojto 110:165afa46840b 1717 */
Kojto 110:165afa46840b 1718 #define __HAL_ETH_DMATXDESC_CRC_ENABLE(__HANDLE__) ((__HANDLE__)->TxDesc->Status &= ~ETH_DMATXDESC_DC)
Kojto 110:165afa46840b 1719
Kojto 110:165afa46840b 1720 /**
Kojto 110:165afa46840b 1721 * @brief Disables the DMA Tx Desc CRC.
Kojto 110:165afa46840b 1722 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1723 * @retval None
Kojto 110:165afa46840b 1724 */
Kojto 110:165afa46840b 1725 #define __HAL_ETH_DMATXDESC_CRC_DISABLE(__HANDLE__) ((__HANDLE__)->TxDesc->Status |= ETH_DMATXDESC_DC)
Kojto 110:165afa46840b 1726
Kojto 110:165afa46840b 1727 /**
Kojto 110:165afa46840b 1728 * @brief Enables the DMA Tx Desc padding for frame shorter than 64 bytes.
Kojto 110:165afa46840b 1729 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1730 * @retval None
Kojto 110:165afa46840b 1731 */
Kojto 110:165afa46840b 1732 #define __HAL_ETH_DMATXDESC_SHORT_FRAME_PADDING_ENABLE(__HANDLE__) ((__HANDLE__)->TxDesc->Status &= ~ETH_DMATXDESC_DP)
Kojto 110:165afa46840b 1733
Kojto 110:165afa46840b 1734 /**
Kojto 110:165afa46840b 1735 * @brief Disables the DMA Tx Desc padding for frame shorter than 64 bytes.
Kojto 110:165afa46840b 1736 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1737 * @retval None
Kojto 110:165afa46840b 1738 */
Kojto 110:165afa46840b 1739 #define __HAL_ETH_DMATXDESC_SHORT_FRAME_PADDING_DISABLE(__HANDLE__) ((__HANDLE__)->TxDesc->Status |= ETH_DMATXDESC_DP)
Kojto 110:165afa46840b 1740
Kojto 110:165afa46840b 1741 /**
Kojto 110:165afa46840b 1742 * @brief Enables the specified ETHERNET MAC interrupts.
Kojto 110:165afa46840b 1743 * @param __HANDLE__ : ETH Handle
Kojto 110:165afa46840b 1744 * @param __INTERRUPT__: specifies the ETHERNET MAC interrupt sources to be
Kojto 110:165afa46840b 1745 * enabled or disabled.
Kojto 110:165afa46840b 1746 * This parameter can be any combination of the following values:
Kojto 110:165afa46840b 1747 * @arg ETH_MAC_IT_TST : Time stamp trigger interrupt
Kojto 110:165afa46840b 1748 * @arg ETH_MAC_IT_PMT : PMT interrupt
Kojto 110:165afa46840b 1749 * @retval None
Kojto 110:165afa46840b 1750 */
Kojto 110:165afa46840b 1751 #define __HAL_ETH_MAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MACIMR |= (__INTERRUPT__))
Kojto 110:165afa46840b 1752
Kojto 110:165afa46840b 1753 /**
Kojto 110:165afa46840b 1754 * @brief Disables the specified ETHERNET MAC interrupts.
Kojto 110:165afa46840b 1755 * @param __HANDLE__ : ETH Handle
Kojto 110:165afa46840b 1756 * @param __INTERRUPT__: specifies the ETHERNET MAC interrupt sources to be
Kojto 110:165afa46840b 1757 * enabled or disabled.
Kojto 110:165afa46840b 1758 * This parameter can be any combination of the following values:
Kojto 110:165afa46840b 1759 * @arg ETH_MAC_IT_TST : Time stamp trigger interrupt
Kojto 110:165afa46840b 1760 * @arg ETH_MAC_IT_PMT : PMT interrupt
Kojto 110:165afa46840b 1761 * @retval None
Kojto 110:165afa46840b 1762 */
Kojto 110:165afa46840b 1763 #define __HAL_ETH_MAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MACIMR &= ~(__INTERRUPT__))
Kojto 110:165afa46840b 1764
Kojto 110:165afa46840b 1765 /**
Kojto 110:165afa46840b 1766 * @brief Initiate a Pause Control Frame (Full-duplex only).
Kojto 110:165afa46840b 1767 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1768 * @retval None
Kojto 110:165afa46840b 1769 */
Kojto 110:165afa46840b 1770 #define __HAL_ETH_INITIATE_PAUSE_CONTROL_FRAME(__HANDLE__) ((__HANDLE__)->Instance->MACFCR |= ETH_MACFCR_FCBBPA)
Kojto 110:165afa46840b 1771
Kojto 110:165afa46840b 1772 /**
Kojto 110:165afa46840b 1773 * @brief Checks whether the ETHERNET flow control busy bit is set or not.
Kojto 110:165afa46840b 1774 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1775 * @retval The new state of flow control busy status bit (SET or RESET).
Kojto 110:165afa46840b 1776 */
Kojto 110:165afa46840b 1777 #define __HAL_ETH_GET_FLOW_CONTROL_BUSY_STATUS(__HANDLE__) (((__HANDLE__)->Instance->MACFCR & ETH_MACFCR_FCBBPA) == ETH_MACFCR_FCBBPA)
Kojto 110:165afa46840b 1778
Kojto 110:165afa46840b 1779 /**
Kojto 110:165afa46840b 1780 * @brief Enables the MAC Back Pressure operation activation (Half-duplex only).
Kojto 110:165afa46840b 1781 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1782 * @retval None
Kojto 110:165afa46840b 1783 */
Kojto 110:165afa46840b 1784 #define __HAL_ETH_BACK_PRESSURE_ACTIVATION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MACFCR |= ETH_MACFCR_FCBBPA)
Kojto 110:165afa46840b 1785
Kojto 110:165afa46840b 1786 /**
Kojto 110:165afa46840b 1787 * @brief Disables the MAC BackPressure operation activation (Half-duplex only).
Kojto 110:165afa46840b 1788 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1789 * @retval None
Kojto 110:165afa46840b 1790 */
Kojto 110:165afa46840b 1791 #define __HAL_ETH_BACK_PRESSURE_ACTIVATION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MACFCR &= ~ETH_MACFCR_FCBBPA)
Kojto 110:165afa46840b 1792
Kojto 110:165afa46840b 1793 /**
Kojto 110:165afa46840b 1794 * @brief Checks whether the specified ETHERNET MAC flag is set or not.
Kojto 110:165afa46840b 1795 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1796 * @param __FLAG__: specifies the flag to check.
Kojto 110:165afa46840b 1797 * This parameter can be one of the following values:
Kojto 110:165afa46840b 1798 * @arg ETH_MAC_FLAG_TST : Time stamp trigger flag
Kojto 110:165afa46840b 1799 * @arg ETH_MAC_FLAG_MMCT : MMC transmit flag
Kojto 110:165afa46840b 1800 * @arg ETH_MAC_FLAG_MMCR : MMC receive flag
Kojto 110:165afa46840b 1801 * @arg ETH_MAC_FLAG_MMC : MMC flag
Kojto 110:165afa46840b 1802 * @arg ETH_MAC_FLAG_PMT : PMT flag
Kojto 110:165afa46840b 1803 * @retval The state of ETHERNET MAC flag.
Kojto 110:165afa46840b 1804 */
Kojto 110:165afa46840b 1805 #define __HAL_ETH_MAC_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->MACSR &( __FLAG__)) == ( __FLAG__))
Kojto 110:165afa46840b 1806
Kojto 110:165afa46840b 1807 /**
Kojto 110:165afa46840b 1808 * @brief Enables the specified ETHERNET DMA interrupts.
Kojto 110:165afa46840b 1809 * @param __HANDLE__ : ETH Handle
Kojto 110:165afa46840b 1810 * @param __INTERRUPT__: specifies the ETHERNET DMA interrupt sources to be
Kojto 110:165afa46840b 1811 * enabled @ref ETH_DMA_Interrupts
Kojto 110:165afa46840b 1812 * @retval None
Kojto 110:165afa46840b 1813 */
Kojto 110:165afa46840b 1814 #define __HAL_ETH_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMAIER |= (__INTERRUPT__))
Kojto 110:165afa46840b 1815
Kojto 110:165afa46840b 1816 /**
Kojto 110:165afa46840b 1817 * @brief Disables the specified ETHERNET DMA interrupts.
Kojto 110:165afa46840b 1818 * @param __HANDLE__ : ETH Handle
Kojto 110:165afa46840b 1819 * @param __INTERRUPT__: specifies the ETHERNET DMA interrupt sources to be
Kojto 110:165afa46840b 1820 * disabled. @ref ETH_DMA_Interrupts
Kojto 110:165afa46840b 1821 * @retval None
Kojto 110:165afa46840b 1822 */
Kojto 110:165afa46840b 1823 #define __HAL_ETH_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMAIER &= ~(__INTERRUPT__))
Kojto 110:165afa46840b 1824
Kojto 110:165afa46840b 1825 /**
Kojto 110:165afa46840b 1826 * @brief Clears the ETHERNET DMA IT pending bit.
Kojto 110:165afa46840b 1827 * @param __HANDLE__ : ETH Handle
Kojto 110:165afa46840b 1828 * @param __INTERRUPT__: specifies the interrupt pending bit to clear. @ref ETH_DMA_Interrupts
Kojto 110:165afa46840b 1829 * @retval None
Kojto 110:165afa46840b 1830 */
Kojto 110:165afa46840b 1831 #define __HAL_ETH_DMA_CLEAR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMASR =(__INTERRUPT__))
Kojto 110:165afa46840b 1832
Kojto 110:165afa46840b 1833 /**
Kojto 110:165afa46840b 1834 * @brief Checks whether the specified ETHERNET DMA flag is set or not.
Kojto 110:165afa46840b 1835 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1836 * @param __FLAG__: specifies the flag to check. @ref ETH_DMA_Flags
Kojto 110:165afa46840b 1837 * @retval The new state of ETH_DMA_FLAG (SET or RESET).
Kojto 110:165afa46840b 1838 */
Kojto 110:165afa46840b 1839 #define __HAL_ETH_DMA_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->DMASR &( __FLAG__)) == ( __FLAG__))
Kojto 110:165afa46840b 1840
Kojto 110:165afa46840b 1841 /**
Kojto 110:165afa46840b 1842 * @brief Checks whether the specified ETHERNET DMA flag is set or not.
Kojto 110:165afa46840b 1843 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1844 * @param __FLAG__: specifies the flag to clear. @ref ETH_DMA_Flags
Kojto 110:165afa46840b 1845 * @retval The new state of ETH_DMA_FLAG (SET or RESET).
Kojto 110:165afa46840b 1846 */
Kojto 110:165afa46840b 1847 #define __HAL_ETH_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->DMASR = (__FLAG__))
Kojto 110:165afa46840b 1848
Kojto 110:165afa46840b 1849 /**
Kojto 110:165afa46840b 1850 * @brief Checks whether the specified ETHERNET DMA overflow flag is set or not.
Kojto 110:165afa46840b 1851 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1852 * @param __OVERFLOW__: specifies the DMA overflow flag to check.
Kojto 110:165afa46840b 1853 * This parameter can be one of the following values:
Kojto 110:165afa46840b 1854 * @arg ETH_DMA_OVERFLOW_RXFIFOCOUNTER : Overflow for FIFO Overflows Counter
Kojto 110:165afa46840b 1855 * @arg ETH_DMA_OVERFLOW_MISSEDFRAMECOUNTER : Overflow for Buffer Unavailable Missed Frame Counter
Kojto 110:165afa46840b 1856 * @retval The state of ETHERNET DMA overflow Flag (SET or RESET).
Kojto 110:165afa46840b 1857 */
Kojto 110:165afa46840b 1858 #define __HAL_ETH_GET_DMA_OVERFLOW_STATUS(__HANDLE__, __OVERFLOW__) (((__HANDLE__)->Instance->DMAMFBOCR & (__OVERFLOW__)) == (__OVERFLOW__))
Kojto 110:165afa46840b 1859
Kojto 110:165afa46840b 1860 /**
Kojto 110:165afa46840b 1861 * @brief Set the DMA Receive status watchdog timer register value
Kojto 110:165afa46840b 1862 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1863 * @param __VALUE__: DMA Receive status watchdog timer register value
Kojto 110:165afa46840b 1864 * @retval None
Kojto 110:165afa46840b 1865 */
Kojto 110:165afa46840b 1866 #define __HAL_ETH_SET_RECEIVE_WATCHDOG_TIMER(__HANDLE__, __VALUE__) ((__HANDLE__)->Instance->DMARSWTR = (__VALUE__))
Kojto 110:165afa46840b 1867
Kojto 110:165afa46840b 1868 /**
Kojto 110:165afa46840b 1869 * @brief Enables any unicast packet filtered by the MAC address
Kojto 110:165afa46840b 1870 * recognition to be a wake-up frame.
Kojto 110:165afa46840b 1871 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1872 * @retval None
Kojto 110:165afa46840b 1873 */
Kojto 110:165afa46840b 1874 #define __HAL_ETH_GLOBAL_UNICAST_WAKEUP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR |= ETH_MACPMTCSR_GU)
Kojto 110:165afa46840b 1875
Kojto 110:165afa46840b 1876 /**
Kojto 110:165afa46840b 1877 * @brief Disables any unicast packet filtered by the MAC address
Kojto 110:165afa46840b 1878 * recognition to be a wake-up frame.
Kojto 110:165afa46840b 1879 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1880 * @retval None
Kojto 110:165afa46840b 1881 */
Kojto 110:165afa46840b 1882 #define __HAL_ETH_GLOBAL_UNICAST_WAKEUP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR &= ~ETH_MACPMTCSR_GU)
Kojto 110:165afa46840b 1883
Kojto 110:165afa46840b 1884 /**
Kojto 110:165afa46840b 1885 * @brief Enables the MAC Wake-Up Frame Detection.
Kojto 110:165afa46840b 1886 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1887 * @retval None
Kojto 110:165afa46840b 1888 */
Kojto 110:165afa46840b 1889 #define __HAL_ETH_WAKEUP_FRAME_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR |= ETH_MACPMTCSR_WFE)
Kojto 110:165afa46840b 1890
Kojto 110:165afa46840b 1891 /**
Kojto 110:165afa46840b 1892 * @brief Disables the MAC Wake-Up Frame Detection.
Kojto 110:165afa46840b 1893 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1894 * @retval None
Kojto 110:165afa46840b 1895 */
Kojto 110:165afa46840b 1896 #define __HAL_ETH_WAKEUP_FRAME_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR &= ~ETH_MACPMTCSR_WFE)
Kojto 110:165afa46840b 1897
Kojto 110:165afa46840b 1898 /**
Kojto 110:165afa46840b 1899 * @brief Enables the MAC Magic Packet Detection.
Kojto 110:165afa46840b 1900 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1901 * @retval None
Kojto 110:165afa46840b 1902 */
Kojto 110:165afa46840b 1903 #define __HAL_ETH_MAGIC_PACKET_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR |= ETH_MACPMTCSR_MPE)
Kojto 110:165afa46840b 1904
Kojto 110:165afa46840b 1905 /**
Kojto 110:165afa46840b 1906 * @brief Disables the MAC Magic Packet Detection.
Kojto 110:165afa46840b 1907 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1908 * @retval None
Kojto 110:165afa46840b 1909 */
Kojto 110:165afa46840b 1910 #define __HAL_ETH_MAGIC_PACKET_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR &= ~ETH_MACPMTCSR_WFE)
Kojto 110:165afa46840b 1911
Kojto 110:165afa46840b 1912 /**
Kojto 110:165afa46840b 1913 * @brief Enables the MAC Power Down.
Kojto 110:165afa46840b 1914 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1915 * @retval None
Kojto 110:165afa46840b 1916 */
Kojto 110:165afa46840b 1917 #define __HAL_ETH_POWER_DOWN_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR |= ETH_MACPMTCSR_PD)
Kojto 110:165afa46840b 1918
Kojto 110:165afa46840b 1919 /**
Kojto 110:165afa46840b 1920 * @brief Disables the MAC Power Down.
Kojto 110:165afa46840b 1921 * @param __HANDLE__: ETH Handle
Kojto 110:165afa46840b 1922 * @retval None
Kojto 110:165afa46840b 1923 */
Kojto 110:165afa46840b 1924 #define __HAL_ETH_POWER_DOWN_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR &= ~ETH_MACPMTCSR_PD)
Kojto 110:165afa46840b 1925
Kojto 110:165afa46840b 1926 /**
Kojto 110:165afa46840b 1927 * @brief Checks whether the specified ETHERNET PMT flag is set or not.
Kojto 110:165afa46840b 1928 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1929 * @param __FLAG__: specifies the flag to check.
Kojto 110:165afa46840b 1930 * This parameter can be one of the following values:
Kojto 110:165afa46840b 1931 * @arg ETH_PMT_FLAG_WUFFRPR : Wake-Up Frame Filter Register Pointer Reset
Kojto 110:165afa46840b 1932 * @arg ETH_PMT_FLAG_WUFR : Wake-Up Frame Received
Kojto 110:165afa46840b 1933 * @arg ETH_PMT_FLAG_MPR : Magic Packet Received
Kojto 110:165afa46840b 1934 * @retval The new state of ETHERNET PMT Flag (SET or RESET).
Kojto 110:165afa46840b 1935 */
Kojto 110:165afa46840b 1936 #define __HAL_ETH_GET_PMT_FLAG_STATUS(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->MACPMTCSR &( __FLAG__)) == ( __FLAG__))
Kojto 110:165afa46840b 1937
Kojto 110:165afa46840b 1938 /**
Kojto 110:165afa46840b 1939 * @brief Preset and Initialize the MMC counters to almost-full value: 0xFFFF_FFF0 (full - 16)
Kojto 110:165afa46840b 1940 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1941 * @retval None
Kojto 110:165afa46840b 1942 */
Kojto 110:165afa46840b 1943 #define __HAL_ETH_MMC_COUNTER_FULL_PRESET(__HANDLE__) ((__HANDLE__)->Instance->MMCCR |= (ETH_MMCCR_MCFHP | ETH_MMCCR_MCP))
Kojto 110:165afa46840b 1944
Kojto 110:165afa46840b 1945 /**
Kojto 110:165afa46840b 1946 * @brief Preset and Initialize the MMC counters to almost-half value: 0x7FFF_FFF0 (half - 16)
Kojto 110:165afa46840b 1947 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1948 * @retval None
Kojto 110:165afa46840b 1949 */
Kojto 110:165afa46840b 1950 #define __HAL_ETH_MMC_COUNTER_HALF_PRESET(__HANDLE__) do{(__HANDLE__)->Instance->MMCCR &= ~ETH_MMCCR_MCFHP;\
Kojto 110:165afa46840b 1951 (__HANDLE__)->Instance->MMCCR |= ETH_MMCCR_MCP;} while (0)
Kojto 110:165afa46840b 1952
Kojto 110:165afa46840b 1953 /**
Kojto 110:165afa46840b 1954 * @brief Enables the MMC Counter Freeze.
Kojto 110:165afa46840b 1955 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1956 * @retval None
Kojto 110:165afa46840b 1957 */
Kojto 110:165afa46840b 1958 #define __HAL_ETH_MMC_COUNTER_FREEZE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MMCCR |= ETH_MMCCR_MCF)
Kojto 110:165afa46840b 1959
Kojto 110:165afa46840b 1960 /**
Kojto 110:165afa46840b 1961 * @brief Disables the MMC Counter Freeze.
Kojto 110:165afa46840b 1962 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1963 * @retval None
Kojto 110:165afa46840b 1964 */
Kojto 110:165afa46840b 1965 #define __HAL_ETH_MMC_COUNTER_FREEZE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MMCCR &= ~ETH_MMCCR_MCF)
Kojto 110:165afa46840b 1966
Kojto 110:165afa46840b 1967 /**
Kojto 110:165afa46840b 1968 * @brief Enables the MMC Reset On Read.
Kojto 110:165afa46840b 1969 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1970 * @retval None
Kojto 110:165afa46840b 1971 */
Kojto 110:165afa46840b 1972 #define __HAL_ETH_ETH_MMC_RESET_ONREAD_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MMCCR |= ETH_MMCCR_ROR)
Kojto 110:165afa46840b 1973
Kojto 110:165afa46840b 1974 /**
Kojto 110:165afa46840b 1975 * @brief Disables the MMC Reset On Read.
Kojto 110:165afa46840b 1976 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1977 * @retval None
Kojto 110:165afa46840b 1978 */
Kojto 110:165afa46840b 1979 #define __HAL_ETH_ETH_MMC_RESET_ONREAD_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MMCCR &= ~ETH_MMCCR_ROR)
Kojto 110:165afa46840b 1980
Kojto 110:165afa46840b 1981 /**
Kojto 110:165afa46840b 1982 * @brief Enables the MMC Counter Stop Rollover.
Kojto 110:165afa46840b 1983 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1984 * @retval None
Kojto 110:165afa46840b 1985 */
Kojto 110:165afa46840b 1986 #define __HAL_ETH_ETH_MMC_COUNTER_ROLLOVER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MMCCR &= ~ETH_MMCCR_CSR)
Kojto 110:165afa46840b 1987
Kojto 110:165afa46840b 1988 /**
Kojto 110:165afa46840b 1989 * @brief Disables the MMC Counter Stop Rollover.
Kojto 110:165afa46840b 1990 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1991 * @retval None
Kojto 110:165afa46840b 1992 */
Kojto 110:165afa46840b 1993 #define __HAL_ETH_ETH_MMC_COUNTER_ROLLOVER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MMCCR |= ETH_MMCCR_CSR)
Kojto 110:165afa46840b 1994
Kojto 110:165afa46840b 1995 /**
Kojto 110:165afa46840b 1996 * @brief Resets the MMC Counters.
Kojto 110:165afa46840b 1997 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 1998 * @retval None
Kojto 110:165afa46840b 1999 */
Kojto 110:165afa46840b 2000 #define __HAL_ETH_MMC_COUNTERS_RESET(__HANDLE__) ((__HANDLE__)->Instance->MMCCR |= ETH_MMCCR_CR)
Kojto 110:165afa46840b 2001
Kojto 110:165afa46840b 2002 /**
Kojto 110:165afa46840b 2003 * @brief Enables the specified ETHERNET MMC Rx interrupts.
Kojto 110:165afa46840b 2004 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 2005 * @param __INTERRUPT__: specifies the ETHERNET MMC interrupt sources to be enabled or disabled.
Kojto 110:165afa46840b 2006 * This parameter can be one of the following values:
Kojto 110:165afa46840b 2007 * @arg ETH_MMC_IT_RGUF : When Rx good unicast frames counter reaches half the maximum value
Kojto 110:165afa46840b 2008 * @arg ETH_MMC_IT_RFAE : When Rx alignment error counter reaches half the maximum value
Kojto 110:165afa46840b 2009 * @arg ETH_MMC_IT_RFCE : When Rx crc error counter reaches half the maximum value
Kojto 110:165afa46840b 2010 * @retval None
Kojto 110:165afa46840b 2011 */
Kojto 110:165afa46840b 2012 #define __HAL_ETH_MMC_RX_IT_ENABLE(__HANDLE__, __INTERRUPT__) (__HANDLE__)->Instance->MMCRIMR &= ~((__INTERRUPT__) & 0xEFFFFFFF)
Kojto 110:165afa46840b 2013 /**
Kojto 110:165afa46840b 2014 * @brief Disables the specified ETHERNET MMC Rx interrupts.
Kojto 110:165afa46840b 2015 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 2016 * @param __INTERRUPT__: specifies the ETHERNET MMC interrupt sources to be enabled or disabled.
Kojto 110:165afa46840b 2017 * This parameter can be one of the following values:
Kojto 110:165afa46840b 2018 * @arg ETH_MMC_IT_RGUF : When Rx good unicast frames counter reaches half the maximum value
Kojto 110:165afa46840b 2019 * @arg ETH_MMC_IT_RFAE : When Rx alignment error counter reaches half the maximum value
Kojto 110:165afa46840b 2020 * @arg ETH_MMC_IT_RFCE : When Rx crc error counter reaches half the maximum value
Kojto 110:165afa46840b 2021 * @retval None
Kojto 110:165afa46840b 2022 */
Kojto 110:165afa46840b 2023 #define __HAL_ETH_MMC_RX_IT_DISABLE(__HANDLE__, __INTERRUPT__) (__HANDLE__)->Instance->MMCRIMR |= ((__INTERRUPT__) & 0xEFFFFFFF)
Kojto 110:165afa46840b 2024 /**
Kojto 110:165afa46840b 2025 * @brief Enables the specified ETHERNET MMC Tx interrupts.
Kojto 110:165afa46840b 2026 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 2027 * @param __INTERRUPT__: specifies the ETHERNET MMC interrupt sources to be enabled or disabled.
Kojto 110:165afa46840b 2028 * This parameter can be one of the following values:
Kojto 110:165afa46840b 2029 * @arg ETH_MMC_IT_TGF : When Tx good frame counter reaches half the maximum value
Kojto 110:165afa46840b 2030 * @arg ETH_MMC_IT_TGFMSC: When Tx good multi col counter reaches half the maximum value
Kojto 110:165afa46840b 2031 * @arg ETH_MMC_IT_TGFSC : When Tx good single col counter reaches half the maximum value
Kojto 110:165afa46840b 2032 * @retval None
Kojto 110:165afa46840b 2033 */
Kojto 110:165afa46840b 2034 #define __HAL_ETH_MMC_TX_IT_ENABLE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MMCRIMR &= ~ (__INTERRUPT__))
Kojto 110:165afa46840b 2035
Kojto 110:165afa46840b 2036 /**
Kojto 110:165afa46840b 2037 * @brief Disables the specified ETHERNET MMC Tx interrupts.
Kojto 110:165afa46840b 2038 * @param __HANDLE__: ETH Handle.
Kojto 110:165afa46840b 2039 * @param __INTERRUPT__: specifies the ETHERNET MMC interrupt sources to be enabled or disabled.
Kojto 110:165afa46840b 2040 * This parameter can be one of the following values:
Kojto 110:165afa46840b 2041 * @arg ETH_MMC_IT_TGF : When Tx good frame counter reaches half the maximum value
Kojto 110:165afa46840b 2042 * @arg ETH_MMC_IT_TGFMSC: When Tx good multi col counter reaches half the maximum value
Kojto 110:165afa46840b 2043 * @arg ETH_MMC_IT_TGFSC : When Tx good single col counter reaches half the maximum value
Kojto 110:165afa46840b 2044 * @retval None
Kojto 110:165afa46840b 2045 */
Kojto 110:165afa46840b 2046 #define __HAL_ETH_MMC_TX_IT_DISABLE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MMCRIMR |= (__INTERRUPT__))
Kojto 110:165afa46840b 2047
Kojto 110:165afa46840b 2048 /**
Kojto 110:165afa46840b 2049 * @brief Enables the ETH External interrupt line.
Kojto 110:165afa46840b 2050 * @retval None
Kojto 110:165afa46840b 2051 */
Kojto 110:165afa46840b 2052 #define __HAL_ETH_WAKEUP_EXTI_ENABLE_IT() EXTI->IMR |= (ETH_EXTI_LINE_WAKEUP)
Kojto 110:165afa46840b 2053
Kojto 110:165afa46840b 2054 /**
Kojto 110:165afa46840b 2055 * @brief Disables the ETH External interrupt line.
Kojto 110:165afa46840b 2056 * @retval None
Kojto 110:165afa46840b 2057 */
Kojto 110:165afa46840b 2058 #define __HAL_ETH_WAKEUP_EXTI_DISABLE_IT() EXTI->IMR &= ~(ETH_EXTI_LINE_WAKEUP)
Kojto 110:165afa46840b 2059
Kojto 110:165afa46840b 2060 /**
Kojto 110:165afa46840b 2061 * @brief Enable event on ETH External event line.
Kojto 110:165afa46840b 2062 * @retval None.
Kojto 110:165afa46840b 2063 */
Kojto 110:165afa46840b 2064 #define __HAL_ETH_WAKEUP_EXTI_ENABLE_EVENT() EXTI->EMR |= (ETH_EXTI_LINE_WAKEUP)
Kojto 110:165afa46840b 2065
Kojto 110:165afa46840b 2066 /**
Kojto 110:165afa46840b 2067 * @brief Disable event on ETH External event line
Kojto 110:165afa46840b 2068 * @retval None.
Kojto 110:165afa46840b 2069 */
Kojto 110:165afa46840b 2070 #define __HAL_ETH_WAKEUP_EXTI_DISABLE_EVENT() EXTI->EMR &= ~(ETH_EXTI_LINE_WAKEUP)
Kojto 110:165afa46840b 2071
Kojto 110:165afa46840b 2072 /**
Kojto 110:165afa46840b 2073 * @brief Get flag of the ETH External interrupt line.
Kojto 110:165afa46840b 2074 * @retval None
Kojto 110:165afa46840b 2075 */
Kojto 110:165afa46840b 2076 #define __HAL_ETH_WAKEUP_EXTI_GET_FLAG() EXTI->PR & (ETH_EXTI_LINE_WAKEUP)
Kojto 110:165afa46840b 2077
Kojto 110:165afa46840b 2078 /**
Kojto 110:165afa46840b 2079 * @brief Clear flag of the ETH External interrupt line.
Kojto 110:165afa46840b 2080 * @retval None
Kojto 110:165afa46840b 2081 */
Kojto 110:165afa46840b 2082 #define __HAL_ETH_WAKEUP_EXTI_CLEAR_FLAG() EXTI->PR = (ETH_EXTI_LINE_WAKEUP)
Kojto 110:165afa46840b 2083
Kojto 110:165afa46840b 2084 /**
Kojto 110:165afa46840b 2085 * @brief Enables rising edge trigger to the ETH External interrupt line.
Kojto 110:165afa46840b 2086 * @retval None
Kojto 110:165afa46840b 2087 */
Kojto 110:165afa46840b 2088 #define __HAL_ETH_WAKEUP_EXTI_ENABLE_RISING_EDGE_TRIGGER() EXTI->RTSR |= ETH_EXTI_LINE_WAKEUP
Kojto 110:165afa46840b 2089
Kojto 110:165afa46840b 2090 /**
Kojto 110:165afa46840b 2091 * @brief Disables the rising edge trigger to the ETH External interrupt line.
Kojto 110:165afa46840b 2092 * @retval None
Kojto 110:165afa46840b 2093 */
Kojto 110:165afa46840b 2094 #define __HAL_ETH_WAKEUP_EXTI_DISABLE_RISING_EDGE_TRIGGER() EXTI->RTSR &= ~(ETH_EXTI_LINE_WAKEUP)
Kojto 110:165afa46840b 2095
Kojto 110:165afa46840b 2096 /**
Kojto 110:165afa46840b 2097 * @brief Enables falling edge trigger to the ETH External interrupt line.
Kojto 110:165afa46840b 2098 * @retval None
Kojto 110:165afa46840b 2099 */
Kojto 110:165afa46840b 2100 #define __HAL_ETH_WAKEUP_EXTI_ENABLE_FALLING_EDGE_TRIGGER() EXTI->FTSR |= (ETH_EXTI_LINE_WAKEUP)
Kojto 110:165afa46840b 2101
Kojto 110:165afa46840b 2102 /**
Kojto 110:165afa46840b 2103 * @brief Disables falling edge trigger to the ETH External interrupt line.
Kojto 110:165afa46840b 2104 * @retval None
Kojto 110:165afa46840b 2105 */
Kojto 110:165afa46840b 2106 #define __HAL_ETH_WAKEUP_EXTI_DISABLE_FALLING_EDGE_TRIGGER() EXTI->FTSR &= ~(ETH_EXTI_LINE_WAKEUP)
Kojto 110:165afa46840b 2107
Kojto 110:165afa46840b 2108 /**
Kojto 110:165afa46840b 2109 * @brief Enables rising/falling edge trigger to the ETH External interrupt line.
Kojto 110:165afa46840b 2110 * @retval None
Kojto 110:165afa46840b 2111 */
Kojto 110:165afa46840b 2112 #define __HAL_ETH_WAKEUP_EXTI_ENABLE_FALLINGRISING_TRIGGER() EXTI->RTSR |= ETH_EXTI_LINE_WAKEUP;\
Kojto 110:165afa46840b 2113 EXTI->FTSR |= ETH_EXTI_LINE_WAKEUP
Kojto 110:165afa46840b 2114
Kojto 110:165afa46840b 2115 /**
Kojto 110:165afa46840b 2116 * @brief Disables rising/falling edge trigger to the ETH External interrupt line.
Kojto 110:165afa46840b 2117 * @retval None
Kojto 110:165afa46840b 2118 */
Kojto 110:165afa46840b 2119 #define __HAL_ETH_WAKEUP_EXTI_DISABLE_FALLINGRISING_TRIGGER() EXTI->RTSR &= ~(ETH_EXTI_LINE_WAKEUP);\
Kojto 110:165afa46840b 2120 EXTI->FTSR &= ~(ETH_EXTI_LINE_WAKEUP)
Kojto 110:165afa46840b 2121
Kojto 110:165afa46840b 2122 /**
Kojto 110:165afa46840b 2123 * @brief Generate a Software interrupt on selected EXTI line.
Kojto 110:165afa46840b 2124 * @retval None.
Kojto 110:165afa46840b 2125 */
Kojto 110:165afa46840b 2126 #define __HAL_ETH_WAKEUP_EXTI_GENERATE_SWIT() EXTI->SWIER|= ETH_EXTI_LINE_WAKEUP
Kojto 110:165afa46840b 2127
Kojto 110:165afa46840b 2128 /**
Kojto 110:165afa46840b 2129 * @}
Kojto 110:165afa46840b 2130 */
Kojto 110:165afa46840b 2131 /* Exported functions --------------------------------------------------------*/
Kojto 110:165afa46840b 2132
Kojto 110:165afa46840b 2133 /** @addtogroup ETH_Exported_Functions
Kojto 110:165afa46840b 2134 * @{
Kojto 110:165afa46840b 2135 */
Kojto 110:165afa46840b 2136
Kojto 110:165afa46840b 2137 /* Initialization and de-initialization functions ****************************/
Kojto 110:165afa46840b 2138
Kojto 110:165afa46840b 2139 /** @addtogroup ETH_Exported_Functions_Group1
Kojto 110:165afa46840b 2140 * @{
Kojto 110:165afa46840b 2141 */
Kojto 110:165afa46840b 2142 HAL_StatusTypeDef HAL_ETH_Init(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2143 HAL_StatusTypeDef HAL_ETH_DeInit(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2144 void HAL_ETH_MspInit(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2145 void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2146 HAL_StatusTypeDef HAL_ETH_DMATxDescListInit(ETH_HandleTypeDef *heth, ETH_DMADescTypeDef *DMATxDescTab, uint8_t* TxBuff, uint32_t TxBuffCount);
Kojto 110:165afa46840b 2147 HAL_StatusTypeDef HAL_ETH_DMARxDescListInit(ETH_HandleTypeDef *heth, ETH_DMADescTypeDef *DMARxDescTab, uint8_t *RxBuff, uint32_t RxBuffCount);
Kojto 110:165afa46840b 2148
Kojto 110:165afa46840b 2149 /**
Kojto 110:165afa46840b 2150 * @}
Kojto 110:165afa46840b 2151 */
Kojto 110:165afa46840b 2152 /* IO operation functions ****************************************************/
Kojto 110:165afa46840b 2153
Kojto 110:165afa46840b 2154 /** @addtogroup ETH_Exported_Functions_Group2
Kojto 110:165afa46840b 2155 * @{
Kojto 110:165afa46840b 2156 */
Kojto 110:165afa46840b 2157 HAL_StatusTypeDef HAL_ETH_TransmitFrame(ETH_HandleTypeDef *heth, uint32_t FrameLength);
Kojto 110:165afa46840b 2158 HAL_StatusTypeDef HAL_ETH_GetReceivedFrame(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2159 /* Communication with PHY functions*/
Kojto 110:165afa46840b 2160 HAL_StatusTypeDef HAL_ETH_ReadPHYRegister(ETH_HandleTypeDef *heth, uint16_t PHYReg, uint32_t *RegValue);
Kojto 110:165afa46840b 2161 HAL_StatusTypeDef HAL_ETH_WritePHYRegister(ETH_HandleTypeDef *heth, uint16_t PHYReg, uint32_t RegValue);
Kojto 110:165afa46840b 2162 /* Non-Blocking mode: Interrupt */
Kojto 110:165afa46840b 2163 HAL_StatusTypeDef HAL_ETH_GetReceivedFrame_IT(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2164 void HAL_ETH_IRQHandler(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2165 /* Callback in non blocking modes (Interrupt) */
Kojto 110:165afa46840b 2166 void HAL_ETH_TxCpltCallback(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2167 void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2168 void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2169 /**
Kojto 110:165afa46840b 2170 * @}
Kojto 110:165afa46840b 2171 */
Kojto 110:165afa46840b 2172
Kojto 110:165afa46840b 2173 /* Peripheral Control functions **********************************************/
Kojto 110:165afa46840b 2174
Kojto 110:165afa46840b 2175 /** @addtogroup ETH_Exported_Functions_Group3
Kojto 110:165afa46840b 2176 * @{
Kojto 110:165afa46840b 2177 */
Kojto 110:165afa46840b 2178
Kojto 110:165afa46840b 2179 HAL_StatusTypeDef HAL_ETH_Start(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2180 HAL_StatusTypeDef HAL_ETH_Stop(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2181 HAL_StatusTypeDef HAL_ETH_ConfigMAC(ETH_HandleTypeDef *heth, ETH_MACInitTypeDef *macconf);
Kojto 110:165afa46840b 2182 HAL_StatusTypeDef HAL_ETH_ConfigDMA(ETH_HandleTypeDef *heth, ETH_DMAInitTypeDef *dmaconf);
Kojto 110:165afa46840b 2183 /**
Kojto 110:165afa46840b 2184 * @}
Kojto 110:165afa46840b 2185 */
Kojto 110:165afa46840b 2186
Kojto 110:165afa46840b 2187 /* Peripheral State functions ************************************************/
Kojto 110:165afa46840b 2188
Kojto 110:165afa46840b 2189 /** @addtogroup ETH_Exported_Functions_Group4
Kojto 110:165afa46840b 2190 * @{
Kojto 110:165afa46840b 2191 */
Kojto 110:165afa46840b 2192 HAL_ETH_StateTypeDef HAL_ETH_GetState(ETH_HandleTypeDef *heth);
Kojto 110:165afa46840b 2193 /**
Kojto 110:165afa46840b 2194 * @}
Kojto 110:165afa46840b 2195 */
Kojto 110:165afa46840b 2196
Kojto 110:165afa46840b 2197 /**
Kojto 110:165afa46840b 2198 * @}
Kojto 110:165afa46840b 2199 */
Kojto 110:165afa46840b 2200
Kojto 110:165afa46840b 2201 /**
Kojto 110:165afa46840b 2202 * @}
Kojto 110:165afa46840b 2203 */
Kojto 110:165afa46840b 2204
Kojto 110:165afa46840b 2205 /**
Kojto 110:165afa46840b 2206 * @}
Kojto 110:165afa46840b 2207 */
Kojto 110:165afa46840b 2208
Kojto 110:165afa46840b 2209 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx ||\
Kojto 110:165afa46840b 2210 STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 110:165afa46840b 2211
Kojto 110:165afa46840b 2212 #ifdef __cplusplus
Kojto 110:165afa46840b 2213 }
Kojto 110:165afa46840b 2214 #endif
Kojto 110:165afa46840b 2215
Kojto 110:165afa46840b 2216 #endif /* __STM32F4xx_HAL_ETH_H */
Kojto 110:165afa46840b 2217
Kojto 110:165afa46840b 2218
Kojto 110:165afa46840b 2219 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/