diff options
author | Michael Auchter <michael.auchter@ni.com> | 2019-09-09 16:46:14 -0500 |
---|---|---|
committer | Martin Braun <martin@gnuradio.org> | 2021-05-31 05:28:47 -0700 |
commit | 530cb0a8aaaac906fe124086e780d6651241b0ad (patch) | |
tree | 8a5301163392b3d0c1642da0cb9ba2a9ea176401 /mpm/tools/tlv_eeprom/eeprom-pids.c | |
parent | fa997d52cc62c3c39f5b7560890e31d41e4eb9e9 (diff) | |
download | uhd-530cb0a8aaaac906fe124086e780d6651241b0ad.tar.gz uhd-530cb0a8aaaac906fe124086e780d6651241b0ad.tar.bz2 uhd-530cb0a8aaaac906fe124086e780d6651241b0ad.zip |
mpm: add tlv_eeprom
Add support for parsing an eeprom that uses tag-length-value to store
contents.
Co-authored-by: Michael Auchter <michael.auchter@ni.com>
Co-authored-by: Virendra Kakade <virendra.kakade@ni.com>
Co-authored-by: Cristina Fuentes <cristina.fuentes@ni.com>
Diffstat (limited to 'mpm/tools/tlv_eeprom/eeprom-pids.c')
-rw-r--r-- | mpm/tools/tlv_eeprom/eeprom-pids.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/mpm/tools/tlv_eeprom/eeprom-pids.c b/mpm/tools/tlv_eeprom/eeprom-pids.c new file mode 100644 index 000000000..d181133d7 --- /dev/null +++ b/mpm/tools/tlv_eeprom/eeprom-pids.c @@ -0,0 +1,50 @@ +// +// Copyright 2021 Ettus Research, a National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#include "eeprom-pids.h" +#include <stddef.h> + +static struct pid_info pid_list[] = { + { 0x0410, "titanium", "X410 Motherboard", 0 }, + { 0x4000, NULL, "Power Aux Board", 0 }, + { 0x4001, NULL, "Debug RF DB", 0 }, + { 0x4002, "zbx", "Zirconium RF DB", 0}, + { 0x4003, NULL, "HDMI SE DIO Aux Board", 0}, + { 0x4004, NULL, "Clocking Aux Board with GPSDO", 0}, + { 0x4005, NULL, "Clocking Aux Board (no GPSDO)", 0}, + { 0x4006, NULL, "IF Test Manufacturing CCA", 0}, +}; + +#define ARRAY_SIZE(x) (sizeof((x)) / sizeof((*x))) + +const struct pid_info* get_info_from_pid(uint16_t pid) { + for (size_t i = 0; i < ARRAY_SIZE(pid_list); i++) + if (pid_list[i].pid == pid) + return &pid_list[i]; + + return NULL; +} + +const char* get_name_from_pid(uint16_t pid) { + const struct pid_info *info = get_info_from_pid(pid); + if (!info) + return NULL; + return info->name; +} + +const char* get_description_from_pid(uint16_t pid) { + const struct pid_info *info = get_info_from_pid(pid); + if (!info) + return NULL; + return info->description; +} + +uint16_t get_rev_offset_from_pid(uint16_t pid) { + const struct pid_info *info = get_info_from_pid(pid); + if (!info) + return -1; + return info->rev_offset; +} |