-
Notifications
You must be signed in to change notification settings - Fork 179
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
feat(hardware): Added a driver to read and write data from the Flex eeprom #12847
Conversation
fix an issue when reading properties from the eeprom
Codecov Report
@@ Coverage Diff @@
## edge #12847 +/- ##
==========================================
Coverage 72.34% 72.35%
==========================================
Files 1548 2348 +800
Lines 50597 64379 +13782
Branches 3235 7120 +3885
==========================================
+ Hits 36606 46580 +9974
- Misses 13513 16127 +2614
- Partials 478 1672 +1194
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we're doing TLV, we should do TLV all the way. We can drop the start and end tokens, because we have the type, length and value. Require the type to not be 255 and you can't be confused with erased data; then, you can read out size-1
bytes, nice and easy.
PropType.SHORT: 2, | ||
PropType.INT: 4, | ||
PropType.STR: 254, | ||
PropType.BIN: 254, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same?
…line SODIMM_222 low when writting to the eeprom
deal with overflowing incomplete data cleaning up
…h for testing - removed hard while loops when parsing data - return set of PropertyId of the properties that were successfully written to the eeprom - dropped the manufacturing_facility and unique_id values from the serial number - removed unused PropertyId’s MACHINE_TYPE, MACHINE_VERSION, PROGRAMMED_DATE, UNIT_NUMBER - added MAX_DATA_LEN so we can limit the size of a property to 255 bytes - removed eeprom_writter.py script as this will be added in a separate pr - added unit tests
…em_hardware to return one item added defines to drivers.__init__ use gpiod passed down from ot3Controller when initializing the EEPROMDriver
return the EEPROMDriver module from the OT3Controller via a property fix the eeprom_build_driver module
added unit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Overview
We need a way to read/write to the eeprom on the carrier board, this python module will let us do that from userspace.
Closes: RET-1346
Property Format
Data is written to the eeprom in the form of serialized property byte string with the following format
prop_id(1b) + data_length(1b) + data(1-253b)
prop_id
is a 1-byte 1-0xFE value and denotes the unique property being stored: NOTE: 0xFF is invaliddata_length
is a 1-byte 1-0xFD value and denotes the length of the datadata
is a 1-253b long hexadecimal value representing some data that corresponds to a prop_id.Properties
Properties represent some piece of data stored on the eeprom, and are categorized by a
prop_id
, adata_type
, and avalue
. When we find a valid serialized property byte string, which means we have a bytestring matching our format denoted above where thelength
byte corresponds to the actual size of the data. We deserialize this bytestring based on the specific prop_id, the type of data that prop_id is associated with, and how long the data should be. We use the data_type to encode/decode the data accordingly and create a Property object with the parsed data type.API
In order to interact with the eeprom we have the concept of properties, and we use the methods
self.property_write
andself.property_read
to read and write these properties to the eeprom.The
self.property_write
method takes a set of property and value tuplesSet[Tuple[property_id, Any]])
which are serialized, chunked up, and written to the eeprom. This method returns a set of PropId for the properties that were successfully written to the eeprom.The
self.property_read
method takes a set of PropId enums and returns a set of Property objects which represent the eeprom data.Test Plan
Changelog
/sys/bus/i2c/devices
Review requests
Risk assessment
Low, flex work