summaryrefslogtreecommitdiff
path: root/arm9/lib/include
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/lib/include')
-rw-r--r--arm9/lib/include/NNS_FND_allocator.h34
-rw-r--r--arm9/lib/include/NNS_FND_expheap.h55
-rw-r--r--arm9/lib/include/NNS_FND_heapcommon.h26
-rw-r--r--arm9/lib/include/NNS_FND_list.h20
-rw-r--r--arm9/lib/include/consts.h1
-rw-r--r--arm9/lib/include/tp.h8
6 files changed, 144 insertions, 0 deletions
diff --git a/arm9/lib/include/NNS_FND_allocator.h b/arm9/lib/include/NNS_FND_allocator.h
new file mode 100644
index 00000000..48df282a
--- /dev/null
+++ b/arm9/lib/include/NNS_FND_allocator.h
@@ -0,0 +1,34 @@
+#ifndef GUARD_NNS_FND_ALLOCATOR_H
+#define GUARD_NNS_FND_ALLOCATOR_H
+
+#include "NNS_FND_heapcommon.h"
+
+typedef struct NNSFndAllocator NNSFndAllocator;
+
+typedef void* (*NNSFndFuncAllocatorAlloc)(
+ NNSFndAllocator* pAllocator,
+ u32 size);
+
+typedef void (*NNSFndFuncAllocatorFree)(
+ NNSFndAllocator* pAllocator,
+ void* memBlock);
+
+typedef struct NNSFndAllocatorFunc NNSFndAllocatorFunc;
+
+struct NNSFndAllocatorFunc
+{
+ NNSFndFuncAllocatorAlloc pfAlloc;
+ NNSFndFuncAllocatorFree pfFree;
+};
+
+struct NNSFndAllocator
+{
+ NNSFndAllocatorFunc const * pFunc;
+ void* pHeap;
+ u32 heapParam1;
+ u32 heapParam2;
+};
+
+void NNS_FndInitAllocatorForExpHeap(NNSFndAllocator * pAllocator, NNSFndHeapHandle heap, int alignment);
+
+#endif //GUARD_NNS_FND_ALLOCATOR_H
diff --git a/arm9/lib/include/NNS_FND_expheap.h b/arm9/lib/include/NNS_FND_expheap.h
new file mode 100644
index 00000000..c0008f28
--- /dev/null
+++ b/arm9/lib/include/NNS_FND_expheap.h
@@ -0,0 +1,55 @@
+#ifndef GUARD_NNS_FND_EXPHEAP_H
+#define GUARD_NNS_FND_EXPHEAP_H
+
+#include "NNS_FND_heapcommon.h"
+
+typedef struct NNSiFndExpHeapMBlockHead NNSiFndExpHeapMBlockHead;
+
+struct NNSiFndExpHeapMBlockHead
+{
+ u16 signature; // Signature
+ u16 attribute; // Attribute
+ // [8:groupID]
+ // [7:alignment]
+ // [1:temporary flag]
+
+ u32 blockSize; // Block size (data area only)
+
+ NNSiFndExpHeapMBlockHead* pMBHeadPrev; // Previous block
+ NNSiFndExpHeapMBlockHead* pMBHeadNext; // Next block
+};
+
+typedef struct NNSiFndExpMBlockList NNSiFndExpMBlockList;
+
+struct NNSiFndExpMBlockList
+{
+ NNSiFndExpHeapMBlockHead* head; // Pointer for memory block linked to header
+ NNSiFndExpHeapMBlockHead* tail; // Pointer to the memory block linked to the tail of the expanded heap
+};
+
+typedef struct NNSiFndExpHeapHead NNSiFndExpHeapHead;
+
+struct NNSiFndExpHeapHead
+{
+ NNSiFndExpMBlockList mbFreeList; // Free list
+ NNSiFndExpMBlockList mbUsedList; // Used list
+
+ u16 groupID; // Current group ID (lower 8 bits only)
+ u16 feature; // Attribute
+};
+
+NNSFndHeapHandle NNS_FndCreateExpHeapEx(void *startAddress, u32 size, u32 optFlag);
+void *NNS_FndAllocFromExpHeapEx(NNSFndHeapHandle heap, u32 size, int alignment);
+void NNS_FndDestroyExpHeap(NNSFndHeapHandle heap);
+void NNS_FndFreeToExpHeap(NNSFndHeapHandle heap, void *memBlock);
+u32 NNS_FndGetTotalFreeSizeForExpHeap(NNSFndHeapHandle heap);
+u32 NNS_FndGetSizeForMBlockExpHeap(const void *memBlock);
+void NNS_FndResizeForMBlockExpHeap(NNSFndHeapHandle heap, void *memBlock, u32 size);
+
+#define NNS_FndCreateExpHeap(startAddress, size) \
+ NNS_FndCreateExpHeapEx(startAddress, size, 0)
+#define NNS_FndAllocFromExpHeap(heap, size) \
+ NNS_FndAllocFromExpHeapEx(heap, size, NNS_FND_HEAP_DEFAULT_ALIGNMENT)
+
+
+#endif //GUARD_NNS_FND_EXPHEAP_H
diff --git a/arm9/lib/include/NNS_FND_heapcommon.h b/arm9/lib/include/NNS_FND_heapcommon.h
new file mode 100644
index 00000000..eb6f1bdb
--- /dev/null
+++ b/arm9/lib/include/NNS_FND_heapcommon.h
@@ -0,0 +1,26 @@
+#ifndef GUARD_NNS_FND_HEAPCOMMON_H
+#define GUARD_NNS_FND_HEAPCOMMON_H
+
+#include "NNS_FND_list.h"
+
+#define NNS_FND_HEAP_DEFAULT_ALIGNMENT 4
+
+typedef struct NNSiFndHeapHead NNSiFndHeapHead;
+
+struct NNSiFndHeapHead
+{
+ u32 signature;
+
+ NNSFndLink link;
+ NNSFndList childList;
+
+ void* heapStart; // Heap start address
+ void* heapEnd; // Heap end (+1) address
+
+ u32 attribute; // Attribute
+ // [8:Option flag]
+};
+
+typedef NNSiFndHeapHead* NNSFndHeapHandle; // Type to represent heap handle
+
+#endif //GUARD_NNS_FND_HEAPCOMMON_H
diff --git a/arm9/lib/include/NNS_FND_list.h b/arm9/lib/include/NNS_FND_list.h
new file mode 100644
index 00000000..5df01e5f
--- /dev/null
+++ b/arm9/lib/include/NNS_FND_list.h
@@ -0,0 +1,20 @@
+#ifndef GUARD_NNS_FND_LIST_H
+#define GUARD_NNS_FND_LIST_H
+
+typedef struct
+{
+ void* prevObject; // Pointer to the previous linked object.
+ void* nextObject; // Pointer to the next linked object.
+
+} NNSFndLink;
+
+typedef struct
+{
+ void* headObject; // Pointer for the object linked to the top of the list.
+ void* tailObject; // Pointer for the object linked to the end of the list.
+ u16 numObjects; // Number of objects linked in the list.
+ u16 offset; // Offset for NNSFndLink type structure member.
+
+} NNSFndList;
+
+#endif //GUARD_NNS_FND_LIST_H
diff --git a/arm9/lib/include/consts.h b/arm9/lib/include/consts.h
index a41f22ae..1ad79b93 100644
--- a/arm9/lib/include/consts.h
+++ b/arm9/lib/include/consts.h
@@ -52,6 +52,7 @@
#define OSi_TCM_REGION_BASE_MASK 0xfffff000
#define OS_IE_V_BLANK (1UL << 0)
+#define OS_IE_H_BLANK (1UL << 1)
#define HW_CPU_CLOCK_ARM9 67027964
diff --git a/arm9/lib/include/tp.h b/arm9/lib/include/tp.h
index d2687545..dc762f10 100644
--- a/arm9/lib/include/tp.h
+++ b/arm9/lib/include/tp.h
@@ -1,6 +1,14 @@
#ifndef NITRO_TP_H_
#define NITRO_TP_H_
+#define TP_TOUCH_OFF 0 // Not being touched
+#define TP_TOUCH_ON 1 // Being touched
+
+#define TP_VALIDITY_VALID 0 // Valid
+#define TP_VALIDITY_INVALID_X 1 // Data with invalid X coordinate
+#define TP_VALIDITY_INVALID_Y 2 // Data with invalid Y coordinate
+#define TP_VALIDITY_INVALID_XY (TP_VALIDITY_INVALID_X | TP_VALIDITY_INVALID_Y) // Data with invalid X and Y coordinates
+
// Touch panel input structure
typedef struct
{