wii_ipcreg.h revision 252500
11541Srgrimes/*- 21541Srgrimes * Copyright (C) 2012 Margarida Gouveia 31541Srgrimes * All rights reserved. 41541Srgrimes * 51541Srgrimes * Redistribution and use in source and binary forms, with or without 61541Srgrimes * modification, are permitted provided that the following conditions 71541Srgrimes * are met: 81541Srgrimes * 1. Redistributions of source code must retain the above copyright 91541Srgrimes * notice, this list of conditions and the following disclaimer. 101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111541Srgrimes * notice, this list of conditions and the following disclaimer in the 121541Srgrimes * documentation and/or other materials provided with the distribution. 131541Srgrimes * 141541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 151541Srgrimes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 161541Srgrimes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 171541Srgrimes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 181541Srgrimes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 191541Srgrimes * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 201541Srgrimes * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 211541Srgrimes * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 221541Srgrimes * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 231541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 241541Srgrimes * SUCH DAMAGE. 251541Srgrimes * 261541Srgrimes * $FreeBSD: head/sys/powerpc/wii/wii_ipcreg.h 252500 2013-07-02 07:17:56Z rpaulo $ 271541Srgrimes */ 281541Srgrimes 291541Srgrimes#ifndef _POWERPC_WII_WII_IPCREG_H 301541Srgrimes#define _POWERPC_WII_WII_IPCREG_H 311541Srgrimes 321541Srgrimes#define WIIIPC_REG_ADDR 0x0d000000 331541Srgrimes#define WIIIPC_REG_LEN 0x40 341541Srgrimes#define WIIIPC_IOH_ADDR 0x133e0000 351541Srgrimes#define WIIIPC_IOH_LEN 0xc20000 3636503Speter 3736979Sbde#define WIIIPC_TXBUF 0x00 381541Srgrimes#define WIIIPC_CSR 0x04 391541Srgrimes#define WIIIPC_CSR_TXSTART 0x01 401541Srgrimes#define WIIIPC_CSR_TBEI 0x02 411541Srgrimes#define WIIIPC_CSR_RBFI 0x04 421541Srgrimes#define WIIIPC_CSR_RXREADY 0x08 431541Srgrimes#define WIIIPC_CSR_RBFIMASK 0x10 441541Srgrimes#define WIIIPC_CSR_TBEIMASK 0x20 451541Srgrimes#define WIIIPC_RXBUF 0x08 4631886Sbde#define WIIIPC_ISR 0x30 471541Srgrimes#define WIIIPC_ISR_MAGIC 0x40000000 481541Srgrimes 491541Srgrimesenum wiiipc_cmd { 501541Srgrimes WIIIPC_CMD_OPEN = 1, 511541Srgrimes WIIIPC_CMD_CLOSE = 2, 521541Srgrimes WIIIPC_CMD_READ = 3, 531541Srgrimes WIIIPC_CMD_WRITE = 4, 541541Srgrimes WIIIPC_CMD_SEEK = 5, 551541Srgrimes WIIIPC_CMD_IOCTL = 6, 569336Sdfr WIIIPC_CMD_IOCTLV = 7, 572997Swollman WIIIPC_CMD_ASYNCRESP = 8 582997Swollman}; 591541Srgrimes 603305Sphkstruct wiiipc_ipc_msg { 6112662Sdg uint32_t ipc_cmd; 6212662Sdg int32_t ipc_result; 6332011Sbde int32_t ipc_fd; /* WIIIPC_CMD_ASYNCRESP - the original cmd */ 643305Sphk union { 651541Srgrimes struct { 669336Sdfr intptr_t pathname; 6730808Sbde uint32_t mode; 681541Srgrimes } _ipc_open; 691541Srgrimes struct { 701541Srgrimes intptr_t data; 711541Srgrimes uint32_t len; 721541Srgrimes } _ipc_read, _ipc_write; 731541Srgrimes struct { 741541Srgrimes int32_t offset; 751541Srgrimes int32_t whence; 761541Srgrimes } _ipc_seek; 771541Srgrimes struct { 781541Srgrimes uint32_t request; 791541Srgrimes intptr_t ibuf; 801541Srgrimes uint32_t ilen; 811541Srgrimes intptr_t obuf; 821541Srgrimes uint32_t olen; 831541Srgrimes } _ipc_ioctl; 841541Srgrimes struct { 851541Srgrimes uint32_t request; 8636541Speter uint32_t argin; 8736541Speter uint32_t argout; 889336Sdfr intptr_t iovec; 891541Srgrimes } _ipc_ioctlv; 9036541Speter uint32_t _ipc_argv[5]; 911541Srgrimes } args; 921541Srgrimes} __attribute__((packed)); 9336541Speter 9412911SphkCTASSERT(sizeof(struct wiiipc_ipc_msg) == 32); 9512911Sphk 9612911Sphk#define ipc_open args._ipc_open 9712911Sphk#define ipc_read args._ipc_read 9812911Sphk#define ipc_write args._ipc_write 9912911Sphk#define ipc_ioctl args._ipc_ioctl 10012911Sphk#define ipc_ioctlv args._ipc_ioctlv 10122521Sdyson 1029336Sdfr#endif /* _POWERPC_WII_WII_IPCREG_H */ 1039336Sdfr