Skip to content

Commit 8f8138f

Browse files
committed
Add status method to EndpointHeader
1 parent 144da34 commit 8f8138f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,17 @@ impl EndpointHeader {
209209
}
210210
}
211211

212+
pub fn status(&self, access: &impl ConfigRegionAccess) -> StatusRegister {
213+
let data = unsafe { access.read(self.0, 0x4).get_bits(16..32) };
214+
StatusRegister::new(data as u16)
215+
}
216+
212217
pub fn header(&self) -> PciHeader {
213218
PciHeader(self.0)
214219
}
215220

216221
pub fn capability_pointer(&self, access: &impl ConfigRegionAccess) -> u16 {
217-
let data = unsafe { access.read(self.0, 0x4).get_bits(16..32) };
218-
let status = StatusRegister::new(data as u16);
222+
let status = self.status(access);
219223
if status.has_capability_list() {
220224
unsafe { access.read(self.0, 0x34).get_bits(0..8) as u16 }
221225
} else {

0 commit comments

Comments
 (0)