#include <types.h>#include <broadway.h>Go to the source code of this file.
Enumerations | |
| enum | di_cmd_t { DI_CMD_INQUIRY = 0x12, DI_CMD_DMAREAD = 0xA8, DI_CMD_SEEK = 0xAB, DI_CMD_GETERROR = 0xE0, DI_CMD_PLAYAUDIO = 0xE1, DI_CMD_AUDIOSTATUS = 0xE2, DI_CMD_STOPMOTOR = 0xE3, DI_CMD_DVDAUDIO = 0xE4, DI_CMD_DEBUG = 0xFE, DI_CMD_UNLOCK = 0xFF } |
| enum | di_dmaread_cmd_t { DI_DMAREAD_SECTOR = 0x00, DI_DMAREAD_DISCID = 0x40 } |
| enum | di_debug_cmd_t { DI_DEBUG_MEMORY = 0x01, DI_DEBUG_DRVCONTROL = 0x11, DI_DEBUG_JUMP = 0x12 } |
| enum | di_drvctrl_cmd2_t { DI_MOTOR_DOWN = 0x0000, DI_MOTOR_UP = 0x0100, DI_DRIVE_ACCEPT = 0x0400, DI_DRIVE_CHECKDISK = 0x0800 } |
| enum | di_error1_t { DI_ERROR1_OK = 0x00, DI_ERROR1_LIDOPEN = 0x01, DI_ERROR1_DISKCHANGED = 0x02, DI_ERROR1_NODISC = 0x03, DI_ERROR1_MOTOROFF = 0x04, DI_ERROR1_BADDISC = 0x05 } |
| enum | di_error2_t { DI_ERROR2_OK = 0x000000, DI_ERROR2_MOTORSTOP = 0x020400, DI_ERROR2_DISCID = 0x020401, DI_ERROR2_COVEROPEN = 0x023A00, DI_ERROR2_NOSEEK = 0x030200, DI_ERROR2_READERROR = 0x031100, DI_ERROR2_TRANSFER = 0x040800, DI_ERROR2_COMMAND = 0x052000, DI_ERROR2_AUDIOBUF = 0x052001, DI_ERROR2_LBARANGE = 0x052100, DI_ERROR2_INVALIDFIELD = 0x052400, DI_ERROR2_AUDIOCMD = 0x052401, DI_ERROR2_CONFIG = 0x052402, DI_ERROR2_ENDOFUSER = 0x056300, DI_ERROR2_MEDIUMCHANGE = 0x062800, DI_ERROR2_OPREMOVAL = 0x0B5A01 } |
Functions | |
| int | di_initialize (void) |
| Initialize the DI subsystem. | |
| int | di_shutdown (void) |
| Shut down the DI subsystem. | |
| void | di_reset (BOOL hard) |
| Resets the drive. | |
| BOOL | di_cover_open (void) |
| Detects if the drive cover is open. | |
| void | di_set_command (di_cmd_t cmd, u8 subcmd1, u16 subcmd2, u32 off, u32 len) |
| Set the command to be sent for a transfer. | |
| void | di_set_dma (u32 addr, u32 len) |
| Set DMA address and length. | |
| u32 | di_immediate_recv (void) |
| Read the immediate data buffer. | |
| void | di_immediate_send (u32 data) |
| Write the immediate data buffer. | |
| void | di_transfer (BOOL write, BOOL dma) |
| Starts a transfer from the DI. | |
| BOOL | di_transfer_ended (void) |
| Check if the DI transfer is complete. | |
| void | irq_di_enable (u32 irq) |
| Enables a specific DI IRQ. | |
| void | irq_di_disable (u32 irq) |
| Disables a specific DI IRQ. | |
| int | irq_di_register_handler (u32 irqn, int(*exec)(u32 irq, void *data), void *data) |
| Register a DI IRQ handler. | |
| irq_handler_t | irq_di_get_handler (u32 irqn) |
| Gets a DI IRQ handler. | |
An abstraction of the Drive Interface (DI). Low level access is abstracted; a higher level abstraction should be available soon.
| enum di_cmd_t |
The known command numbers for di_send_command()
| enum di_debug_cmd_t |
| enum di_dmaread_cmd_t |
| enum di_drvctrl_cmd2_t |
| enum di_error1_t |
| enum di_error2_t |
Error codes (bottom 3 bytes)
| BOOL di_cover_open | ( | void | ) |
Detects if the drive cover is open.
| u32 di_immediate_recv | ( | void | ) |
Read the immediate data buffer.
| void di_immediate_send | ( | u32 | data | ) |
Write the immediate data buffer.
| data | data to write to immediate data buffer. |
| int di_initialize | ( | void | ) |
Initialize the DI subsystem.
Initializes the DI subsystem, registers the handler for the DI interrupt and performs all other required initialization tasks.
| void di_reset | ( | BOOL | hard | ) |
Resets the drive.
| hard | if TRUE, perform a hard drive reset. If FALSE, just soft reset. |
| void di_set_command | ( | di_cmd_t | cmd, | |
| u8 | subcmd1, | |||
| u16 | subcmd2, | |||
| u32 | off, | |||
| u32 | len | |||
| ) |
Set the command to be sent for a transfer.
| cmd | the command to use. | |
| subcmd1 | a parameter to cmd. | |
| subcmd2 | a parameter to cmd. | |
| off | offset to data to use. (in 32bit words) | |
| len | length of the data to use. |
| void di_set_dma | ( | u32 | addr, | |
| u32 | len | |||
| ) |
Set DMA address and length.
| addr | address of the buffer in main memory. (32byte aligned) | |
| len | length of the buffer. (32byte aligned) |
| int di_shutdown | ( | void | ) |
Shut down the DI subsystem.
Shuts down the DI subsystem, unregisters the handler for the DI interrupt and performs all other required shut down tasks.
| void di_transfer | ( | BOOL | write, | |
| BOOL | dma | |||
| ) |
Starts a transfer from the DI.
| write | if TRUE, this transfer is a write. If FALSE, it's a read. | |
| dma | if TRUE, this transfer is a DMA. If FALSE, it's an immediate transfer. |
| BOOL di_transfer_ended | ( | void | ) |
Check if the DI transfer is complete.
| void irq_di_disable | ( | u32 | irq | ) |
| void irq_di_enable | ( | u32 | irq | ) |
| irq_handler_t irq_di_get_handler | ( | u32 | irqn | ) |
Gets a DI IRQ handler.
Gets the IRQ handler information for a DI IRQ.
| irqn | the IRQ whose handler is to be returned. |
| int irq_di_register_handler | ( | u32 | irqn, | |
| int(*)(u32 irq, void *data) | exec, | |||
| void * | data | |||
| ) |
Register a DI IRQ handler.
| irqn | the IRQ whose handle is to be registered. | |
| exec | the callback to be called when the IRQ fires. Pass NULL to unregister the IRQ. | |
| data | the data to be passed to the IRQ when it fires. |
1.6.3