• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
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 DT_TABLE_H
18 #define DT_TABLE_H
19 
20 #include <stdint.h>
21 
22 /*
23  * For the image layout, refer README.md for the detail
24  */
25 
26 #define DT_TABLE_MAGIC 0xd7b7ab1e
27 #define DT_TABLE_DEFAULT_PAGE_SIZE 2048
28 
29 struct dt_table_header {
30   uint32_t magic;             /* DT_TABLE_MAGIC */
31   uint32_t total_size;        /* includes dt_table_header + all dt_table_entry
32                                  and all dtb/dtbo */
33   uint32_t header_size;       /* sizeof(dt_table_header) */
34 
35   uint32_t dt_entry_size;     /* sizeof(dt_table_entry) */
36   uint32_t dt_entry_count;    /* number of dt_table_entry */
37   uint32_t dt_entries_offset; /* offset to the first dt_table_entry
38                                  from head of dt_table_header.
39                                  The value will be equal to header_size if
40                                  no padding is appended */
41 
42   uint32_t page_size;         /* flash page size we assume */
43   uint32_t reserved[1];       /* must be zero */
44 };
45 
46 struct dt_table_entry {
47   uint32_t dt_size;
48   uint32_t dt_offset;         /* offset from head of dt_table_header */
49 
50   uint32_t id;                /* optional, must be zero if unused */
51   uint32_t rev;               /* optional, must be zero if unused */
52   uint32_t custom[4];         /* optional, must be zero if unused */
53 };
54 
55 void dt_table_header_init(struct dt_table_header *header);
56 
57 #endif
58