Download kernel/src/drivers/framebuffer.rs from Jaswanth-2008/AeroOS: direct link, hf CLI and curl.
- Browser
- Download file 859 Bytes
-
https://huggingface.co/Jaswanth-2008/AeroOS/resolve/main/kernel/src/drivers/framebuffer.rs
- Command line
-
hf download hf://Jaswanth-2008/AeroOS/kernel/src/drivers/framebuffer.rs
-
curl -L -o framebuffer.rs https://huggingface.co/Jaswanth-2008/AeroOS/resolve/main/kernel/src/drivers/framebuffer.rs
859 Bytes
| use bootloader_api::info::{FrameBuffer, FrameBufferInfo, PixelFormat}; | |
| use spin::Mutex; | |
| pub struct FramebufferConfig { | |
| pub width: usize, | |
| pub height: usize, | |
| pub stride: usize, | |
| pub bytes_per_pixel: usize, | |
| pub pixel_format: PixelFormat, | |
| pub buffer: *mut u8, | |
| } | |
| unsafe impl Send for FramebufferConfig {} | |
| unsafe impl Sync for FramebufferConfig {} | |
| pub static FRAMEBUFFER: Mutex<Option<FramebufferConfig>> = Mutex::new(None); | |
| pub fn init(fb: &'static mut FrameBuffer) { | |
| let info: FrameBufferInfo = fb.info(); | |
| let ptr = fb.buffer_mut().as_mut_ptr(); | |
| let config = FramebufferConfig { | |
| width: info.width, | |
| height: info.height, | |
| stride: info.stride, | |
| bytes_per_pixel: info.bytes_per_pixel, | |
| pixel_format: info.pixel_format, | |
| buffer: ptr, | |
| }; | |
| *FRAMEBUFFER.lock() = Some(config); | |
| } | |