sectorread.c
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <ultra64.h>
#ifndef _LONGCMD
#include <leo.h>
#else
#include <leosp.h>
#endif
extern s32 __leoActive;
s32 LeoSectorRead(LEOCmd *cmdBlock, s32 LBA, void *vAddr,
u32 nLBAs, OSMesgQueue *mq)
{
/*
* Check for existence of Leo Manager
*/
if (!__leoActive) {
return(-1);
}
/*
* Fill up command block
*/
cmdBlock->header.command = LEO_COMMAND_READ_SECTOR;
cmdBlock->header.reserve1 = 0;
/*
* if mq == null, message will not be sent.
*/
if (mq != NULL)
cmdBlock->header.control = LEO_CONTROL_POST;
else
cmdBlock->header.control = 0;
cmdBlock->header.reserve3 = 0;
cmdBlock->header.post = mq;
cmdBlock->data.readwrite.lba = LBA;
cmdBlock->data.readwrite.xfer_blks = nLBAs;
cmdBlock->data.readwrite.buff_ptr = vAddr;
/*
* If the read is from system blocks, enable
* "No Defect" flag.
*/
if (LBA < 0)
cmdBlock->header.control |= LEO_CONTROL_ND;
leoCommand((void *)cmdBlock);
return 0; /* For now, simply returns 0 */
} /* LeoSectorRead */