mgh: fix for default HDD DMA mode, that wasn't correctly set
[open-ps2-loader.git] / modules / ps2fs / misc.h
blob08874d512104dac2b836b7b0c8e7039ccc516e26
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
10 # $Id: misc.h 577 2004-09-14 14:41:46Z pixel $
13 #ifndef _MISC_H
14 #define _MISC_H
16 ///////////////////////////////////////////////////////////////////////////////
17 // APA Commands defines
19 // APA IOCTL2 commands
20 #define APA_IOCTL2_ADD_SUB 0x00006801
21 #define APA_IOCTL2_DELETE_LAST_SUB 0x00006802
22 #define APA_IOCTL2_NUMBER_OF_SUBS 0x00006803
23 #define APA_IOCTL2_FLUSH_CACHE 0x00006804
24 #define APA_IOCTL2_TRANSFER_DATA 0x00006832 // used by pfs to read/write data :P
25 #define APA_IOCTL2_GETSIZE 0x00006833 // for main(0)/subs(1+)
26 #define APA_IOCTL2_SET_PART_ERROR 0x00006834
28 #define IOCTL2_TMODE_READ 0x00
29 #define IOCTL2_TMODE_WRITE 0x01
31 // for APA_IOCTL2_TRANSFER_DATA
32 typedef struct
34 u32 sub; // main(0)/subs(1+) to read/write
35 u32 sector; //
36 u32 size; // in sectors
37 u32 mode; // IOCTL2_TMODE_*
38 void *buffer; //
39 } hdd_ioctl2_transfer_t;
42 // APA DEVCTL commands
43 #define APA_DEVCTL_MAX_SECTORS 0x00004801 // max partition size(in sectors)
44 #define APA_DEVCTL_TOTAL_SECTORS 0x00004802
45 #define APA_DEVCTL_IDLE 0x00004803
46 #define APA_DEVCTL_FLUSH_CACHE 0x00004804
47 #define APA_DEVCTL_SWAP_TMP 0x00004805
48 #define APA_DEVCTL_DEV9_SHUTDOWN 0x00004806
49 #define APA_DEVCTL_STATUS 0x00004807
50 #define APA_DEVCTL_FORMAT 0x00004808
51 #define APA_DEVCTL_SMART_STAT 0x00004809
52 #define APA_DEVCTL_FREE_SECTORS 0x0000480A
53 #define APA_DEVCTL_GETTIME 0x00006832
55 ///////////////////////////////////////////////////////////////////////////////
56 // Function declerations
58 int fsckStat(pfs_mount_t *pfsMount, pfs_super_block *superblock, u32 stat, int mode);
60 void *allocMem(int size);
61 int getPs2Time(pfs_datetime *tm);
62 void printBitmap(u32 *bitmap);
64 block_device *getDeviceTable(const char *name);
65 int getScale(int num, int size);
66 u32 fixIndex(u32 index);
67 int checkAccess(pfs_cache_t *clink, int flags);
68 pfs_cache_t *sdGetNext(pfs_cache_t *clink, int *result);
69 char* splitPath(char *filename, char *path, int *result);
70 u16 getMaxthIndex(pfs_mount_t *pfsMount);
72 int hddTransfer(int fd, void *buffer, u32 sub/*0=main 1+=subs*/, u32 sector,
73 u32 size/* in sectors*/, u32 mode);
74 u32 hddGetSubNumber(int fd);
75 u32 hddGetSize(int fd, u32 sub/*0=main 1+=subs*/);
76 void hddSetPartError(int fd);
77 int hddFlushCache(int fd);
79 #endif /* _MISC_H */