blob: b9aa4c8591741dc1a3365768f6e8cc4af2586472 [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>
James Feist053a6642018-10-15 13:17:09 -070040 exportTemplates{
James Feist57cf32d2018-10-15 16:15:36 -070041 {{"EEPROM", ExportTemplate("eeprom $Address",
42 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Patrick Venture75966572019-08-13 09:28:08 -070043 {"24C02", ExportTemplate("24c02 $Address",
44 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Patrick Venture6d4f1f92019-07-30 18:06:53 -070045 {"24C64", ExportTemplate("24c64 $Address",
46 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
James Feistc1aff3a2018-10-26 14:10:34 -070047 {"Gpio", ExportTemplate("$Index", "/sys/class/gpio/export")},
James Feist57cf32d2018-10-15 16:15:36 -070048 {"PCA9543Mux",
James Feist053a6642018-10-15 13:17:09 -070049 ExportTemplate("pca9543 $Address",
50 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Ed Tanousbea722b2019-01-28 16:22:28 -080051 {"PCA9544Mux",
52 ExportTemplate("pca9544 $Address",
53 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
James Feist053a6642018-10-15 13:17:09 -070054 {"PCA9545Mux",
55 ExportTemplate("pca9545 $Address",
56 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
James Feist286babc2019-02-07 16:48:28 -080057 {"PCA9546Mux",
58 ExportTemplate("pca9546 $Address",
59 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Patrick Venturec04587f2019-08-14 15:35:53 -070060 {"MAX31725",
61 ExportTemplate("max31725 $Address",
62 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
James Feista3f1e722018-10-15 16:33:03 -070063 {"pmbus", ExportTemplate("pmbus $Address",
64 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
James Feist053a6642018-10-15 13:17:09 -070065 {"TMP75", ExportTemplate("tmp75 $Address",
James Feist57cf32d2018-10-15 16:15:36 -070066 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
James Feist053a6642018-10-15 13:17:09 -070067 {"TMP421", ExportTemplate("tmp421 $Address",
Jae Hyun Yoo9cdeabb2018-10-16 11:47:09 -070068 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Patrick Venturee2785e92019-08-09 16:04:16 -070069 {"TMP441", ExportTemplate("tmp441 $Address",
70 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
John Wang3e200992019-04-18 14:10:46 +080071 {"EMC1413",
72 ExportTemplate("emc1413 $Address",
73 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Jae Hyun Yooa39ff4b2019-08-02 10:15:35 -070074 {"TMP112",
75 ExportTemplate("tmp112 $Address",
76 "/sys/bus/i2c/devices/i2c-$Bus/new_device")}}};
Jae Hyun Yoo9cdeabb2018-10-16 11:47:09 -070077} // namespace devices