File: aplib.h

package info (click to toggle)
kernel-source-2.2.25 2.2.25-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 92,756 kB
  • ctags: 280,018
  • sloc: ansic: 1,711,350; asm: 60,340; makefile: 10,295; sh: 2,396; perl: 907; tcl: 570; lisp: 218; cpp: 186; awk: 133; sed: 72
file content (119 lines) | stat: -rw-r--r-- 3,240 bytes parent folder | download | duplicates (10)
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
  /*
   * Copyright 1996 The Australian National University.
   * Copyright 1996 Fujitsu Laboratories Limited
   * 
   * This software may be distributed under the terms of the Gnu
   * Public License version 2 or later
  */

/* aplib kernel interface definition */

#ifndef _APLIB_H_
#define _APLIB_H_

struct aplib_struct {
	unsigned *ringbuf;
	unsigned write_pointer, read_pointer; /* in words */
	unsigned ringbuf_size; /* in words */
	unsigned rbuf_counter; /* read messages */
	unsigned rbuf_flag1, rbuf_flag2; /* received messages */
	unsigned *physical_cid; /* logical to physical mapping */
	unsigned *rel_cid;      /* logical to relative (RTC) mapping */
	unsigned numcells; /* number of logical cells */
	unsigned numcells_x; /* number of logical cells in x direction */
	unsigned numcells_y; /* number of logical cells in y direction */
	unsigned cid, tid;      /* this cells logical cell ID and task ID */
	unsigned cidx, cidy;    /* logical cell id in x and y direction */
	unsigned ack_flag, ack_request;
	unsigned ok_x, ok_y, ok_xy; /* whether hardware x, y and xy sends are allowed */
};


/*
 * the system ringbuffer structure
 * this is also the old way that tasks accessed the MSC hardware
 */
struct ringbuf_struct {
	void *ringbuf; /* pointer to the ringbuf */
	void *shared; /* pointer to the shared page */
	int order; /* arg to __get_free_pages */
	unsigned write_ptr; /* write pointer into the ringbuf */
	unsigned vaddr; /* base virtual address of ringbuf for task */
	unsigned frag_count; /* how many words in the frag queue */
	unsigned frag_len; /* how many words expected in the frag queue */
	unsigned sq_fragment[16]; /* if the task switches part way through
				     an op then shove the partial op here */
};


#define APLIB_INIT    1
#define APLIB_SYNC    2
#define APLIB_GET     3
#define APLIB_PUT     4
#define APLIB_SEND    5
#define APLIB_PROBE   6
#define APLIB_POLL    7
#define APLIB_XSEND   8
#define APLIB_YSEND   9
#define APLIB_XYSEND 10
#define APLIB_XPUT   11
#define APLIB_YPUT   12
#define APLIB_XYPUT  13


/* message kinds */
#define RBUF_SYSTEM  0
#define RBUF_SEND    1
#define RBUF_X_BRD   2
#define RBUF_Y_BRD   3
#define RBUF_XY_BRD  4
#define RBUF_RPC     5
#define RBUF_GET     6
#define RBUF_MPI     7
#define RBUF_BIGSEND 8
#define RBUF_SEEN   0xE
#define RBUF_READ   0xF

#define APLIB_PAGE_BASE 0xd0000000
#define APLIB_PAGE_LEN  8192

struct aplib_init {
	unsigned numcells, cid;
	unsigned numcells_x, numcells_y;
	unsigned *phys_cells; /* physical cell list */
	unsigned *ringbuffer;  /* pointer to user supplied ring buffer */
	unsigned ringbuf_size; /* in words */
};


struct aplib_putget {
	unsigned cid;
	unsigned *src_addr, *dest_addr;
	unsigned size; /* in words */
	unsigned *dest_flag, *src_flag;
	unsigned ack;
};


struct aplib_send {
	/* the ordering here is actually quite important - the parts to be
	   read by the bigrecv function must be in the first 24 bytes */
	unsigned src_addr;
	unsigned size;
	unsigned info1, info2;
	unsigned flag_addr;
	volatile unsigned flag;
	unsigned type;
	unsigned tag;
	unsigned cid;
};

#ifdef __KERNEL__
#define MAX_PUT_SIZE (1024*1024 - 1) /* in words */
#define SMALL_SEND_THRESHOLD 128


#endif

#endif /* _APLIB_H_ */