File: system.h

package info (click to toggle)
faumachine 20100527-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 53,836 kB
  • ctags: 20,552
  • sloc: ansic: 179,550; asm: 3,645; makefile: 3,611; perl: 2,103; sh: 1,529; python: 600; xml: 563; lex: 210; vhdl: 204
file content (168 lines) | stat: -rw-r--r-- 4,522 bytes parent folder | download | duplicates (2)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
 * $Id: system.h,v 1.68 2009-10-13 07:30:54 vrsieh Exp $
 *
 * Copyright (C) 2003-2009 FAUmachine Team <info@faumachine.org>.
 * This program is free software. You can redistribute it and/or modify it
 * under the terms of the GNU General Public License, either version 2 of
 * the License, or (at your option) any later version. See COPYING.
 */

#ifndef __SYSTEM_H_INCLUDED
#define __SYSTEM_H_INCLUDED

enum port_type {
	PORT_NONE = 0,

	PORT_CDDVD_DRIVE = 2,
	PORT_CDDVD_MEDIA,

	PORT_FLOPPY_DRIVE,
	PORT_FLOPPY_MEDIA,

	PORT_RJ45_FEMALE,
	PORT_RJ45_MALE,

	PORT_USB_FEMALE,
	PORT_USB_MALE,
};

extern void
system_name_push(const char *name);
extern void
system_name_pop(void);
extern const char *
system_path(void);

extern int
system_page_create(const char *name);
extern int
system_page_destroy(unsigned int page_id);
extern int
system_page_lookup(const char *name);

extern int
system_sig_create(const char *type, const char *name);
extern void *
system_sig_get(unsigned int sig_id);
extern int
system_sig_unget(void *ptr);
extern void
system_sig_destroy(unsigned int sig_id);

extern int
system_sig_info(unsigned int sigid, char *type, char *name);

/** create a component.
 *  @param type component type.
 *  @param name path name of the component.
 *  @param node desired node id of the component.
 *  @param page desired page id of the component.
 *  @return component id or -1 on error.
 */
extern int
system_comp_create(
	const char *type,
	const char *name,
	unsigned int node,
	unsigned int page
);

/** set a generic of a component
 *  @param comp component id (as from system_comp_create)
 *  @param type VHDL type name.
 *  @param generic name of the generic
 *  @param value string representation of value.
 *  @return currently always 0
 */
extern int
system_comp_generic_set(unsigned int comp,
		const char *type, const char *name, const char *value);
extern int
system_comp_port_connect(unsigned int comp, const char *port, unsigned int sig);
extern int
system_comp_init(unsigned int comp);
extern int
system_comp_exit(unsigned int comp);
extern int
system_comp_destroy(unsigned int comp);

extern int
system_comp_info(unsigned int compid, char *type, char *name,
		unsigned int *nodep, unsigned int *pagep);
extern int
system_comp_generic_info(unsigned int compid, unsigned int genericid,
		char *type, char *generic, char *value);
extern int
system_comp_port_info(unsigned int compid, unsigned int portid,
		char *port, unsigned int *sigidp);

/** create an architecture.
 *  @param type architecture type.
 *  @param name path name of the architecture.
 *  @param node desired node id of the architecture.
 *  @param page desired page id of the architecture.
 *  @return architecture id or -1 on error.
 */
extern int
system_arch_create(
	const char *type,
	const char *name,
	unsigned int node,
	unsigned int page
);

/** set a generic of an architecture
 *  @param comp architecture id (as from system_arch_create)
 *  @param type VHDL type name.
 *  @param generic name of the generic
 *  @param value string representation of value.
 *  @return currently always 0
 */
extern int
system_arch_generic_set(unsigned int arch,
		const char *type, const char *name, const char *value);
extern int
system_arch_port_connect(unsigned int arch, const char *port, unsigned int sig);
extern int
system_arch_init(unsigned int arch);
extern int
system_arch_exit(unsigned int arch);
extern int
system_arch_destroy(unsigned int arch);

extern void
system_comp_connect(unsigned int comp, const char *port, unsigned int sig);
extern void
system_comp_disconnect(unsigned int comp, const char *port);

/** lookup a component by path name
 *  @param name path name of component (same as name of system_comp_create)
 *  @return component id, or -1 if not found.
 */
extern int
system_comp_lookup(const char *name);

/** lookup a signal by path name
 *  @param name path name of signal (same as name of system_sig_create)
 *  @return signal id, or -1 if not found.
 */
extern int
system_sig_lookup(const char *name);

enum system_gender {
	SYSTEM_GENDER_NEUTRAL = 0,
	SYSTEM_GENDER_FEMALE = 1,
	SYSTEM_GENDER_MALE = 2,
};

extern int
system_port_lookup(const char *type, enum system_gender gender, unsigned int n,
		const char **comp_name, const char **port_name);

extern int
system_port_connect(const char *comp_name0, const char *port_name0,
		const char *comp_name1, const char *port_name1);
extern int
system_port_disconnect(const char *comp_name0, const char *port_name0);

#endif /* __SYSTEM_H_INCLUDED */