blob: 58636a4282c77d99b293cbeab66ef9e8d0a23e80 [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>
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070040 exportTemplates{
41 {{"EEPROM", ExportTemplate("eeprom $Address",
Patrick Venture306b1a42019-08-14 18:28:56 -070042 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070043 {"24C02", ExportTemplate("24c02 $Address",
Josh Lehance80db72019-10-09 14:56:35 -070044 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070045 {"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 {"PCA9547Mux",
61 ExportTemplate("pca9547 $Address",
62 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
63 {"MAX31725",
64 ExportTemplate("max31725 $Address",
65 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
66 {"pmbus", ExportTemplate("pmbus $Address",
67 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
68 {"MAX34451",
69 ExportTemplate("max34451 $Address",
70 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
71 {"TMP75", ExportTemplate("tmp75 $Address",
72 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
73 {"TMP175", ExportTemplate("tmp175 $Address",
74 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
75 {"TMP421", ExportTemplate("tmp421 $Address",
76 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
77 {"TMP441", ExportTemplate("tmp441 $Address",
78 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
79 {"EMC1413",
80 ExportTemplate("emc1413 $Address",
81 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
82 {"TMP112", ExportTemplate("tmp112 $Address",
83 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
84 {"ISL68137",
85 ExportTemplate("isl68137 $Address",
86 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
87 {"INA230",
88 ExportTemplate("ina230 $Address",
89 "/sys/bus/i2c/devices/i2c-$Bus/new_device")}}};
Jae Hyun Yoo9cdeabb2018-10-16 11:47:09 -070090} // namespace devices