2009-04-10 18:15:10 +02:00
|
|
|
/*
|
|
|
|
mini - a Free Software replacement for the Nintendo/BroadOn IOS.
|
|
|
|
inter-processor communications
|
|
|
|
|
|
|
|
Copyright (C) 2008, 2009 Hector Martin "marcan" <marcan@marcansoft.com>
|
2009-04-13 22:13:45 +02:00
|
|
|
Copyright (C) 2008, 2009 Haxx Enterprises <bushing@gmail.com>
|
|
|
|
Copyright (C) 2008, 2009 Sven Peter <svenpeter@gmail.com>
|
|
|
|
Copyright (C) 2009 Andre Heider "dhewg" <dhewg@wiibrew.org>
|
2009-04-14 01:32:37 +02:00
|
|
|
Copyright (C) 2009 John Kelley <wiidev@kelley.ca>
|
2009-04-10 18:15:10 +02:00
|
|
|
|
2009-05-11 07:53:16 +02:00
|
|
|
# This code is licensed to you under the terms of the GNU GPL, version 2;
|
|
|
|
# see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
2009-04-10 18:15:10 +02:00
|
|
|
*/
|
2009-05-11 07:53:16 +02:00
|
|
|
|
2009-01-16 08:51:51 +01:00
|
|
|
#ifndef __IPC_H__
|
|
|
|
#define __IPC_H__
|
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
2009-04-13 05:27:10 +02:00
|
|
|
/* For the sake of interface compatibility between mini and powerpc code,
|
|
|
|
you should try to commit any enhancements you make back upstream so
|
|
|
|
that they can be assigned a standard request number. Otherwise, if
|
|
|
|
you are creating a new device, you MUST assign it a device ID >= 0x80.
|
|
|
|
|
|
|
|
Likewise, if you add functionality to any of the existing drivers,
|
|
|
|
your must assign it to a request ID >= 0x8000. This will prevent
|
|
|
|
problems if a mismatch between ARM and PPC code occurs. Similarly,
|
|
|
|
if you add functions, you should always add them to the end, to
|
|
|
|
prevent someone from calling the wrong function.
|
|
|
|
|
|
|
|
Even still, you are encouraged to add in sanity checks and version
|
|
|
|
checking to prevent strange bugs or even data loss. --bushing */
|
|
|
|
|
2009-02-26 09:54:15 +01:00
|
|
|
#define IPC_FAST 0x01
|
|
|
|
#define IPC_SLOW 0x00
|
2009-01-16 08:51:51 +01:00
|
|
|
|
2009-01-30 13:43:35 +01:00
|
|
|
#define IPC_DEV_SYS 0x00
|
2009-01-27 13:32:39 +01:00
|
|
|
#define IPC_DEV_NAND 0x01
|
2009-04-12 14:40:35 +02:00
|
|
|
#define IPC_DEV_SDHC 0x02
|
2009-01-27 13:32:39 +01:00
|
|
|
#define IPC_DEV_KEYS 0x03
|
2009-01-30 13:43:35 +01:00
|
|
|
#define IPC_DEV_AES 0x04
|
2009-02-26 09:54:15 +01:00
|
|
|
#define IPC_DEV_BOOT2 0x05
|
2009-04-08 16:30:32 +02:00
|
|
|
#define IPC_DEV_PPC 0x06
|
2009-04-12 14:40:35 +02:00
|
|
|
#define IPC_DEV_SDMMC 0x07
|
2009-01-16 08:51:51 +01:00
|
|
|
|
2009-04-13 05:27:10 +02:00
|
|
|
//#define IPC_DEV_USER0 0x80
|
|
|
|
//#define IPC_DEV_USER1 0x81
|
|
|
|
|
2009-01-25 04:04:19 +01:00
|
|
|
#define IPC_SYS_PING 0x0000
|
|
|
|
#define IPC_SYS_JUMP 0x0001
|
2009-04-13 05:27:10 +02:00
|
|
|
#define IPC_SYS_GETVERS 0x0002
|
2009-05-12 22:50:22 +02:00
|
|
|
#define IPC_SYS_GETGITS 0x0003
|
2009-01-16 08:51:51 +01:00
|
|
|
#define IPC_SYS_WRITE32 0x0100
|
|
|
|
#define IPC_SYS_WRITE16 0x0101
|
|
|
|
#define IPC_SYS_WRITE8 0x0102
|
|
|
|
#define IPC_SYS_READ32 0x0103
|
|
|
|
#define IPC_SYS_READ16 0x0104
|
|
|
|
#define IPC_SYS_READ8 0x0105
|
|
|
|
#define IPC_SYS_SET32 0x0106
|
|
|
|
#define IPC_SYS_SET16 0x0107
|
|
|
|
#define IPC_SYS_SET8 0x0108
|
|
|
|
#define IPC_SYS_CLEAR32 0x0109
|
|
|
|
#define IPC_SYS_CLEAR16 0x010a
|
|
|
|
#define IPC_SYS_CLEAR8 0x010b
|
|
|
|
#define IPC_SYS_MASK32 0x010c
|
|
|
|
#define IPC_SYS_MASK16 0x010d
|
|
|
|
#define IPC_SYS_MASK8 0x010e
|
|
|
|
|
2009-01-27 13:32:39 +01:00
|
|
|
#define IPC_NAND_RESET 0x0000
|
|
|
|
#define IPC_NAND_GETID 0x0001
|
|
|
|
#define IPC_NAND_READ 0x0002
|
|
|
|
#define IPC_NAND_WRITE 0x0003
|
|
|
|
#define IPC_NAND_ERASE 0x0004
|
2009-03-07 13:19:16 +01:00
|
|
|
#define IPC_NAND_STATUS 0x0005
|
2010-04-07 12:21:20 +02:00
|
|
|
#define IPC_NAND_SETMINPAGE 0x0006
|
|
|
|
#define IPC_NAND_GETMINPAGE 0x0007
|
2009-04-13 05:27:10 +02:00
|
|
|
//#define IPC_NAND_USER0 0x8000
|
|
|
|
//#define IPC_NAND_USER1 0x8001
|
|
|
|
// etc.
|
2009-01-27 13:32:39 +01:00
|
|
|
|
2009-04-12 14:40:35 +02:00
|
|
|
#define IPC_SDHC_DISCOVER 0x0000
|
2009-05-22 19:30:33 +02:00
|
|
|
#define IPC_SDHC_EXIT 0x0001
|
2009-04-12 14:40:35 +02:00
|
|
|
|
|
|
|
#define IPC_SDMMC_ACK 0x0000
|
|
|
|
#define IPC_SDMMC_READ 0x0001
|
|
|
|
#define IPC_SDMMC_WRITE 0x0002
|
2009-04-12 18:29:20 +02:00
|
|
|
#define IPC_SDMMC_STATE 0x0003
|
|
|
|
#define IPC_SDMMC_SIZE 0x0004
|
2009-01-27 13:32:39 +01:00
|
|
|
|
|
|
|
#define IPC_KEYS_GETOTP 0x0000
|
|
|
|
#define IPC_KEYS_GETEEP 0x0001
|
|
|
|
|
2009-01-30 13:43:35 +01:00
|
|
|
#define IPC_AES_RESET 0x0000
|
|
|
|
#define IPC_AES_SETIV 0x0001
|
|
|
|
#define IPC_AES_SETKEY 0x0002
|
|
|
|
#define IPC_AES_DECRYPT 0x0003
|
|
|
|
|
2009-02-26 09:54:15 +01:00
|
|
|
#define IPC_BOOT2_RUN 0x0000
|
2009-04-07 21:27:34 +02:00
|
|
|
#define IPC_BOOT2_TMD 0x0001
|
2009-01-27 13:32:39 +01:00
|
|
|
|
2009-04-08 16:30:32 +02:00
|
|
|
#define IPC_PPC_BOOT 0x0000
|
|
|
|
|
2009-01-16 08:51:51 +01:00
|
|
|
#define IPC_CODE (f,d,r) (((f)<<24)|((d)<<16)|(r))
|
|
|
|
|
2009-04-13 05:27:10 +02:00
|
|
|
#define IPC_IN_SIZE 32
|
2009-01-25 04:04:19 +01:00
|
|
|
#define IPC_OUT_SIZE 32
|
|
|
|
#define IPC_SLOW_SIZE 128
|
|
|
|
|
2009-01-16 08:51:51 +01:00
|
|
|
typedef struct {
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
u8 flags;
|
|
|
|
u8 device;
|
|
|
|
u16 req;
|
|
|
|
};
|
|
|
|
u32 code;
|
|
|
|
};
|
|
|
|
u32 tag;
|
|
|
|
u32 args[6];
|
|
|
|
} ipc_request;
|
|
|
|
|
2009-01-25 04:04:19 +01:00
|
|
|
typedef const struct {
|
|
|
|
char magic[3];
|
|
|
|
char version;
|
|
|
|
void *mem2_boundary;
|
|
|
|
volatile ipc_request *ipc_in;
|
|
|
|
u32 ipc_in_size;
|
|
|
|
volatile ipc_request *ipc_out;
|
|
|
|
u32 ipc_out_size;
|
|
|
|
} ipc_infohdr;
|
|
|
|
|
2009-01-16 08:51:51 +01:00
|
|
|
void ipc_irq(void);
|
|
|
|
|
|
|
|
void ipc_initialize(void);
|
|
|
|
void ipc_shutdown(void);
|
|
|
|
void ipc_post(u32 code, u32 tag, u32 num_args, ...);
|
2009-03-18 18:21:00 +01:00
|
|
|
void ipc_flush(void);
|
2009-04-13 05:27:10 +02:00
|
|
|
u32 ipc_process_slow(void);
|
2009-01-16 08:51:51 +01:00
|
|
|
|
2009-04-15 20:23:07 +02:00
|
|
|
// Enqueues a request in the slow in_queue, use this in IRQ context only.
|
|
|
|
void ipc_enqueue_slow(u8 device, u16 req, u32 num_args, ...);
|
2009-04-11 23:42:53 +02:00
|
|
|
|
2009-01-16 08:51:51 +01:00
|
|
|
#endif
|
2009-04-13 22:13:45 +02:00
|
|
|
|