Skip to content

Commit 2608c23

Browse files
Apply suggestions from code review
Co-Authored-By: Jonas Schievink <[email protected]>
1 parent 9fac3d9 commit 2608c23

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/peripheral/scb.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ use self::scb_consts::*;
314314

315315
#[cfg(not(armv6m))]
316316
impl SCB {
317-
/// Enables I-cache if currently disabled
317+
/// Enables I-cache if currently disabled.
318318
///
319319
/// This operation first invalidates the entire I-cache.
320320
#[inline]
@@ -338,7 +338,7 @@ impl SCB {
338338
crate::asm::isb();
339339
}
340340

341-
/// Disables I-cache if currently enabled
341+
/// Disables I-cache if currently enabled.
342342
///
343343
/// This operation invalidates the entire I-cache after disabling.
344344
#[inline]
@@ -362,7 +362,7 @@ impl SCB {
362362
crate::asm::isb();
363363
}
364364

365-
/// Returns whether the I-cache is currently enabled
365+
/// Returns whether the I-cache is currently enabled.
366366
#[inline(always)]
367367
pub fn icache_enabled() -> bool {
368368
crate::asm::dsb();
@@ -372,7 +372,7 @@ impl SCB {
372372
unsafe { (*Self::ptr()).ccr.read() & SCB_CCR_IC_MASK == SCB_CCR_IC_MASK }
373373
}
374374

375-
/// Invalidates entire I-cache
375+
/// Invalidates the entire I-cache.
376376
#[inline]
377377
pub fn invalidate_icache(&mut self) {
378378
// NOTE(unsafe): No races as all CBP registers are write-only and stateless
@@ -385,7 +385,7 @@ impl SCB {
385385
crate::asm::isb();
386386
}
387387

388-
/// Enables D-cache if currently disabled
388+
/// Enables D-cache if currently disabled.
389389
///
390390
/// This operation first invalidates the entire D-cache, ensuring it does
391391
/// not contain stale values before being enabled.
@@ -407,7 +407,7 @@ impl SCB {
407407
crate::asm::isb();
408408
}
409409

410-
/// Disables D-cache if currently enabled
410+
/// Disables D-cache if currently enabled.
411411
///
412412
/// This operation subsequently cleans and invalidates the entire D-cache,
413413
/// ensuring all contents are safely written back to main memory after disabling.
@@ -426,7 +426,7 @@ impl SCB {
426426
self.clean_invalidate_dcache(cpuid);
427427
}
428428

429-
/// Returns whether the D-cache is currently enabled
429+
/// Returns whether the D-cache is currently enabled.
430430
#[inline]
431431
pub fn dcache_enabled() -> bool {
432432
crate::asm::dsb();
@@ -436,7 +436,7 @@ impl SCB {
436436
unsafe { (*Self::ptr()).ccr.read() & SCB_CCR_DC_MASK == SCB_CCR_DC_MASK }
437437
}
438438

439-
/// Invalidates entire D-cache
439+
/// Invalidates the entire D-cache.
440440
///
441441
/// Note that calling this while the dcache is enabled will probably wipe out the
442442
/// stack, depending on optimisations, therefore breaking returning to the call point.
@@ -461,7 +461,7 @@ impl SCB {
461461
crate::asm::isb();
462462
}
463463

464-
/// Cleans entire D-cache
464+
/// Cleans the entire D-cache.
465465
///
466466
/// This function causes everything in the D-cache to be written back to main memory,
467467
/// overwriting whatever is already there.
@@ -483,7 +483,7 @@ impl SCB {
483483
crate::asm::isb();
484484
}
485485

486-
/// Cleans and invalidates entire D-cache
486+
/// Cleans and invalidates the entire D-cache.
487487
///
488488
/// This function causes everything in the D-cache to be written back to main memory,
489489
/// and then marks the entire D-cache as invalid, causing future reads to first fetch
@@ -506,10 +506,10 @@ impl SCB {
506506
crate::asm::isb();
507507
}
508508

509-
/// Invalidates D-cache by address
509+
/// Invalidates D-cache by address.
510510
///
511-
/// * `addr`: the address to invalidate, which must be cache-line aligned
512-
/// * `size`: number of bytes to invalidate, which must be a multiple of the cache line size
511+
/// * `addr`: The address to invalidate, which must be cache-line aligned.
512+
/// * `size`: Number of bytes to invalidate, which must be a multiple of the cache line size.
513513
///
514514
/// Invalidates D-cache cache lines, starting from the first line containing `addr`,
515515
/// finishing once at least `size` bytes have been invalidated.
@@ -530,7 +530,7 @@ impl SCB {
530530
/// # Safety
531531
///
532532
/// After invalidating, the next read of invalidated data will be from main memory. This may
533-
/// cause recent writes to be lost, potentially including writes that initialised objects.
533+
/// cause recent writes to be lost, potentially including writes that initialized objects.
534534
/// Therefore, this method may cause uninitialised memory or invalid values to be read,
535535
/// resulting in undefined behaviour. You must ensure that main memory contains valid and
536536
/// initialised values before invalidating.
@@ -575,9 +575,9 @@ impl SCB {
575575
crate::asm::isb();
576576
}
577577

578-
/// Invalidates an object from the D-cache
578+
/// Invalidates an object from the D-cache.
579579
///
580-
/// * `obj`: Object to invalidate
580+
/// * `obj`: The object to invalidate.
581581
///
582582
/// Invalidates D-cache starting from the first cache line containing `obj`,
583583
/// continuing to invalidate cache lines until all of `obj` has been invalidated.
@@ -613,9 +613,9 @@ impl SCB {
613613
self.invalidate_dcache_by_address(obj as *const T as usize, core::mem::size_of::<T>());
614614
}
615615

616-
/// Invalidates a slice from the D-cache
616+
/// Invalidates a slice from the D-cache.
617617
///
618-
/// * `slice`: Slice to invalidate
618+
/// * `slice`: The slice to invalidate.
619619
///
620620
/// Invalidates D-cache starting from the first cache line containing members of `slice`,
621621
/// continuing to invalidate cache lines until all of `slice` has been invalidated.
@@ -652,10 +652,10 @@ impl SCB {
652652
slice.len() * core::mem::size_of::<T>());
653653
}
654654

655-
/// Cleans D-cache by address
655+
/// Cleans D-cache by address.
656656
///
657-
/// * `addr`: the address to clean
658-
/// * `size`: number of bytes to clean
657+
/// * `addr`: The address to start cleaning at.
658+
/// * `size`: The number of bytes to clean.
659659
///
660660
/// Cleans D-cache cache lines, starting from the first line containing `addr`,
661661
/// finishing once at least `size` bytes have been invalidated.
@@ -701,9 +701,9 @@ impl SCB {
701701
crate::asm::isb();
702702
}
703703

704-
/// Cleans an object in D-cache
704+
/// Cleans an object from the D-cache.
705705
///
706-
/// * `obj`: Object to clean
706+
/// * `obj`: The object to clean.
707707
///
708708
/// Cleans D-cache starting from the first cache line containing `obj`,
709709
/// continuing to clean cache lines until all of `obj` has been cleaned.
@@ -717,9 +717,9 @@ impl SCB {
717717
self.clean_dcache_by_address(obj as *const T as usize, core::mem::size_of::<T>());
718718
}
719719

720-
/// Cleans a slice in D-cache
720+
/// Cleans a slice from D-cache.
721721
///
722-
/// * `slice`: Slice to clean
722+
/// * `slice`: The slice to clean.
723723
///
724724
/// Cleans D-cache starting from the first cache line containing members of `slice`,
725725
/// continuing to clean cache lines until all of `slice` has been cleaned.
@@ -734,10 +734,10 @@ impl SCB {
734734
slice.len() * core::mem::size_of::<T>());
735735
}
736736

737-
/// Cleans and invalidates D-cache by address
737+
/// Cleans and invalidates D-cache by address.
738738
///
739-
/// * `addr`: the address to clean and invalidate
740-
/// * `size`: number of bytes to clean and invalidate
739+
/// * `addr`: The address to clean and invalidate.
740+
/// * `size`: The number of bytes to clean and invalidate.
741741
///
742742
/// Cleans and invalidates D-cache starting from the first cache line containing `addr`,
743743
/// finishing once at least `size` bytes have been cleaned and invalidated.

0 commit comments

Comments
 (0)