scripts: add crosstools packages for i386 and armhf
[AROS.git] / rom / devs / ata / ata_bus.h
blobf016d68303dcc9eefffac1efc4361417d434c524
1 /*
2 Copyright © 2004-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: private inline stubs for calling DMA and PIO vectors
6 Lang: English
7 */
9 static inline VOID PIO_Out(struct ata_Bus* bus, UBYTE val, UWORD offset)
11 register void *obj = bus->pioInterface;
12 struct ATA_BusInterface *vec = obj - sizeof(struct ATA_BusInterface);
14 vec->ata_out(obj, val, offset);
17 static inline UBYTE PIO_In(struct ata_Bus* bus, UWORD offset)
19 register void *obj = bus->pioInterface;
20 struct ATA_BusInterface *vec = obj - sizeof(struct ATA_BusInterface);
22 return vec->ata_in(obj, offset);
25 static inline VOID PIO_OutAlt(struct ata_Bus* bus, UBYTE val, UWORD offset)
27 register void *obj = bus->pioInterface;
28 struct ATA_BusInterface *vec = obj - sizeof(struct ATA_BusInterface);
30 vec->ata_out_alt(obj, val, offset);
33 static inline UBYTE PIO_InAlt(struct ata_Bus* bus, UWORD offset)
35 register void *obj = bus->pioInterface;
36 struct ATA_BusInterface *vec = obj - sizeof(struct ATA_BusInterface);
38 return vec->ata_in_alt(obj, offset);
41 static inline BOOL DMA_Setup(struct ata_Bus *bus, APTR buffer, IPTR size, BOOL read)
43 register void *obj = bus->dmaInterface;
44 struct ATA_DMAInterface *vec = obj - sizeof(struct ATA_DMAInterface);
46 return vec->dma_Prepare(obj, buffer, size, read);
49 static inline void DMA_Start(struct ata_Bus *bus)
51 register void *obj = bus->dmaInterface;
52 struct ATA_DMAInterface *vec = obj - sizeof(struct ATA_DMAInterface);
54 vec->dma_Start(obj);
57 static inline void DMA_End(struct ata_Bus *bus, APTR addr, IPTR len, BOOL read)
59 register void *obj = bus->dmaInterface;
60 struct ATA_DMAInterface *vec = obj - sizeof(struct ATA_DMAInterface);
62 vec->dma_End(obj, addr, len, read);
65 static inline ULONG DMA_GetResult(struct ata_Bus *bus)
67 register void *obj = bus->dmaInterface;
68 struct ATA_DMAInterface *vec = obj - sizeof(struct ATA_DMAInterface);
70 return vec->dma_Result(obj);
73 /* Convert data instance pointer back to OOP object pointer */
74 #define OOP_OBJECT(cl, data) (((void *)data) - cl->InstOffset)
76 static inline void Unit_Enable32Bit(struct ata_Unit *unit)
78 struct ata_Bus *bus = unit->au_Bus;
80 unit->au_UseModes |= AF_XFER_PIO32;
81 unit->au_ins = bus->pioVectors->ata_insl;
82 unit->au_outs = bus->pioVectors->ata_outsl;
85 static inline void Unit_Disable32Bit(struct ata_Unit *unit)
87 struct ata_Bus *bus = unit->au_Bus;
89 unit->au_UseModes &= ~AF_XFER_PIO32;
90 unit->au_ins = bus->pioVectors->ata_insw;
91 unit->au_outs = bus->pioVectors->ata_outsw;
94 static inline void Unit_OutS(struct ata_Unit *unit, APTR data, ULONG length)
96 unit->au_outs(unit->pioInterface, data, length);
99 static inline void Unit_InS(struct ata_Unit *unit, APTR data, ULONG length)
101 unit->au_ins(unit->pioInterface, data, length);