STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
stm32f7xx_hal_eth.c
Go to the documentation of this file.
1 
98 /* Includes ------------------------------------------------------------------*/
99 #include "stm32f7xx_hal.h"
100 
110 #ifdef HAL_ETH_MODULE_ENABLED
111 
112 /* Private typedef -----------------------------------------------------------*/
113 /* Private define ------------------------------------------------------------*/
117 #define ETH_TIMEOUT_SWRESET ((uint32_t)500)
118 #define ETH_TIMEOUT_LINKED_STATE ((uint32_t)5000)
119 #define ETH_TIMEOUT_AUTONEGO_COMPLETED ((uint32_t)5000)
120 
124 /* Private macro -------------------------------------------------------------*/
125 /* Private variables ---------------------------------------------------------*/
126 /* Private function prototypes -----------------------------------------------*/
130 static void ETH_MACDMAConfig(ETH_HandleTypeDef *heth, uint32_t err);
131 static void ETH_MACAddressConfig(ETH_HandleTypeDef *heth, uint32_t MacAddr, uint8_t *Addr);
132 static void ETH_MACReceptionEnable(ETH_HandleTypeDef *heth);
133 static void ETH_MACReceptionDisable(ETH_HandleTypeDef *heth);
134 static void ETH_MACTransmissionEnable(ETH_HandleTypeDef *heth);
135 static void ETH_MACTransmissionDisable(ETH_HandleTypeDef *heth);
136 static void ETH_DMATransmissionEnable(ETH_HandleTypeDef *heth);
137 static void ETH_DMATransmissionDisable(ETH_HandleTypeDef *heth);
138 static void ETH_DMAReceptionEnable(ETH_HandleTypeDef *heth);
139 static void ETH_DMAReceptionDisable(ETH_HandleTypeDef *heth);
140 static void ETH_FlushTransmitFIFO(ETH_HandleTypeDef *heth);
141 
145 /* Private functions ---------------------------------------------------------*/
146 
174 {
175  uint32_t tempreg = 0, phyreg = 0;
176  uint32_t hclk = 60000000;
177  uint32_t tickstart = 0;
178  uint32_t err = ETH_SUCCESS;
179 
180  /* Check the ETH peripheral state */
181  if(heth == NULL)
182  {
183  return HAL_ERROR;
184  }
185 
186  /* Check parameters */
191 
192  if(heth->State == HAL_ETH_STATE_RESET)
193  {
194  /* Allocate lock resource and initialize it */
195  heth->Lock = HAL_UNLOCKED;
196  /* Init the low level hardware : GPIO, CLOCK, NVIC. */
197  HAL_ETH_MspInit(heth);
198  }
199 
200  /* Enable SYSCFG Clock */
202 
203  /* Select MII or RMII Mode*/
204  SYSCFG->PMC &= ~(SYSCFG_PMC_MII_RMII_SEL);
205  SYSCFG->PMC |= (uint32_t)heth->Init.MediaInterface;
206 
207  /* Ethernet Software reset */
208  /* Set the SWR bit: resets all MAC subsystem internal registers and logic */
209  /* After reset all the registers holds their respective reset values */
210  (heth->Instance)->DMABMR |= ETH_DMABMR_SR;
211 
212  /* Get tick */
213  tickstart = HAL_GetTick();
214 
215  /* Wait for software reset */
216  while (((heth->Instance)->DMABMR & ETH_DMABMR_SR) != (uint32_t)RESET)
217  {
218  /* Check for the Timeout */
219  if((HAL_GetTick() - tickstart ) > ETH_TIMEOUT_SWRESET)
220  {
222 
223  /* Process Unlocked */
224  __HAL_UNLOCK(heth);
225 
226  /* Note: The SWR is not performed if the ETH_RX_CLK or the ETH_TX_CLK are
227  not available, please check your external PHY or the IO configuration */
228 
229  return HAL_TIMEOUT;
230  }
231  }
232 
233  /*-------------------------------- MAC Initialization ----------------------*/
234  /* Get the ETHERNET MACMIIAR value */
235  tempreg = (heth->Instance)->MACMIIAR;
236  /* Clear CSR Clock Range CR[2:0] bits */
237  tempreg &= ETH_MACMIIAR_CR_MASK;
238 
239  /* Get hclk frequency value */
240  hclk = HAL_RCC_GetHCLKFreq();
241 
242  /* Set CR bits depending on hclk value */
243  if((hclk >= 20000000)&&(hclk < 35000000))
244  {
245  /* CSR Clock Range between 20-35 MHz */
246  tempreg |= (uint32_t)ETH_MACMIIAR_CR_Div16;
247  }
248  else if((hclk >= 35000000)&&(hclk < 60000000))
249  {
250  /* CSR Clock Range between 35-60 MHz */
251  tempreg |= (uint32_t)ETH_MACMIIAR_CR_Div26;
252  }
253  else if((hclk >= 60000000)&&(hclk < 100000000))
254  {
255  /* CSR Clock Range between 60-100 MHz */
256  tempreg |= (uint32_t)ETH_MACMIIAR_CR_Div42;
257  }
258  else if((hclk >= 100000000)&&(hclk < 150000000))
259  {
260  /* CSR Clock Range between 100-150 MHz */
261  tempreg |= (uint32_t)ETH_MACMIIAR_CR_Div62;
262  }
263  else /* ((hclk >= 150000000)&&(hclk <= 216000000)) */
264  {
265  /* CSR Clock Range between 150-216 MHz */
266  tempreg |= (uint32_t)ETH_MACMIIAR_CR_Div102;
267  }
268 
269  /* Write to ETHERNET MAC MIIAR: Configure the ETHERNET CSR Clock Range */
270  (heth->Instance)->MACMIIAR = (uint32_t)tempreg;
271 
272  /*-------------------- PHY initialization and configuration ----------------*/
273  /* Put the PHY in reset mode */
275  {
276  /* In case of write timeout */
277  err = ETH_ERROR;
278 
279  /* Config MAC and DMA */
280  ETH_MACDMAConfig(heth, err);
281 
282  /* Set the ETH peripheral state to READY */
283  heth->State = HAL_ETH_STATE_READY;
284 
285  /* Return HAL_ERROR */
286  return HAL_ERROR;
287  }
288 
289  /* Delay to assure PHY reset */
291 
292  if((heth->Init).AutoNegotiation != ETH_AUTONEGOTIATION_DISABLE)
293  {
294  /* Get tick */
295  tickstart = HAL_GetTick();
296 
297  /* We wait for linked status */
298  do
299  {
300  HAL_ETH_ReadPHYRegister(heth, PHY_BSR, &phyreg);
301 
302  /* Check for the Timeout */
303  if((HAL_GetTick() - tickstart ) > ETH_TIMEOUT_LINKED_STATE)
304  {
305  /* In case of write timeout */
306  err = ETH_ERROR;
307 
308  /* Config MAC and DMA */
309  ETH_MACDMAConfig(heth, err);
310 
311  heth->State= HAL_ETH_STATE_READY;
312 
313  /* Process Unlocked */
314  __HAL_UNLOCK(heth);
315 
316  return HAL_TIMEOUT;
317  }
318  } while (((phyreg & PHY_LINKED_STATUS) != PHY_LINKED_STATUS));
319 
320 
321  /* Enable Auto-Negotiation */
323  {
324  /* In case of write timeout */
325  err = ETH_ERROR;
326 
327  /* Config MAC and DMA */
328  ETH_MACDMAConfig(heth, err);
329 
330  /* Set the ETH peripheral state to READY */
331  heth->State = HAL_ETH_STATE_READY;
332 
333  /* Return HAL_ERROR */
334  return HAL_ERROR;
335  }
336 
337  /* Get tick */
338  tickstart = HAL_GetTick();
339 
340  /* Wait until the auto-negotiation will be completed */
341  do
342  {
343  HAL_ETH_ReadPHYRegister(heth, PHY_BSR, &phyreg);
344 
345  /* Check for the Timeout */
346  if((HAL_GetTick() - tickstart ) > ETH_TIMEOUT_AUTONEGO_COMPLETED)
347  {
348  /* In case of write timeout */
349  err = ETH_ERROR;
350 
351  /* Config MAC and DMA */
352  ETH_MACDMAConfig(heth, err);
353 
354  heth->State= HAL_ETH_STATE_READY;
355 
356  /* Process Unlocked */
357  __HAL_UNLOCK(heth);
358 
359  return HAL_TIMEOUT;
360  }
361 
362  } while (((phyreg & PHY_AUTONEGO_COMPLETE) != PHY_AUTONEGO_COMPLETE));
363 
364  /* Read the result of the auto-negotiation */
365  if((HAL_ETH_ReadPHYRegister(heth, PHY_SR, &phyreg)) != HAL_OK)
366  {
367  /* In case of write timeout */
368  err = ETH_ERROR;
369 
370  /* Config MAC and DMA */
371  ETH_MACDMAConfig(heth, err);
372 
373  /* Set the ETH peripheral state to READY */
374  heth->State = HAL_ETH_STATE_READY;
375 
376  /* Return HAL_ERROR */
377  return HAL_ERROR;
378  }
379 
380  /* Configure the MAC with the Duplex Mode fixed by the auto-negotiation process */
381  if((phyreg & PHY_DUPLEX_STATUS) != (uint32_t)RESET)
382  {
383  /* Set Ethernet duplex mode to Full-duplex following the auto-negotiation */
384  (heth->Init).DuplexMode = ETH_MODE_FULLDUPLEX;
385  }
386  else
387  {
388  /* Set Ethernet duplex mode to Half-duplex following the auto-negotiation */
389  (heth->Init).DuplexMode = ETH_MODE_HALFDUPLEX;
390  }
391  /* Configure the MAC with the speed fixed by the auto-negotiation process */
392  if((phyreg & PHY_SPEED_STATUS) == PHY_SPEED_STATUS)
393  {
394  /* Set Ethernet speed to 10M following the auto-negotiation */
395  (heth->Init).Speed = ETH_SPEED_10M;
396  }
397  else
398  {
399  /* Set Ethernet speed to 100M following the auto-negotiation */
400  (heth->Init).Speed = ETH_SPEED_100M;
401  }
402  }
403  else /* AutoNegotiation Disable */
404  {
405  /* Check parameters */
408 
409  /* Set MAC Speed and Duplex Mode */
410  if(HAL_ETH_WritePHYRegister(heth, PHY_BCR, ((uint16_t)((heth->Init).DuplexMode >> 3) |
411  (uint16_t)((heth->Init).Speed >> 1))) != HAL_OK)
412  {
413  /* In case of write timeout */
414  err = ETH_ERROR;
415 
416  /* Config MAC and DMA */
417  ETH_MACDMAConfig(heth, err);
418 
419  /* Set the ETH peripheral state to READY */
420  heth->State = HAL_ETH_STATE_READY;
421 
422  /* Return HAL_ERROR */
423  return HAL_ERROR;
424  }
425 
426  /* Delay to assure PHY configuration */
428  }
429 
430  /* Config MAC and DMA */
431  ETH_MACDMAConfig(heth, err);
432 
433  /* Set ETH HAL State to Ready */
434  heth->State= HAL_ETH_STATE_READY;
435 
436  /* Return function status */
437  return HAL_OK;
438 }
439 
447 {
448  /* Set the ETH peripheral state to BUSY */
449  heth->State = HAL_ETH_STATE_BUSY;
450 
451  /* De-Init the low level hardware : GPIO, CLOCK, NVIC. */
452  HAL_ETH_MspDeInit(heth);
453 
454  /* Set ETH HAL state to Disabled */
455  heth->State= HAL_ETH_STATE_RESET;
456 
457  /* Release Lock */
458  __HAL_UNLOCK(heth);
459 
460  /* Return function status */
461  return HAL_OK;
462 }
463 
473 HAL_StatusTypeDef HAL_ETH_DMATxDescListInit(ETH_HandleTypeDef *heth, ETH_DMADescTypeDef *DMATxDescTab, uint8_t *TxBuff, uint32_t TxBuffCount)
474 {
475  uint32_t i = 0;
476  ETH_DMADescTypeDef *dmatxdesc;
477 
478  /* Process Locked */
479  __HAL_LOCK(heth);
480 
481  /* Set the ETH peripheral state to BUSY */
482  heth->State = HAL_ETH_STATE_BUSY;
483 
484  /* Set the DMATxDescToSet pointer with the first one of the DMATxDescTab list */
485  heth->TxDesc = DMATxDescTab;
486 
487  /* Fill each DMATxDesc descriptor with the right values */
488  for(i=0; i < TxBuffCount; i++)
489  {
490  /* Get the pointer on the ith member of the Tx Desc list */
491  dmatxdesc = DMATxDescTab + i;
492 
493  /* Set Second Address Chained bit */
494  dmatxdesc->Status = ETH_DMATXDESC_TCH;
495 
496  /* Set Buffer1 address pointer */
497  dmatxdesc->Buffer1Addr = (uint32_t)(&TxBuff[i*ETH_TX_BUF_SIZE]);
498 
499  if ((heth->Init).ChecksumMode == ETH_CHECKSUM_BY_HARDWARE)
500  {
501  /* Set the DMA Tx descriptors checksum insertion */
503  }
504 
505  /* Initialize the next descriptor with the Next Descriptor Polling Enable */
506  if(i < (TxBuffCount-1))
507  {
508  /* Set next descriptor address register with next descriptor base address */
509  dmatxdesc->Buffer2NextDescAddr = (uint32_t)(DMATxDescTab+i+1);
510  }
511  else
512  {
513  /* For last descriptor, set next descriptor address register equal to the first descriptor base address */
514  dmatxdesc->Buffer2NextDescAddr = (uint32_t) DMATxDescTab;
515  }
516  }
517 
518  /* Set Transmit Descriptor List Address Register */
519  (heth->Instance)->DMATDLAR = (uint32_t) DMATxDescTab;
520 
521  /* Set ETH HAL State to Ready */
522  heth->State= HAL_ETH_STATE_READY;
523 
524  /* Process Unlocked */
525  __HAL_UNLOCK(heth);
526 
527  /* Return function status */
528  return HAL_OK;
529 }
530 
540 HAL_StatusTypeDef HAL_ETH_DMARxDescListInit(ETH_HandleTypeDef *heth, ETH_DMADescTypeDef *DMARxDescTab, uint8_t *RxBuff, uint32_t RxBuffCount)
541 {
542  uint32_t i = 0;
543  ETH_DMADescTypeDef *DMARxDesc;
544 
545  /* Process Locked */
546  __HAL_LOCK(heth);
547 
548  /* Set the ETH peripheral state to BUSY */
549  heth->State = HAL_ETH_STATE_BUSY;
550 
551  /* Set the Ethernet RxDesc pointer with the first one of the DMARxDescTab list */
552  heth->RxDesc = DMARxDescTab;
553 
554  /* Fill each DMARxDesc descriptor with the right values */
555  for(i=0; i < RxBuffCount; i++)
556  {
557  /* Get the pointer on the ith member of the Rx Desc list */
558  DMARxDesc = DMARxDescTab+i;
559 
560  /* Set Own bit of the Rx descriptor Status */
561  DMARxDesc->Status = ETH_DMARXDESC_OWN;
562 
563  /* Set Buffer1 size and Second Address Chained bit */
565 
566  /* Set Buffer1 address pointer */
567  DMARxDesc->Buffer1Addr = (uint32_t)(&RxBuff[i*ETH_RX_BUF_SIZE]);
568 
569  if((heth->Init).RxMode == ETH_RXINTERRUPT_MODE)
570  {
571  /* Enable Ethernet DMA Rx Descriptor interrupt */
572  DMARxDesc->ControlBufferSize &= ~ETH_DMARXDESC_DIC;
573  }
574 
575  /* Initialize the next descriptor with the Next Descriptor Polling Enable */
576  if(i < (RxBuffCount-1))
577  {
578  /* Set next descriptor address register with next descriptor base address */
579  DMARxDesc->Buffer2NextDescAddr = (uint32_t)(DMARxDescTab+i+1);
580  }
581  else
582  {
583  /* For last descriptor, set next descriptor address register equal to the first descriptor base address */
584  DMARxDesc->Buffer2NextDescAddr = (uint32_t)(DMARxDescTab);
585  }
586  }
587 
588  /* Set Receive Descriptor List Address Register */
589  (heth->Instance)->DMARDLAR = (uint32_t) DMARxDescTab;
590 
591  /* Set ETH HAL State to Ready */
592  heth->State= HAL_ETH_STATE_READY;
593 
594  /* Process Unlocked */
595  __HAL_UNLOCK(heth);
596 
597  /* Return function status */
598  return HAL_OK;
599 }
600 
607 __weak void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
608 {
609  /* Prevent unused argument(s) compilation warning */
610  UNUSED(heth);
611 
612  /* NOTE : This function Should not be modified, when the callback is needed,
613  the HAL_ETH_MspInit could be implemented in the user file
614  */
615 }
616 
623 __weak void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
624 {
625  /* Prevent unused argument(s) compilation warning */
626  UNUSED(heth);
627 
628  /* NOTE : This function Should not be modified, when the callback is needed,
629  the HAL_ETH_MspDeInit could be implemented in the user file
630  */
631 }
632 
667 HAL_StatusTypeDef HAL_ETH_TransmitFrame(ETH_HandleTypeDef *heth, uint32_t FrameLength)
668 {
669  uint32_t bufcount = 0, size = 0, i = 0;
670 
671  /* Process Locked */
672  __HAL_LOCK(heth);
673 
674  /* Set the ETH peripheral state to BUSY */
675  heth->State = HAL_ETH_STATE_BUSY;
676 
677  if (FrameLength == 0)
678  {
679  /* Set ETH HAL state to READY */
680  heth->State = HAL_ETH_STATE_READY;
681 
682  /* Process Unlocked */
683  __HAL_UNLOCK(heth);
684 
685  return HAL_ERROR;
686  }
687 
688  /* Check if the descriptor is owned by the ETHERNET DMA (when set) or CPU (when reset) */
689  if(((heth->TxDesc)->Status & ETH_DMATXDESC_OWN) != (uint32_t)RESET)
690  {
691  /* OWN bit set */
693 
694  /* Process Unlocked */
695  __HAL_UNLOCK(heth);
696 
697  return HAL_ERROR;
698  }
699 
700  /* Get the number of needed Tx buffers for the current frame */
701  if (FrameLength > ETH_TX_BUF_SIZE)
702  {
703  bufcount = FrameLength/ETH_TX_BUF_SIZE;
704  if (FrameLength % ETH_TX_BUF_SIZE)
705  {
706  bufcount++;
707  }
708  }
709  else
710  {
711  bufcount = 1;
712  }
713  if (bufcount == 1)
714  {
715  /* Set LAST and FIRST segment */
717  /* Set frame size */
718  heth->TxDesc->ControlBufferSize = (FrameLength & ETH_DMATXDESC_TBS1);
719  /* Set Own bit of the Tx descriptor Status: gives the buffer back to ETHERNET DMA */
720  heth->TxDesc->Status |= ETH_DMATXDESC_OWN;
721  /* Point to next descriptor */
723  }
724  else
725  {
726  for (i=0; i< bufcount; i++)
727  {
728  /* Clear FIRST and LAST segment bits */
730 
731  if (i == 0)
732  {
733  /* Setting the first segment bit */
734  heth->TxDesc->Status |= ETH_DMATXDESC_FS;
735  }
736 
737  /* Program size */
738  heth->TxDesc->ControlBufferSize = (ETH_TX_BUF_SIZE & ETH_DMATXDESC_TBS1);
739 
740  if (i == (bufcount-1))
741  {
742  /* Setting the last segment bit */
743  heth->TxDesc->Status |= ETH_DMATXDESC_LS;
744  size = FrameLength - (bufcount-1)*ETH_TX_BUF_SIZE;
745  heth->TxDesc->ControlBufferSize = (size & ETH_DMATXDESC_TBS1);
746  }
747 
748  /* Set Own bit of the Tx descriptor Status: gives the buffer back to ETHERNET DMA */
749  heth->TxDesc->Status |= ETH_DMATXDESC_OWN;
750  /* point to next descriptor */
752  }
753  }
754 
755  /* When Tx Buffer unavailable flag is set: clear it and resume transmission */
756  if (((heth->Instance)->DMASR & ETH_DMASR_TBUS) != (uint32_t)RESET)
757  {
758  /* Clear TBUS ETHERNET DMA flag */
759  (heth->Instance)->DMASR = ETH_DMASR_TBUS;
760  /* Resume DMA transmission*/
761  (heth->Instance)->DMATPDR = 0;
762  }
763 
764  /* Set ETH HAL State to Ready */
765  heth->State = HAL_ETH_STATE_READY;
766 
767  /* Process Unlocked */
768  __HAL_UNLOCK(heth);
769 
770  /* Return function status */
771  return HAL_OK;
772 }
773 
781 {
782  uint32_t framelength = 0;
783 
784  /* Process Locked */
785  __HAL_LOCK(heth);
786 
787  /* Check the ETH state to BUSY */
788  heth->State = HAL_ETH_STATE_BUSY;
789 
790  /* Check if segment is not owned by DMA */
791  /* (((heth->RxDesc->Status & ETH_DMARXDESC_OWN) == (uint32_t)RESET) && ((heth->RxDesc->Status & ETH_DMARXDESC_LS) != (uint32_t)RESET)) */
792  if(((heth->RxDesc->Status & ETH_DMARXDESC_OWN) == (uint32_t)RESET))
793  {
794  /* Check if last segment */
795  if(((heth->RxDesc->Status & ETH_DMARXDESC_LS) != (uint32_t)RESET))
796  {
797  /* increment segment count */
798  (heth->RxFrameInfos).SegCount++;
799 
800  /* Check if last segment is first segment: one segment contains the frame */
801  if ((heth->RxFrameInfos).SegCount == 1)
802  {
803  (heth->RxFrameInfos).FSRxDesc =heth->RxDesc;
804  }
805 
806  heth->RxFrameInfos.LSRxDesc = heth->RxDesc;
807 
808  /* Get the Frame Length of the received packet: substruct 4 bytes of the CRC */
809  framelength = (((heth->RxDesc)->Status & ETH_DMARXDESC_FL) >> ETH_DMARXDESC_FRAMELENGTHSHIFT) - 4;
810  heth->RxFrameInfos.length = framelength;
811 
812  /* Get the address of the buffer start address */
813  heth->RxFrameInfos.buffer = ((heth->RxFrameInfos).FSRxDesc)->Buffer1Addr;
814  /* point to next descriptor */
815  heth->RxDesc = (ETH_DMADescTypeDef*) ((heth->RxDesc)->Buffer2NextDescAddr);
816 
817  /* Set HAL State to Ready */
818  heth->State = HAL_ETH_STATE_READY;
819 
820  /* Process Unlocked */
821  __HAL_UNLOCK(heth);
822 
823  /* Return function status */
824  return HAL_OK;
825  }
826  /* Check if first segment */
827  else if((heth->RxDesc->Status & ETH_DMARXDESC_FS) != (uint32_t)RESET)
828  {
829  (heth->RxFrameInfos).FSRxDesc = heth->RxDesc;
830  (heth->RxFrameInfos).LSRxDesc = NULL;
831  (heth->RxFrameInfos).SegCount = 1;
832  /* Point to next descriptor */
834  }
835  /* Check if intermediate segment */
836  else
837  {
838  (heth->RxFrameInfos).SegCount++;
839  /* Point to next descriptor */
841  }
842  }
843 
844  /* Set ETH HAL State to Ready */
845  heth->State = HAL_ETH_STATE_READY;
846 
847  /* Process Unlocked */
848  __HAL_UNLOCK(heth);
849 
850  /* Return function status */
851  return HAL_ERROR;
852 }
853 
861 {
862  uint32_t descriptorscancounter = 0;
863 
864  /* Process Locked */
865  __HAL_LOCK(heth);
866 
867  /* Set ETH HAL State to BUSY */
868  heth->State = HAL_ETH_STATE_BUSY;
869 
870  /* Scan descriptors owned by CPU */
871  while (((heth->RxDesc->Status & ETH_DMARXDESC_OWN) == (uint32_t)RESET) && (descriptorscancounter < ETH_RXBUFNB))
872  {
873  /* Just for security */
874  descriptorscancounter++;
875 
876  /* Check if first segment in frame */
877  /* ((heth->RxDesc->Status & ETH_DMARXDESC_FS) != (uint32_t)RESET) && ((heth->RxDesc->Status & ETH_DMARXDESC_LS) == (uint32_t)RESET)) */
878  if((heth->RxDesc->Status & (ETH_DMARXDESC_FS | ETH_DMARXDESC_LS)) == (uint32_t)ETH_DMARXDESC_FS)
879  {
880  heth->RxFrameInfos.FSRxDesc = heth->RxDesc;
881  heth->RxFrameInfos.SegCount = 1;
882  /* Point to next descriptor */
884  }
885  /* Check if intermediate segment */
886  /* ((heth->RxDesc->Status & ETH_DMARXDESC_LS) == (uint32_t)RESET)&& ((heth->RxDesc->Status & ETH_DMARXDESC_FS) == (uint32_t)RESET)) */
887  else if ((heth->RxDesc->Status & (ETH_DMARXDESC_LS | ETH_DMARXDESC_FS)) == (uint32_t)RESET)
888  {
889  /* Increment segment count */
890  (heth->RxFrameInfos.SegCount)++;
891  /* Point to next descriptor */
893  }
894  /* Should be last segment */
895  else
896  {
897  /* Last segment */
898  heth->RxFrameInfos.LSRxDesc = heth->RxDesc;
899 
900  /* Increment segment count */
901  (heth->RxFrameInfos.SegCount)++;
902 
903  /* Check if last segment is first segment: one segment contains the frame */
904  if ((heth->RxFrameInfos.SegCount) == 1)
905  {
906  heth->RxFrameInfos.FSRxDesc = heth->RxDesc;
907  }
908 
909  /* Get the Frame Length of the received packet: substruct 4 bytes of the CRC */
910  heth->RxFrameInfos.length = (((heth->RxDesc)->Status & ETH_DMARXDESC_FL) >> ETH_DMARXDESC_FRAMELENGTHSHIFT) - 4;
911 
912  /* Get the address of the buffer start address */
913  heth->RxFrameInfos.buffer =((heth->RxFrameInfos).FSRxDesc)->Buffer1Addr;
914 
915  /* Point to next descriptor */
917 
918  /* Set HAL State to Ready */
919  heth->State = HAL_ETH_STATE_READY;
920 
921  /* Process Unlocked */
922  __HAL_UNLOCK(heth);
923 
924  /* Return function status */
925  return HAL_OK;
926  }
927  }
928 
929  /* Set HAL State to Ready */
930  heth->State = HAL_ETH_STATE_READY;
931 
932  /* Process Unlocked */
933  __HAL_UNLOCK(heth);
934 
935  /* Return function status */
936  return HAL_ERROR;
937 }
938 
946 {
947  /* Frame received */
949  {
950  /* Receive complete callback */
952 
953  /* Clear the Eth DMA Rx IT pending bits */
955 
956  /* Set HAL State to Ready */
957  heth->State = HAL_ETH_STATE_READY;
958 
959  /* Process Unlocked */
960  __HAL_UNLOCK(heth);
961  }
962  /* Frame transmitted */
963  else if (__HAL_ETH_DMA_GET_FLAG(heth, ETH_DMA_FLAG_T))
964  {
965  /* Transfer complete callback */
967 
968  /* Clear the Eth DMA Tx IT pending bits */
970 
971  /* Set HAL State to Ready */
972  heth->State = HAL_ETH_STATE_READY;
973 
974  /* Process Unlocked */
975  __HAL_UNLOCK(heth);
976  }
977 
978  /* Clear the interrupt flags */
980 
981  /* ETH DMA Error */
983  {
984  /* Ethernet Error callback */
985  HAL_ETH_ErrorCallback(heth);
986 
987  /* Clear the interrupt flags */
989 
990  /* Set HAL State to Ready */
991  heth->State = HAL_ETH_STATE_READY;
992 
993  /* Process Unlocked */
994  __HAL_UNLOCK(heth);
995  }
996 }
997 
1004 __weak void HAL_ETH_TxCpltCallback(ETH_HandleTypeDef *heth)
1005 {
1006  /* Prevent unused argument(s) compilation warning */
1007  UNUSED(heth);
1008 
1009  /* NOTE : This function Should not be modified, when the callback is needed,
1010  the HAL_ETH_TxCpltCallback could be implemented in the user file
1011  */
1012 }
1013 
1020 __weak void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *heth)
1021 {
1022  /* Prevent unused argument(s) compilation warning */
1023  UNUSED(heth);
1024 
1025  /* NOTE : This function Should not be modified, when the callback is needed,
1026  the HAL_ETH_TxCpltCallback could be implemented in the user file
1027  */
1028 }
1029 
1036 __weak void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *heth)
1037 {
1038  /* Prevent unused argument(s) compilation warning */
1039  UNUSED(heth);
1040 
1041  /* NOTE : This function Should not be modified, when the callback is needed,
1042  the HAL_ETH_TxCpltCallback could be implemented in the user file
1043  */
1044 }
1045 
1058 HAL_StatusTypeDef HAL_ETH_ReadPHYRegister(ETH_HandleTypeDef *heth, uint16_t PHYReg, uint32_t *RegValue)
1059 {
1060  uint32_t tmpreg = 0;
1061  uint32_t tickstart = 0;
1062 
1063  /* Check parameters */
1065 
1066  /* Check the ETH peripheral state */
1067  if(heth->State == HAL_ETH_STATE_BUSY_RD)
1068  {
1069  return HAL_BUSY;
1070  }
1071  /* Set ETH HAL State to BUSY_RD */
1072  heth->State = HAL_ETH_STATE_BUSY_RD;
1073 
1074  /* Get the ETHERNET MACMIIAR value */
1075  tmpreg = heth->Instance->MACMIIAR;
1076 
1077  /* Keep only the CSR Clock Range CR[2:0] bits value */
1078  tmpreg &= ~ETH_MACMIIAR_CR_MASK;
1079 
1080  /* Prepare the MII address register value */
1081  tmpreg |=(((uint32_t)heth->Init.PhyAddress << 11) & ETH_MACMIIAR_PA); /* Set the PHY device address */
1082  tmpreg |=(((uint32_t)PHYReg<<6) & ETH_MACMIIAR_MR); /* Set the PHY register address */
1083  tmpreg &= ~ETH_MACMIIAR_MW; /* Set the read mode */
1084  tmpreg |= ETH_MACMIIAR_MB; /* Set the MII Busy bit */
1085 
1086  /* Write the result value into the MII Address register */
1087  heth->Instance->MACMIIAR = tmpreg;
1088 
1089  /* Get tick */
1090  tickstart = HAL_GetTick();
1091 
1092  /* Check for the Busy flag */
1093  while((tmpreg & ETH_MACMIIAR_MB) == ETH_MACMIIAR_MB)
1094  {
1095  /* Check for the Timeout */
1096  if((HAL_GetTick() - tickstart ) > PHY_READ_TO)
1097  {
1098  heth->State= HAL_ETH_STATE_READY;
1099 
1100  /* Process Unlocked */
1101  __HAL_UNLOCK(heth);
1102 
1103  return HAL_TIMEOUT;
1104  }
1105 
1106  tmpreg = heth->Instance->MACMIIAR;
1107  }
1108 
1109  /* Get MACMIIDR value */
1110  *RegValue = (uint16_t)(heth->Instance->MACMIIDR);
1111 
1112  /* Set ETH HAL State to READY */
1113  heth->State = HAL_ETH_STATE_READY;
1114 
1115  /* Return function status */
1116  return HAL_OK;
1117 }
1118 
1130 HAL_StatusTypeDef HAL_ETH_WritePHYRegister(ETH_HandleTypeDef *heth, uint16_t PHYReg, uint32_t RegValue)
1131 {
1132  uint32_t tmpreg = 0;
1133  uint32_t tickstart = 0;
1134 
1135  /* Check parameters */
1137 
1138  /* Check the ETH peripheral state */
1139  if(heth->State == HAL_ETH_STATE_BUSY_WR)
1140  {
1141  return HAL_BUSY;
1142  }
1143  /* Set ETH HAL State to BUSY_WR */
1144  heth->State = HAL_ETH_STATE_BUSY_WR;
1145 
1146  /* Get the ETHERNET MACMIIAR value */
1147  tmpreg = heth->Instance->MACMIIAR;
1148 
1149  /* Keep only the CSR Clock Range CR[2:0] bits value */
1150  tmpreg &= ~ETH_MACMIIAR_CR_MASK;
1151 
1152  /* Prepare the MII register address value */
1153  tmpreg |=(((uint32_t)heth->Init.PhyAddress<<11) & ETH_MACMIIAR_PA); /* Set the PHY device address */
1154  tmpreg |=(((uint32_t)PHYReg<<6) & ETH_MACMIIAR_MR); /* Set the PHY register address */
1155  tmpreg |= ETH_MACMIIAR_MW; /* Set the write mode */
1156  tmpreg |= ETH_MACMIIAR_MB; /* Set the MII Busy bit */
1157 
1158  /* Give the value to the MII data register */
1159  heth->Instance->MACMIIDR = (uint16_t)RegValue;
1160 
1161  /* Write the result value into the MII Address register */
1162  heth->Instance->MACMIIAR = tmpreg;
1163 
1164  /* Get tick */
1165  tickstart = HAL_GetTick();
1166 
1167  /* Check for the Busy flag */
1168  while((tmpreg & ETH_MACMIIAR_MB) == ETH_MACMIIAR_MB)
1169  {
1170  /* Check for the Timeout */
1171  if((HAL_GetTick() - tickstart ) > PHY_WRITE_TO)
1172  {
1173  heth->State= HAL_ETH_STATE_READY;
1174 
1175  /* Process Unlocked */
1176  __HAL_UNLOCK(heth);
1177 
1178  return HAL_TIMEOUT;
1179  }
1180 
1181  tmpreg = heth->Instance->MACMIIAR;
1182  }
1183 
1184  /* Set ETH HAL State to READY */
1185  heth->State = HAL_ETH_STATE_READY;
1186 
1187  /* Return function status */
1188  return HAL_OK;
1189 }
1190 
1223 {
1224  /* Process Locked */
1225  __HAL_LOCK(heth);
1226 
1227  /* Set the ETH peripheral state to BUSY */
1228  heth->State = HAL_ETH_STATE_BUSY;
1229 
1230  /* Enable transmit state machine of the MAC for transmission on the MII */
1231  ETH_MACTransmissionEnable(heth);
1232 
1233  /* Enable receive state machine of the MAC for reception from the MII */
1234  ETH_MACReceptionEnable(heth);
1235 
1236  /* Flush Transmit FIFO */
1237  ETH_FlushTransmitFIFO(heth);
1238 
1239  /* Start DMA transmission */
1240  ETH_DMATransmissionEnable(heth);
1241 
1242  /* Start DMA reception */
1243  ETH_DMAReceptionEnable(heth);
1244 
1245  /* Set the ETH state to READY*/
1246  heth->State= HAL_ETH_STATE_READY;
1247 
1248  /* Process Unlocked */
1249  __HAL_UNLOCK(heth);
1250 
1251  /* Return function status */
1252  return HAL_OK;
1253 }
1254 
1262 {
1263  /* Process Locked */
1264  __HAL_LOCK(heth);
1265 
1266  /* Set the ETH peripheral state to BUSY */
1267  heth->State = HAL_ETH_STATE_BUSY;
1268 
1269  /* Stop DMA transmission */
1270  ETH_DMATransmissionDisable(heth);
1271 
1272  /* Stop DMA reception */
1273  ETH_DMAReceptionDisable(heth);
1274 
1275  /* Disable receive state machine of the MAC for reception from the MII */
1276  ETH_MACReceptionDisable(heth);
1277 
1278  /* Flush Transmit FIFO */
1279  ETH_FlushTransmitFIFO(heth);
1280 
1281  /* Disable transmit state machine of the MAC for transmission on the MII */
1282  ETH_MACTransmissionDisable(heth);
1283 
1284  /* Set the ETH state*/
1285  heth->State = HAL_ETH_STATE_READY;
1286 
1287  /* Process Unlocked */
1288  __HAL_UNLOCK(heth);
1289 
1290  /* Return function status */
1291  return HAL_OK;
1292 }
1293 
1302 {
1303  uint32_t tmpreg = 0;
1304 
1305  /* Process Locked */
1306  __HAL_LOCK(heth);
1307 
1308  /* Set the ETH peripheral state to BUSY */
1309  heth->State= HAL_ETH_STATE_BUSY;
1310 
1313 
1314  if (macconf != NULL)
1315  {
1316  /* Check the parameters */
1318  assert_param(IS_ETH_JABBER(macconf->Jabber));
1344 
1345  /*------------------------ ETHERNET MACCR Configuration --------------------*/
1346  /* Get the ETHERNET MACCR value */
1347  tmpreg = (heth->Instance)->MACCR;
1348  /* Clear WD, PCE, PS, TE and RE bits */
1349  tmpreg &= ETH_MACCR_CLEAR_MASK;
1350 
1351  tmpreg |= (uint32_t)(macconf->Watchdog |
1352  macconf->Jabber |
1353  macconf->InterFrameGap |
1354  macconf->CarrierSense |
1355  (heth->Init).Speed |
1356  macconf->ReceiveOwn |
1357  macconf->LoopbackMode |
1358  (heth->Init).DuplexMode |
1359  macconf->ChecksumOffload |
1360  macconf->RetryTransmission |
1361  macconf->AutomaticPadCRCStrip |
1362  macconf->BackOffLimit |
1363  macconf->DeferralCheck);
1364 
1365  /* Write to ETHERNET MACCR */
1366  (heth->Instance)->MACCR = (uint32_t)tmpreg;
1367 
1368  /* Wait until the write operation will be taken into account :
1369  at least four TX_CLK/RX_CLK clock cycles */
1370  tmpreg = (heth->Instance)->MACCR;
1372  (heth->Instance)->MACCR = tmpreg;
1373 
1374  /*----------------------- ETHERNET MACFFR Configuration --------------------*/
1375  /* Write to ETHERNET MACFFR */
1376  (heth->Instance)->MACFFR = (uint32_t)(macconf->ReceiveAll |
1377  macconf->SourceAddrFilter |
1378  macconf->PassControlFrames |
1379  macconf->BroadcastFramesReception |
1380  macconf->DestinationAddrFilter |
1381  macconf->PromiscuousMode |
1382  macconf->MulticastFramesFilter |
1383  macconf->UnicastFramesFilter);
1384 
1385  /* Wait until the write operation will be taken into account :
1386  at least four TX_CLK/RX_CLK clock cycles */
1387  tmpreg = (heth->Instance)->MACFFR;
1389  (heth->Instance)->MACFFR = tmpreg;
1390 
1391  /*--------------- ETHERNET MACHTHR and MACHTLR Configuration ---------------*/
1392  /* Write to ETHERNET MACHTHR */
1393  (heth->Instance)->MACHTHR = (uint32_t)macconf->HashTableHigh;
1394 
1395  /* Write to ETHERNET MACHTLR */
1396  (heth->Instance)->MACHTLR = (uint32_t)macconf->HashTableLow;
1397  /*----------------------- ETHERNET MACFCR Configuration --------------------*/
1398 
1399  /* Get the ETHERNET MACFCR value */
1400  tmpreg = (heth->Instance)->MACFCR;
1401  /* Clear xx bits */
1402  tmpreg &= ETH_MACFCR_CLEAR_MASK;
1403 
1404  tmpreg |= (uint32_t)((macconf->PauseTime << 16) |
1405  macconf->ZeroQuantaPause |
1406  macconf->PauseLowThreshold |
1407  macconf->UnicastPauseFrameDetect |
1408  macconf->ReceiveFlowControl |
1409  macconf->TransmitFlowControl);
1410 
1411  /* Write to ETHERNET MACFCR */
1412  (heth->Instance)->MACFCR = (uint32_t)tmpreg;
1413 
1414  /* Wait until the write operation will be taken into account :
1415  at least four TX_CLK/RX_CLK clock cycles */
1416  tmpreg = (heth->Instance)->MACFCR;
1418  (heth->Instance)->MACFCR = tmpreg;
1419 
1420  /*----------------------- ETHERNET MACVLANTR Configuration -----------------*/
1421  (heth->Instance)->MACVLANTR = (uint32_t)(macconf->VLANTagComparison |
1422  macconf->VLANTagIdentifier);
1423 
1424  /* Wait until the write operation will be taken into account :
1425  at least four TX_CLK/RX_CLK clock cycles */
1426  tmpreg = (heth->Instance)->MACVLANTR;
1428  (heth->Instance)->MACVLANTR = tmpreg;
1429  }
1430  else /* macconf == NULL : here we just configure Speed and Duplex mode */
1431  {
1432  /*------------------------ ETHERNET MACCR Configuration --------------------*/
1433  /* Get the ETHERNET MACCR value */
1434  tmpreg = (heth->Instance)->MACCR;
1435 
1436  /* Clear FES and DM bits */
1437  tmpreg &= ~((uint32_t)0x00004800);
1438 
1439  tmpreg |= (uint32_t)(heth->Init.Speed | heth->Init.DuplexMode);
1440 
1441  /* Write to ETHERNET MACCR */
1442  (heth->Instance)->MACCR = (uint32_t)tmpreg;
1443 
1444  /* Wait until the write operation will be taken into account:
1445  at least four TX_CLK/RX_CLK clock cycles */
1446  tmpreg = (heth->Instance)->MACCR;
1448  (heth->Instance)->MACCR = tmpreg;
1449  }
1450 
1451  /* Set the ETH state to Ready */
1452  heth->State= HAL_ETH_STATE_READY;
1453 
1454  /* Process Unlocked */
1455  __HAL_UNLOCK(heth);
1456 
1457  /* Return function status */
1458  return HAL_OK;
1459 }
1460 
1469 {
1470  uint32_t tmpreg = 0;
1471 
1472  /* Process Locked */
1473  __HAL_LOCK(heth);
1474 
1475  /* Set the ETH peripheral state to BUSY */
1476  heth->State= HAL_ETH_STATE_BUSY;
1477 
1478  /* Check parameters */
1495 
1496  /*----------------------- ETHERNET DMAOMR Configuration --------------------*/
1497  /* Get the ETHERNET DMAOMR value */
1498  tmpreg = (heth->Instance)->DMAOMR;
1499  /* Clear xx bits */
1500  tmpreg &= ETH_DMAOMR_CLEAR_MASK;
1501 
1502  tmpreg |= (uint32_t)(dmaconf->DropTCPIPChecksumErrorFrame |
1503  dmaconf->ReceiveStoreForward |
1504  dmaconf->FlushReceivedFrame |
1505  dmaconf->TransmitStoreForward |
1506  dmaconf->TransmitThresholdControl |
1507  dmaconf->ForwardErrorFrames |
1508  dmaconf->ForwardUndersizedGoodFrames |
1509  dmaconf->ReceiveThresholdControl |
1510  dmaconf->SecondFrameOperate);
1511 
1512  /* Write to ETHERNET DMAOMR */
1513  (heth->Instance)->DMAOMR = (uint32_t)tmpreg;
1514 
1515  /* Wait until the write operation will be taken into account:
1516  at least four TX_CLK/RX_CLK clock cycles */
1517  tmpreg = (heth->Instance)->DMAOMR;
1519  (heth->Instance)->DMAOMR = tmpreg;
1520 
1521  /*----------------------- ETHERNET DMABMR Configuration --------------------*/
1522  (heth->Instance)->DMABMR = (uint32_t)(dmaconf->AddressAlignedBeats |
1523  dmaconf->FixedBurst |
1524  dmaconf->RxDMABurstLength | /* !! if 4xPBL is selected for Tx or Rx it is applied for the other */
1525  dmaconf->TxDMABurstLength |
1526  dmaconf->EnhancedDescriptorFormat |
1527  (dmaconf->DescriptorSkipLength << 2) |
1528  dmaconf->DMAArbitration |
1529  ETH_DMABMR_USP); /* Enable use of separate PBL for Rx and Tx */
1530 
1531  /* Wait until the write operation will be taken into account:
1532  at least four TX_CLK/RX_CLK clock cycles */
1533  tmpreg = (heth->Instance)->DMABMR;
1535  (heth->Instance)->DMABMR = tmpreg;
1536 
1537  /* Set the ETH state to Ready */
1538  heth->State= HAL_ETH_STATE_READY;
1539 
1540  /* Process Unlocked */
1541  __HAL_UNLOCK(heth);
1542 
1543  /* Return function status */
1544  return HAL_OK;
1545 }
1546 
1576 {
1577  /* Return ETH state */
1578  return heth->State;
1579 }
1580 
1600 static void ETH_MACDMAConfig(ETH_HandleTypeDef *heth, uint32_t err)
1601 {
1602  ETH_MACInitTypeDef macinit;
1603  ETH_DMAInitTypeDef dmainit;
1604  uint32_t tmpreg = 0;
1605 
1606  if (err != ETH_SUCCESS) /* Auto-negotiation failed */
1607  {
1608  /* Set Ethernet duplex mode to Full-duplex */
1609  (heth->Init).DuplexMode = ETH_MODE_FULLDUPLEX;
1610 
1611  /* Set Ethernet speed to 100M */
1612  (heth->Init).Speed = ETH_SPEED_100M;
1613  }
1614 
1615  /* Ethernet MAC default initialization **************************************/
1616  macinit.Watchdog = ETH_WATCHDOG_ENABLE;
1617  macinit.Jabber = ETH_JABBER_ENABLE;
1620  //XXXX - we need this, otherwise no UDP reception
1621  //macinit.ReceiveOwn = ETH_RECEIVEOWN_ENABLE;
1625  {
1627  }
1628  else
1629  {
1631  }
1636  //XXXX - we need this
1637 #ifdef UDANTE
1639 #else
1641 #endif
1646  //XXXX
1647 #ifdef UDANTE
1649 #else
1651 #endif
1654  macinit.HashTableHigh = 0x0;
1655  macinit.HashTableLow = 0x0;
1656  macinit.PauseTime = 0x0;
1663  macinit.VLANTagIdentifier = 0x0;
1664 
1665  /*------------------------ ETHERNET MACCR Configuration --------------------*/
1666  /* Get the ETHERNET MACCR value */
1667  tmpreg = (heth->Instance)->MACCR;
1668  /* Clear WD, PCE, PS, TE and RE bits */
1669  tmpreg &= ETH_MACCR_CLEAR_MASK;
1670  /* Set the WD bit according to ETH Watchdog value */
1671  /* Set the JD: bit according to ETH Jabber value */
1672  /* Set the IFG bit according to ETH InterFrameGap value */
1673  /* Set the DCRS bit according to ETH CarrierSense value */
1674  /* Set the FES bit according to ETH Speed value */
1675  /* Set the DO bit according to ETH ReceiveOwn value */
1676  /* Set the LM bit according to ETH LoopbackMode value */
1677  /* Set the DM bit according to ETH Mode value */
1678  /* Set the IPCO bit according to ETH ChecksumOffload value */
1679  /* Set the DR bit according to ETH RetryTransmission value */
1680  /* Set the ACS bit according to ETH AutomaticPadCRCStrip value */
1681  /* Set the BL bit according to ETH BackOffLimit value */
1682  /* Set the DC bit according to ETH DeferralCheck value */
1683  tmpreg |= (uint32_t)(macinit.Watchdog |
1684  macinit.Jabber |
1685  macinit.InterFrameGap |
1686  macinit.CarrierSense |
1687  (heth->Init).Speed |
1688  macinit.ReceiveOwn |
1689  macinit.LoopbackMode |
1690  (heth->Init).DuplexMode |
1691  macinit.ChecksumOffload |
1692  macinit.RetryTransmission |
1693  macinit.AutomaticPadCRCStrip |
1694  macinit.BackOffLimit |
1695  macinit.DeferralCheck);
1696 
1697  /* Write to ETHERNET MACCR */
1698  (heth->Instance)->MACCR = (uint32_t)tmpreg;
1699 
1700  /* Wait until the write operation will be taken into account:
1701  at least four TX_CLK/RX_CLK clock cycles */
1702  tmpreg = (heth->Instance)->MACCR;
1704  (heth->Instance)->MACCR = tmpreg;
1705 
1706  /*----------------------- ETHERNET MACFFR Configuration --------------------*/
1707  /* Set the RA bit according to ETH ReceiveAll value */
1708  /* Set the SAF and SAIF bits according to ETH SourceAddrFilter value */
1709  /* Set the PCF bit according to ETH PassControlFrames value */
1710  /* Set the DBF bit according to ETH BroadcastFramesReception value */
1711  /* Set the DAIF bit according to ETH DestinationAddrFilter value */
1712  /* Set the PR bit according to ETH PromiscuousMode value */
1713  /* Set the PM, HMC and HPF bits according to ETH MulticastFramesFilter value */
1714  /* Set the HUC and HPF bits according to ETH UnicastFramesFilter value */
1715  /* Write to ETHERNET MACFFR */
1716  (heth->Instance)->MACFFR = (uint32_t)(macinit.ReceiveAll |
1717  macinit.SourceAddrFilter |
1718  macinit.PassControlFrames |
1719  macinit.BroadcastFramesReception |
1720  macinit.DestinationAddrFilter |
1721  macinit.PromiscuousMode |
1722  macinit.MulticastFramesFilter |
1723  macinit.UnicastFramesFilter);
1724 
1725  /* Wait until the write operation will be taken into account:
1726  at least four TX_CLK/RX_CLK clock cycles */
1727  tmpreg = (heth->Instance)->MACFFR;
1729  (heth->Instance)->MACFFR = tmpreg;
1730 
1731  /*--------------- ETHERNET MACHTHR and MACHTLR Configuration --------------*/
1732  /* Write to ETHERNET MACHTHR */
1733  (heth->Instance)->MACHTHR = (uint32_t)macinit.HashTableHigh;
1734 
1735  /* Write to ETHERNET MACHTLR */
1736  (heth->Instance)->MACHTLR = (uint32_t)macinit.HashTableLow;
1737  /*----------------------- ETHERNET MACFCR Configuration -------------------*/
1738 
1739  /* Get the ETHERNET MACFCR value */
1740  tmpreg = (heth->Instance)->MACFCR;
1741  /* Clear xx bits */
1742  tmpreg &= ETH_MACFCR_CLEAR_MASK;
1743 
1744  /* Set the PT bit according to ETH PauseTime value */
1745  /* Set the DZPQ bit according to ETH ZeroQuantaPause value */
1746  /* Set the PLT bit according to ETH PauseLowThreshold value */
1747  /* Set the UP bit according to ETH UnicastPauseFrameDetect value */
1748  /* Set the RFE bit according to ETH ReceiveFlowControl value */
1749  /* Set the TFE bit according to ETH TransmitFlowControl value */
1750  tmpreg |= (uint32_t)((macinit.PauseTime << 16) |
1751  macinit.ZeroQuantaPause |
1752  macinit.PauseLowThreshold |
1753  macinit.UnicastPauseFrameDetect |
1754  macinit.ReceiveFlowControl |
1755  macinit.TransmitFlowControl);
1756 
1757  /* Write to ETHERNET MACFCR */
1758  (heth->Instance)->MACFCR = (uint32_t)tmpreg;
1759 
1760  /* Wait until the write operation will be taken into account:
1761  at least four TX_CLK/RX_CLK clock cycles */
1762  tmpreg = (heth->Instance)->MACFCR;
1764  (heth->Instance)->MACFCR = tmpreg;
1765 
1766  /*----------------------- ETHERNET MACVLANTR Configuration ----------------*/
1767  /* Set the ETV bit according to ETH VLANTagComparison value */
1768  /* Set the VL bit according to ETH VLANTagIdentifier value */
1769  (heth->Instance)->MACVLANTR = (uint32_t)(macinit.VLANTagComparison |
1770  macinit.VLANTagIdentifier);
1771 
1772  /* Wait until the write operation will be taken into account:
1773  at least four TX_CLK/RX_CLK clock cycles */
1774  tmpreg = (heth->Instance)->MACVLANTR;
1776  (heth->Instance)->MACVLANTR = tmpreg;
1777 
1778  /* Ethernet DMA default initialization ************************************/
1793  dmainit.DescriptorSkipLength = 0x0;
1795 
1796  /* Get the ETHERNET DMAOMR value */
1797  tmpreg = (heth->Instance)->DMAOMR;
1798  /* Clear xx bits */
1799  tmpreg &= ETH_DMAOMR_CLEAR_MASK;
1800 
1801  /* Set the DT bit according to ETH DropTCPIPChecksumErrorFrame value */
1802  /* Set the RSF bit according to ETH ReceiveStoreForward value */
1803  /* Set the DFF bit according to ETH FlushReceivedFrame value */
1804  /* Set the TSF bit according to ETH TransmitStoreForward value */
1805  /* Set the TTC bit according to ETH TransmitThresholdControl value */
1806  /* Set the FEF bit according to ETH ForwardErrorFrames value */
1807  /* Set the FUF bit according to ETH ForwardUndersizedGoodFrames value */
1808  /* Set the RTC bit according to ETH ReceiveThresholdControl value */
1809  /* Set the OSF bit according to ETH SecondFrameOperate value */
1810  tmpreg |= (uint32_t)(dmainit.DropTCPIPChecksumErrorFrame |
1811  dmainit.ReceiveStoreForward |
1812  dmainit.FlushReceivedFrame |
1813  dmainit.TransmitStoreForward |
1814  dmainit.TransmitThresholdControl |
1815  dmainit.ForwardErrorFrames |
1816  dmainit.ForwardUndersizedGoodFrames |
1817  dmainit.ReceiveThresholdControl |
1818  dmainit.SecondFrameOperate);
1819 
1820  /* Write to ETHERNET DMAOMR */
1821  (heth->Instance)->DMAOMR = (uint32_t)tmpreg;
1822 
1823  /* Wait until the write operation will be taken into account:
1824  at least four TX_CLK/RX_CLK clock cycles */
1825  tmpreg = (heth->Instance)->DMAOMR;
1827  (heth->Instance)->DMAOMR = tmpreg;
1828 
1829  /*----------------------- ETHERNET DMABMR Configuration ------------------*/
1830  /* Set the AAL bit according to ETH AddressAlignedBeats value */
1831  /* Set the FB bit according to ETH FixedBurst value */
1832  /* Set the RPBL and 4*PBL bits according to ETH RxDMABurstLength value */
1833  /* Set the PBL and 4*PBL bits according to ETH TxDMABurstLength value */
1834  /* Set the Enhanced DMA descriptors bit according to ETH EnhancedDescriptorFormat value*/
1835  /* Set the DSL bit according to ETH DesciptorSkipLength value */
1836  /* Set the PR and DA bits according to ETH DMAArbitration value */
1837  (heth->Instance)->DMABMR = (uint32_t)(dmainit.AddressAlignedBeats |
1838  dmainit.FixedBurst |
1839  dmainit.RxDMABurstLength | /* !! if 4xPBL is selected for Tx or Rx it is applied for the other */
1840  dmainit.TxDMABurstLength |
1841  dmainit.EnhancedDescriptorFormat |
1842  (dmainit.DescriptorSkipLength << 2) |
1843  dmainit.DMAArbitration |
1844  ETH_DMABMR_USP); /* Enable use of separate PBL for Rx and Tx */
1845 
1846  /* Wait until the write operation will be taken into account:
1847  at least four TX_CLK/RX_CLK clock cycles */
1848  tmpreg = (heth->Instance)->DMABMR;
1850  (heth->Instance)->DMABMR = tmpreg;
1851 
1852  if((heth->Init).RxMode == ETH_RXINTERRUPT_MODE)
1853  {
1854  /* Enable the Ethernet Rx Interrupt */
1856  }
1857 
1858  /* Initialize MAC address in ethernet MAC */
1859  ETH_MACAddressConfig(heth, ETH_MAC_ADDRESS0, heth->Init.MACAddr);
1860 }
1861 
1875 static void ETH_MACAddressConfig(ETH_HandleTypeDef *heth, uint32_t MacAddr, uint8_t *Addr)
1876 {
1877  uint32_t tmpreg;
1878 
1879  /* Check the parameters */
1881 
1882  /* Calculate the selected MAC address high register */
1883  tmpreg = ((uint32_t)Addr[5] << 8) | (uint32_t)Addr[4];
1884  /* Load the selected MAC address high register */
1885  (*(__IO uint32_t *)((uint32_t)(ETH_MAC_ADDR_HBASE + MacAddr))) = tmpreg;
1886  /* Calculate the selected MAC address low register */
1887  tmpreg = ((uint32_t)Addr[3] << 24) | ((uint32_t)Addr[2] << 16) | ((uint32_t)Addr[1] << 8) | Addr[0];
1888 
1889  /* Load the selected MAC address low register */
1890  (*(__IO uint32_t *)((uint32_t)(ETH_MAC_ADDR_LBASE + MacAddr))) = tmpreg;
1891 }
1892 
1899 static void ETH_MACTransmissionEnable(ETH_HandleTypeDef *heth)
1900 {
1901  __IO uint32_t tmpreg = 0;
1902 
1903  /* Enable the MAC transmission */
1904  (heth->Instance)->MACCR |= ETH_MACCR_TE;
1905 
1906  /* Wait until the write operation will be taken into account:
1907  at least four TX_CLK/RX_CLK clock cycles */
1908  tmpreg = (heth->Instance)->MACCR;
1910  (heth->Instance)->MACCR = tmpreg;
1911 }
1912 
1919 static void ETH_MACTransmissionDisable(ETH_HandleTypeDef *heth)
1920 {
1921  __IO uint32_t tmpreg = 0;
1922 
1923  /* Disable the MAC transmission */
1924  (heth->Instance)->MACCR &= ~ETH_MACCR_TE;
1925 
1926  /* Wait until the write operation will be taken into account:
1927  at least four TX_CLK/RX_CLK clock cycles */
1928  tmpreg = (heth->Instance)->MACCR;
1930  (heth->Instance)->MACCR = tmpreg;
1931 }
1932 
1939 static void ETH_MACReceptionEnable(ETH_HandleTypeDef *heth)
1940 {
1941  __IO uint32_t tmpreg = 0;
1942 
1943  /* Enable the MAC reception */
1944  (heth->Instance)->MACCR |= ETH_MACCR_RE;
1945 
1946  /* Wait until the write operation will be taken into account:
1947  at least four TX_CLK/RX_CLK clock cycles */
1948  tmpreg = (heth->Instance)->MACCR;
1950  (heth->Instance)->MACCR = tmpreg;
1951 }
1952 
1959 static void ETH_MACReceptionDisable(ETH_HandleTypeDef *heth)
1960 {
1961  __IO uint32_t tmpreg = 0;
1962 
1963  /* Disable the MAC reception */
1964  (heth->Instance)->MACCR &= ~ETH_MACCR_RE;
1965 
1966  /* Wait until the write operation will be taken into account:
1967  at least four TX_CLK/RX_CLK clock cycles */
1968  tmpreg = (heth->Instance)->MACCR;
1970  (heth->Instance)->MACCR = tmpreg;
1971 }
1972 
1979 static void ETH_DMATransmissionEnable(ETH_HandleTypeDef *heth)
1980 {
1981  /* Enable the DMA transmission */
1982  (heth->Instance)->DMAOMR |= ETH_DMAOMR_ST;
1983 }
1984 
1991 static void ETH_DMATransmissionDisable(ETH_HandleTypeDef *heth)
1992 {
1993  /* Disable the DMA transmission */
1994  (heth->Instance)->DMAOMR &= ~ETH_DMAOMR_ST;
1995 }
1996 
2003 static void ETH_DMAReceptionEnable(ETH_HandleTypeDef *heth)
2004 {
2005  /* Enable the DMA reception */
2006  (heth->Instance)->DMAOMR |= ETH_DMAOMR_SR;
2007 }
2008 
2015 static void ETH_DMAReceptionDisable(ETH_HandleTypeDef *heth)
2016 {
2017  /* Disable the DMA reception */
2018  (heth->Instance)->DMAOMR &= ~ETH_DMAOMR_SR;
2019 }
2020 
2027 static void ETH_FlushTransmitFIFO(ETH_HandleTypeDef *heth)
2028 {
2029  __IO uint32_t tmpreg = 0;
2030 
2031  /* Set the Flush Transmit FIFO bit */
2032  (heth->Instance)->DMAOMR |= ETH_DMAOMR_FTF;
2033 
2034  /* Wait until the write operation will be taken into account:
2035  at least four TX_CLK/RX_CLK clock cycles */
2036  tmpreg = (heth->Instance)->DMAOMR;
2038  (heth->Instance)->DMAOMR = tmpreg;
2039 }
2040 
2045 #endif /* HAL_ETH_MODULE_ENABLED */
2046 
2054 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_StatusTypeDef HAL_ETH_GetReceivedFrame(ETH_HandleTypeDef *heth)
#define IS_ETH_PAUSE_TIME(TIME)
#define PHY_BSR
#define ETH_DMASR_TBUS
Definition: stm32f745xx.h:8024
#define ETH_DMAENHANCEDDESCRIPTOR_ENABLE
#define __HAL_ETH_DMA_GET_FLAG(__HANDLE__, __FLAG__)
Checks whether the specified Ethernet DMA flag is set or not.
ETH_DMADescTypeDef * RxDesc
uint32_t UnicastPauseFrameDetect
#define ETH_DMARXDESC_OWN
Bit definition of RDES0 register: DMA Rx descriptor status register.
HAL_ETH_StateTypeDef
HAL State structures definition.
#define IS_ETH_CARRIER_SENSE(CMD)
void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *heth)
#define PHY_AUTONEGOTIATION
#define IS_ETH_SPEED(SPEED)
#define ETH_DROPTCPIPCHECKSUMERRORFRAME_ENABLE
#define ETH_TX_BUF_SIZE
#define assert_param(expr)
Include module&#39;s header file.
#define ETH_DMARXDESC_FS
void HAL_Delay(__IO uint32_t Delay)
This function provides accurate delay (in milliseconds) based on variable incremented.
#define ETH_DMARXDESC_FRAMELENGTHSHIFT
#define ETH_DMA_IT_R
#define IS_ETH_DEFERRAL_CHECK(CMD)
HAL_StatusTypeDef HAL_ETH_Stop(ETH_HandleTypeDef *heth)
HAL_StatusTypeDef HAL_ETH_Start(ETH_HandleTypeDef *heth)
#define ETH_MODE_HALFDUPLEX
#define ETH_UNICASTFRAMESFILTER_PERFECT
#define ETH_CHECKSUMOFFLAOD_DISABLE
#define IS_ETH_LOOPBACK_MODE(CMD)
#define IS_ETH_BACKOFF_LIMIT(LIMIT)
#define IS_ETH_JABBER(CMD)
ETH DMA Configuration Structure definition.
#define PHY_DUPLEX_STATUS
#define ETH_DMA_FLAG_R
#define ETH_MACMIIAR_CR_Div42
Definition: stm32f745xx.h:7717
#define IS_ETH_RECEIVE_ALL(CMD)
#define ETH_DMATXDESC_TCH
#define ETH_SPEED_10M
ETH_DMADescTypeDef * TxDesc
#define ETH_PROMISCUOUS_MODE_ENABLE
#define __HAL_UNLOCK(__HANDLE__)
#define __HAL_ETH_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enables the specified Ethernet DMA interrupts.
ETH DMA Descriptors data structure definition.
#define ETH_MACMIIAR_CR_MASK
void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
#define ETH_VLANTAGCOMPARISON_16BIT
#define PHY_SPEED_STATUS
ETH_InitTypeDef Init
#define ETH_MODE_FULLDUPLEX
#define ETH_DMAOMR_ST
Definition: stm32f745xx.h:8043
#define ETH_TRANSMITSTOREFORWARD_ENABLE
#define IS_ETH_MEDIA_INTERFACE(MODE)
#define ETH_MACMIIAR_CR_Div102
Definition: stm32f745xx.h:7721
HAL_StatusTypeDef HAL_ETH_ConfigDMA(ETH_HandleTypeDef *heth, ETH_DMAInitTypeDef *dmaconf)
#define PHY_READ_TO
#define ETH_MACMIIAR_MB
Definition: stm32f745xx.h:7723
#define ETH_RECEIVEALL_ENABLE
#define ETH_AUTOMATICPADCRCSTRIP_DISABLE
#define ETH_DMATXDESC_LS
#define ETH_WATCHDOG_ENABLE
#define __HAL_ETH_DMA_CLEAR_IT(__HANDLE__, __INTERRUPT__)
Clears the Ethernet DMA IT pending bit.
#define ETH_AUTONEGOTIATION_DISABLE
#define ETH_FIXEDBURST_ENABLE
#define ETH_DMATXDESC_TBS1
#define IS_ETH_DROP_TCPIP_CHECKSUM_FRAME(CMD)
#define ETH_DMAOMR_FTF
Definition: stm32f745xx.h:8033
HAL_StatusTypeDef HAL_ETH_DeInit(ETH_HandleTypeDef *heth)
#define ETH_RECEIVEALL_DISABLE
HAL_LockTypeDef Lock
#define ETH_MACCR_RE
Definition: stm32f745xx.h:7689
HAL_StatusTypeDef HAL_ETH_DMATxDescListInit(ETH_HandleTypeDef *heth, ETH_DMADescTypeDef *DMATxDescTab, uint8_t *TxBuff, uint32_t TxBuffCount)
#define ETH_TXDMABURSTLENGTH_32BEAT
#define IS_ETH_MULTICAST_FRAMES_FILTER(FILTER)
#define IS_ETH_TRANSMIT_FLOWCONTROL(CMD)
#define IS_ETH_UNICAST_FRAMES_FILTER(FILTER)
#define ETH_MACMIIAR_PA
Definition: stm32f745xx.h:7714
#define ETH_DMAARBITRATION_ROUNDROBIN_RXTX_1_1
#define IS_ETH_RXDMA_BURST_LENGTH(LENGTH)
#define ETH_SECONDFRAMEOPERARTE_ENABLE
#define ETH_RECEIVEDTHRESHOLDCONTROL_64BYTES
#define __HAL_LOCK(__HANDLE__)
#define PHY_RESET
#define IS_ETH_PAUSE_LOW_THRESHOLD(THRESHOLD)
#define ETH_RECEIVEOWN_DISABLE
#define IS_ETH_FLUSH_RECEIVE_FRAME(CMD)
#define IS_ETH_DMA_ARBITRATION_ROUNDROBIN_RXTX(RATIO)
#define NULL
Definition: usbd_def.h:53
#define IS_ETH_FORWARD_ERROR_FRAMES(CMD)
uint32_t BroadcastFramesReception
#define ETH_DMA_IT_NIS
#define ETH_MAC_ADDR_LBASE
#define IS_ETH_SECOND_FRAME_OPERATE(CMD)
#define IS_ETH_RECEIVE_THRESHOLD_CONTROL(THRESHOLD)
ETH_DMADescTypeDef * FSRxDesc
void HAL_ETH_IRQHandler(ETH_HandleTypeDef *heth)
HAL_StatusTypeDef HAL_ETH_TransmitFrame(ETH_HandleTypeDef *heth, uint32_t FrameLength)
#define __IO
Definition: core_cm0.h:213
uint32_t ForwardUndersizedGoodFrames
#define IS_ETH_VLAN_TAG_COMPARISON(COMPARISON)
#define IS_ETH_RECEIVE_OWN(CMD)
#define ETH_MAC_ADDR_HBASE
#define ETH_DMATXDESC_FS
#define IS_ETH_CHECKSUM_OFFLOAD(CMD)
HAL_StatusTypeDef HAL_ETH_ReadPHYRegister(ETH_HandleTypeDef *heth, uint16_t PHYReg, uint32_t *RegValue)
#define ETH_DMABMR_SR
Definition: stm32f745xx.h:7975
#define ETH_RETRYTRANSMISSION_DISABLE
#define ETH_DMARXDESC_LS
This file contains all the functions prototypes for the HAL module driver.
ETH_DMADescTypeDef * LSRxDesc
#define IS_ETH_FIXED_BURST(CMD)
#define ETH_DMARXDESC_RCH
__IO uint32_t MACMIIAR
Definition: stm32f745xx.h:451
#define ETH_RXDMABURSTLENGTH_32BEAT
#define ETH_CARRIERSENCE_ENABLE
#define IS_ETH_INTER_FRAME_GAP(GAP)
#define IS_ETH_TRANSMIT_THRESHOLD_CONTROL(THRESHOLD)
#define PHY_BCR
#define ETH_JABBER_ENABLE
#define ETH_FORWARDUNDERSIZEDGOODFRAMES_DISABLE
#define IS_ETH_TRANSMIT_STORE_FORWARD(CMD)
#define ETH_RXINTERRUPT_MODE
#define IS_ETH_ENHANCED_DESCRIPTOR_FORMAT(CMD)
ETH MAC Configuration Structure definition.
#define ETH_ERROR
#define ETH_MULTICASTFRAMESFILTER_PERFECT
#define ETH_DEFFERRALCHECK_DISABLE
#define ETH_PASSCONTROLFRAMES_BLOCKALL
#define PHY_LINKED_STATUS
#define IS_ETH_RETRY_TRANSMISSION(CMD)
#define ETH_LOOPBACKMODE_DISABLE
uint32_t EnhancedDescriptorFormat
#define ETH_ADDRESSALIGNEDBEATS_ENABLE
#define ETH_DMA_IT_T
#define ETH_MAC_ADDRESS0
#define ETH_MACMIIAR_CR_Div62
Definition: stm32f745xx.h:7718
#define ETH_DMATXDESC_CHECKSUMTCPUDPICMPFULL
#define __HAL_RCC_SYSCFG_CLK_ENABLE()
#define IS_ETH_AUTONEGOTIATION(CMD)
#define IS_ETH_VLAN_TAG_IDENTIFIER(IDENTIFIER)
#define IS_ETH_WATCHDOG(CMD)
HAL_ETH_StateTypeDef HAL_ETH_GetState(ETH_HandleTypeDef *heth)
#define IS_ETH_RECEIVE_FLOWCONTROL(CMD)
#define UNUSED(x)
#define IS_ETH_PHY_ADDRESS(ADDRESS)
HAL_StatusTypeDef HAL_ETH_ConfigMAC(ETH_HandleTypeDef *heth, ETH_MACInitTypeDef *macconf)
#define SYSCFG_PMC_MII_RMII_SEL
Definition: stm32f745xx.h:6698
#define ETH_FLUSHRECEIVEDFRAME_ENABLE
#define IS_ETH_CONTROL_FRAMES(PASS)
void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
Initializes the ETH MSP.
Definition: ethernetif.c:113
ETH_DMARxFrameInfos RxFrameInfos
#define ETH_BACKOFFLIMIT_10
#define ETH_PAUSELOWTHRESHOLD_MINUS4
#define ETH_MACCR_TE
Definition: stm32f745xx.h:7688
#define ETH_PROMISCUOUS_MODE_DISABLE
#define ETH_DMAOMR_CLEAR_MASK
#define ETH_SUCCESS
#define IS_ETH_ZEROQUANTA_PAUSE(CMD)
HAL_StatusTypeDef HAL_ETH_DMARxDescListInit(ETH_HandleTypeDef *heth, ETH_DMADescTypeDef *DMARxDescTab, uint8_t *RxBuff, uint32_t RxBuffCount)
#define ETH_REG_WRITE_DELAY
#define IS_ETH_RX_MODE(MODE)
__IO uint32_t MACMIIDR
Definition: stm32f745xx.h:452
#define ETH_RECEIVEFLOWCONTROL_DISABLE
#define IS_ETH_TXDMA_BURST_LENGTH(LENGTH)
uint32_t HAL_RCC_GetHCLKFreq(void)
#define ETH_TRANSMITFLOWCONTROL_DISABLE
#define PHY_SR
#define IS_ETH_DESTINATION_ADDR_FILTER(FILTER)
HAL_StatusTypeDef HAL_ETH_GetReceivedFrame_IT(ETH_HandleTypeDef *heth)
#define PHY_CONFIG_DELAY
void HAL_ETH_TxCpltCallback(ETH_HandleTypeDef *heth)
#define IS_ETH_MAC_ADDRESS0123(ADDRESS)
#define ETH_MACMIIAR_MR
Definition: stm32f745xx.h:7715
#define ETH_BROADCASTFRAMESRECEPTION_ENABLE
#define ETH_DMARXDESC_FL
#define ETH_DESTINATIONADDRFILTER_NORMAL
#define ETH_CHECKSUM_BY_HARDWARE
#define IS_ETH_CHECKSUM_MODE(MODE)
#define ETH_MACCR_CLEAR_MASK
#define ETH_DMARXDESC_DIC
Bit definition of RDES1 register.
#define ETH_INTERFRAMEGAP_96BIT
#define ETH_MACMIIAR_CR_Div26
Definition: stm32f745xx.h:7720
#define IS_ETH_DMA_DESC_SKIP_LENGTH(LENGTH)
#define IS_ETH_SOURCE_ADDR_FILTER(CMD)
void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *heth)
Ethernet Rx Transfer completed callback.
Definition: ethernetif.c:165
#define ETH_MACMIIAR_MW
Definition: stm32f745xx.h:7722
#define ETH_DMA_FLAG_T
#define ETH_SOURCEADDRFILTER_DISABLE
#define ETH_DMABMR_USP
Definition: stm32f745xx.h:7939
#define ETH_UNICASTPAUSEFRAMEDETECT_DISABLE
uint32_t DropTCPIPChecksumErrorFrame
#define PHY_RESET_DELAY
#define ETH_RECEIVESTOREFORWARD_ENABLE
#define IS_ETH_FORWARD_UNDERSIZED_GOOD_FRAMES(CMD)
#define ETH_DMAOMR_SR
Definition: stm32f745xx.h:8052
#define ETH_ZEROQUANTAPAUSE_DISABLE
__IO HAL_ETH_StateTypeDef State
HAL_StatusTypeDef
HAL Status structures definition.
#define ETH_RXBUFNB
#define IS_ETH_ADDRESS_ALIGNED_BEATS(CMD)
HAL_StatusTypeDef HAL_ETH_WritePHYRegister(ETH_HandleTypeDef *heth, uint16_t PHYReg, uint32_t RegValue)
#define ETH_MACMIIAR_CR_Div16
Definition: stm32f745xx.h:7719
uint32_t ReceiveThresholdControl
#define ETH_MACFCR_CLEAR_MASK
#define ETH_RX_BUF_SIZE
#define ETH_DMATXDESC_OWN
Bit definition of TDES0 register: DMA Tx descriptor status register.
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
#define IS_ETH_RECEIVE_STORE_FORWARD(CMD)
HAL_StatusTypeDef HAL_ETH_Init(ETH_HandleTypeDef *heth)
ETH_TypeDef * Instance
#define PHY_AUTONEGO_COMPLETE
#define IS_ETH_DUPLEX_MODE(MODE)
#define IS_ETH_BROADCAST_FRAMES_RECEPTION(CMD)
#define ETH_CHECKSUMOFFLAOD_ENABLE
#define ETH_DMA_FLAG_AIS
#define ETH_SPEED_100M
ETH Handle Structure definition.
#define IS_ETH_PROMISCUOUS_MODE(CMD)
#define PHY_WRITE_TO
#define IS_ETH_AUTOMATIC_PADCRC_STRIP(CMD)
#define ETH_TRANSMITTHRESHOLDCONTROL_64BYTES
uint32_t TransmitThresholdControl
#define ETH_FORWARDERRORFRAMES_DISABLE
#define IS_ETH_UNICAST_PAUSE_FRAME_DETECT(CMD)
#define SYSCFG
Definition: stm32f745xx.h:1300