VirtualBox

source: vbox/trunk/include/iprt/fdt.h@ 100013

Last change on this file since 100013 was 100013, checked in by vboxsync, 18 months ago

fix lnx64dep2 burn

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
1/** @file
2 * IPRT - Flattened Devicetree parser and generator API.
3 */
4
5/*
6 * Copyright (C) 2023 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef IPRT_INCLUDED_fdt_h
37#define IPRT_INCLUDED_fdt_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <iprt/cdefs.h>
43#include <iprt/types.h>
44#include <iprt/vfs.h>
45
46
47RT_C_DECLS_BEGIN
48
49/** @defgroup grp_rt_fdt RTFdt - Flattened Devicetree parser and generator API.
50 * @ingroup grp_rt
51 * @{
52 */
53
54/**
55 * Flattened device tree type.
56 */
57typedef enum RTFDTTYPE
58{
59 /** The invalid output type. */
60 RTFDTTYPE_INVALID = 0,
61 /** Output is an UTF-8 DTS. */
62 RTFDTTYPE_DTS,
63 /** Output is the flattened devicetree binary format. */
64 RTFDTTYPE_DTB,
65 /** Usual 32-bit hack. */
66 RTFDTTYPE_32BIT_HACK = 0x7fffffff
67} RTFDTTYPE;
68
69
70#ifdef IN_RING3
71
72/**
73 * Creates a new empty flattened devicetree returning the handle.
74 *
75 * @returns IPRT status code.
76 * @param phFdt Where to store the handle to the flattened devicetree on success.
77 */
78RTDECL(int) RTFdtCreateEmpty(PRTFDT phFdt);
79
80
81/**
82 * Creates a flattened device tree from the given VFS file.
83 *
84 * @returns IPRT status code.
85 * @param phFdt Where to store the handle to the flattened devicetree on success.
86 * @param hVfsIos The VFS I/O stream handle to read the devicetree from.
87 * @param enmInType The input type of the flattened devicetree.
88 * @param pErrInfo Where to return additional error information.
89 */
90RTDECL(int) RTFdtCreateFromVfsIoStrm(PRTFDT phFdt, RTVFSIOSTREAM hVfsIos, RTFDTTYPE enmInType, PRTERRINFO pErrInfo);
91
92
93/**
94 * Creates a flattened device tree from the given filename.
95 *
96 * @returns IPRT status code.
97 * @param phFdt Where to store the handle to the flattened devicetree on success.
98 * @param pszFilename The filename to read the devicetree from.
99 * @param enmInType The input type of the flattened devicetree.
100 * @param pErrInfo Where to return additional error information.
101 */
102RTDECL(int) RTFdtCreateFromFile(PRTFDT phFdt, const char *pszFilename, RTFDTTYPE enmInType, PRTERRINFO pErrInfo);
103
104
105/**
106 * Destroys the given flattened devicetree.
107 *
108 * @param hFdt The flattened devicetree handle to destroy.
109 */
110RTDECL(void) RTFdtDestroy(RTFDT hFdt);
111
112
113/**
114 * Dumps the given flattened devicetree to the given VFS file.
115 *
116 * @returns IPRT status code.
117 * @param hFdt The flattened devicetree handle.
118 * @param enmOutType The output type.
119 * @param fFlags Flags controlling the output, MBZ.
120 * @param hVfsIos The VFS I/O stream handle to dump the DTS to.
121 */
122RTDECL(int) RTFdtDumpToVfsIoStrm(RTFDT hFdt, RTFDTTYPE enmOutType, uint32_t fFlags, RTVFSIOSTREAM hVfsIos);
123
124
125/**
126 * Dumps the given flattened devicetree to the given file.
127 *
128 * @returns IPRT status code.
129 * @param hFdt The flattened devicetree handle.
130 * @param enmOutType The output type.
131 * @param fFlags Flags controlling the output, MBZ.
132 * @param pszFilename The filename to dump to.
133 */
134RTDECL(int) RTFdtDumpToFile(RTFDT hFdt, RTFDTTYPE enmOutType, uint32_t fFlags, const char *pszFilename);
135
136#endif /* IN_RING3 */
137
138/** @} */
139
140RT_C_DECLS_END
141
142#endif /* !IPRT_INCLUDED_fdt_h */
143
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette