sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
atad.h
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
16
17#ifndef __ATAD_H__
18#define __ATAD_H__
19
20#include <types.h>
21#include <irx.h>
22
23/* These are used with the dir parameter of ata_device_sector_io(). */
24#define ATA_DIR_READ 0
25#define ATA_DIR_WRITE 1
26
27typedef struct _ata_devinfo
28{
30 s32 exists;
38 u32 lba48;
41} ata_devinfo_t;
42
43/* Error definitions. */
44#define ATA_RES_ERR_NOTREADY -501
45#define ATA_RES_ERR_TIMEOUT -502
46#define ATA_RES_ERR_IO -503
47#define ATA_RES_ERR_NODATA -504
48#define ATA_RES_ERR_NODEV -505
49#define ATA_RES_ERR_CMD -506
50#define ATA_RES_ERR_LOCKED -509
51#define ATA_RES_ERR_ICRC -510
52
53extern ata_devinfo_t *sceAtaInit(int device);
54
55extern int sceAtaSoftReset(void);
56
57extern int sceAtaExecCmd(void *buf, u32 blkcount, u16 feature, u16 nsector, u16 sector, u16 lcyl, u16 hcyl, u16 select, u16 command);
58extern int sceAtaWaitResult(void);
59
60extern int sceAtaGetError(void);
61
62extern int sceAtaDmaTransfer(int device, void *buf, u32 lba, u32 nsectors, int dir);
63
64// DRM functions that were meant to keep users from sharing disks (and hence the contained content). Supported by only Sony-modified HDDs (e.g. the SCPH-20400).
65extern int sceAtaSecuritySetPassword(int device, void *password);
66extern int sceAtaSecurityUnLock(int device, void *password);
67extern int sceAtaSecurityEraseUnit(int device);
68
69extern int sceAtaIdle(int device, int period);
70extern int sceAtaGetSceId(int device, void *data);
71extern int sceAtaSmartReturnStatus(int device);
72extern int sceAtaSmartSaveAttr(int device);
73extern int sceAtaFlushCache(int device);
74extern int sceAtaIdleImmediate(int device);
75
76extern int ata_device_sector_io64(int device, void *buf, u64 lba, u32 nsectors, int dir);
77
78#define atad_IMPORTS_start DECLARE_IMPORT_TABLE(atad, 1, 3)
79#define atad_IMPORTS_end END_IMPORT_TABLE
80
81#define I_sceAtaInit DECLARE_IMPORT(4, sceAtaInit)
82#define I_sceAtaSoftReset DECLARE_IMPORT(5, sceAtaSoftReset)
83#define I_sceAtaExecCmd DECLARE_IMPORT(6, sceAtaExecCmd)
84#define I_sceAtaWaitResult DECLARE_IMPORT(7, sceAtaWaitResult)
85#define I_sceAtaGetError DECLARE_IMPORT(8, sceAtaGetError)
86#define I_sceAtaDmaTransfer DECLARE_IMPORT(9, sceAtaDmaTransfer)
87#define I_sceAtaSecuritySetPassword DECLARE_IMPORT(10, sceAtaSecuritySetPassword)
88#define I_sceAtaSecurityUnLock DECLARE_IMPORT(11, sceAtaSecurityUnLock)
89#define I_sceAtaSecurityEraseUnit DECLARE_IMPORT(12, sceAtaSecurityEraseUnit)
90#define I_sceAtaIdle DECLARE_IMPORT(13, sceAtaIdle)
91#define I_sceAtaGetSceId DECLARE_IMPORT(14, sceAtaGetSceId)
92#define I_sceAtaSmartReturnStatus DECLARE_IMPORT(15, sceAtaSmartReturnStatus)
93#define I_sceAtaSmartSaveAttr DECLARE_IMPORT(16, sceAtaSmartSaveAttr)
94#define I_sceAtaFlushCache DECLARE_IMPORT(17, sceAtaFlushCache)
95#define I_sceAtaIdleImmediate DECLARE_IMPORT(18, sceAtaIdleImmediate)
96#define I_ata_device_sector_io64 DECLARE_IMPORT(19, ata_device_sector_io64)
97
98// Backward-compatibility definitions
99#define ata_get_devinfo sceAtaInit
100#define ata_reset_devices sceAtaSoftReset
101#define ata_io_start sceAtaExecCmd
102#define ata_io_finish sceAtaWaitResult
103#define ata_get_error sceAtaGetError
104#define ata_device_sector_io sceAtaDmaTransfer
105#define ata_device_sce_sec_set_password sceAtaSecuritySetPassword
106#define ata_device_sce_sec_unlock sceAtaSecurityUnLock
107#define ata_device_sce_sec_erase sceAtaSecurityEraseUnit
108#define ata_device_idle sceAtaIdle
109#define ata_device_sce_identify_drive sceAtaGetSceId
110#define ata_device_smart_get_status sceAtaSmartReturnStatus
111#define ata_device_smart_save_attr sceAtaSmartSaveAttr
112#define ata_device_flush_cache sceAtaFlushCache
113#define ata_device_idle_immediate sceAtaIdleImmediate
114#define ata_device_dma_transfer sceAtaDmaTransfer
115
116#define I_ata_get_devinfo I_sceAtaInit
117#define I_ata_reset_devices I_sceAtaSoftReset
118#define I_ata_io_start I_sceAtaExecCmd
119#define I_ata_io_finish I_sceAtaWaitResult
120#define I_ata_get_error I_sceAtaGetError
121#define I_ata_device_sector_io I_sceAtaDmaTransfer
122#define I_ata_device_sce_sec_set_password I_sceAtaSecuritySetPassword
123#define I_ata_device_sce_sec_unlock I_sceAtaSecurityUnLock
124#define I_ata_device_sce_sec_erase I_sceAtaSecurityEraseUnit
125#define I_ata_device_idle I_sceAtaIdle
126#define I_ata_device_sce_identify_drive I_sceAtaGetSceId
127#define I_ata_device_smart_get_status I_sceAtaSmartReturnStatus
128#define I_ata_device_smart_save_attr I_sceAtaSmartSaveAttr
129#define I_ata_device_flush_cache I_sceAtaFlushCache
130#define I_ata_device_idle_immediate I_sceAtaIdleImmediate
131#define I_ata_device_dma_transfer I_sceAtaDmaTransfer
132
133#endif /* __ATAD_H__ */
u32 security_status
Definition atad.h:36
u32 lba48
Definition atad.h:38
s32 exists
Definition atad.h:30
u32 total_sectors
Definition atad.h:34
s32 has_packet
Definition atad.h:32
u32 total_sectors_lba48
Definition atad.h:40