sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
ps2atad.c File Reference
#include <types.h>
#include <defs.h>
#include <irx.h>
#include <loadcore.h>
#include <thbase.h>
#include <thevent.h>
#include <stdio.h>
#include <sysclib.h>
#include <atad.h>
#include <atahw.h>

Go to the source code of this file.

Classes

struct  _ata_cmd_info
struct  _ata_cmd_state

Macros

#define MODNAME   "atad"
#define M_PRINTF(format, args...)
#define BANNER   "ATA device driver %s - Copyright (c) 2003 Marcus R. Brown\n"
#define VERSION   "v1.2"
#define ATA_XFER_MODE_PIO   0x08
#define ATA_XFER_MODE_UDMA   0x40
#define ATA_EV_TIMEOUT   1
#define ATA_EV_COMPLETE   2
#define ATA_CMD_TABLE_SIZE   (sizeof ata_cmd_table / sizeof(ata_cmd_info_t))
#define SEC_CTRL_CMD_TABLE_SIZE   (sizeof sec_ctrl_cmd_table / sizeof(ata_cmd_info_t))
#define SMART_CMD_TABLE_SIZE   (sizeof smart_cmd_table / sizeof(ata_cmd_info_t))
#define ATA_WAIT_BUSY   0x80
#define ATA_WAIT_BUSBUSY   0x88
#define ata_wait_busy()
#define ata_wait_bus_busy()

Typedefs

typedef struct _ata_cmd_info ata_cmd_info_t
typedef struct _ata_cmd_state ata_cmd_state_t

Functions

 IRX_ID (MODNAME, 2, 7)
int ata_device_sector_io64 (int device, void *buf, u64 lba, u32 nsectors, int dir)
int _start (int argc, char *argv[])
int _exit (void)
int sceAtaGetError (void)
int sceAtaExecCmd (void *buf, u32 blkcount, u16 feature, u16 nsector, u16 sector, u16 lcyl, u16 hcyl, u16 select, u16 command)
int sceAtaWaitResult (void)
int sceAtaSoftReset (void)
int sceAtaFlushCache (int device)
int sceAtaIdle (int device, int period)
int sceAtaGetSceId (int device, void *data)
int sceAtaSmartSaveAttr (int device)
int sceAtaSmartReturnStatus (int device)
int sceAtaDmaTransfer (int device, void *buf, u32 lba, u32 nsectors, int dir)
int sceAtaSecuritySetPassword (int device, void *password)
int sceAtaSecurityUnLock (int device, void *password)
int sceAtaSecurityEraseUnit (int device)
ata_devinfo_t * sceAtaInit (int device)
int sceAtaIdleImmediate (int device)

Variables

struct irx_export_table _exp_atad

Detailed Description

ATA device driver. This module provides the low-level ATA support for hard disk drives, based on ATAD v2.7. It is 100% compatible with its proprietary counterpart called atad.irx.

This module also include support for 48-bit feature set (done by Clement). To avoid causing an "emergency park" for some HDDs, shutdown callback 15 of dev9 is used for issuing the STANDBY IMMEDIATE command prior to DEV9 getting shut down.

Definition in file ps2atad.c.

Macro Definition Documentation

◆ ATA_CMD_TABLE_SIZE

#define ATA_CMD_TABLE_SIZE   (sizeof ata_cmd_table / sizeof(ata_cmd_info_t))

Definition at line 150 of file ps2atad.c.

◆ ATA_EV_COMPLETE

#define ATA_EV_COMPLETE   2

Definition at line 66 of file ps2atad.c.

◆ ATA_EV_TIMEOUT

#define ATA_EV_TIMEOUT   1

Definition at line 65 of file ps2atad.c.

◆ ata_wait_bus_busy

#define ata_wait_bus_busy ( )
Value:
gen_ata_wait_busy(ATA_WAIT_BUSBUSY)

Definition at line 439 of file ps2atad.c.

◆ ATA_WAIT_BUSBUSY

#define ATA_WAIT_BUSBUSY   0x88

Definition at line 436 of file ps2atad.c.

◆ ATA_WAIT_BUSY

#define ATA_WAIT_BUSY   0x80

Definition at line 435 of file ps2atad.c.

◆ ata_wait_busy

#define ata_wait_busy ( )
Value:
gen_ata_wait_busy(ATA_WAIT_BUSY)

Definition at line 438 of file ps2atad.c.

◆ ATA_XFER_MODE_PIO

#define ATA_XFER_MODE_PIO   0x08

Definition at line 59 of file ps2atad.c.

◆ ATA_XFER_MODE_UDMA

#define ATA_XFER_MODE_UDMA   0x40

Definition at line 63 of file ps2atad.c.

◆ BANNER

#define BANNER   "ATA device driver %s - Copyright (c) 2003 Marcus R. Brown\n"

Definition at line 56 of file ps2atad.c.

◆ M_PRINTF

#define M_PRINTF ( format,
args... )
Value:
printf(MODNAME ": " format, ##args)

Definition at line 53 of file ps2atad.c.

◆ MODNAME

#define MODNAME   "atad"

Definition at line 47 of file ps2atad.c.

◆ SEC_CTRL_CMD_TABLE_SIZE

#define SEC_CTRL_CMD_TABLE_SIZE   (sizeof sec_ctrl_cmd_table / sizeof(ata_cmd_info_t))

Definition at line 161 of file ps2atad.c.

◆ SMART_CMD_TABLE_SIZE

#define SMART_CMD_TABLE_SIZE   (sizeof smart_cmd_table / sizeof(ata_cmd_info_t))

Definition at line 173 of file ps2atad.c.

◆ VERSION

#define VERSION   "v1.2"

Definition at line 57 of file ps2atad.c.

Function Documentation

◆ _exit()

int _exit ( void )

Definition at line 389 of file ps2atad.c.

◆ _start()

int _start ( int argc,
char * argv[] )

Definition at line 263 of file ps2atad.c.

◆ ata_device_sector_io64()

int ata_device_sector_io64 ( int device,
void * buf,
u64 lba,
u32 nsectors,
int dir )

Definition at line 1025 of file ps2atad.c.

◆ sceAtaDmaTransfer()

int sceAtaDmaTransfer ( int device,
void * buf,
u32 lba,
u32 nsectors,
int dir )

Definition at line 1020 of file ps2atad.c.

◆ sceAtaExecCmd()

int sceAtaExecCmd ( void * buf,
u32 blkcount,
u16 feature,
u16 nsector,
u16 sector,
u16 lcyl,
u16 hcyl,
u16 select,
u16 command )

Definition at line 521 of file ps2atad.c.

◆ sceAtaFlushCache()

int sceAtaFlushCache ( int device)

Definition at line 885 of file ps2atad.c.

◆ sceAtaGetError()

int sceAtaGetError ( void )

Definition at line 424 of file ps2atad.c.

◆ sceAtaGetSceId()

int sceAtaGetSceId ( int device,
void * data )

Definition at line 927 of file ps2atad.c.

◆ sceAtaIdle()

int sceAtaIdle ( int device,
int period )

Definition at line 896 of file ps2atad.c.

◆ sceAtaIdleImmediate()

int sceAtaIdleImmediate ( int device)

Definition at line 1502 of file ps2atad.c.

◆ sceAtaInit()

ata_devinfo_t * sceAtaInit ( int device)

Definition at line 1372 of file ps2atad.c.

◆ sceAtaSecurityEraseUnit()

int sceAtaSecurityEraseUnit ( int device)

Definition at line 1153 of file ps2atad.c.

◆ sceAtaSecuritySetPassword()

int sceAtaSecuritySetPassword ( int device,
void * password )

Definition at line 1106 of file ps2atad.c.

◆ sceAtaSecurityUnLock()

int sceAtaSecurityUnLock ( int device,
void * password )

Definition at line 1127 of file ps2atad.c.

◆ sceAtaSmartReturnStatus()

int sceAtaSmartReturnStatus ( int device)

Definition at line 959 of file ps2atad.c.

◆ sceAtaSmartSaveAttr()

int sceAtaSmartSaveAttr ( int device)

Definition at line 948 of file ps2atad.c.

◆ sceAtaSoftReset()

int sceAtaSoftReset ( void )

Definition at line 861 of file ps2atad.c.

◆ sceAtaWaitResult()

int sceAtaWaitResult ( void )

Definition at line 762 of file ps2atad.c.