NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
dus_common_data.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
17 #ifndef DUS_COMMON_DATA_H_
18 #define DUS_COMMON_DATA_H_
19 
20 #include <stdint.h>
21 
22 /* Common definitions */
23 
24 #define DUS_IVC_MEMPOOL_DATA_VERSION (0x1)
25 
26 /* Definations of the chain/command/operation/magic */
27 // CHAIN_TYPE
28 #define CHAIN_A (0U)
29 #define CHAIN_B (1U)
30 #define CHAIN_C (2U)
31 #define CHAIN_INVALID (3U)
32 // For persist partition in L1PT
33 #define CHAIN_PERSIST (0xFFU)
34 typedef uint8_t CHAIN_TYPE;
35 
36 // IVC_CMD
37 #define CMD_APPLY_PAYLOAD (0U)
38 #define CMD_MARK_BOOTABLE (1U)
39 #define CMD_APPLY_PAYLOAD_PERSISTENT (2U)
40 #define CMD_BRBCT_UPDATE (3U)
41 #define CMD_GET_CONTENT (4U)
42 #define CMD_RELOAD_PT (5U)
43 #define CMD_GET_PARTS_INFO (6U)
44 #define CMD_GET_SERVER_LOG (7U)
45 #define CMD_GET_PT_LOG (8U)
46 #define CMD_MAX (9U)
47 typedef uint32_t CMD_TYPE;
48 
49 // PAYLOAD_OPERATION
50 #define PAYLOAD_DISCARD (0U)
51 #define PAYLOAD_REPLACE (1U)
52 #define PAYLOAD_COPY (2U)
53 #define PAYLOAD_PATCH (3U)
54 #define PAYLOAD_BRBCT_UPDATE (4U)
55 #define PAYLOAD_MARK_BOOTABLE (5U)
56 #define PAYLOAD_PERSISTENT_UPDATE (6U)
57 #define PAYLOAD_OPERATION_MAX (0xFFU)
58 typedef uint8_t PAYLOAD_TYPE;
59 
60 // Mempool direction
61 #define MEMPOOL_DIRECTION_CLIENT_TO_SERVER (0U)
62 #define MEMPOOL_DIRECTION_SERVER_TO_CLIENT (1U)
63 
64 // Magic Number definitions in big-endian presentation
65 #define MAGIC_NVDUCMD (0x00444d435544564eU)
66 #define MAGIC_NVDURET (0x005445525544564eU)
67 #define MAGIC_NVDUMEM (0x004d454d5544564eU)
68 #define MAGIC_NVDUPLD (0x00444c505544564eU)
69 
73 #define DUS_PARTITION_LEVEL_1 (1U)
75 #define DUS_PARTITION_LEVEL_2 (2U)
77 #define DUS_PARTITION_LEVEL_3 (3U)
79 
81 // (A/B/C) + '_' + guest ID + '_' + container name (24, gpt partition) + '_' + partition name (24)
82 // and up align 8 bytes
83 #define DUS_PART_NAME_LENGTH (64U)
84 
89 #define DUS_GUEST_ID_MASK ((1U << 5) - 1U)
90 
95 #define DUS_GPT_CONTAINER (0x10000000U)
96 
100 #define DUS_MAX_PARTITION_NUM (300U)
101 
102 #define DUS_STORAGE_TYPE_QSPI (0U)
103 #define DUS_STORAGE_TYPE_EMMC (1U)
104 #define DUS_STORAGE_TYPE_UFS (2U)
105 #define DUS_STORAGE_TYPE_INVALID (0xFFFFU)
106 
110 typedef struct __attribute__((packed)) DUS_IVC_TX
111 {
112  // Magic number: NVDUCMD = 0x00444d435544564eU
113  uint64_t magic;
114  // Version Number
115  uint8_t version;
116  // Reserve1: [9, 31]
117  uint8_t reserved1[23];
118  // Command ID
119  uint32_t cmd;
120  // Chain ID
121  uint8_t chain;
122  // Length of send data(mempool data length)
123  uint32_t lengthOfMempool;
124  // Reserved2: [41, 63]
125  uint8_t reserved2[23];
126 
127 } DUS_IVC_TX;
128 
132 typedef struct __attribute__((packed)) DUS_IVC_RX
133 {
134  // Magic char: NVDURET 0x005445525544564eU
135  uint64_t magic;
136  // Version Number
137  uint8_t version;
138  // Return code for the previous command
139  uint32_t retCode;
140  // Length of Ret data(mempool data length)
141  uint32_t lengthOfMempool;
142  // Message info
143  uint8_t msg[47];
144 } DUS_IVC_RX;
145 
149 typedef union DUS_IVC_DATA
150 {
153 } DUS_IVC_DATA;
154 
158 typedef struct __attribute__((packed)) DUS_MEMPOOL_HEADER
159 {
160  // Magic: NVDUMEM 0x004d454d5544564eU
161  uint64_t magic;
162  // Version
163  uint8_t version;
164  // Direction: 0x0 for DUS data input, 0x1 for DUS data output
165  uint8_t direction;
166  // Reserved;
167  uint8_t reserved[22];
169 
173 typedef struct __attribute__((packed)) DUS_PAYLOAD_HEADER
174 {
175  // Magic: NVDUPLD 0x00444c505544564eU
176  uint64_t magic;
177  // Version
178  uint8_t version;
179  // Length of the payload (Exclude Signature) in bytes
180  uint32_t payloadLength;
181  // Signed
182  uint8_t isSigned;
183  // Operation code
184  uint8_t operationCode;
186 
187 
188 typedef struct __attribute__((packed)) DUS_PART_INFO
189 {
191  uint32_t partitionAttr;
193  char partName[DUS_PART_NAME_LENGTH];
195  uint64_t partitionSize;
197  char containerPartName[DUS_PART_NAME_LENGTH];
199  uint32_t partitionLevel;
201  uint32_t blockSize;
203  uint32_t storageType;
204 } DUS_PART_INFO;
205 
206 typedef struct __attribute__((packed)) DUS_ALL_PART_INFO
207 {
209  uint32_t numPartitions;
213 
214 #endif // DUS_COMMON_DATA_H_
DUS_IVC_TX::lengthOfMempool
uint32_t lengthOfMempool
Definition: dus_common_data.h:123
DUS_IVC_RX::lengthOfMempool
uint32_t lengthOfMempool
Definition: dus_common_data.h:141
PAYLOAD_TYPE
uint8_t PAYLOAD_TYPE
Definition: dus_common_data.h:58
DUS_IVC_DATA
Defines IVC common data type.
Definition: dus_common_data.h:149
DUS_IVC_DATA
union DUS_IVC_DATA DUS_IVC_DATA
Defines IVC common data type.
DUS_PAYLOAD_HEADER::magic
uint64_t magic
Definition: dus_common_data.h:176
DUS_IVC_TX
Defines IVC transmit data type.
Definition: dus_common_data.h:110
DUS_PART_INFO::partitionLevel
uint32_t partitionLevel
Level at which partition resides.
Definition: dus_common_data.h:199
CMD_TYPE
uint32_t CMD_TYPE
Definition: dus_common_data.h:47
DUS_ALL_PART_INFO::numPartitions
uint32_t numPartitions
Total number of partitions.
Definition: dus_common_data.h:209
DUS_MEMPOOL_HEADER
struct DUS_MEMPOOL_HEADER DUS_MEMPOOL_HEADER
Defines Mempool data type.
reserved
uint8_t reserved[504]
Reserved.
Definition: IMUTypes.h:181
DUS_IVC_RX
Defines IVC recive data type.
Definition: dus_common_data.h:132
DUS_PAYLOAD_HEADER::version
uint8_t version
Definition: dus_common_data.h:178
DUS_PAYLOAD_HEADER::operationCode
uint8_t operationCode
Definition: dus_common_data.h:184
DUS_PAYLOAD_HEADER::payloadLength
uint32_t payloadLength
Definition: dus_common_data.h:180
DUS_IVC_TX
struct DUS_IVC_TX DUS_IVC_TX
Defines IVC transmit data type.
DUS_PART_INFO
Definition: dus_common_data.h:188
DUS_ALL_PART_INFO
struct DUS_ALL_PART_INFO DUS_ALL_PART_INFO
DUS_IVC_TX::cmd
uint32_t cmd
Definition: dus_common_data.h:119
DUS_IVC_TX::magic
uint64_t magic
Definition: dus_common_data.h:113
DUS_PART_INFO::blockSize
uint32_t blockSize
Block size of partition.
Definition: dus_common_data.h:201
DUS_ALL_PART_INFO
Definition: dus_common_data.h:206
DUS_PAYLOAD_HEADER
Defines Payload data type.
Definition: dus_common_data.h:173
DUS_PART_NAME_LENGTH
#define DUS_PART_NAME_LENGTH
Maximum number of partitions.
Definition: dus_common_data.h:83
DUS_PAYLOAD_HEADER::isSigned
uint8_t isSigned
Definition: dus_common_data.h:182
DUS_PAYLOAD_HEADER
struct DUS_PAYLOAD_HEADER DUS_PAYLOAD_HEADER
Defines Payload data type.
DUS_IVC_TX::chain
uint8_t chain
Definition: dus_common_data.h:121
DUS_PART_INFO::partitionSize
uint64_t partitionSize
Partition Size.
Definition: dus_common_data.h:195
DUS_MAX_PARTITION_NUM
#define DUS_MAX_PARTITION_NUM
Maximum number of partitions.
Definition: dus_common_data.h:100
DUS_IVC_RX::retCode
uint32_t retCode
Definition: dus_common_data.h:139
DUS_IVC_DATA::tx
DUS_IVC_TX tx
Definition: dus_common_data.h:151
DUS_MEMPOOL_HEADER
Defines Mempool data type.
Definition: dus_common_data.h:158
DUS_IVC_RX::magic
uint64_t magic
Definition: dus_common_data.h:135
DUS_PART_INFO::storageType
uint32_t storageType
Storage type, qspi, emmc or ufs.
Definition: dus_common_data.h:203
DUS_MEMPOOL_HEADER::direction
uint8_t direction
Definition: dus_common_data.h:165
DUS_PART_INFO::partitionAttr
uint32_t partitionAttr
Holds partition attributes.
Definition: dus_common_data.h:191
DUS_IVC_RX::version
uint8_t version
Definition: dus_common_data.h:137
CHAIN_TYPE
uint8_t CHAIN_TYPE
Definition: dus_common_data.h:34
DUS_IVC_TX::version
uint8_t version
Definition: dus_common_data.h:115
DUS_IVC_DATA::rx
DUS_IVC_RX rx
Definition: dus_common_data.h:152
DUS_MEMPOOL_HEADER::version
uint8_t version
Definition: dus_common_data.h:163
DUS_MEMPOOL_HEADER::magic
uint64_t magic
Definition: dus_common_data.h:161
DUS_PART_INFO
struct DUS_PART_INFO DUS_PART_INFO
DUS_IVC_RX
struct DUS_IVC_RX DUS_IVC_RX
Defines IVC recive data type.