#![no_std]
#[doc(no_inline)]
pub use axdriver_base::{BaseDriverOps, DevError, DevResult, DeviceType};
#[derive(Debug, Clone, Copy)]
pub struct DisplayInfo {
pub width: u32,
pub height: u32,
pub fb_base_vaddr: usize,
pub fb_size: usize,
}
pub struct FrameBuffer<'a> {
_raw: &'a mut [u8],
}
impl<'a> FrameBuffer<'a> {
pub unsafe fn from_raw_parts_mut(ptr: *mut u8, len: usize) -> Self {
Self {
_raw: unsafe { core::slice::from_raw_parts_mut(ptr, len) },
}
}
pub fn from_slice(slice: &'a mut [u8]) -> Self {
Self { _raw: slice }
}
}
pub trait DisplayDriverOps: BaseDriverOps {
fn info(&self) -> DisplayInfo;
fn fb(&self) -> FrameBuffer<'_>;
fn need_flush(&self) -> bool;
fn flush(&mut self) -> DevResult;
}