delint
[AROS.git] / rom / devs / sdcard / sdcard_base.h
blob7af0b2c4e697c8324a16f3c55b27c7294a33bdc2
1 #ifndef _SDCARD_BASE_H
2 #define _SDCARD_BASE_H
3 /*
4 Copyright © 2013, The AROS Development Team. All rights reserved.
5 $Id$
6 */
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)
16 #define DIRQ(a)
17 #define DIRQ_MORE(a)
18 #define DUMP(a)
19 #define DUMP_MORE(a)
20 #define DINIT(a) a
21 #define DTRANS(a)
22 #define DDEV(a)
23 #define DFUNCS(a)
24 #else
25 #define DIRQ(a)
26 #define DIRQ_MORE(a)
27 #define DUMP(a)
28 #define DUMP_MORE(a)
29 #define DINIT(a)
30 #define DTRANS(a)
31 #define DDEV(a)
32 #define DFUNCS(a)
33 #endif
34 /* Errors that shouldn't happen */
35 #define DERROR(a) a
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)
56 #define LED_OFF 0
57 #define LED_ON 100
59 /* sdhc.device base */
60 struct SDCardBase
62 /* standard device structure */
63 struct Device sdcard_Device;
65 /* Imports */
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;
72 ULONG sdcard_BusCnt;
73 ULONG sdcard_TotalBusUnits;
74 // struct sdcard_Bus *sdcard_Bus;
76 /* Memory Management */
77 APTR sdcard_MemPool;
80 #undef KernelBase
81 #define KernelBase SDCardBase->sdcard_KernelBase
83 #define IOStdReq(io) ((struct IOStdReq *)io)
85 /* Internal flags */
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);
97 /* IO Ops */
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 */