File tree Expand file tree Collapse file tree 11 files changed +214
-32
lines changed Expand file tree Collapse file tree 11 files changed +214
-32
lines changed Original file line number Diff line number Diff line change @@ -805,4 +805,30 @@ package body STM32.Device is
805805 RCC_Periph.AHB1RSTR.CRCRST := False;
806806 end Reset ;
807807
808+ -- --------------
809+ -- Enable_Eth --
810+ -- --------------
811+
812+ procedure Enable_Eth
813+ (MAC : Boolean := True;
814+ MAC_TX : Boolean := True;
815+ MAC_RX : Boolean := True;
816+ MAC_PTP : Boolean := True) is
817+ begin
818+ RCC_Periph.AHB1ENR.ETHMACEN := MAC;
819+ RCC_Periph.AHB1ENR.ETHMACTXEN := MAC_TX;
820+ RCC_Periph.AHB1ENR.ETHMACRXEN := MAC_RX;
821+ RCC_Periph.AHB1ENR.ETHMACPTPEN := MAC_PTP;
822+ end Enable_Eth ;
823+
824+ -- -------------
825+ -- Reset_Eth --
826+ -- -------------
827+
828+ procedure Reset_Eth is
829+ begin
830+ RCC_Periph.AHB1RSTR.ETHMACRST := True;
831+ RCC_Periph.AHB1RSTR.ETHMACRST := False;
832+ end Reset_Eth ;
833+
808834end STM32.Device ;
Original file line number Diff line number Diff line change @@ -475,6 +475,24 @@ package STM32.Device is
475475
476476 RTC : aliased RTC_Device;
477477
478+ -- ------------
479+ -- Ethernet --
480+ -- ------------
481+
482+ procedure Enable_Eth
483+ (MAC : Boolean := True;
484+ MAC_TX : Boolean := True;
485+ MAC_RX : Boolean := True;
486+ MAC_PTP : Boolean := True);
487+ -- Enable/disable Ethernet MAC clocks:
488+ -- * MAC - Ethernet MAC clock enable
489+ -- * MAC_TX - Ethernet Transmission clock enable
490+ -- * MAC_RX - Ethernet Reception clock enable
491+ -- * MAC_PTP - Ethernet PTP clock enable
492+
493+ procedure Reset_Eth ;
494+ -- Ethernet MAC reset
495+
478496private
479497
480498 GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function := 0 ;
Original file line number Diff line number Diff line change @@ -935,4 +935,30 @@ package body STM32.Device is
935935 RCC_Periph.AHB1RSTR.CRCRST := False;
936936 end Reset ;
937937
938+ -- --------------
939+ -- Enable_Eth --
940+ -- --------------
941+
942+ procedure Enable_Eth
943+ (MAC : Boolean := True;
944+ MAC_TX : Boolean := True;
945+ MAC_RX : Boolean := True;
946+ MAC_PTP : Boolean := True) is
947+ begin
948+ RCC_Periph.AHB1ENR.ETHMACEN := MAC;
949+ RCC_Periph.AHB1ENR.ETHMACTXEN := MAC_TX;
950+ RCC_Periph.AHB1ENR.ETHMACRXEN := MAC_RX;
951+ RCC_Periph.AHB1ENR.ETHMACPTPEN := MAC_PTP;
952+ end Enable_Eth ;
953+
954+ -- -------------
955+ -- Reset_Eth --
956+ -- -------------
957+
958+ procedure Reset_Eth is
959+ begin
960+ RCC_Periph.AHB1RSTR.ETHMACRST := True;
961+ RCC_Periph.AHB1RSTR.ETHMACRST := False;
962+ end Reset_Eth ;
963+
938964end STM32.Device ;
Original file line number Diff line number Diff line change @@ -540,6 +540,24 @@ package STM32.Device is
540540
541541 RTC : aliased RTC_Device;
542542
543+ -- ------------
544+ -- Ethernet --
545+ -- ------------
546+
547+ procedure Enable_Eth
548+ (MAC : Boolean := True;
549+ MAC_TX : Boolean := True;
550+ MAC_RX : Boolean := True;
551+ MAC_PTP : Boolean := True);
552+ -- Enable/disable Ethernet MAC clocks:
553+ -- * MAC - Ethernet MAC clock enable
554+ -- * MAC_TX - Ethernet Transmission clock enable
555+ -- * MAC_RX - Ethernet Reception clock enable
556+ -- * MAC_PTP - Ethernet PTP clock enable
557+
558+ procedure Reset_Eth ;
559+ -- Ethernet MAC reset
560+
543561private
544562
545563 GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function := 0 ;
Original file line number Diff line number Diff line change @@ -1080,4 +1080,30 @@ package body STM32.Device is
10801080 RCC_Periph.AHB1RSTR.CRCRST := False;
10811081 end Reset ;
10821082
1083+ -- --------------
1084+ -- Enable_Eth --
1085+ -- --------------
1086+
1087+ procedure Enable_Eth
1088+ (MAC : Boolean := True;
1089+ MAC_TX : Boolean := True;
1090+ MAC_RX : Boolean := True;
1091+ MAC_PTP : Boolean := True) is
1092+ begin
1093+ RCC_Periph.AHB1ENR.ETHMACEN := MAC;
1094+ RCC_Periph.AHB1ENR.ETHMACTXEN := MAC_TX;
1095+ RCC_Periph.AHB1ENR.ETHMACRXEN := MAC_RX;
1096+ RCC_Periph.AHB1ENR.ETHMACPTPEN := MAC_PTP;
1097+ end Enable_Eth ;
1098+
1099+ -- -------------
1100+ -- Reset_Eth --
1101+ -- -------------
1102+
1103+ procedure Reset_Eth is
1104+ begin
1105+ RCC_Periph.AHB1RSTR.ETHMACRST := True;
1106+ RCC_Periph.AHB1RSTR.ETHMACRST := False;
1107+ end Reset_Eth ;
1108+
10831109end STM32.Device ;
Original file line number Diff line number Diff line change @@ -629,6 +629,24 @@ package STM32.Device is
629629
630630 RTC : aliased RTC_Device;
631631
632+ -- ------------
633+ -- Ethernet --
634+ -- ------------
635+
636+ procedure Enable_Eth
637+ (MAC : Boolean := True;
638+ MAC_TX : Boolean := True;
639+ MAC_RX : Boolean := True;
640+ MAC_PTP : Boolean := True);
641+ -- Enable/disable Ethernet MAC clocks:
642+ -- * MAC - Ethernet MAC clock enable
643+ -- * MAC_TX - Ethernet Transmission clock enable
644+ -- * MAC_RX - Ethernet Reception clock enable
645+ -- * MAC_PTP - Ethernet PTP clock enable
646+
647+ procedure Reset_Eth ;
648+ -- Ethernet MAC reset
649+
632650private
633651
634652 GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function := 0 ;
Original file line number Diff line number Diff line change @@ -1063,4 +1063,30 @@ package body STM32.Device is
10631063 RCC_Periph.AHB2RSTR.DCMIRST := False;
10641064 end Reset_DCMI ;
10651065
1066+ -- --------------
1067+ -- Enable_Eth --
1068+ -- --------------
1069+
1070+ procedure Enable_Eth
1071+ (MAC : Boolean := True;
1072+ MAC_TX : Boolean := True;
1073+ MAC_RX : Boolean := True;
1074+ MAC_PTP : Boolean := True) is
1075+ begin
1076+ RCC_Periph.AHB1ENR.ETHMACEN := MAC;
1077+ RCC_Periph.AHB1ENR.ETHMACTXEN := MAC_TX;
1078+ RCC_Periph.AHB1ENR.ETHMACRXEN := MAC_RX;
1079+ RCC_Periph.AHB1ENR.ETHMACPTPEN := MAC_PTP;
1080+ end Enable_Eth ;
1081+
1082+ -- -------------
1083+ -- Reset_Eth --
1084+ -- -------------
1085+
1086+ procedure Reset_Eth is
1087+ begin
1088+ RCC_Periph.AHB1RSTR.ETHMACRST := True;
1089+ RCC_Periph.AHB1RSTR.ETHMACRST := False;
1090+ end Reset_Eth ;
1091+
10661092end STM32.Device ;
Original file line number Diff line number Diff line change @@ -611,6 +611,24 @@ package STM32.Device is
611611
612612 RTC : aliased RTC_Device;
613613
614+ -- ------------
615+ -- Ethernet --
616+ -- ------------
617+
618+ procedure Enable_Eth
619+ (MAC : Boolean := True;
620+ MAC_TX : Boolean := True;
621+ MAC_RX : Boolean := True;
622+ MAC_PTP : Boolean := True);
623+ -- Enable/disable Ethernet MAC clocks:
624+ -- * MAC - Ethernet MAC clock enable
625+ -- * MAC_TX - Ethernet Transmission clock enable
626+ -- * MAC_RX - Ethernet Reception clock enable
627+ -- * MAC_PTP - Ethernet PTP clock enable
628+
629+ procedure Reset_Eth ;
630+ -- Ethernet MAC reset
631+
614632private
615633
616634 HSE_VALUE : constant UInt32 := ADL_Config.High_Speed_External_Clock;
Original file line number Diff line number Diff line change @@ -132,4 +132,13 @@ package body STM32.SYSCFG is
132132 Clear_External_Interrupt (External_Line_Number'Val (GPIO_Pin'Pos (Pin)));
133133 end Clear_External_Interrupt ;
134134
135+ -- ------------------
136+ -- Configure_RMII --
137+ -- ------------------
138+
139+ procedure Configure_RMII (RMII : Boolean := True) is
140+ begin
141+ STM32_SVD.SYSCFG.SYSCFG_Periph.PMC.MII_RMII_SEL := RMII;
142+ end Configure_RMII ;
143+
135144end STM32.SYSCFG ;
Original file line number Diff line number Diff line change @@ -57,4 +57,9 @@ package STM32.SYSCFG is
5757
5858 procedure Clear_External_Interrupt (Pin : GPIO_Pin) with Inline;
5959
60+ procedure Configure_RMII (RMII : Boolean := True);
61+ -- Ethernet PHY interface selection:
62+ -- * RMII=False - MII
63+ -- * RMII=True - RMII
64+
6065end STM32.SYSCFG ;
You can’t perform that action at this time.
0 commit comments