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_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 */
53 ULONG sdcb_Capabilities
;
57 ULONG sdcb_Power
; /* Supported Voltages */
62 struct sdcard_BusUnits
*sdcb_BusUnits
; /* Units on the bus */
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 */
79 #define AB_Bus_MediaPresent 30 /* media available */
80 #define AB_Bus_MediaChanged 29 /* media changed */
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 */