MCPcopy Index your code
hub / github.com/FrameworkComputer/framework-system / i2c_port

Method i2c_port

framework_lib/src/ccgx/device.rs:109–152  ·  view source on GitHub ↗

I2C port on the EC

(&self)

Source from the content-addressed store, hash-verified

107
108 /// I2C port on the EC
109 fn i2c_port(&self) -> EcResult<u8> {
110 let config = Config::get();
111 let platform = &(*config).as_ref().unwrap().platform;
112 let unsupported = Err(EcError::DeviceError(format!(
113 "Controller {:?}, does not exist on {:?}",
114 self, platform
115 )));
116
117 Ok(match (platform, self) {
118 (Platform::GenericFramework(_, (left, _, _)), PdPort::Right01) => *left,
119 (Platform::GenericFramework(_, (_, right, _)), PdPort::Left23) => *right,
120 (Platform::GenericFramework(_, (_, _, back)), PdPort::Back) => *back,
121 (Platform::IntelGen11, _) => 6,
122 (Platform::IntelGen12 | Platform::IntelGen13, PdPort::Right01) => 6,
123 (Platform::IntelGen12 | Platform::IntelGen13, PdPort::Left23) => 7,
124 (
125 Platform::Framework13Amd7080
126 | Platform::Framework16Amd7080
127 | Platform::Framework16AmdAi300
128 | Platform::IntelCoreUltra1
129 | Platform::IntelCoreUltra3
130 | Platform::Framework13AmdAi300
131 | Platform::Framework12IntelGen13,
132 PdPort::Right01,
133 ) => 1,
134 (
135 Platform::Framework13Amd7080
136 | Platform::Framework16Amd7080
137 | Platform::Framework16AmdAi300
138 | Platform::IntelCoreUltra1
139 | Platform::IntelCoreUltra3
140 | Platform::Framework13AmdAi300
141 | Platform::Framework12IntelGen13,
142 PdPort::Left23,
143 ) => 2,
144 (Platform::Framework16Amd7080 | Platform::Framework16AmdAi300, PdPort::Back) => 5,
145 (Platform::FrameworkDesktopAmdAiMax300, PdPort::Back) => 1,
146 (Platform::FrameworkDesktopAmdAiMax300, _) => unsupported?,
147 (Platform::UnknownSystem, _) => {
148 Err(EcError::DeviceError("Unsupported platform".to_string()))?
149 }
150 (_, PdPort::Back) => unsupported?,
151 })
152 }
153}
154
155pub struct PdController {

Callers 2

i2c_readMethod · 0.80
i2c_writeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected