blob: e873500e40f04f8d71637deade16f225e3c1ce22 [file] [log] [blame]
James Feist053a6642018-10-15 13:17:09 -07001/*
2// Copyright (c) 2018 Intel Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15*/
16
17#pragma once
18#include <boost/container/flat_map.hpp>
19
20namespace devices
21{
22
23struct CmpStr
24{
James Feista465ccc2019-02-08 12:51:01 -080025 bool operator()(const char* a, const char* b) const
James Feist053a6642018-10-15 13:17:09 -070026 {
27 return std::strcmp(a, b) < 0;
28 }
29};
30
31struct ExportTemplate
32{
James Feist98132792019-07-09 13:29:09 -070033 ExportTemplate(const char* params, const char* dev) :
34 parameters(params), device(dev){};
James Feista465ccc2019-02-08 12:51:01 -080035 const char* parameters;
36 const char* device;
James Feist053a6642018-10-15 13:17:09 -070037};
38
James Feista465ccc2019-02-08 12:51:01 -080039const boost::container::flat_map<const char*, ExportTemplate, CmpStr>
Josh Lehance80db72019-10-09 14:56:35 -070040 exportTemplates{{
41 {"EEPROM", ExportTemplate("eeprom $Address",
Patrick Venture75966572019-08-13 09:28:08 -070042 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Josh Lehance80db72019-10-09 14:56:35 -070043 {"24C02", ExportTemplate("24c02 $Address",
44 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
45 {"24C64", ExportTemplate("24c64 $Address",
46 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
47 {"Gpio", ExportTemplate("$Index", "/sys/class/gpio/export")},
48 {"PCA9543Mux",
49 ExportTemplate("pca9543 $Address",
50 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
51 {"PCA9544Mux",
52 ExportTemplate("pca9544 $Address",
53 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
54 {"PCA9545Mux",
55 ExportTemplate("pca9545 $Address",
56 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
57 {"PCA9546Mux",
58 ExportTemplate("pca9546 $Address",
59 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
60 {"MAX31725",
61 ExportTemplate("max31725 $Address",
62 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
63 {"pmbus", ExportTemplate("pmbus $Address",
64 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
65 {"MAX34451",
66 ExportTemplate("max34451 $Address",
67 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
68 {"TMP75", ExportTemplate("tmp75 $Address",
69 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
70 {"TMP175", ExportTemplate("tmp175 $Address",
Patrick Venture6d4f1f92019-07-30 18:06:53 -070071 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Josh Lehance80db72019-10-09 14:56:35 -070072 {"TMP421", ExportTemplate("tmp421 $Address",
James Feista3f1e722018-10-15 16:33:03 -070073 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Josh Lehance80db72019-10-09 14:56:35 -070074 {"TMP441", ExportTemplate("tmp441 $Address",
James Feist57cf32d2018-10-15 16:15:36 -070075 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Josh Lehance80db72019-10-09 14:56:35 -070076 {"EMC1413", ExportTemplate("emc1413 $Address",
Patrick Venture306b1a42019-08-14 18:28:56 -070077 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Josh Lehance80db72019-10-09 14:56:35 -070078 {"TMP112", ExportTemplate("tmp112 $Address",
79 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
80 {"ISL68137",
81 ExportTemplate("isl68137 $Address",
82 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
83 }};
Jae Hyun Yoo9cdeabb2018-10-16 11:47:09 -070084} // namespace devices