delint
[AROS.git] / rom / devs / sdcard / sdcard_bus.h
blobeac7001ba498e8e79a94542e6c9c416e9a3c070c
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_SectorShift; /* (1 << sdcb_SectorShift) == sector size in bytes */
42 struct TagItem *sdcb_RespListener; /* Current TagList waiting for Response */
43 struct TagItem *sdcb_DataListener; /* Current TagList waiting for Data */
45 struct Task *sdcb_Task;
46 struct MsgPort *sdcb_MsgPort;
47 struct IORequest *sdcb_Timer; /* timer stuff */
49 APTR sdcb_IRQHandle;
51 /* Chipset .. */
52 ULONG sdcb_Capabilities;
53 ULONG sdcb_Version;
54 ULONG sdcb_ClockMax;
55 ULONG sdcb_ClockMin;
56 ULONG sdcb_Power; /* Supported Voltages */
58 ULONG sdcb_IntrMask;
60 /* Unit Management */
61 struct sdcard_BusUnits *sdcb_BusUnits; /* Units on the bus */
63 /* */
64 BYTE (*sdcb_LEDCtrl)(int);
65 UBYTE (*sdcb_IOReadByte)(ULONG, struct sdcard_Bus *);
66 UWORD (*sdcb_IOReadWord)(ULONG, struct sdcard_Bus *);
67 ULONG (*sdcb_IOReadLong)(ULONG, struct sdcard_Bus *);
69 void (*sdcb_IOWriteByte)(ULONG, UBYTE, struct sdcard_Bus *);
70 void (*sdcb_IOWriteWord)(ULONG, UWORD, struct sdcard_Bus *);
71 void (*sdcb_IOWriteLong)(ULONG, ULONG, struct sdcard_Bus *);
73 /* Bus Instance Private/Internal */
74 IPTR sdcb_Private;
77 /* Bus Flags .. */
78 #define AB_Bus_MediaPresent 30 /* media available */
79 #define AB_Bus_MediaChanged 29 /* media changed */
80 #define AB_Bus_SPI 28
81 #define AB_Bus_Active 1
83 #define AF_Bus_MediaPresent (1 << AB_Bus_MediaPresent)
84 #define AF_Bus_MediaChanged (1 << AB_Bus_MediaChanged)
85 #define AF_Bus_SPI (1 << AB_Bus_SPI)
86 #define AF_Bus_Active (1 << AB_Bus_Active)
88 BOOL FNAME_SDCBUS(RegisterUnit)(struct sdcard_Bus *);
89 BOOL FNAME_SDCBUS(StartUnit)(struct sdcard_Unit *);
91 void FNAME_SDCBUS(SoftReset)(UBYTE, struct sdcard_Bus *);
92 ULONG FNAME_SDCBUS(GetClockDiv)(ULONG, struct sdcard_Bus *);
93 void FNAME_SDCBUS(SetClock)(ULONG, struct sdcard_Bus *);
94 void FNAME_SDCBUS(SetPowerLevel)(ULONG, BOOL, struct sdcard_Bus *);
95 ULONG FNAME_SDCBUS(SendCmd)(struct TagItem *, struct sdcard_Bus *);
96 ULONG FNAME_SDCBUS(WaitCmd)(ULONG, ULONG, struct sdcard_Bus *);
97 ULONG FNAME_SDCBUS(FinishCmd)(struct TagItem *, struct sdcard_Bus *);
98 ULONG FNAME_SDCBUS(FinishData)(struct TagItem *, struct sdcard_Bus *);
99 ULONG FNAME_SDCBUS(Rsp136Unpack)(ULONG *, ULONG, const ULONG);
101 void FNAME_SDCBUS(BusIRQ)(struct sdcard_Bus *, void *);
102 void FNAME_SDCBUS(BusTask)(struct sdcard_Bus *);
104 #endif /* _SDCARD_BUS_H */