]> git.ipfire.org Git - thirdparty/u-boot.git/blame - include/hwconfig.h
colibri_imx6: switch to zimage
[thirdparty/u-boot.git] / include / hwconfig.h
CommitLineData
83d290c5 1/* SPDX-License-Identifier: GPL-2.0+ */
93f9dcf9
AV
2/*
3 * An inteface for configuring a hardware via u-boot environment.
4 *
5 * Copyright (c) 2009 MontaVista Software, Inc.
dd50af25 6 * Copyright 2011 Freescale Semiconductor, Inc.
93f9dcf9
AV
7 *
8 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
93f9dcf9
AV
9 */
10
11#ifndef _HWCONFIG_H
12#define _HWCONFIG_H
13
14#include <linux/types.h>
1221ce45 15#include <linux/errno.h>
93f9dcf9
AV
16
17#ifdef CONFIG_HWCONFIG
18
dd50af25
KG
19extern int hwconfig_f(const char *opt, char *buf);
20extern const char *hwconfig_arg_f(const char *opt, size_t *arglen, char *buf);
21extern int hwconfig_arg_cmp_f(const char *opt, const char *arg, char *buf);
22extern int hwconfig_sub_f(const char *opt, const char *subopt, char *buf);
23extern const char *hwconfig_subarg_f(const char *opt, const char *subopt,
24 size_t *subarglen, char *buf);
25extern int hwconfig_subarg_cmp_f(const char *opt, const char *subopt,
26 const char *subarg, char *buf);
93f9dcf9
AV
27#else
28
dd50af25 29static inline int hwconfig_f(const char *opt, char *buf)
93f9dcf9
AV
30{
31 return -ENOSYS;
32}
33
dd50af25
KG
34static inline const char *hwconfig_arg_f(const char *opt, size_t *arglen,
35 char *buf)
93f9dcf9
AV
36{
37 *arglen = 0;
38 return "";
39}
40
dd50af25
KG
41static inline int hwconfig_arg_cmp_f(const char *opt, const char *arg,
42 char *buf)
93f9dcf9
AV
43{
44 return -ENOSYS;
45}
46
dd50af25 47static inline int hwconfig_sub_f(const char *opt, const char *subopt, char *buf)
93f9dcf9
AV
48{
49 return -ENOSYS;
50}
51
dd50af25
KG
52static inline const char *hwconfig_subarg_f(const char *opt, const char *subopt,
53 size_t *subarglen, char *buf)
93f9dcf9
AV
54{
55 *subarglen = 0;
56 return "";
57}
58
dd50af25
KG
59static inline int hwconfig_subarg_cmp_f(const char *opt, const char *subopt,
60 const char *subarg, char *buf)
93f9dcf9
AV
61{
62 return -ENOSYS;
63}
64
65#endif /* CONFIG_HWCONFIG */
66
dd50af25
KG
67static inline int hwconfig(const char *opt)
68{
69 return hwconfig_f(opt, NULL);
70}
71
72static inline const char *hwconfig_arg(const char *opt, size_t *arglen)
73{
74 return hwconfig_arg_f(opt, arglen, NULL);
75}
76
77static inline int hwconfig_arg_cmp(const char *opt, const char *arg)
78{
79 return hwconfig_arg_cmp_f(opt, arg, NULL);
80}
81
82static inline int hwconfig_sub(const char *opt, const char *subopt)
83{
84 return hwconfig_sub_f(opt, subopt, NULL);
85}
86
87static inline const char *hwconfig_subarg(const char *opt, const char *subopt,
88 size_t *subarglen)
89{
90 return hwconfig_subarg_f(opt, subopt, subarglen, NULL);
91}
92
93static inline int hwconfig_subarg_cmp(const char *opt, const char *subopt,
94 const char *subarg)
95{
96 return hwconfig_subarg_cmp_f(opt, subopt, subarg, NULL);
97}
98
93f9dcf9 99#endif /* _HWCONFIG_H */