summaryrefslogtreecommitdiff
path: root/util/genvif.h
Commit message (Collapse)AuthorAgeFilesLines
* genvif: add override XML initializationDenis Brockus2020-11-171-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | You can now feed in a VIF XML file with fields that you want to override and these will get set instead of using the CONFIG_ initialization for those fields. $ build/morphius/util/genvif -o build/morphius \ -b morphius_sku5_dvt2 \ --over board/morphius/sku5_dvt2.xml Where the override file is a valid VIF file (no matter how partial it is). Tags such as <? .... ?> and comments <!-- .... --> are ignored. In the above example the override file looked as followed: <?xml version="1.0" encoding="UTF-8"?> <VIF> <Model_Part_Number>Morphius SKU5</Model_Part_Number> <Product_Revision>DVT2</Product_Revision> </VIF> The Model_Part_Number and Product_Revision used this override value instead of "morphius" and "FIX-ME". The values can also be used to set other values. I added a couple of those but the uses of get_vif_field can be added to create more automated generation. Here are a couple of examples: static bool is_src(void) { int override_value; bool was_overridden; /* Determine if we are DRP, SRC or SNK */ was_overridden = get_vif_field_tag_number( &vif.Component[0] .vif_field[Type_C_State_Machine], &override_value); if (was_overridden) { switch (override_value) { case SRC: case DRP: return true; case SNK: return false; default: break; } } return src_pdo_cnt; } and /* Determine if we are DRP, SRC or SNK */ was_overridden = get_vif_field_tag_number( &vif->Component[0] .vif_field[Type_C_State_Machine], &override_value); if (was_overridden) { switch (override_value) { case SRC: case SNK: case DRP: type = (enum dtype)override_value; break; default: was_overridden = false; } } if (!was_overridden) { if (is_drp()) type = DRP; else if (is_src() && is_snk()) /* No DRP with SRC and SNK PDOs detected. So ignore. */ /* ie. Twinkie or Plankton */ return 0; else if (is_src()) type = SRC; else if (is_snk()) type = SNK; else return 1; } Bumped the version to 3.0.0.6. BUG=b:172489443 BRANCH=none TEST=use --over to override fields within the XML Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ic1ecd3e0d2f643c3315bcc8abecdf7490fb69b8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2535672 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* genvif: field output ordering to be like specDenis Brockus2020-11-171-48/+48
| | | | | | | | | | | | | | BUG=b:172293518 BRANCH=none TEST=verify XML output Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ibf433a6d6472c2c3a4422f4a9d757196be7884ce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2538258 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* genvif: Update VIF generator to v3.0.0.1+Denis Brockus2020-10-281-6/+6
| | | | | | | | | | | | | | | | | | | | | | | Some additional comment tag output was added for PDO values. Changed BC_1_2_Support to be an int instead of boolean. Added xml tag at the beginning. Added some additional fields needed for customer request. Added a comment of the structure fields that are not yet being initialized. BUG=b:170646602,b:171887601 BRANCH=none TEST=verify generated VIF files Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Iaf36eaa8410d50ece3c6a4bff88ab4fcab4e4c23 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2503493 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* genvif: Update VIF generator to v3.0.0.1+Denis Brockus2020-10-261-0/+399
This upgrade gives a generator that produces the latest spec's XML output. More work can be done on this to produce more complete VIF files, but this is a good starting point. BUG=b:170646602 BRANCH=none TEST=verify generated VIF files Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ie7a3c174a5e433c04dc168a39857cc2fcb6c28ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2497612 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>