Sony PlayStation2 Study
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.8 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. /**
  11. * @file
  12. * ATA Device Driver definitions and imports.
  13. */
  14. #ifndef __ATAD_H__
  15. #define __ATAD_H__
  16. #include <types.h>
  17. #include <irx.h>
  18. /* These are used with the dir parameter of ata_device_sector_io(). */
  19. #define ATA_DIR_READ 0
  20. #define ATA_DIR_WRITE 1
  21. typedef struct _ata_devinfo
  22. {
  23. /** Was successfully probed. */
  24. s32 exists;
  25. /** Supports the PACKET command set. */
  26. s32 has_packet;
  27. /** Total number of user sectors. */
  28. u32 total_sectors;
  29. /** Word 0x100 of the identify info. */
  30. u32 security_status;
  31. /** Supports the 48-bit LBA command set (unofficial). */
  32. u32 lba48;
  33. /** Total number of 48-bit LBA user sectors (unofficial). */
  34. u32 total_sectors_lba48;
  35. } ata_devinfo_t;
  36. /* Error definitions. */
  37. #define ATA_RES_ERR_NOTREADY -501
  38. #define ATA_RES_ERR_TIMEOUT -502
  39. #define ATA_RES_ERR_IO -503
  40. #define ATA_RES_ERR_NODATA -504
  41. #define ATA_RES_ERR_NODEV -505
  42. #define ATA_RES_ERR_CMD -506
  43. #define ATA_RES_ERR_LOCKED -509
  44. #define ATA_RES_ERR_ICRC -510
  45. ata_devinfo_t *ata_get_devinfo(int device);
  46. int ata_reset_devices(void);
  47. int ata_io_start(void *buf, u32 blkcount, u16 feature, u16 nsector, u16 sector, u16 lcyl, u16 hcyl, u16 select, u16 command);
  48. int ata_io_finish(void);
  49. int ata_get_error(void);
  50. #define ata_device_dma_transfer ata_device_sector_io // Backward-compatibility
  51. int ata_device_sector_io(int device, void *buf, u32 lba, u32 nsectors, int dir);
  52. // 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).
  53. int ata_device_sce_sec_set_password(int device, void *password);
  54. int ata_device_sce_sec_unlock(int device, void *password);
  55. int ata_device_sce_sec_erase(int device);
  56. int ata_device_idle(int device, int period);
  57. int ata_device_sce_identify_drive(int device, void *data);
  58. int ata_device_smart_get_status(int device);
  59. int ata_device_smart_save_attr(int device);
  60. int ata_device_flush_cache(int device);
  61. int ata_device_idle_immediate(int device);
  62. #define atad_IMPORTS_start DECLARE_IMPORT_TABLE(atad, 1, 3)
  63. #define atad_IMPORTS_end END_IMPORT_TABLE
  64. #define I_ata_get_devinfo DECLARE_IMPORT(4, ata_get_devinfo)
  65. #define I_ata_reset_devices DECLARE_IMPORT(5, ata_reset_devices)
  66. #define I_ata_io_start DECLARE_IMPORT(6, ata_io_start)
  67. #define I_ata_io_finish DECLARE_IMPORT(7, ata_io_finish)
  68. #define I_ata_get_error DECLARE_IMPORT(8, ata_get_error)
  69. #define I_ata_device_dma_transfer I_ata_device_sector_io // Backward-compatibility
  70. #define I_ata_device_sector_io DECLARE_IMPORT(9, ata_device_sector_io)
  71. #define I_ata_device_sce_sec_set_password DECLARE_IMPORT(10, ata_device_sce_sec_set_password)
  72. #define I_ata_device_sce_sec_unlock DECLARE_IMPORT(11, ata_device_sce_sec_unlock)
  73. #define I_ata_device_sce_sec_erase DECLARE_IMPORT(12, ata_device_sce_sec_erase)
  74. #define I_ata_device_idle DECLARE_IMPORT(13, ata_device_idle)
  75. #define I_ata_device_sce_identify_drive DECLARE_IMPORT(14, ata_device_sce_identify_drive)
  76. #define I_ata_device_smart_get_status DECLARE_IMPORT(15, ata_device_smart_get_status)
  77. #define I_ata_device_smart_save_attr DECLARE_IMPORT(16, ata_device_smart_save_attr)
  78. #define I_ata_device_flush_cache DECLARE_IMPORT(17, ata_device_flush_cache)
  79. #define I_ata_device_idle_immediate DECLARE_IMPORT(18, ata_device_idle_immediate)
  80. #endif /* __ATAD_H__ */