osPiStartDma.3p
3.59 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
.TH osPiStartDma 3P local "Silicon Graphics, Inc."
.SH NAME
.upperok
osPiStartDma, osPiWriteIo, osPiReadIo, osCreatePiManager, osPiGetCmdQueue \- managed address to the parallel interface (PI)
.SH SYNOPSIS
.nf
\f3
.Op c
#include <ultra64.h>
.sp .8v
s32 osPiStartDma(OSIoMesg \(**mb, s32 priority, s32 direction,
u32 devAddr, void \(**vAddr, u32 nbytes, OSMesgQueue \(**mq);
.sp .8v
void osCreatePiManager(OSPri pri, OSMesgQueue \(**cmdQ, OSMesg \(**cmdBuf,
s32 cmdMsgCnt);
.sp .8v
OSMesgQueue \(**osPiGetCmdQueue(void);
.sp .8v
s32 osPiWriteIo(u32 devAddr, u32 data);
.sp .8v
s32 osPiReadIo(u32 devAddr, u32 \(**data);
.Op
\f1
.fi
.SH DESCRIPTION
The parallel interface (PI) is responsible for the transport of data between
RDRAM and bulk-storage devices (BSD) which could be ROM, RAM, CDROM, and other
technologies.
These functions listed above provide "managed" control of the PI,
which provide synchronization and mutual exclusion support
when the parallel interface is to be shared for simple peripheral I/O.
The use of these PI routines require that the operating system be correctly
initialized.
.PP
The
.I osPiStartDma
routine sets up a DMA transfer between RDRAM
and PI device address space by sending
an I/O message block request
.I mb
to the PI manager. The caller specifies various parameters to be included in
the request block such as
.I direction,
device address
.I devAddr,
RDRAM address
.I vAddr, nbytes
of transfer, and message queue
.I mq
to receive the notification from PI manager once the I/O operation has
completed. If the requested
.I priority
is OS_MESG_PRI_HIGH (default is OS_MESG_PRI_NORMAL),
.I osPiStartDma
jams the message to the front of PI manager's command queue; otherwise,
it simply appends the message to the end of the queue. If the PI manager has
not been started,
.I osPiStartDma
returns -1. Otherwise, it returns the status of either
.I osSendMesg(3P)
or
.I osJamMesg(3P).
The length count
.I nbytes
contains the number of bytes to transfer (up to 16 Mbytes) and must be a
multiple of 2 bytes.
The PI device address
.I devAddr
must be 2-byte aligned.
The RDRAM virtual address
.I vAddr
must be 8-byte aligned,
but for OS_READ DMA operations, a stricter alignment is recommended.
See
.IR OS_DCACHE_ROUNDUP_ADDR (3P)
for a description of the problems that may result when transfers
are not an integral number of cache lines.
.PP
.I osCreatePiManager
creates and starts the PI manager system thread to provide mutual exclusion
and synchronization support for the PI devices. The caller specifies the
priority
.I pri
at which the PI manager will run and the command message queue
.I cmdQ
where the PI manager will accept its request messages.
Together,
.I cmdBuf
and
.I cmdMsgCnt
specify the message buffer and its number of entries needed by the command
message queue.
.I osPiGetCmdQueue
simply returns a pointer to the command queue of the PI manager or NULL if
PI manager has not been started.
.PP
The
.I osPiWriteIo
routine performs a 32-bit programmed IO write to the PI device address
.I devAddr.
Similarly,
.I osPiRawReadIo
performs a 32-bit programmed IO read from the PI device address
.I devAddr
and returns the value in
.I data.
.SH NOTES
It is strongly recommended that the high-level functions (i.e.,
.I osCreatePiManager, osPiWriteIo, osPiReadIo,
and
.I osPiStartDma)
be used to access PI. Caution must be exercised when intermixing
low (raw) and high level PI functions. Without proper synchronization,
this type of usage might cause an error in the PI
since PI can only support one I/O
operation at any one time.
.SH SEE ALSO
.IR osPiRawStartDma (3P),
.IR osSendMesg (3P),
.IR osJamMesg (3P)