blob: 24cba32bce6ebd962a433b413ff18d89980a9ff5 [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{
25 bool operator()(const char *a, const char *b) const
26 {
27 return std::strcmp(a, b) < 0;
28 }
29};
30
31struct ExportTemplate
32{
33 ExportTemplate(const char *parameters, const char *device) :
34 parameters(parameters), device(device){};
35 const char *parameters;
36 const char *device;
37};
38
39const boost::container::flat_map<const char *, ExportTemplate, CmpStr>
40 exportTemplates{
James Feist57cf32d2018-10-15 16:15:36 -070041 {{"EEPROM", ExportTemplate("eeprom $Address",
42 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
James Feistc1aff3a2018-10-26 14:10:34 -070043 {"Gpio", ExportTemplate("$Index", "/sys/class/gpio/export")},
James Feist57cf32d2018-10-15 16:15:36 -070044 {"PCA9543Mux",
James Feist053a6642018-10-15 13:17:09 -070045 ExportTemplate("pca9543 $Address",
46 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Ed Tanousbea722b2019-01-28 16:22:28 -080047 {"PCA9544Mux",
48 ExportTemplate("pca9544 $Address",
49 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
James Feist053a6642018-10-15 13:17:09 -070050 {"PCA9545Mux",
51 ExportTemplate("pca9545 $Address",
52 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
James Feist286babc2019-02-07 16:48:28 -080053 {"PCA9546Mux",
54 ExportTemplate("pca9546 $Address",
55 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
James Feista3f1e722018-10-15 16:33:03 -070056 {"pmbus", ExportTemplate("pmbus $Address",
57 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
James Feist053a6642018-10-15 13:17:09 -070058 {"TMP75", ExportTemplate("tmp75 $Address",
James Feist57cf32d2018-10-15 16:15:36 -070059 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
James Feist053a6642018-10-15 13:17:09 -070060 {"TMP421", ExportTemplate("tmp421 $Address",
Jae Hyun Yoo9cdeabb2018-10-16 11:47:09 -070061 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
62 {"SkylakeCPU",
63 ExportTemplate("peci-client $Address",
64 "/sys/bus/peci/devices/peci-$Bus/new_device")
James Feist053a6642018-10-15 13:17:09 -070065
66 }}};
Jae Hyun Yoo9cdeabb2018-10-16 11:47:09 -070067} // namespace devices