@@ -119,8 +119,8 @@ impl<const TD: usize> TDesRing<TD> {
119
119
/// will be stored in the descriptors, so ensure the TDesRing is
120
120
/// not moved after initialisation.
121
121
pub fn init ( & mut self ) {
122
- for td in self . td . iter_mut ( ) {
123
- td . init ( ) ;
122
+ for x in 0 .. TD {
123
+ self . td [ x ] . init ( ) ;
124
124
}
125
125
self . tdidx = 0 ;
126
126
@@ -129,9 +129,8 @@ impl<const TD: usize> TDesRing<TD> {
129
129
unsafe {
130
130
let dma = & * stm32:: ETHERNET_DMA :: ptr ( ) ;
131
131
dma. dmactx_dlar
132
- . write ( |w| w. bits ( & self . td as * const _ as u32 ) ) ;
133
- dma. dmactx_rlr
134
- . write ( |w| w. tdrl ( ) . bits ( self . td . len ( ) as u16 - 1 ) ) ;
132
+ . write ( |w| w. bits ( & self . td [ 0 ] as * const _ as u32 ) ) ;
133
+ dma. dmactx_rlr . write ( |w| w. tdrl ( ) . bits ( TD as u16 - 1 ) ) ;
135
134
dma. dmactx_dtpr
136
135
. write ( |w| w. bits ( & self . td [ 0 ] as * const _ as u32 ) ) ;
137
136
}
@@ -265,18 +264,17 @@ impl<const RD: usize> RDesRing<RD> {
265
264
/// will be stored in the descriptors, so ensure the RDesRing is
266
265
/// not moved after initialisation.
267
266
pub fn init ( & mut self ) {
268
- for rd in self . rd . iter_mut ( ) {
269
- rd . init ( ) ;
267
+ for x in 0 .. RD {
268
+ self . rd [ x ] . init ( ) ;
270
269
}
271
270
self . rdidx = 0 ;
272
271
273
272
// Initialise pointers in the DMA engine
274
273
unsafe {
275
274
let dma = & * stm32:: ETHERNET_DMA :: ptr ( ) ;
276
275
dma. dmacrx_dlar
277
- . write ( |w| w. bits ( & self . rd as * const _ as u32 ) ) ;
278
- dma. dmacrx_rlr
279
- . write ( |w| w. rdrl ( ) . bits ( self . rd . len ( ) as u16 - 1 ) ) ;
276
+ . write ( |w| w. bits ( & self . rd [ 0 ] as * const _ as u32 ) ) ;
277
+ dma. dmacrx_rlr . write ( |w| w. rdrl ( ) . bits ( RD as u16 - 1 ) ) ;
280
278
}
281
279
282
280
// Release descriptors to the DMA engine
0 commit comments