Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 17 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,22 @@
name = "pldm-lib"
version = "0.1.0"
authors = ["Caliptra contributors", "OpenPRoT contributors"]
edition = "2024"
edition = "2021"

[dependencies]
zerocopy = {version = "0.8.17", features = ["derive"]}
[workspace]
members = [
"pldm-common"
]
Comment on lines +7 to +10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving pldm-lib into its own directory and adding it to the workspace members might be cleaner and probably better for packaging releases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have thought about that, but I want to keep pldm-common as part of pldm-lib. Don't we want pldm-common to exist within pldm-lib?


[workspace.package]
version = "0.1.0"
authors = ["Caliptra contributors", "OpenPRoT contributors"]
edition = "2021"

[workspace.dependencies]
pldm-common = { path = "pldm-common" }
bitfield = "0.14.0"
zerocopy = { version = "0.8.17", features = ["derive"] }

[dependencies]
pldm-common.workspace = true
12 changes: 12 additions & 0 deletions pldm-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Licensed under the Apache-2.0 license

[package]
name = "pldm-common"
version.workspace = true
edition.workspace = true
authors.workspace = true

[dependencies]
zerocopy.workspace = true
bitfield.workspace = true

File renamed without changes.
36 changes: 36 additions & 0 deletions pldm-common/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Licensed under the Apache-2.0 license

#[derive(Debug, Clone, PartialEq)]
pub enum PldmError {
InvalidData,
InvalidLength,
InvalidMsgType,
InvalidProtocolVersion,
UnsupportedCmd,
UnsupportedPldmType,
InvalidCompletionCode,
InvalidTransferOpFlag,
InvalidTransferRespFlag,

InvalidVersionStringType,
InvalidVersionStringLength,
InvalidFdState,
InvalidDescriptorType,
InvalidDescriptorLength,
InvalidDescriptorCount,
InvalidComponentClassification,
InvalidComponentResponseCode,
InvalidComponentCompatibilityResponse,
InvalidComponentCompatibilityResponseCode,
InvalidTransferResult,
InvalidVerifyResult,
InvalidApplyResult,
InvalidGetStatusReasonCode,
InvalidAuxStateStatus,
}

#[derive(Debug, Clone, PartialEq)]
pub enum UtilError {
InvalidMctpPayloadLength,
InvalidMctpMsgType,
}
16 changes: 16 additions & 0 deletions pldm-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#![no_std]

// Re-export core types for no_std compatibility
pub use core::{
option::Option::{self, Some, None},
result::Result::{self, Ok, Err},
};

// Licensed under the Apache-2.0 license


pub mod codec;
pub mod error;
pub mod message;
pub mod protocol;
pub mod util;
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ pub fn get_descriptor_length(descriptor_type: DescriptorType) -> usize {
}

#[derive(Debug, Copy, Clone, PartialEq)]
#[repr(C)]
#[derive(FromBytes, IntoBytes)]
//#[repr(C)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't checked in depth what triggered this change.
Is the layout of this type critical for (de)serialization?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good question. I can't say why this changed was made. It may have been a co-pilot adjustment. I'll change it back.

pub struct Descriptor {
pub descriptor_type: u16,
pub descriptor_length: u16,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions src/Cargo.toml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this inteded as another package?
Then this belongs in its on directory with its own /src/lib.rs.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Licensed under the Apache-2.0 license

[package]
name = "pldm-service"
version.workspace = true
edition.workspace = true
authors.workspace = true

[dependencies]
zerocopy.workspace = true
bitfield.workspace = true
pldm-common.workspace = true
Loading