move delay code into separate function.
[AROS.git] / rom / partition / readpartitiondata.c
blob2ffc27b8cf4b4a1fcea8e0d17120c65a886d3c6d
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/libcall.h>
7 #include <proto/exec.h>
9 #include "partition_intern.h"
10 #include "partition_support.h"
12 /*****************************************************************************
14 NAME */
15 AROS_LH3QUAD1(LONG, ReadPartitionDataQ,
17 /* SYNOPSIS */
18 AROS_LHA(struct PartitionHandle *, Partition , A0),
19 AROS_LHA(APTR , Buffer , A1),
20 AROS_LHA(ULONG , DataSize , D0),
21 AROS_LHAQUAD(UQUAD , StartBlock, D1, D2),
23 /* LOCATION */
24 struct Library *, PartitionBase, 25, Partition)
26 /* FUNCTION
27 Read raw data from the partition.
29 INPUTS
30 Partition - a handle to a partition to read from
31 Buffer - a pointer to a data buffer
32 DataSize - Size of data to read in bytes. This size must be a multiple of block size,
33 in order to ensure correct operation
34 StartBlock - Number of the first block to start reading from.
36 RESULT
37 A return code of DoIO() function which was used to read the data
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
47 INTERNALS
49 HISTORY
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 UQUAD offset = (getStartBlock(Partition) + StartBlock) * (Partition->de.de_SizeBlock << 2);
56 struct IOExtTD *ioreq = Partition->bd->ioreq;
58 ioreq->iotd_Req.io_Command = Partition->bd->cmdread;
59 ioreq->iotd_Req.io_Length = DataSize;
60 ioreq->iotd_Req.io_Data = Buffer;
61 ioreq->iotd_Req.io_Offset = offset;
62 ioreq->iotd_Req.io_Actual = offset >> 32;
64 return DoIO((struct IORequest *)ioreq);
66 AROS_LIBFUNC_EXIT