OpenCores
URL https://opencores.org/ocsvn/mips_enhanced/mips_enhanced/trunk

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [software/] [spw/] [spwapi.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
/*****************************************************************************/
2
/*   This file is a part of the GRLIB VHDL IP LIBRARY */
3
/*   Copyright (C) 2004 GAISLER RESEARCH */
4
 
5
/*   This program is free software; you can redistribute it and/or modify */
6
/*   it under the terms of the GNU General Public License as published by */
7
/*   the Free Software Foundation; either version 2 of the License, or */
8
/*   (at your option) any later version. */
9
 
10
/*   See the file COPYING for the full details of the license. */
11
/*****************************************************************************/
12
 
13
struct dmachanregs
14
{
15
   volatile int ctrl;
16
   volatile int rxmaxlen;
17
   volatile int txdesc;
18
   volatile int rxdesc;
19
   volatile int addr;
20
   volatile int unused[3];
21
};
22
 
23
struct spwregs
24
{
25
   volatile int ctrl;
26
   volatile int status;
27
   volatile int nodeaddr;
28
   volatile int clkdiv;
29
   volatile int destkey;
30
   volatile int timereg;
31
   volatile int timer;
32
   volatile int unused;
33
   struct dmachanregs dma[4];
34
};
35
 
36
struct txdescriptor
37
{
38
   volatile int ctrl;
39
   volatile int haddr;
40
   volatile int dlen;
41
   volatile int daddr;
42
};
43
 
44
struct rxstatus
45
{
46
   int truncated;
47
   int dcrcerr;
48
   int hcrcerr;
49
   int eep;
50
};
51
 
52
struct rxdescriptor
53
{
54
   volatile int ctrl;
55
   volatile int daddr;
56
};
57
 
58
struct dmachanvar
59
{
60
  int    nospill;
61
  int    rxmaxlen;
62
  int    rxpnt;
63
  int    rxchkpnt;
64
  int    txpnt;
65
  int    txchkpnt;
66
  int    addr;
67
  int    mask;
68
  struct txdescriptor *txd;
69
  struct rxdescriptor *rxd;
70
};
71
 
72
struct spwvars
73
{
74
   struct spwregs *regs;
75
   int    rmap;
76
   int    rxunaligned;
77
   int    rmapcrc;
78
   int    timetxen;
79
   int    timerxen;
80
   int    ver;
81
   int    khz;
82
   int    dmachan;
83
   int    clkdiv;
84
   int    clkdivs;
85
   int    timer;
86
   int    dc;
87
   int    nodeaddr;
88
   int    mask;
89
   int    destkey;
90
   struct dmachanvar dma[4];
91
};
92
 
93
int spw_init(struct spwvars *spw);
94
 
95
int wait_running(struct spwvars *spw);
96
 
97
/*sets node specific parameters in the spwvars structure */
98
int spw_setparam(int nodeaddr, int clkdiv, int destkey,
99
                 int timetxen, int timerxen, int spwadr,
100
                 int khz, struct spwvars *spw);
101
 
102
int spw_setparam_dma(int dmachan, int addr, int mask, int nospill, int rxmaxlen, struct spwvars *spw);
103
 
104
/*set new transmit descriptor pointer*/
105
int set_txdesc(int dmachan, int pnt, struct spwvars *spw);
106
 
107
/*set new receive descriptor pointer*/
108
int set_rxdesc(int dmachan, int pnt, struct spwvars *spw);
109
 
110
/*disable spacewire link*/
111
void spw_disable(struct spwvars *spw);
112
 
113
/*enable spacewire link*/
114
void spw_enable(struct spwvars *spw);
115
 
116
/*start spacewire link*/
117
void spw_start(struct spwvars *spw);
118
 
119
/*stop spacewire link*/
120
void spw_stop(struct spwvars *spw);
121
 
122
/*set clock divisor value. returns 1 if the clockdiv parameter is illegal,
123
 
124
int spw_setclockdiv(struct spwvars *spw);
125
 
126
/*set node address, returns 1 if the nodeaddr parameter is illegal,
127
 
128
int spw_set_nodeadr(struct spwvars *spw);
129
 
130
int spw_set_chanadr(int dmachan, struct spwvars *spw);
131
 
132
 
133
/*set maximum receive packet length, returns 1 if the nodeaddr parameter is illegal,
134
 
135
int spw_set_rxmaxlength(int dmachan, struct spwvars *spw);
136
 
137
/*Transmits hsize bytes from hbuf and dsize bytes from dbuf.returns 0 on success.
138
/*1 if there are no free buffers. 2 if there was an illegal parameter value.*/
139
int spw_tx(int dmachan, int hcrc, int dcrc, int skipcrcsize, int hsize, char *hbuf, int dsize, char *dbuf, struct spwvars *spw);
140
 
141
/*Receives one packet to buf. This function only initializes a descriptor, spw_checkrx should
142
be used to poll when a packet has arrived*/
143
int spw_rx(int dmachan, char *buf, struct spwvars *spw);
144
 
145
/*Polls receiver descriptor. Returns 0 if no packet has been received,
146
1 if packet has been received. Then size contains the number of
147
bytes received. rxs contains som status bits such as crc errors,
148
eep termination etc*/
149
int spw_checkrx(int dmachan, int *size, struct rxstatus *rxs, struct spwvars *spw);
150
 
151
/*Polls transmitter descriptor, returns 0 if packet has not been transmitted,
152
  1 if packet was correctly transmitted and 2 if an error occured*/
153
int spw_checktx(int dmachan, struct spwvars *spw);
154
 
155
/*Send time-codee*/
156
void send_time(struct spwvars *spw);
157
 
158
/*Check if time-code has been received*/
159
int check_time(struct spwvars *spw);
160
 
161
/*Get the current time-code value*/
162
int get_time(struct spwvars *spw);
163
 
164
/*Reset GRSPW*/
165
void spw_reset(struct spwvars *spw);
166
 
167
/*Enable hardware RMAP*/
168
void spw_rmapen(struct spwvars *spw);
169
 
170
/*Disable hardware RMAP*/
171
void spw_rmapdis(struct spwvars *spw);
172
 
173
int spw_setdestkey(struct spwvars *spw);
174
 
175
void spw_setsepaddr(int dmachan, struct spwvars *spw);
176
 
177
void spw_disablesepaddr(int dmachan, struct spwvars *spw);
178
 
179
void spw_enablerx(int dmachan, struct spwvars *spw);
180
 
181
void spw_disablerx(int dmachan, struct spwvars *spw);
182
 
183
 
184
 
185
 
186
 
187
 
188
 
189
 
190
 
191
 
192
 
193
 
194
 
195
 
196
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.