diff --git a/Makefile b/Makefile
index 284239b..971dd7e 100755
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,10 @@ TARGET := hekate
BUILDDIR := build
OUTPUTDIR := output
SOURCEDIR = bootloader
+BDKDIR := bdk
+BDKINC := -I./$(BDKDIR)
VPATH = $(dir ./$(SOURCEDIR)/) $(dir $(wildcard ./$(SOURCEDIR)/*/)) $(dir $(wildcard ./$(SOURCEDIR)/*/*/))
+VPATH += $(dir $(wildcard ./$(BDKDIR)/*/)) $(dir $(wildcard ./$(BDKDIR)/*/*/))
# Main and graphics.
OBJS = $(addprefix $(BUILDDIR)/$(TARGET)/, \
@@ -54,11 +57,15 @@ OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
elfload.o elfreloc_arm.o \
)
+GFX_INC := '"../$(SOURCEDIR)/gfx/gfx.h"'
+FFCFG_INC := '"../$(SOURCEDIR)/libs/fatfs/ffconf.h"'
+
################################################################################
CUSTOMDEFINES := -DIPL_LOAD_ADDR=$(IPL_LOAD_ADDR) -DBL_MAGIC=$(IPL_MAGIC)
CUSTOMDEFINES += -DBL_VER_MJ=$(BLVERSION_MAJOR) -DBL_VER_MN=$(BLVERSION_MINOR) -DBL_VER_HF=$(BLVERSION_HOTFX) -DBL_RESERVED=$(BLVERSION_RSVD)
CUSTOMDEFINES += -DNYX_VER_MJ=$(NYXVERSION_MAJOR) -DNYX_VER_MN=$(NYXVERSION_MINOR) -DNYX_VER_HF=$(NYXVERSION_HOTFX) -DNYX_RESERVED=$(NYXVERSION_RSVD)
+CUSTOMDEFINES += -DGFX_INC=$(GFX_INC) -DFFCFG_INC=$(FFCFG_INC)
# 0: UART_A, 1: UART_B.
#CUSTOMDEFINES += -DDEBUG_UART_PORT=0
@@ -104,7 +111,7 @@ $(BUILDDIR)/$(TARGET)/$(TARGET).elf: $(OBJS)
$(BUILDDIR)/$(TARGET)/%.o: %.c
@echo Building $@
- @$(CC) $(CFLAGS) -c $< -o $@
+ @$(CC) $(CFLAGS) $(BDKINC) -c $< -o $@
$(BUILDDIR)/$(TARGET)/%.o: %.S
@echo Building $@
diff --git a/common/common_heap.h b/bdk/fatfs_cfg.h
similarity index 59%
rename from common/common_heap.h
rename to bdk/fatfs_cfg.h
index 110f013..a12585f 100644
--- a/common/common_heap.h
+++ b/bdk/fatfs_cfg.h
@@ -1,6 +1,5 @@
/*
- * Copyright (c) 2018 naehrwert
- * Copyright (c) 2018 M4xw
+ * Copyright (c) 2020 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -13,29 +12,13 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
-*/
+ */
-#pragma once
-//TODO: Move it to BDK
-#include "../bootloader/utils/types.h"
+#ifndef _FATFS_CFG_H_
+#define _FATFS_CFG_H_
-typedef struct _hnode
-{
- int used;
- u32 size;
- struct _hnode *prev;
- struct _hnode *next;
- u32 align[4]; // Align to arch cache line size.
-} hnode_t;
+#ifdef FFCFG_INC
+#include FFCFG_INC
+#endif
-typedef struct _heap
-{
- u32 start;
- hnode_t *first;
-} heap_t;
-
-typedef struct
-{
- u32 total;
- u32 used;
-} heap_monitor_t;
+#endif
diff --git a/bdk/gfx/di.c b/bdk/gfx/di.c
index 015df23..1549e7b 100644
--- a/bdk/gfx/di.c
+++ b/bdk/gfx/di.c
@@ -18,16 +18,15 @@
#include
#include "di.h"
-#include "../gfx/gfx.h"
-#include "../power/max77620.h"
-#include "../power/max7762x.h"
-#include "../soc/clock.h"
-#include "../soc/gpio.h"
-#include "../soc/i2c.h"
-#include "../soc/pinmux.h"
-#include "../soc/pmc.h"
-#include "../soc/t210.h"
-#include "../utils/util.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
#include "di.inl"
diff --git a/bdk/gfx/di.h b/bdk/gfx/di.h
index 2b4e579..2723de0 100644
--- a/bdk/gfx/di.h
+++ b/bdk/gfx/di.h
@@ -18,8 +18,8 @@
#ifndef _DI_H_
#define _DI_H_
-#include "../../common/memory_map.h"
-#include "../utils/types.h"
+#include
+#include
/*! Display registers. */
#define _DIREG(reg) ((reg) * 4)
diff --git a/common/common_gfx.h b/bdk/gfx_utils.h
similarity index 57%
rename from common/common_gfx.h
rename to bdk/gfx_utils.h
index b6dbdab..ca81a7f 100644
--- a/common/common_gfx.h
+++ b/bdk/gfx_utils.h
@@ -1,8 +1,5 @@
/*
- * Common Gfx Header
- * Copyright (c) 2018 naehrwert
- * Copyright (c) 2018 CTCaer
- * Copyright (c) 2018 M4xw
+ * Copyright (c) 2020 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -15,30 +12,13 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
-*/
+ */
-#pragma once
-//TODO: Move it to BDK
-#include "../bootloader/utils/types.h"
+#ifndef _GFX_UTILS_H_
+#define _GFX_UTILS_H_
-typedef struct _gfx_ctxt_t
-{
- u32 *fb;
- u32 width;
- u32 height;
- u32 stride;
-} gfx_ctxt_t;
+#ifdef GFX_INC
+#include GFX_INC
+#endif
-typedef struct _gfx_con_t
-{
- gfx_ctxt_t *gfx_ctxt;
- u32 fntsz;
- u32 x;
- u32 y;
- u32 savedx;
- u32 savedy;
- u32 fgcol;
- int fillbg;
- u32 bgcol;
- bool mute;
-} gfx_con_t;
+#endif
diff --git a/bdk/ianos/elfload/elfload.h b/bdk/ianos/elfload/elfload.h
index 3a15dc2..2b9bb67 100644
--- a/bdk/ianos/elfload/elfload.h
+++ b/bdk/ianos/elfload/elfload.h
@@ -22,10 +22,10 @@
#include "elfarch.h"
#include "elf.h"
-#include "../../utils/types.h"
+#include
#ifdef DEBUG
-#include "../../gfx/gfx.h"
+#include
#define EL_DEBUG(format, ...) \
gfx_printf(format __VA_OPT__(, ) __VA_ARGS__)
#else
diff --git a/bdk/ianos/ianos.c b/bdk/ianos/ianos.c
index 15f3c30..5eca1b6 100644
--- a/bdk/ianos/ianos.c
+++ b/bdk/ianos/ianos.c
@@ -18,12 +18,13 @@
#include
#include "ianos.h"
-#include "../../common/common_module.h"
-#include "../gfx/gfx.h"
-#include "../libs/elfload/elfload.h"
-#include "../mem/heap.h"
-#include "../storage/nx_sd.h"
-#include "../utils/types.h"
+#include "elfload/elfload.h"
+#include
+#include
+#include
+#include
+
+#include
#define IRAM_LIB_ADDR 0x4002B000
#define DRAM_LIB_ADDR 0xE0000000
@@ -36,8 +37,8 @@ void *fileBuf = NULL;
static void _ianos_call_ep(moduleEntrypoint_t entrypoint, void *moduleConfig)
{
bdkParams_t bdkParameters = (bdkParams_t)malloc(sizeof(struct _bdkParams_t));
- bdkParameters->gfxCon = &gfx_con;
- bdkParameters->gfxCtx = &gfx_ctxt;
+ bdkParameters->gfxCon = (void *)&gfx_con;
+ bdkParameters->gfxCtx = (void *)&gfx_ctxt;
bdkParameters->memcpy = (memcpy_t)&memcpy;
bdkParameters->memset = (memset_t)&memset;
bdkParameters->sharedHeap = &_heap;
diff --git a/bdk/ianos/ianos.h b/bdk/ianos/ianos.h
index d64b329..5ebec64 100644
--- a/bdk/ianos/ianos.h
+++ b/bdk/ianos/ianos.h
@@ -18,7 +18,7 @@
#ifndef IANOS_H
#define IANOS_H
-#include "../utils/types.h"
+#include
typedef enum
{
diff --git a/bdk/input/als.c b/bdk/input/als.c
index ef9a4c8..3f59657 100644
--- a/bdk/input/als.c
+++ b/bdk/input/als.c
@@ -17,11 +17,11 @@
*/
#include "als.h"
-#include "../power/max77620.h"
-#include "../soc/clock.h"
-#include "../soc/i2c.h"
-#include "../soc/pinmux.h"
-#include "../utils/util.h"
+#include
+#include
+#include
+#include
+#include
#define HOS_GAIN BH1730_GAIN_64X
#define HOS_ITIME 38
diff --git a/bdk/input/als.h b/bdk/input/als.h
index 11f1e5e..ad31e42 100644
--- a/bdk/input/als.h
+++ b/bdk/input/als.h
@@ -19,7 +19,7 @@
#ifndef __ALS_H_
#define __ALS_H_
-#include "../utils/types.h"
+#include
#define BH1730_I2C_ADDR 0x29
diff --git a/bdk/input/joycon.c b/bdk/input/joycon.c
index 8cc74aa..2db1aa6 100644
--- a/bdk/input/joycon.c
+++ b/bdk/input/joycon.c
@@ -19,19 +19,19 @@
#include
#include "joycon.h"
-#include "../gfx/gfx.h"
-#include "../power/max17050.h"
-#include "../power/regulator_5v.h"
-#include "../soc/bpmp.h"
-#include "../soc/clock.h"
-#include "../soc/gpio.h"
-#include "../soc/pinmux.h"
-#include "../soc/uart.h"
-#include "../soc/t210.h"
-#include "../utils/util.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
// For disabling driver when logging is enabled.
-#include "../libs/lvgl/lvgl.h"
+#include
#define JC_WIRED_CMD 0x91
#define JC_WIRED_HID 0x92
diff --git a/bdk/input/joycon.h b/bdk/input/joycon.h
index 187ccb7..932c836 100644
--- a/bdk/input/joycon.h
+++ b/bdk/input/joycon.h
@@ -19,7 +19,7 @@
#ifndef __JOYCON_H_
#define __JOYCON_H_
-#include "../utils/types.h"
+#include
#define JC_BTNS_DIRECTION_PAD 0xF0000
#define JC_BTNS_PREV_NEXT 0x800080
diff --git a/bdk/input/touch.c b/bdk/input/touch.c
index 9887e6f..eef61ec 100644
--- a/bdk/input/touch.c
+++ b/bdk/input/touch.c
@@ -19,19 +19,19 @@
#include
-#include "../soc/clock.h"
-#include "../soc/i2c.h"
-#include "../soc/pinmux.h"
-#include "../power/max7762x.h"
-#include "../power/max77620.h"
-#include "../soc/gpio.h"
-#include "../soc/t210.h"
-#include "../utils/btn.h"
-#include "../utils/util.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
#include "touch.h"
-#include "../gfx/gfx.h"
+#include
#define DPRINTF(...) gfx_printf(__VA_ARGS__)
static int touch_command(u8 cmd, u8 *buf, u8 size)
diff --git a/bdk/input/touch.h b/bdk/input/touch.h
index 87b6fb2..9245be3 100644
--- a/bdk/input/touch.h
+++ b/bdk/input/touch.h
@@ -20,7 +20,7 @@
#ifndef __TOUCH_H_
#define __TOUCH_H_
-#include "../utils/types.h"
+#include
#define STMFTS_I2C_ADDR 0x49
diff --git a/bdk/libs/compr/blz.h b/bdk/libs/compr/blz.h
index 4171049..a1cce37 100644
--- a/bdk/libs/compr/blz.h
+++ b/bdk/libs/compr/blz.h
@@ -17,7 +17,7 @@
#ifndef _BLZ_H_
#define _BLZ_H_
-#include "../../utils/types.h"
+#include
typedef struct _blz_footer
{
diff --git a/bdk/libs/fatfs/diskio.h b/bdk/libs/fatfs/diskio.h
index 31b855d..6959fb4 100644
--- a/bdk/libs/fatfs/diskio.h
+++ b/bdk/libs/fatfs/diskio.h
@@ -9,7 +9,7 @@
extern "C" {
#endif
-#include "../../utils/types.h"
+#include
/* Status of Disk Functions */
typedef BYTE DSTATUS;
diff --git a/bdk/libs/fatfs/ff.c b/bdk/libs/fatfs/ff.c
index c6c4d75..9035f35 100644
--- a/bdk/libs/fatfs/ff.c
+++ b/bdk/libs/fatfs/ff.c
@@ -38,7 +38,7 @@
#include "ff.h" /* Declarations of FatFs API */
#include "diskio.h" /* Declarations of device I/O functions */
-#include "../../gfx/gfx.h"
+#include
#define EFSPRINTF(text, ...) print_error(); gfx_printf("%k"text"%k\n", 0xFFFFFF00, 0xFFFFFFFF);
//#define EFSPRINTF(...)
diff --git a/bdk/libs/fatfs/ff.h b/bdk/libs/fatfs/ff.h
index af1151f..a83cf63 100644
--- a/bdk/libs/fatfs/ff.h
+++ b/bdk/libs/fatfs/ff.h
@@ -26,8 +26,8 @@
extern "C" {
#endif
-#include "../../utils/types.h" /* Basic integer types */
-#include "ffconf.h" /* FatFs configuration options */
+#include /* Basic integer types */
+#include /* FatFs configuration options */
#if FF_DEFINED != FFCONF_DEF
#error Wrong configuration file (ffconf.h).
diff --git a/bdk/libs/lv_conf.h b/bdk/libs/lv_conf.h
index 797d1f9..ab7f311 100644
--- a/bdk/libs/lv_conf.h
+++ b/bdk/libs/lv_conf.h
@@ -17,8 +17,8 @@
#ifndef LV_CONF_H
#define LV_CONF_H
-#include "../utils/types.h"
-#include "../../../common/memory_map.h"
+#include
+#include
/*===================
Dynamic memory
*===================*/
@@ -32,7 +32,7 @@
# define LV_MEM_ADR NYX_LV_MEM_ADR /*Set an address for memory pool instead of allocation it as an array. Can be in external SRAM too.*/
# define LV_MEM_AUTO_DEFRAG 1 /*Automatically defrag on free*/
#else /*LV_MEM_CUSTOM*/
-# define LV_MEM_CUSTOM_INCLUDE "../../../mem/heap.h" /*Header for the dynamic memory function*/
+# define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/
# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
#endif /*LV_MEM_CUSTOM*/
@@ -149,7 +149,7 @@
/*HAL settings*/
#define LV_TICK_CUSTOM 1 /*1: use a custom tick source (removing the need to manually update the tick with `lv_tick_inc`) */
#if LV_TICK_CUSTOM == 1
-#define LV_TICK_CUSTOM_INCLUDE "../../../utils/util.h" /*Header for the sys time function*/
+#define LV_TICK_CUSTOM_INCLUDE /*Header for the sys time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (get_tmr_ms()) /*Expression evaluating to current systime in ms*/
#endif /*LV_TICK_CUSTOM*/
diff --git a/bdk/libs/lvgl/lv_fonts/hekate_symbol_120.c b/bdk/libs/lvgl/lv_fonts/hekate_symbol_120.c
index 9a27deb..c97eda6 100644
--- a/bdk/libs/lvgl/lv_fonts/hekate_symbol_120.c
+++ b/bdk/libs/lvgl/lv_fonts/hekate_symbol_120.c
@@ -16,7 +16,7 @@
#include "../lv_misc/lv_font.h"
-#include "../../../../../common/memory_map.h"
+#include
#if USE_HEKATE_SYMBOL_120 != 0 /*Can be enabled in lv_conf.h*/
diff --git a/bdk/libs/lvgl/lv_fonts/hekate_symbol_20.c b/bdk/libs/lvgl/lv_fonts/hekate_symbol_20.c
index 8ded987..426bde8 100644
--- a/bdk/libs/lvgl/lv_fonts/hekate_symbol_20.c
+++ b/bdk/libs/lvgl/lv_fonts/hekate_symbol_20.c
@@ -16,7 +16,7 @@
#include "../lv_misc/lv_font.h"
-#include "../../../../../common/memory_map.h"
+#include
#if USE_HEKATE_SYMBOL_20 != 0 /*Can be enabled in lv_conf.h*/
diff --git a/bdk/libs/lvgl/lv_fonts/hekate_symbol_30.c b/bdk/libs/lvgl/lv_fonts/hekate_symbol_30.c
index 08842d2..4e0da47 100644
--- a/bdk/libs/lvgl/lv_fonts/hekate_symbol_30.c
+++ b/bdk/libs/lvgl/lv_fonts/hekate_symbol_30.c
@@ -16,7 +16,7 @@
#include "../lv_misc/lv_font.h"
-#include "../../../../../common/memory_map.h"
+#include
#if USE_HEKATE_SYMBOL_30 != 0 /*Can be enabled in lv_conf.h*/
diff --git a/bdk/libs/lvgl/lv_fonts/interui_20.c b/bdk/libs/lvgl/lv_fonts/interui_20.c
index db0bbe5..5f50c6c 100644
--- a/bdk/libs/lvgl/lv_fonts/interui_20.c
+++ b/bdk/libs/lvgl/lv_fonts/interui_20.c
@@ -16,7 +16,7 @@
#include "../lv_misc/lv_font.h"
-#include "../../../../../common/memory_map.h"
+#include
#if USE_INTERUI_20 != 0 /*Can be enabled in lv_conf.h*/
diff --git a/bdk/libs/lvgl/lv_fonts/interui_30.c b/bdk/libs/lvgl/lv_fonts/interui_30.c
index 1f97abf..238bcb1 100644
--- a/bdk/libs/lvgl/lv_fonts/interui_30.c
+++ b/bdk/libs/lvgl/lv_fonts/interui_30.c
@@ -16,7 +16,7 @@
#include "../lv_misc/lv_font.h"
-#include "../../../../../common/memory_map.h"
+#include
#if USE_INTERUI_30 != 0 /*Can be enabled in lv_conf.h*/
diff --git a/bdk/libs/lvgl/lv_fonts/ubuntu_mono.c b/bdk/libs/lvgl/lv_fonts/ubuntu_mono.c
index b88cb2c..4c988fc 100644
--- a/bdk/libs/lvgl/lv_fonts/ubuntu_mono.c
+++ b/bdk/libs/lvgl/lv_fonts/ubuntu_mono.c
@@ -16,7 +16,7 @@
#include "../lv_misc/lv_font.h"
-#include "../../../../../common/memory_map.h"
+#include
#if USE_UBUNTU_MONO != 0 /*Can be enabled in lv_conf.h*/
diff --git a/bdk/libs/lvgl/lv_hal/lv_hal_indev.h b/bdk/libs/lvgl/lv_hal/lv_hal_indev.h
index b9d4255..2355baa 100644
--- a/bdk/libs/lvgl/lv_hal/lv_hal_indev.h
+++ b/bdk/libs/lvgl/lv_hal/lv_hal_indev.h
@@ -17,7 +17,7 @@ extern "C" {
*********************/
#include
#include "lv_hal.h"
-#include "../../../utils/types.h"
+#include
#include "../lv_misc/lv_area.h"
#include "../lv_core/lv_obj.h"
diff --git a/bdk/libs/lvgl/lv_misc/lv_area.h b/bdk/libs/lvgl/lv_misc/lv_area.h
index bae0753..63ea059 100644
--- a/bdk/libs/lvgl/lv_misc/lv_area.h
+++ b/bdk/libs/lvgl/lv_misc/lv_area.h
@@ -15,7 +15,7 @@ extern "C" {
* INCLUDES
*********************/
#include
-#include "../../../utils/types.h"
+#include
/*********************
* DEFINES
diff --git a/bdk/libs/lvgl/lv_misc/lv_circ.h b/bdk/libs/lvgl/lv_misc/lv_circ.h
index f0fbb3f..bc1c1dd 100644
--- a/bdk/libs/lvgl/lv_misc/lv_circ.h
+++ b/bdk/libs/lvgl/lv_misc/lv_circ.h
@@ -16,7 +16,7 @@ extern "C" {
*********************/
#include
#include "lv_area.h"
-#include "../../../utils/types.h"
+#include
/*********************
* DEFINES
diff --git a/bdk/libs/lvgl/lv_misc/lv_log.c b/bdk/libs/lvgl/lv_misc/lv_log.c
index 79f8113..bd59cf3 100644
--- a/bdk/libs/lvgl/lv_misc/lv_log.c
+++ b/bdk/libs/lvgl/lv_misc/lv_log.c
@@ -11,9 +11,9 @@
#if LV_LOG_PRINTF
#include
-#include "../../../mem/heap.h"
-#include "../../../soc/uart.h"
-#include "../../../utils/sprintf.h"
+#include
+#include
+#include
#endif
/*********************
* DEFINES
diff --git a/bdk/mem/heap.c b/bdk/mem/heap.c
index cafd806..d249140 100644
--- a/bdk/mem/heap.c
+++ b/bdk/mem/heap.c
@@ -1,7 +1,6 @@
/*
* Copyright (c) 2018 naehrwert
* Copyright (c) 2018-2020 CTCaer
- * Copyright (c) 2018 M4xw
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -18,8 +17,7 @@
#include
#include "heap.h"
-#include "../gfx/gfx.h"
-#include "../../common/common_heap.h"
+#include
static void _heap_create(heap_t *heap, u32 start)
{
diff --git a/bdk/mem/heap.h b/bdk/mem/heap.h
index 05faee2..811f13d 100644
--- a/bdk/mem/heap.h
+++ b/bdk/mem/heap.h
@@ -18,8 +18,28 @@
#ifndef _HEAP_H_
#define _HEAP_H_
-#include "../utils/types.h"
-#include "../../common/common_heap.h"
+#include
+
+typedef struct _hnode
+{
+ int used;
+ u32 size;
+ struct _hnode *prev;
+ struct _hnode *next;
+ u32 align[4]; // Align to arch cache line size.
+} hnode_t;
+
+typedef struct _heap
+{
+ u32 start;
+ hnode_t *first;
+} heap_t;
+
+typedef struct
+{
+ u32 total;
+ u32 used;
+} heap_monitor_t;
void heap_init(u32 base);
void heap_copy(heap_t *heap);
diff --git a/bdk/mem/mc.c b/bdk/mem/mc.c
index dd508e2..8a0da1a 100644
--- a/bdk/mem/mc.c
+++ b/bdk/mem/mc.c
@@ -1,7 +1,24 @@
-#include "../mem/mc.h"
-#include "../soc/t210.h"
-#include "../soc/clock.h"
-#include "../utils/util.h"
+/*
+ * Copyright (c) 2018 naehrwert
+ * Copyright (c) 2018 CTCaer
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+#include
+#include
+#include
void mc_config_tsec_carveout(u32 bom, u32 size1mb, bool lock)
{
diff --git a/bdk/mem/mc.h b/bdk/mem/mc.h
index 6a28bde..1a9bc83 100644
--- a/bdk/mem/mc.h
+++ b/bdk/mem/mc.h
@@ -1,8 +1,24 @@
+/*
+ * Copyright (c) 2018 naehrwert
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
#ifndef _MC_H_
#define _MC_H_
-#include "../utils/types.h"
-#include "../mem/mc_t210.h"
+#include
+#include
void mc_config_tsec_carveout(u32 bom, u32 size1mb, bool lock);
void mc_config_carveout();
diff --git a/bdk/mem/minerva.c b/bdk/mem/minerva.c
index e30fa56..259c63a 100644
--- a/bdk/mem/minerva.c
+++ b/bdk/mem/minerva.c
@@ -18,13 +18,13 @@
#include
#include "minerva.h"
-#include "../soc/fuse.h"
-#include "../utils/util.h"
-#include "../soc/clock.h"
-#include "../ianos/ianos.h"
-#include "../soc/fuse.h"
-#include "../soc/t210.h"
+#include
+#include
+#include
+#include
+#include
+#include
extern volatile nyx_storage_t *nyx_str;
diff --git a/bdk/mem/minerva.h b/bdk/mem/minerva.h
index 9be55c9..ed80b95 100644
--- a/bdk/mem/minerva.h
+++ b/bdk/mem/minerva.h
@@ -18,7 +18,7 @@
#define _FE_MINERVA_H_
#include "mtc_table.h"
-#include "../utils/types.h"
+#include
#define MTC_INIT_MAGIC 0x3043544D
#define MTC_NEW_MAGIC 0x5243544D
diff --git a/bdk/mem/mtc_table.h b/bdk/mem/mtc_table.h
index 38a3e2f..e24fa81 100644
--- a/bdk/mem/mtc_table.h
+++ b/bdk/mem/mtc_table.h
@@ -20,7 +20,7 @@
#ifndef _MTC_TABLE_H_
#define _MTC_TABLE_H_
-#include "../utils/types.h"
+#include
typedef struct
{
diff --git a/bdk/mem/sdram.c b/bdk/mem/sdram.c
index 9990848..e58a1eb 100644
--- a/bdk/mem/sdram.c
+++ b/bdk/mem/sdram.c
@@ -18,23 +18,23 @@
#include
-#include "mc.h"
-#include "emc.h"
-#include "sdram_param_t210.h"
-#include "../../common/memory_map.h"
-#include "../power/max77620.h"
-#include "../power/max7762x.h"
-#include "../soc/clock.h"
-#include "../soc/fuse.h"
-#include "../soc/i2c.h"
-#include "../soc/pmc.h"
-#include "../soc/t210.h"
-#include "../utils/util.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
#define CONFIG_SDRAM_KEEP_ALIVE
#ifdef CONFIG_SDRAM_COMPRESS_CFG
-#include "../libs/compr/lz.h"
+#include
#include "sdram_config_lz.inl"
#else
#include "sdram_config.inl"
diff --git a/bdk/mem/sdram.h b/bdk/mem/sdram.h
index 059bc9c..620c078 100644
--- a/bdk/mem/sdram.h
+++ b/bdk/mem/sdram.h
@@ -17,8 +17,8 @@
#ifndef _SDRAM_H_
#define _SDRAM_H_
-#include "emc.h"
-#include "sdram_param_t210.h"
+#include
+#include
void sdram_init();
sdram_params_t *sdram_get_params();
diff --git a/bdk/mem/sdram_lp0.c b/bdk/mem/sdram_lp0.c
index 869e85a..2a83c27 100644
--- a/bdk/mem/sdram_lp0.c
+++ b/bdk/mem/sdram_lp0.c
@@ -14,9 +14,9 @@
* more details.
*/
-#include "../soc/t210.h"
-#include "../soc/pmc_lp0_t210.h"
-#include "sdram_lp0_param_t210.h"
+#include
+#include
+#include
/*
* This function reads SDRAM parameters from the common BCT format and
diff --git a/bdk/mem/sdram_lp0_param_t210.h b/bdk/mem/sdram_lp0_param_t210.h
index 9028990..1422ed3 100644
--- a/bdk/mem/sdram_lp0_param_t210.h
+++ b/bdk/mem/sdram_lp0_param_t210.h
@@ -23,7 +23,7 @@
#ifndef __SOC_NVIDIA_TEGRA210_SDRAM_PARAM_H__
#define __SOC_NVIDIA_TEGRA210_SDRAM_PARAM_H__
-#include "../utils/types.h"
+#include
enum
{
diff --git a/bdk/mem/smmu.c b/bdk/mem/smmu.c
index ef4f9bb..6ee99b9 100644
--- a/bdk/mem/smmu.c
+++ b/bdk/mem/smmu.c
@@ -17,12 +17,12 @@
#include
-#include "smmu.h"
-#include "../soc/ccplex.h"
-#include "../soc/t210.h"
-#include "../mem/mc_t210.h"
-#include "../utils/util.h"
-#include "../utils/aarch64_util.h"
+#include
+#include
+#include
+#include
+#include
+#include
bool smmu_used = false;
u8 *_pageheap = (u8 *)SMMU_HEAP_ADDR;
diff --git a/bdk/mem/smmu.h b/bdk/mem/smmu.h
index 827d58b..7846253 100644
--- a/bdk/mem/smmu.h
+++ b/bdk/mem/smmu.h
@@ -14,7 +14,7 @@
* along with this program. If not, see .
*/
-#include "../utils/types.h"
+#include
#define SMMU_HEAP_ADDR 0xA0000000
diff --git a/bdk/module.h b/bdk/module.h
index 93a1541..6ec303f 100644
--- a/bdk/module.h
+++ b/bdk/module.h
@@ -15,11 +15,11 @@
* along with this program. If not, see .
*/
-#pragma once
+#ifndef _MODULE_H_
+#define _MODULE_H_
+
#include
-//TODO: Move it to BDK
-#include "common_gfx.h"
-#include "common_heap.h"
+#include
// Module Callback
typedef void (*cbMainModule_t)(const char *s);
@@ -28,8 +28,8 @@ typedef void (*memset_t)(void *, int, size_t);
typedef struct _bdkParams_t
{
- gfx_con_t *gfxCon;
- gfx_ctxt_t *gfxCtx;
+ void *gfxCon;
+ void *gfxCtx;
heap_t *sharedHeap;
memcpy_t memcpy;
memset_t memset;
@@ -37,3 +37,5 @@ typedef struct _bdkParams_t
// Module Entrypoint
typedef void (*moduleEntrypoint_t)(void *, bdkParams_t);
+
+#endif
diff --git a/bdk/power/bq24193.c b/bdk/power/bq24193.c
index 0ade8da..2b2e744 100644
--- a/bdk/power/bq24193.c
+++ b/bdk/power/bq24193.c
@@ -17,8 +17,8 @@
*/
#include "bq24193.h"
-#include "../soc/i2c.h"
-#include "../utils/util.h"
+#include
+#include
static u8 bq24193_get_reg(u8 reg)
{
diff --git a/bdk/power/max17050.c b/bdk/power/max17050.c
index f70cfec..2491466 100644
--- a/bdk/power/max17050.c
+++ b/bdk/power/max17050.c
@@ -23,8 +23,8 @@
*/
#include "max17050.h"
-#include "../soc/i2c.h"
-#include "../utils/util.h"
+#include
+#include
/* Status register bits */
#define STATUS_POR_BIT (1 << 1)
diff --git a/bdk/power/max17050.h b/bdk/power/max17050.h
index eb55e65..254aca3 100644
--- a/bdk/power/max17050.h
+++ b/bdk/power/max17050.h
@@ -24,7 +24,7 @@
#ifndef __MAX17050_H_
#define __MAX17050_H_
-#include "../utils/types.h"
+#include
#define MAX17050_STATUS_BattAbsent (1 << 3)
#define MAX17050_DEFAULT_SNS_RESISTOR 10000
diff --git a/bdk/power/max7762x.c b/bdk/power/max7762x.c
index ce07cbe..425ce1f 100644
--- a/bdk/power/max7762x.c
+++ b/bdk/power/max7762x.c
@@ -15,10 +15,10 @@
* along with this program. If not, see .
*/
-#include "max7762x.h"
-#include "max77620.h"
-#include "../soc/i2c.h"
-#include "../utils/util.h"
+#include
+#include
+#include
+#include
#define REGULATOR_SD 0
#define REGULATOR_LDO 1
diff --git a/bdk/power/max7762x.h b/bdk/power/max7762x.h
index aefe892..f60c3b2 100644
--- a/bdk/power/max7762x.h
+++ b/bdk/power/max7762x.h
@@ -18,7 +18,7 @@
#ifndef _MAX7762X_H_
#define _MAX7762X_H_
-#include "../utils/types.h"
+#include
/*
* Switch Power domains (max77620):
diff --git a/bdk/power/regulator_5v.c b/bdk/power/regulator_5v.c
index 7705490..c61db64 100644
--- a/bdk/power/regulator_5v.c
+++ b/bdk/power/regulator_5v.c
@@ -14,11 +14,11 @@
* along with this program. If not, see .
*/
-#include "../soc/gpio.h"
-#include "../soc/pinmux.h"
-#include "../soc/pmc.h"
-#include "../soc/t210.h"
-#include "../utils/types.h"
+#include
+#include
+#include
+#include
+#include
static u8 reg_5v_dev = 0;
diff --git a/bdk/power/regulator_5v.h b/bdk/power/regulator_5v.h
index 7608881..e916fbd 100644
--- a/bdk/power/regulator_5v.h
+++ b/bdk/power/regulator_5v.h
@@ -17,7 +17,7 @@
#ifndef _REGULATOR_5V_H_
#define _REGULATOR_5V_H_
-#include "../utils/types.h"
+#include
enum
{
diff --git a/bdk/rtc/max77620-rtc.c b/bdk/rtc/max77620-rtc.c
index 04c6937..164df75 100644
--- a/bdk/rtc/max77620-rtc.c
+++ b/bdk/rtc/max77620-rtc.c
@@ -17,9 +17,9 @@
* along with this program. If not, see .
*/
-#include "max77620-rtc.h"
-#include "../soc/i2c.h"
-#include "../utils/util.h"
+#include