4 Copyright © 2013, The AROS Development Team. All rights reserved.
8 #include <exec/types.h>
9 #include <exec/devices.h>
10 #include <exec/semaphores.h>
12 #include "sdcard_bus.h"
14 // #define xxx(a) (a) to enable particular sections.
15 #if defined(DEBUG) && (DEBUG > 0)
34 /* Errors that shouldn't happen */
37 #define FNAME_SDC(x) SDCARD__Device__ ## x
38 #define FNAME_SDCIO(x) SDCARD__SDIO__ ## x
40 #define SDCARD_BUSTASKPRI 10
41 #define SDCARD_BUSTASKSTACK 16384
43 #define V200_MAXCLKDIV 256
44 #define V300_MAXCLKDIV 2046
46 #define SDCARD_TAGBASE (TAG_USER | 0x00534400)
48 #define SDCARD_TAG_CMD (SDCARD_TAGBASE + 1)
49 #define SDCARD_TAG_ARG (SDCARD_TAGBASE + 2)
50 #define SDCARD_TAG_RSPTYPE (SDCARD_TAGBASE + 3)
51 #define SDCARD_TAG_RSP (SDCARD_TAGBASE + 4)
52 #define SDCARD_TAG_DATA (SDCARD_TAGBASE + 5)
53 #define SDCARD_TAG_DATALEN (SDCARD_TAGBASE + 6)
54 #define SDCARD_TAG_DATAFLAGS (SDCARD_TAGBASE + 7)
59 /* sdhc.device base */
62 /* standard device structure */
63 struct Device sdcard_Device
;
66 APTR sdcard_KernelBase
;
67 struct Device
*sdcard_TimerBase
;
69 /* Bus's (to be replaced with hidds...) */
70 struct SignalSemaphore sdcard_BusSem
;
71 struct List sdcard_Buses
;
73 ULONG sdcard_TotalBusUnits
;
74 // struct sdcard_Bus *sdcard_Bus;
76 /* Memory Management */
81 #define KernelBase SDCardBase->sdcard_KernelBase
83 #define IOStdReq(io) ((struct IOStdReq *)io)
87 #define AB_Quirk_AtomicTMAndCMD 30
88 #define AB_Quirk_MissingCapabilities 29
89 #define AF_Quirk_AtomicTMAndCMD (1 << AB_Quirk_AtomicTMAndCMD)
90 #define AF_Quirk_MissingCapabilities (1 << AB_Quirk_MissingCapabilities)
92 #define SDCARD_BUSINITPRIO 10
94 BOOL
FNAME_SDC(RegisterBus
)(struct sdcard_Bus
*, struct SDCardBase
*);
95 BOOL
FNAME_SDC(HandleIO
)(struct IORequest
*io
);
98 BYTE
FNAME_SDCIO(ReadSector32
)(struct sdcard_Unit
*, ULONG
, ULONG
, APTR
, ULONG
*);
99 BYTE
FNAME_SDCIO(ReadSector64
)(struct sdcard_Unit
*, UQUAD
, ULONG
, APTR
, ULONG
*);
100 BYTE
FNAME_SDCIO(ReadMultiple32
)(struct sdcard_Unit
*, ULONG
, ULONG
, APTR
, ULONG
*);
101 BYTE
FNAME_SDCIO(ReadMultiple64
)(struct sdcard_Unit
*, UQUAD
, ULONG
, APTR
, ULONG
*);
102 BYTE
FNAME_SDCIO(ReadDMA32
)(struct sdcard_Unit
*, ULONG
, ULONG
, APTR
, ULONG
*);
103 BYTE
FNAME_SDCIO(ReadDMA64
)(struct sdcard_Unit
*, UQUAD
, ULONG
, APTR
, ULONG
*);
104 BYTE
FNAME_SDCIO(WriteSector32
)(struct sdcard_Unit
*, ULONG
, ULONG
, APTR
, ULONG
*);
105 BYTE
FNAME_SDCIO(WriteSector64
)(struct sdcard_Unit
*, UQUAD
, ULONG
, APTR
, ULONG
*);
106 BYTE
FNAME_SDCIO(WriteMultiple32
)(struct sdcard_Unit
*, ULONG
, ULONG
, APTR
, ULONG
*);
107 BYTE
FNAME_SDCIO(WriteMultiple64
)(struct sdcard_Unit
*, UQUAD
, ULONG
, APTR
, ULONG
*);
108 BYTE
FNAME_SDCIO(WriteDMA32
)(struct sdcard_Unit
*, ULONG
, ULONG
, APTR
, ULONG
*);
109 BYTE
FNAME_SDCIO(WriteDMA64
)(struct sdcard_Unit
*, UQUAD
, ULONG
, APTR
, ULONG
*);
110 BYTE
FNAME_SDCIO(Eject
)(struct sdcard_Unit
*);
112 #endif /* _SDCARD_BASE_H */