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>
11 #include <exec/ports.h>
14 #define FNAME_SDCBUS(x) SDCARD__SDBus__ ## x
16 struct sdcard_BusUnits
22 struct sdcard_Unit
*sdcbu_Units
; /* Units on the bus ( x sdcbu_UnitMax) */
27 struct Node sdcb_Node
;
28 struct SDCardBase
*sdcb_DeviceBase
; /* Device self */
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 */
52 ULONG sdcb_Capabilities
;
56 ULONG sdcb_Power
; /* Supported Voltages */
61 struct sdcard_BusUnits
*sdcb_BusUnits
; /* Units on the bus */
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 */
78 #define AB_Bus_MediaPresent 30 /* media available */
79 #define AB_Bus_MediaChanged 29 /* media changed */
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 */