disable changefrequency code temporarily since it is leaving the controller in an...
[AROS.git] / rom / devs / sdcard / sdcard_base.h
blobc17cb1afc6ffb279cb14256866e56c946a2218b0
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 #else
24 #define DIRQ(a)
25 #define DIRQ_MORE(a)
26 #define DUMP(a)
27 #define DUMP_MORE(a)
28 #define DINIT(a)
29 #define DTRANS(a)
30 #define DDEV(a)
31 #endif
32 /* Errors that shouldn't happen */
33 #define DERROR(a) a
35 #define FNAME_SDC(x) SDCARD__Device__ ## x
36 #define FNAME_SDCIO(x) SDCARD__SDIO__ ## x
38 #define SDCARD_BUSTASKPRI 10
39 #define SDCARD_BUSTASKSTACK 16384
41 #define V200_MAXCLKDIV 256
42 #define V300_MAXCLKDIV 2046
44 #define SDCARD_TAGBASE (TAG_USER | 0x00534400)
46 #define SDCARD_TAG_CMD (SDCARD_TAGBASE + 1)
47 #define SDCARD_TAG_ARG (SDCARD_TAGBASE + 2)
48 #define SDCARD_TAG_RSPTYPE (SDCARD_TAGBASE + 3)
49 #define SDCARD_TAG_RSP (SDCARD_TAGBASE + 4)
50 #define SDCARD_TAG_DATA (SDCARD_TAGBASE + 5)
51 #define SDCARD_TAG_DATALEN (SDCARD_TAGBASE + 6)
52 #define SDCARD_TAG_DATAFLAGS (SDCARD_TAGBASE + 7)
54 #define LED_OFF 0
55 #define LED_ON 100
57 /* sdhc.device base */
58 struct SDCardBase
60 /* standard device structure */
61 struct Device sdcard_Device;
63 /* Imports */
64 APTR sdcard_KernelBase;
65 struct Device *sdcard_TimerBase;
67 /* Bus's (to be replaced with hidds...) */
68 struct SignalSemaphore sdcard_BusSem;
69 struct List sdcard_Buses;
70 ULONG sdcard_BusCnt;
71 ULONG sdcard_TotalBusUnits;
72 // struct sdcard_Bus *sdcard_Bus;
74 /* Memory Management */
75 APTR sdcard_MemPool;
78 #undef KernelBase
79 #define KernelBase SDCardBase->sdcard_KernelBase
81 #define IOStdReq(io) ((struct IOStdReq *)io)
83 /* Internal flags */
85 #define AB_Quirk_AtomicTMAndCMD 30
86 #define AB_Quirk_MissingCapabilities 29
87 #define AF_Quirk_AtomicTMAndCMD (1 << AB_Quirk_AtomicTMAndCMD)
88 #define AF_Quirk_MissingCapabilities (1 << AB_Quirk_MissingCapabilities)
90 #define SDCARD_BUSINITPRIO 10
92 BOOL FNAME_SDC(RegisterBus)(struct sdcard_Bus *, struct SDCardBase *);
93 BOOL FNAME_SDC(HandleIO)(struct IORequest *io);
95 /* IO Ops */
96 BYTE FNAME_SDCIO(ReadSector32)(struct sdcard_Unit *, ULONG, ULONG, APTR, ULONG *);
97 BYTE FNAME_SDCIO(ReadSector64)(struct sdcard_Unit *, UQUAD, ULONG, APTR, ULONG *);
98 BYTE FNAME_SDCIO(ReadMultiple32)(struct sdcard_Unit *, ULONG, ULONG, APTR, ULONG *);
99 BYTE FNAME_SDCIO(ReadMultiple64)(struct sdcard_Unit *, UQUAD, ULONG, APTR, ULONG *);
100 BYTE FNAME_SDCIO(ReadDMA32)(struct sdcard_Unit *, ULONG, ULONG, APTR, ULONG *);
101 BYTE FNAME_SDCIO(ReadDMA64)(struct sdcard_Unit *, UQUAD, ULONG, APTR, ULONG *);
102 BYTE FNAME_SDCIO(WriteSector32)(struct sdcard_Unit *, ULONG, ULONG, APTR, ULONG *);
103 BYTE FNAME_SDCIO(WriteSector64)(struct sdcard_Unit *, UQUAD, ULONG, APTR, ULONG *);
104 BYTE FNAME_SDCIO(WriteMultiple32)(struct sdcard_Unit *, ULONG, ULONG, APTR, ULONG *);
105 BYTE FNAME_SDCIO(WriteMultiple64)(struct sdcard_Unit *, UQUAD, ULONG, APTR, ULONG *);
106 BYTE FNAME_SDCIO(WriteDMA32)(struct sdcard_Unit *, ULONG, ULONG, APTR, ULONG *);
107 BYTE FNAME_SDCIO(WriteDMA64)(struct sdcard_Unit *, UQUAD, ULONG, APTR, ULONG *);
108 BYTE FNAME_SDCIO(Eject)(struct sdcard_Unit *);
110 #endif /* _SDCARD_BASE_H */