di.h

Go to the documentation of this file.
00001 /*
00002         libbroadway - A general purpose library to control the Wii.
00003         DI support
00004 
00005 Copyright (C) 2010-2011         Alex Marshall <trap15@raidenii.net>
00006 
00007 # This code is licensed to you under the terms of the GNU GPL, version 2;
00008 # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
00009 */
00010 
00016 #ifndef __DI_H__
00017 #define __DI_H__
00018 
00019 #include <types.h>
00020 #include <broadway.h>
00021 
00024 typedef enum {
00025         DI_CMD_INQUIRY          = 0x12, 
00026         DI_CMD_DMAREAD          = 0xA8, 
00027         DI_CMD_SEEK             = 0xAB, 
00028         DI_CMD_GETERROR         = 0xE0, 
00029         DI_CMD_PLAYAUDIO        = 0xE1, 
00030         DI_CMD_AUDIOSTATUS      = 0xE2, 
00031         DI_CMD_STOPMOTOR        = 0xE3, 
00032         DI_CMD_DVDAUDIO         = 0xE4, 
00033         DI_CMD_DEBUG            = 0xFE, 
00034         DI_CMD_UNLOCK           = 0xFF, 
00035 } di_cmd_t;
00036 
00039 typedef enum {
00040         DI_DMAREAD_SECTOR       = 0x00, 
00041         DI_DMAREAD_DISCID       = 0x40, 
00042 } di_dmaread_cmd_t;
00043 
00046 typedef enum {
00047         DI_DEBUG_MEMORY         = 0x01, 
00048         DI_DEBUG_DRVCONTROL     = 0x11, 
00049         DI_DEBUG_JUMP           = 0x12, 
00050 } di_debug_cmd_t;
00051 
00054 typedef enum {
00055         DI_MOTOR_DOWN           = 0x0000, 
00056         DI_MOTOR_UP             = 0x0100, 
00057         DI_DRIVE_ACCEPT         = 0x0400, 
00058         DI_DRIVE_CHECKDISK      = 0x0800, 
00059 } di_drvctrl_cmd2_t;
00060 
00063 typedef enum {
00064         DI_ERROR1_OK            = 0x00, 
00065         DI_ERROR1_LIDOPEN       = 0x01, 
00066         DI_ERROR1_DISKCHANGED   = 0x02, 
00067         DI_ERROR1_NODISC        = 0x03, 
00068         DI_ERROR1_MOTOROFF      = 0x04, 
00069         DI_ERROR1_BADDISC       = 0x05, 
00070 } di_error1_t;
00071 
00074 typedef enum {
00075         DI_ERROR2_OK            = 0x000000,     
00076         DI_ERROR2_MOTORSTOP     = 0x020400,     
00077         DI_ERROR2_DISCID        = 0x020401,     
00078         DI_ERROR2_COVEROPEN     = 0x023A00,     
00079         DI_ERROR2_NOSEEK        = 0x030200,     
00080         DI_ERROR2_READERROR     = 0x031100,     
00081         DI_ERROR2_TRANSFER      = 0x040800,     
00082         DI_ERROR2_COMMAND       = 0x052000,     
00083         DI_ERROR2_AUDIOBUF      = 0x052001,     
00084         DI_ERROR2_LBARANGE      = 0x052100,     
00085         DI_ERROR2_INVALIDFIELD  = 0x052400,     
00086         DI_ERROR2_AUDIOCMD      = 0x052401,     
00087         DI_ERROR2_CONFIG        = 0x052402,     
00088         DI_ERROR2_ENDOFUSER     = 0x056300,     
00089         DI_ERROR2_MEDIUMCHANGE  = 0x062800,     
00090         DI_ERROR2_OPREMOVAL     = 0x0B5A01,     
00091 } di_error2_t;
00092 
00100 int di_initialize(void);
00108 int di_shutdown(void);
00109 
00114 void di_reset(BOOL hard);
00115 
00120 BOOL di_cover_open(void);
00121 
00130 void di_set_command(di_cmd_t cmd, u8 subcmd1, u16 subcmd2, u32 off, u32 len);
00131 
00137 void di_set_dma(u32 addr, u32 len);
00138 
00143 u32 di_immediate_recv(void);
00148 void di_immediate_send(u32 data);
00149 
00156 void di_transfer(BOOL write, BOOL dma);
00157 
00163 BOOL di_transfer_ended(void);
00164 
00170 void irq_di_enable(u32 irq);
00176 void irq_di_disable(u32 irq);
00177 
00187 int irq_di_register_handler(u32 irqn, int (*exec)(u32 irq, void* data), void* data);
00196 irq_handler_t irq_di_get_handler(u32 irqn);
00197 
00198 #endif
00199 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated by  doxygen 1.6.3