revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / rom / devs / sdcard / sdcard_bus.h
blobab54f37c753f5f17635fe06f5e0ef55f4d88e996
1 #ifndef _SDCARD_BUS_H
2 #define _SDCARD_BUS_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>
11 #include <exec/ports.h>
12 #include <exec/io.h>
14 #define FNAME_SDCBUS(x) SDCARD__SDBus__ ## x
16 struct sdcard_BusUnits
18 /* Unit Management */
19 ULONG sdcbu_UnitBase;
20 ULONG sdcbu_UnitMax;
21 ULONG sdcbu_UnitCnt;
22 struct sdcard_Unit *sdcbu_Units; /* Units on the bus ( x sdcbu_UnitMax) */
25 struct sdcard_Bus
27 struct Node sdcb_Node;
28 struct SDCardBase *sdcb_DeviceBase; /* Device self */
30 ULONG sdcb_Quirks;
32 APTR sdcb_IOBase;
33 ULONG sdcb_BusIRQ;
34 ULONG sdcb_BusNum;
36 ULONG sdcb_BusFlags; /* Bus flags similar to unit flags */
37 volatile ULONG sdcb_BusStatus; /* copy of the status register */
38 UBYTE sdcb_TaskSig; /* Signal used to wake task */
39 UBYTE sdcb_MediaSig; /* Insert/Eject notification */
40 UBYTE sdcb_CommandSig; /* Command completed signal */
41 UBYTE sdcb_SectorShift; /* (1 << sdcb_SectorShift) == sector size in bytes */
43 struct TagItem *sdcb_RespListener; /* Current TagList waiting for Response */
44 struct TagItem *sdcb_DataListener; /* Current TagList waiting for Data */
46 struct Task *sdcb_Task;
47 struct MsgPort *sdcb_MsgPort;
48 struct IORequest *sdcb_Timer; /* timer stuff */
50 APTR sdcb_IRQHandle;
52 /* Chipset .. */
53 ULONG sdcb_Capabilities;
54 ULONG sdcb_Version;
55 ULONG sdcb_ClockMax;
56 ULONG sdcb_ClockMin;
57 ULONG sdcb_Power; /* Supported Voltages */
59 ULONG sdcb_IntrMask;
61 /* Unit Management */
62 struct sdcard_BusUnits *sdcb_BusUnits; /* Units on the bus */
64 /* */
65 BYTE (*sdcb_LEDCtrl)(int);
66 UBYTE (*sdcb_IOReadByte)(ULONG, struct sdcard_Bus *);
67 UWORD (*sdcb_IOReadWord)(ULONG, struct sdcard_Bus *);
68 ULONG (*sdcb_IOReadLong)(ULONG, struct sdcard_Bus *);
70 void (*sdcb_IOWriteByte)(ULONG, UBYTE, struct sdcard_Bus *);
71 void (*sdcb_IOWriteWord)(ULONG, UWORD, struct sdcard_Bus *);
72 void (*sdcb_IOWriteLong)(ULONG, ULONG, struct sdcard_Bus *);
74 /* Bus Instance Private/Internal */
75 IPTR sdcb_Private;
78 /* Bus Flags .. */
79 #define AB_Bus_MediaPresent 30 /* media available */
80 #define AB_Bus_MediaChanged 29 /* media changed */
81 #define AB_Bus_SPI 28
82 #define AB_Bus_Active 1
84 #define AF_Bus_MediaPresent (1 << AB_Bus_MediaPresent)
85 #define AF_Bus_MediaChanged (1 << AB_Bus_MediaChanged)
86 #define AF_Bus_SPI (1 << AB_Bus_SPI)
87 #define AF_Bus_Active (1 << AB_Bus_Active)
89 BOOL FNAME_SDCBUS(RegisterUnit)(struct sdcard_Bus *);
90 BOOL FNAME_SDCBUS(StartUnit)(struct sdcard_Unit *);
92 void FNAME_SDCBUS(SoftReset)(UBYTE, struct sdcard_Bus *);
93 ULONG FNAME_SDCBUS(GetClockDiv)(ULONG, struct sdcard_Bus *);
94 void FNAME_SDCBUS(SetClock)(ULONG, struct sdcard_Bus *);
95 void FNAME_SDCBUS(SetPowerLevel)(ULONG, BOOL, struct sdcard_Bus *);
96 ULONG FNAME_SDCBUS(SendCmd)(struct TagItem *, struct sdcard_Bus *);
97 ULONG FNAME_SDCBUS(WaitCmd)(ULONG, ULONG, struct sdcard_Bus *);
98 ULONG FNAME_SDCBUS(FinishCmd)(struct TagItem *, struct sdcard_Bus *);
99 ULONG FNAME_SDCBUS(FinishData)(struct TagItem *, struct sdcard_Bus *);
100 ULONG FNAME_SDCBUS(Rsp136Unpack)(ULONG *, ULONG, const ULONG);
102 void FNAME_SDCBUS(BusIRQ)(struct sdcard_Bus *, void *);
103 void FNAME_SDCBUS(BusTask)(struct sdcard_Bus *);
105 #endif /* _SDCARD_BUS_H */