disable debug
[AROS.git] / rom / devs / sdcard / sdcard_unit.h
blob0ff3d34395aba52993ddcca41f44b55ad80d0a37
1 #ifndef _SDCARD_UNIT_H
2 #define _SDCARD_UNIT_H
3 /*
4 Copyright © 2013, The AROS Development Team. All rights reserved.
5 $Id$
6 */
8 #include <exec/types.h>
9 #include <devices/scsidisk.h>
11 #define FNAME_SDCUNIT(x) SDCARD__SDUnit__ ## x
13 struct sdcard_Bus;
16 Unit structure describing given device on the bus. It contains all the
17 necessary information unit/device may need.
19 struct sdcard_Unit
21 struct Unit sdcu_Unit; /* exec's unit */
22 struct sdcard_Bus *sdcu_Bus; /* Bus to which this unit is attached */
23 ULONG sdcu_Flags; /* Unit flags, see below */
24 ULONG sdcu_UnitNum; /* Unit number as coded by device */
25 ULONG sdcu_CardRCA;
27 ULONG sdcu_CardPower; /* voltages supported by card/controller */
29 UQUAD sdcu_Capacity; /* Real capacity of device */
30 ULONG sdcu_Cylinders;
31 UBYTE sdcu_Heads;
32 UBYTE sdcu_Sectors;
35 Here are stored pointers to functions responsible for handling this
36 device. They are set during device initialization and point to most
37 effective functions for this particular unit. Read/Write may be done
38 in PIO mode reading single sectors, using multisector PIO, or
39 multiword DMA.
41 BYTE (*sdcu_Read32)(struct sdcard_Unit *, ULONG, ULONG, APTR, ULONG *);
42 BYTE (*sdcu_Write32)(struct sdcard_Unit *, ULONG, ULONG, APTR, ULONG *);
43 BYTE (*sdcu_Read64)(struct sdcard_Unit *, UQUAD, ULONG, APTR, ULONG *);
44 BYTE (*sdcu_Write64)(struct sdcard_Unit *, UQUAD, ULONG, APTR, ULONG *);
45 BYTE (*sdcu_DirectSCSI)(struct sdcard_Unit *, struct SCSICmd *);
46 BYTE (*sdcu_Eject)(struct sdcard_Unit *);
48 ULONG sdcu_ChangeNum; /* Number of disc changes */
50 struct Interrupt *sdcu_RemoveInt; /* Raise this interrupt on a disc change */
51 struct List sdcu_SoftList; /* Raise even more interrupts from this list on disc change */
53 UBYTE sdcu_DevMask; /* device mask used to simplify device number coding */
54 UBYTE sdcu_SenseKey; /* Sense key from ATAPI devices */
55 UBYTE sdcu_DevType;
58 #define Unit(io) ((struct sdcard_Unit *)(io)->io_Unit)
60 /* Unit Flags .. */
62 #define AB_Card_Active 30
63 #define AB_Card_HighSpeed52 27
64 #define AB_Card_HighSpeed 26
65 #define AB_Card_HighCapacity 25
66 #define AB_Card_4bitData 20
67 #define AB_Card_MMC 16
68 #define AB_Card_WriteProtect 1
69 #define AB_Card_Locked 0
71 #define AF_Card_Active (1 << AB_Card_Active)
72 #define AF_Card_HighSpeed52 (1 << AB_Card_HighSpeed52)
73 #define AF_Card_HighSpeed (1 << AB_Card_HighSpeed)
74 #define AF_Card_HighCapacity (1 << AB_Card_HighCapacity)
75 #define AF_Card_4bitData (1 << AB_Card_4bitData)
76 #define AF_Card_MMC (1 << AB_Card_MMC)
77 #define AF_Card_WriteProtect (1 << AB_Card_WriteProtect)
78 #define AF_Card_Locked (1 << AB_Card_Locked)
80 ULONG FNAME_SDCUNIT(WaitStatus)(ULONG, struct sdcard_Unit *);
81 ULONG FNAME_SDCUNIT(SDSCChangeFrequency)(struct sdcard_Unit *);
82 ULONG FNAME_SDCUNIT(MMCChangeFrequency)(struct sdcard_Unit *);
84 #endif /* _SDCARD_UNIT_H */