Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add APOB messages to host_sp_comms #2006

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Add APOB messages to host_sp_comms #2006

wants to merge 3 commits into from

Conversation

hf.bonus_sector_erase(offset)
.map_err(|err| APOBError::EraseFailed { offset, err })?;
} else {
// Read back the page and confirm that it's all empty
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this fail if there's a blip in the IPCC path and the host resends an APOB request? (I'm not sure what the expectations are for the offsets the host is providing.)

@mkeeter mkeeter marked this pull request as draft February 7, 2025 17:08
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

Some mostly kind of annoying nitpicks.

Comment on lines +126 to +127
// APOB is followed by a binary data blob, which should be written to flash
APOB {
Copy link
Member

Choose a reason for hiding this comment

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

suuuper nitpicky, feel free to disregard me: I think the recommended Rust naming conventions for casing is that acronyms should be treated as a "word" in camel-case, and only the first letter should be uppercased, so this would be:

Suggested change
// APOB is followed by a binary data blob, which should be written to flash
APOB {
// APOB is followed by a binary data blob, which should be written to flash
Apob {

Copy link
Member

Choose a reason for hiding this comment

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

Note that other variants of this enum follow this convention (e.g. GetMacIdentity rather than GetMACIdentity; RotRequest rather than ROTRequest, and so on).

@@ -134,6 +134,11 @@ enum Trace {
#[count(children)]
message: SpToHost,
},
APOBWriteError {
Copy link
Member

Choose a reason for hiding this comment

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

similarly, i think this would be

Suggested change
APOBWriteError {
ApobWriteError {

@@ -160,6 +165,31 @@ enum Timers {
TxPeriodicZeroByte,
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, counters::Count)]
enum APOBError {
Copy link
Member

Choose a reason for hiding this comment

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

aaaaand my stupid capitalization thing again:

Suggested change
enum APOBError {
enum ApobError {

Comment on lines +138 to +140
offset: u64,
#[count(children)]
err: APOBError,
Copy link
Member

Choose a reason for hiding this comment

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

It might be worth leaving a comment here indicating that the offset field in the ringbuf entry is the initial offset of the write, while the offset fields in the APOBError variant are the offset of the page we were writing when the error actually occurred? Having two fields with the same names but potentially differing values could be confusing.

Or, perhaps we should call the APOBError field "page_offset" or something, to distinguish these?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants