blob: 24cba32bce6ebd962a433b413ff18d89980a9ff5 [file] [log] [blame]
/*
// Copyright (c) 2018 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/
#pragma once
#include <boost/container/flat_map.hpp>
namespace devices
{
struct CmpStr
{
bool operator()(const char *a, const char *b) const
{
return std::strcmp(a, b) < 0;
}
};
struct ExportTemplate
{
ExportTemplate(const char *parameters, const char *device) :
parameters(parameters), device(device){};
const char *parameters;
const char *device;
};
const boost::container::flat_map<const char *, ExportTemplate, CmpStr>
exportTemplates{
{{"EEPROM", ExportTemplate("eeprom $Address",
"/sys/bus/i2c/devices/i2c-$Bus/new_device")},
{"Gpio", ExportTemplate("$Index", "/sys/class/gpio/export")},
{"PCA9543Mux",
ExportTemplate("pca9543 $Address",
"/sys/bus/i2c/devices/i2c-$Bus/new_device")},
{"PCA9544Mux",
ExportTemplate("pca9544 $Address",
"/sys/bus/i2c/devices/i2c-$Bus/new_device")},
{"PCA9545Mux",
ExportTemplate("pca9545 $Address",
"/sys/bus/i2c/devices/i2c-$Bus/new_device")},
{"PCA9546Mux",
ExportTemplate("pca9546 $Address",
"/sys/bus/i2c/devices/i2c-$Bus/new_device")},
{"pmbus", ExportTemplate("pmbus $Address",
"/sys/bus/i2c/devices/i2c-$Bus/new_device")},
{"TMP75", ExportTemplate("tmp75 $Address",
"/sys/bus/i2c/devices/i2c-$Bus/new_device")},
{"TMP421", ExportTemplate("tmp421 $Address",
"/sys/bus/i2c/devices/i2c-$Bus/new_device")},
{"SkylakeCPU",
ExportTemplate("peci-client $Address",
"/sys/bus/peci/devices/peci-$Bus/new_device")
}}};
} // namespace devices