OpenBIC
OpenSource Bridge-IC
plat_voltage_peak_shell.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
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#ifndef PLAT_VOLTAGE_PEAK_SHELL_H
18#define PLAT_VOLTAGE_PEAK_SHELL_H
19
20#include <shell/shell.h>
21#include "plat_class.h"
22
23void cmd_get_voltage_peak(const struct shell *shell, size_t argc, char **argv);
24void cmd_clear_voltage_peak(const struct shell *shell, size_t argc, char **argv);
25
26static void voltage_rname_get(size_t idx, struct shell_static_entry *entry)
27{
29 idx++;
30
31 uint8_t *name = NULL;
32 vr_rail_name_get((uint8_t)idx, &name);
33
34 if (idx == VR_RAIL_E_MAX)
35 name = (uint8_t *)"all";
36
37 entry->syntax = (name) ? (const char *)name : NULL;
38 entry->handler = NULL;
39 entry->help = NULL;
40 entry->subcmd = NULL;
41}
42
43SHELL_DYNAMIC_CMD_CREATE(voltage_rname, voltage_rname_get);
44
45/* Sub-command Level 1 of command voltage-peak */
46SHELL_STATIC_SUBCMD_SET_CREATE(sub_voltage_peak_cmds,
47 SHELL_CMD(get, &voltage_rname, "get_voltage_peak",
49 SHELL_CMD(clear, &voltage_rname, "clear_voltage_peak",
51 SHELL_SUBCMD_SET_END);
52
53/* Root of command voltage-peak */
54SHELL_CMD_REGISTER(voltage_peak, &sub_voltage_peak_cmds, "Voltage Peak commands for AG", NULL);
55
56#endif
uint8_t idx
Definition: plat_util.c:39
uint8_t get_board_type()
Definition: plat_class.c:272
@ MINERVA_AEGIS_BD
Definition: plat_class.h:61
bool vr_rail_name_get(uint8_t rail, uint8_t **name)
Definition: plat_hook.c:474
@ VR_RAIL_E_MAX
Definition: plat_hook.h:63
void cmd_clear_voltage_peak(const struct shell *shell, size_t argc, char **argv)
SHELL_DYNAMIC_CMD_CREATE(voltage_rname, voltage_rname_get)
SHELL_STATIC_SUBCMD_SET_CREATE(sub_voltage_peak_cmds, SHELL_CMD(get, &voltage_rname, "get_voltage_peak", cmd_get_voltage_peak), SHELL_CMD(clear, &voltage_rname, "clear_voltage_peak", cmd_clear_voltage_peak), SHELL_SUBCMD_SET_END)
void cmd_get_voltage_peak(const struct shell *shell, size_t argc, char **argv)
SHELL_CMD_REGISTER(voltage_peak, &sub_voltage_peak_cmds, "Voltage Peak commands for AG", NULL)
name
Definition: plat_i2c.h:24