• 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 #include "dt_table.h"
18 
19 #include <memory.h>
20 
21 #include "libfdt.h"
22 #include "libufdt_sysdeps.h"
23 
24 
dt_table_header_init(struct dt_table_header * header)25 void dt_table_header_init(struct dt_table_header *header) {
26   const uint32_t header_size = sizeof(struct dt_table_header);
27   const uint32_t entry_size = sizeof(struct dt_table_entry);
28 
29   dto_memset(header, 0, header_size);
30   header->magic = cpu_to_fdt32(DT_TABLE_MAGIC);
31   header->total_size = cpu_to_fdt32(header_size);
32   header->header_size = cpu_to_fdt32(header_size);
33   header->dt_entry_size = cpu_to_fdt32(entry_size);
34   header->dt_entries_offset = cpu_to_fdt32(header_size);
35   header->page_size = cpu_to_fdt32(DT_TABLE_DEFAULT_PAGE_SIZE);
36 }
37