Lines Matching defs:CoherentBox
363 /// Unlike [`Coherent`], a [`CoherentBox`] is guaranteed to be fully owned by the CPU -- its DMA
367 /// A typical use is to allocate a [`CoherentBox`], populate it with normal CPU access, and then
372 /// `CoherentBox<T>`:
381 /// CoherentBox,
385 /// let mut dmem: CoherentBox<u64> = CoherentBox::zeroed(dev, GFP_KERNEL)?;
391 /// `CoherentBox<[T]>`:
401 /// CoherentBox,
405 /// let mut dmem: CoherentBox<[u64]> = CoherentBox::zeroed_slice(dev, 4, GFP_KERNEL)?;
410 pub struct CoherentBox<T: KnownSize + ?Sized>(Coherent<T>);
412 impl<T: AsBytes + FromBytes> CoherentBox<[T]> {
413 /// [`CoherentBox`] variant of [`Coherent::zeroed_slice_with_attrs`].
424 /// Same as [CoherentBox::zeroed_slice_with_attrs], but with `dma::Attrs(0)`.
460 /// This is the [`CoherentBox`] variant of [`Coherent::from_slice_with_attrs`].
470 /// CoherentBox
475 /// let c: CoherentBox<[u8]> =
476 /// CoherentBox::from_slice_with_attrs(dev, &data, GFP_KERNEL, DMA_ATTR_NO_WARN)?;
503 /// Performs the same functionality as [`CoherentBox::from_slice_with_attrs`], except the
518 impl<T: AsBytes + FromBytes> CoherentBox<T> {
519 /// Same as [`CoherentBox::zeroed_slice_with_attrs`], but for a single element.
529 /// Same as [`CoherentBox::zeroed_slice`], but for a single element.
536 impl<T: KnownSize + ?Sized> Deref for CoherentBox<T> {
549 impl<T: AsBytes + FromBytes + KnownSize + ?Sized> DerefMut for CoherentBox<T> {
560 impl<T: AsBytes + FromBytes + KnownSize + ?Sized> From<CoherentBox<T>> for Coherent<T> {
562 fn from(value: CoherentBox<T>) -> Self {
933 CoherentBox::from_slice_with_attrs(dev, data, gfp_flags, dma_attrs).map(Into::into)