{"id":29675794,"url":"https://github.com/oxidecomputer/pmbus","last_synced_at":"2025-07-22T23:38:47.310Z","repository":{"id":44641104,"uuid":"385007735","full_name":"oxidecomputer/pmbus","owner":"oxidecomputer","description":"A no_std crate for PMBus manipulation","archived":false,"fork":false,"pushed_at":"2025-06-17T16:31:02.000Z","size":214,"stargazers_count":9,"open_issues_count":0,"forks_count":5,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-06-17T16:31:23.716Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oxidecomputer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-07-11T17:09:37.000Z","updated_at":"2025-06-17T16:31:01.000Z","dependencies_parsed_at":"2023-12-14T09:30:05.285Z","dependency_job_id":"c66cda70-011e-4a38-ab2d-096dab6c956c","html_url":"https://github.com/oxidecomputer/pmbus","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oxidecomputer/pmbus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxidecomputer%2Fpmbus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxidecomputer%2Fpmbus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxidecomputer%2Fpmbus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxidecomputer%2Fpmbus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oxidecomputer","download_url":"https://codeload.github.com/oxidecomputer/pmbus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxidecomputer%2Fpmbus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266591233,"owners_count":23953082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-22T23:38:42.911Z","updated_at":"2025-07-22T23:38:47.302Z","avatar_url":"https://github.com/oxidecomputer.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pmbus\n\npmbus: A crate for PMBus manipulation\n\nThis is a no_std crate that expresses the PMBus protocol, as described in\nthe PMBus 1.3 specification.  This crate is intended to be generic with\nrespect to implementation and usable by software that will directly\ncommunicate with PMBus devices via SMBus/I2C as well as by software that\nmerely wishes to make sense of the PMBus protocol (e.g., debuggers or\nanalyzers running on a host).  For PMBus, this can be a bit of a\nchallenge, as much of the definition is left up to a particular device\n(that is, much is implementation-defined).  Our two use cases are\ntherefore divergent in their needs:\n\n1. The embedded system that is speaking to a particular PMBus device *in\n   situ* is likely to know (and want to use) the special capabilities of a\n   given device.  That is, these use cases know their target device at\n   compile time, and have no need or desire to dynamically discover their\n   device capabilities.\n\n2. The host-based system that is trying to make sense of PMBus is *not*\n   necessarily going to know the specifics of the attached devices at\n   compile time; it is going to want to allow the device to be specified\n   (or otherwise dynamically determined) and then discover that device's\n   capabilities dynamically -- even if only to pass those capabilities on\n   to the user.\n\nThese use cases are in tension:  we want the first to be tight and\ntypesafe while still allowing for the more dynamic second use case.  We\nbalance these two cases by dynamically compiling the crate based on\nper-device RON files that specify the commands and their corresponding\ndestructured data; each device is in its own module, with each PMBus\ncommand further having its own module that contains the types for the\ncorresponding command data.\n\nAs a concrete example, `commands::OPERATION` contains an implementation\nof the `CommandData` trait for the fields for the common PMBus\n`OPERATION` command.  For each device, there is a device-specific\n`OPERATION` module -- e.g.  `[commands::adm1272::OPERATION]` -- that may\nextend or override the common definition.  Further, the device may define\nits own constants; for example, while PMBus defines the command code\n`0xd4` to be `CommandCode::MFR_SPECIFIC_D4`, the ADM1272 defines this to\nbe `PMON_CONFIG`, a device-specific power monitor configuration register.\nThere therefore exists a `commands::adm1272::PMON_CONFIG` module that\nunderstands the full (ADM1272-specific) functionality.  For code that\nwishes to be device agnostic but still be able to display contents, there\nexists a `Device::interpret` that given a device, a code, and a payload,\ncalls the specified closure to iterate over fields and values.\n\nA final (crucial) constraint is that this crate remains `no_std`; it\nperforms no dynamic allocation and in general relies on program text\nrather than table lookups -- with the knowledge that the compiler is very\ngood about dead code elimination and will not include unused program text\nin the embedded system.\n\nIf it needs to be said:  all of this adds up to specifications almost\nentirely via RON definitions -- and an absolutely unholy `build.rs` to\nassemble it all at build time.  Paraphrasing [the late Roger\nFaulker](https://www.usenix.org/memoriam-roger-faulkner),\nterrible things are sometimes required for beautiful abstractions.\n\n\nLicense: MPL-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxidecomputer%2Fpmbus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxidecomputer%2Fpmbus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxidecomputer%2Fpmbus/lists"}