libnile
Loading...
Searching...
No Matches
ipc.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023, 2024 Adrian "asie" Siekierka
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 *
8 * Permission is granted to anyone to use this software for any purpose,
9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 *
12 * 1. The origin of this software must not be misrepresented; you must not
13 * claim that you wrote the original software. If you use this software
14 * in a product, an acknowledgment in the product documentation would be
15 * appreciated but is not required.
16 *
17 * 2. Altered source versions must be plainly marked as such, and must not be
18 * misrepresented as being the original software.
19 *
20 * 3. This notice may not be removed or altered from any source distribution.
21 */
22
23#ifndef NILE_IPC_H_
24#define NILE_IPC_H_
25
26#include <wonderful.h>
27
28#define NILE_IPC_MAGIC 0xAA55
29
30#ifndef __ASSEMBLER__
31
32#include <stdbool.h>
33#include <stdint.h>
34
35#define NILE_IPC_TF_BLOCK 0x80
36#define NILE_IPC_TF_TYPE(v) ((v) & 0x7F)
37#define NILE_IPC_TF_TYPE_MMC_OLD 0x01
38#define NILE_IPC_TF_TYPE_MMC_NEW 0x02
39#define NILE_IPC_TF_TYPE_TF_OLD 0x04
40#define NILE_IPC_TF_TYPE_TF_NEW 0x08
41#define NILE_IPC_TF_TYPE_MMC 0x03
42#define NILE_IPC_TF_TYPE_TF 0x0C
43
47#define NILE_IPC_BOOT_FFFF_0000 0
51#define NILE_IPC_BOOT_4000_0000 1
56#define NILE_IPC_BOOT_4000_0010 2
57
58typedef struct __attribute__((packed)) {
63 uint16_t magic;
77 uint8_t reserved_1[4];
81 union {
82 struct {
83 uint16_t ax, bx, cx, dx;
84 uint16_t sp, bp, si, di;
85 uint16_t ds, es, ss, flags;
86 };
87 uint16_t data[12];
88 } boot_regs;
92 uint8_t boot_io[0xB8];
93 uint8_t reserved_2[8];
94
95 uint8_t user_area[288];
97
98#if __STDC_VERSION__ >= 201112L
99_Static_assert(sizeof(nile_ipc_t) == 512, "nile_ipc_t size not equal to 512");
100#endif
101
102#define MEM_NILE_IPC ((nile_ipc_t __far*) MK_FP(0x1000, 0x0000))
103
104#endif /* __ASSEMBLER__ */
105
106#endif /* NILE_IPC_H_ */
uint16_t ss
Definition ipc.h:85
uint16_t ds
Definition ipc.h:85
uint16_t flags
Definition ipc.h:85
uint16_t dx
Definition ipc.h:83
uint16_t bx
Definition ipc.h:83
uint8_t boot_io[0xB8]
The I/O port state at cartridge boot.
Definition ipc.h:92
uint16_t sp
Definition ipc.h:84
uint8_t user_area[288]
Definition ipc.h:95
uint16_t magic
Magic value. If set to NILE_IPC_MAGIC, the IPC area has been initialized by IPL1.
Definition ipc.h:63
uint16_t ax
Definition ipc.h:83
uint8_t boot_entrypoint
The entrypoint the cartridge was booted from.
Definition ipc.h:76
uint16_t data[12]
Definition ipc.h:87
uint16_t bp
Definition ipc.h:84
uint16_t di
Definition ipc.h:84
uint16_t cx
Definition ipc.h:83
uint8_t tf_card_status
TF card status.
Definition ipc.h:69
uint8_t reserved_1[4]
Definition ipc.h:77
uint8_t reserved_2[8]
Definition ipc.h:93
uint16_t si
Definition ipc.h:84
uint16_t es
Definition ipc.h:85