Implement a new set of physical page APIs

This commit is contained in:
Zhang Junyang
2024-12-24 18:20:55 +08:00
committed by Tate, Hongliang Tian
parent 6e1c36965a
commit cdac59beda
56 changed files with 882 additions and 995 deletions

View File

@ -34,10 +34,10 @@ impl TxBuffer {
let dma_stream = if let Some(stream) = pool.lock().pop_front() {
stream
} else {
let segment = FrameAllocOptions::new(TX_BUFFER_LEN / PAGE_SIZE)
.alloc_contiguous()
let segment = FrameAllocOptions::new()
.alloc_segment(TX_BUFFER_LEN / PAGE_SIZE)
.unwrap();
DmaStream::map(segment, DmaDirection::ToDevice, false).unwrap()
DmaStream::map(segment.into(), DmaDirection::ToDevice, false).unwrap()
};
let tx_buffer = {

View File

@ -152,9 +152,9 @@ impl DmaPage {
pool: Weak<DmaPool>,
) -> Result<Self, ostd::Error> {
let dma_stream = {
let segment = FrameAllocOptions::new(1).alloc_contiguous()?;
let segment = FrameAllocOptions::new().alloc_segment(1)?;
DmaStream::map(segment, direction, is_cache_coherent)
DmaStream::map(segment.into(), direction, is_cache_coherent)
.map_err(|_| ostd::Error::AccessDenied)?
};