Change Protocol::guid() -> Protocol::GUID
This commit is contained in:
@@ -109,7 +109,7 @@ impl BootServices {
|
||||
}
|
||||
|
||||
pub fn locate_protocol<T: Protocol>(&self) -> Result<&'static mut T, Status> {
|
||||
let guid = <T as Protocol>::guid();
|
||||
let guid = &<T as Protocol>::GUID;
|
||||
let mut proto_ptr: *mut c_void = core::ptr::null_mut();
|
||||
|
||||
match Status::from_num(unsafe {
|
||||
|
||||
@@ -2,13 +2,6 @@ use crate::{Status, Guid};
|
||||
use crate::proto::Protocol;
|
||||
use core::ffi::c_void;
|
||||
|
||||
const GRAPHICS_OUTPUT_PROTOCOL_GUID: Guid = Guid {
|
||||
data1: 0x9042a9de,
|
||||
data2: 0x23dc,
|
||||
data3: 0x4a38,
|
||||
data4: [0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a]
|
||||
};
|
||||
|
||||
#[repr(C)]
|
||||
pub struct Mode {
|
||||
pub max_mode: u32,
|
||||
@@ -62,9 +55,12 @@ pub struct ModeIterator<'a> {
|
||||
}
|
||||
|
||||
impl Protocol for GraphicsOutputProtocol {
|
||||
fn guid() -> &'static Guid {
|
||||
return &GRAPHICS_OUTPUT_PROTOCOL_GUID;
|
||||
}
|
||||
const GUID: Guid = Guid {
|
||||
data1: 0x9042a9de,
|
||||
data2: 0x23dc,
|
||||
data3: 0x4a38,
|
||||
data4: [0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a]
|
||||
};
|
||||
}
|
||||
|
||||
impl GraphicsOutputProtocol {
|
||||
|
||||
@@ -3,7 +3,8 @@ pub mod stip;
|
||||
pub mod gop;
|
||||
|
||||
pub trait Protocol {
|
||||
fn guid() -> &'static super::Guid;
|
||||
const GUID: super::Guid;
|
||||
//fn guid() -> &'static super::Guid;
|
||||
}
|
||||
|
||||
pub use stop::SimpleTextOutputProtocol;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::{Status, Guid, Event, system_table};
|
||||
use core::ffi::c_void;
|
||||
use crate::{Status, Guid, Protocol, Event, system_table};
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
@@ -15,6 +14,15 @@ pub struct SimpleTextInputProtocol {
|
||||
wait_for_key: Event
|
||||
}
|
||||
|
||||
impl Protocol for SimpleTextInputProtocol {
|
||||
const GUID: Guid = Guid {
|
||||
data1: 0x387477c1,
|
||||
data2: 0x69c7,
|
||||
data3: 0x11d2,
|
||||
data4: [0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b]
|
||||
};
|
||||
}
|
||||
|
||||
impl SimpleTextInputProtocol {
|
||||
pub fn reset(&mut self, extended_verification: bool) -> Result<(), Status> {
|
||||
return Status::from_num(unsafe {
|
||||
@@ -23,7 +31,7 @@ impl SimpleTextInputProtocol {
|
||||
}
|
||||
|
||||
pub fn read_key_blocking(&mut self) -> Result<InputKey, Status> {
|
||||
let res = system_table().boot_services.wait_for_event(self.wait_for_key)?;
|
||||
system_table().boot_services.wait_for_event(self.wait_for_key)?;
|
||||
loop {
|
||||
let res = self.read_key_stroke();
|
||||
match res {
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
use crate::{Status, Guid};
|
||||
use crate::{Status, Guid, Protocol};
|
||||
|
||||
use core::ffi::c_void;
|
||||
use core::fmt;
|
||||
|
||||
const SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID: Guid = Guid {
|
||||
data1: 0x387477c2,
|
||||
data2: 0x69c7,
|
||||
data3: 0x11d2,
|
||||
data4: [0x82, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b]
|
||||
};
|
||||
|
||||
#[repr(C)]
|
||||
pub struct SimpleTextOutputProtocol {
|
||||
fn_reset: *mut c_void,
|
||||
fn_output_string: unsafe fn(&SimpleTextOutputProtocol, s: *const i16) -> u64
|
||||
}
|
||||
|
||||
impl super::Protocol for SimpleTextOutputProtocol {
|
||||
fn guid() -> &'static Guid {
|
||||
return &SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID;
|
||||
}
|
||||
impl Protocol for SimpleTextOutputProtocol {
|
||||
const GUID: Guid = Guid {
|
||||
data1: 0x387477c2,
|
||||
data2: 0x69c7,
|
||||
data3: 0x11d2,
|
||||
data4: [0x82, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b]
|
||||
};
|
||||
}
|
||||
|
||||
impl SimpleTextOutputProtocol {
|
||||
|
||||
Reference in New Issue
Block a user