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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [synth/] [arch/] [v2_0/] [include/] [hal_io.h] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_HAL_HAL_IO_H
2
#define CYGONCE_HAL_HAL_IO_H
3
 
4
//=============================================================================
5
//
6
//      hal_io.h
7
//
8
//      HAL device IO register support.
9
//
10
//=============================================================================
11
//####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 2002 Bart Veer
15
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
16
//
17
// eCos is free software; you can redistribute it and/or modify it under
18
// the terms of the GNU General Public License as published by the Free
19
// Software Foundation; either version 2 or (at your option) any later version.
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
22
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License along
27
// with eCos; if not, write to the Free Software Foundation, Inc.,
28
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
29
//
30
// As a special exception, if other files instantiate templates or use macros
31
// or inline functions from this file, or you compile this file and link it
32
// with other works to produce a work based on this file, this file does not
33
// by itself cause the resulting work to be covered by the GNU General Public
34
// License. However the source code for this file must still be made available
35
// in accordance with section (3) of the GNU General Public License.
36
//
37
// This exception does not invalidate any other reasons why a work based on
38
// this file might be covered by the GNU General Public License.
39
//
40
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
41
// at http://sources.redhat.com/ecos/ecos-license/
42
// -------------------------------------------
43
//####ECOSGPLCOPYRIGHTEND####
44
//=============================================================================
45
//#####DESCRIPTIONBEGIN####
46
//
47
// Author(s):   nickg
48
// Contributors:nickg, bartv, alunn, jlarmour
49
// Date:        1998-02-17
50
// Purpose:     Define IO register support
51
// Description: The macros defined here provide the HAL APIs for handling
52
//              device IO control registers.
53
//
54
//              For the synthetic target these macros should never
55
//              actually be used since the application will run as an
56
//              ordinary user application and should not have
57
//              permission to access any real hardware. Instead
58
//              hardware access should go via the auxiliary. Possibly
59
//              the macros should be #pragma poison'd, but some people
60
//              may want to run the synthetic target in a way that
61
//              does involve accessing real hardware.
62
//              
63
//              The synthetic target provides some additional I/O
64
//              facilities in the form of Linux system calls. A useful
65
//              subset of these are prototyped here, together with
66
//              associated constants. There are also I/O operations to
67
//              interact with the auxiliary.
68
//
69
// Usage:
70
//              #include <cyg/hal/hal_io.h>
71
//              ...
72
//
73
//####DESCRIPTIONEND####
74
//
75
//=============================================================================
76
 
77
#include <cyg/infra/cyg_type.h>
78
 
79
//-----------------------------------------------------------------------------
80
// IO Register address.
81
// This type is for recording the address of an IO register.
82
 
83
typedef volatile CYG_ADDRWORD HAL_IO_REGISTER;
84
 
85
//-----------------------------------------------------------------------------
86
// BYTE Register access.
87
// Individual and vectorized access to 8 bit registers.
88
 
89
#define HAL_READ_UINT8( _register_, _value_ )           \
90
    CYG_MACRO_START                                     \
91
    ((_value_) = *((volatile CYG_BYTE *)(_register_))); \
92
    CYG_MACRO_END
93
 
94
#define HAL_WRITE_UINT8( _register_, _value_ )          \
95
    CYG_MACRO_START                                     \
96
    (*((volatile CYG_BYTE *)(_register_)) = (_value_)); \
97
    CYG_MACRO_END
98
 
99
#define HAL_READ_UINT8_VECTOR( _register_, _buf_, _count_, _step_ )     \
100
    CYG_MACRO_START                                                     \
101
    cyg_count32 _i_,_j_;                                                \
102
    for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) {   \
103
        (_buf_)[_i_] = ((volatile CYG_BYTE *)(_register_))[_j_];        \
104
    }                                                                   \
105
    CYG_MACRO_END
106
 
107
#define HAL_WRITE_UINT8_VECTOR( _register_, _buf_, _count_, _step_ )    \
108
    CYG_MACRO_START                                                     \
109
    cyg_count32 _i_,_j_;                                                \
110
    for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) {   \
111
        ((volatile CYG_BYTE *)(_register_))[_j_] = (_buf_)[_i_];        \
112
    }                                                                   \
113
    CYG_MACRO_END
114
 
115
 
116
//-----------------------------------------------------------------------------
117
// 16 bit access.
118
// Individual and vectorized access to 16 bit registers.
119
 
120
#define HAL_READ_UINT16( _register_, _value_ )                  \
121
    CYG_MACRO_START                                             \
122
    ((_value_) = *((volatile CYG_WORD16 *)(_register_)));       \
123
    CYG_MACRO_END
124
 
125
#define HAL_WRITE_UINT16( _register_, _value_ )                 \
126
    CYG_MACRO_START                                             \
127
    (*((volatile CYG_WORD16 *)(_register_)) = (_value_));       \
128
    CYG_MACRO_END
129
 
130
#define HAL_READ_UINT16_VECTOR( _register_, _buf_, _count_, _step_ )    \
131
    CYG_MACRO_START                                                     \
132
    cyg_count32 _i_,_j_;                                                \
133
    for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) {   \
134
        (_buf_)[_i_] = ((volatile CYG_WORD16 *)(_register_))[_j_];      \
135
    }                                                                   \
136
    CYG_MACRO_END
137
 
138
#define HAL_WRITE_UINT16_VECTOR( _register_, _buf_, _count_, _step_ )   \
139
    CYG_MACRO_START                                                     \
140
    cyg_count32 _i_,_j_;                                                \
141
    for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) {   \
142
        ((volatile CYG_WORD16 *)(_register_))[_j_] = (_buf_)[_i_];      \
143
    }                                                                   \
144
    CYG_MACRO_END
145
 
146
//-----------------------------------------------------------------------------
147
// 32 bit access.
148
// Individual and vectorized access to 32 bit registers.
149
 
150
#define HAL_READ_UINT32( _register_, _value_ )                  \
151
    CYG_MACRO_START                                             \
152
    ((_value_) = *((volatile CYG_WORD32 *)(_register_)));       \
153
    CYG_MACRO_END
154
 
155
#define HAL_WRITE_UINT32( _register_, _value_ )                 \
156
    CYG_MACRO_START                                             \
157
    (*((volatile CYG_WORD32 *)(_register_)) = (_value_));       \
158
    CYG_MACRO_END
159
 
160
#define HAL_READ_UINT32_VECTOR( _register_, _buf_, _count_, _step_ )    \
161
    CYG_MACRO_START                                                     \
162
    cyg_count32 _i_,_j_;                                                \
163
    for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) {   \
164
        (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_))[_j_];      \
165
    }                                                                   \
166
    CYG_MACRO_END
167
 
168
#define HAL_WRITE_UINT32_VECTOR( _register_, _buf_, _count_, _step_ )   \
169
    CYG_MACRO_START                                                     \
170
    cyg_count32 _i_,_j_;                                                \
171
    for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) {   \
172
        ((volatile CYG_WORD32 *)(_register_))[_j_] = (_buf_)[_i_];      \
173
    }                                                                   \
174
    CYG_MACRO_END
175
 
176
// ----------------------------------------------------------------------------
177
// Linux system calls and associated structures and constants. This is
178
// by no means a complete list, but there is enough information for
179
// the needs of the relevant HAL packages. The information needs to be
180
// kept in synch with the Linux header files, but in practice
181
// divergence will be rare because that would imply incompatible
182
// changes in the Linux kernel API.
183
//
184
// It may seem tempting to import the Linux header files directly, but
185
// that would prevent cross-compilation and introduce all kinds of
186
// namespace pollution.
187
//
188
// The actual implementation lives in variant HAL packages since
189
// typically they involve direct system calls via bits of assembler.
190
// Note that only a subset of system calls are actually implemented,
191
// so the variant HALs may need to be updated if this list needs to
192
// be extended.
193
 
194
// Error codes.
195
#define CYG_HAL_SYS_EINTR                4
196
#define CYG_HAL_SYS_EAGAIN              11
197
 
198
// Signal-related information
199
#define CYG_HAL_SYS_SIGHUP               1
200
#define CYG_HAL_SYS_SIGINT               2
201
#define CYG_HAL_SYS_SIGQUIT              3
202
#define CYG_HAL_SYS_SIGILL               4
203
#define CYG_HAL_SYS_SIGTRAP              5
204
#define CYG_HAL_SYS_SIGABRT              6
205
#define CYG_HAL_SYS_SIGBUS               7
206
#define CYG_HAL_SYS_SIGFPE               8
207
#define CYG_HAL_SYS_SIGKILL              9
208
#define CYG_HAL_SYS_SIGUSR1             10
209
#define CYG_HAL_SYS_SIGSEGV             11
210
#define CYG_HAL_SYS_SIGUSR2             12
211
#define CYG_HAL_SYS_SIGPIPE             13
212
#define CYG_HAL_SYS_SIGALRM             14
213
#define CYG_HAL_SYS_SIGTERM             15
214
#define CYG_HAL_SYS_SIGSTKFLT           16
215
#define CYG_HAL_SYS_SIGCHLD             17
216
#define CYG_HAL_SYS_SIGCONT             18
217
#define CYG_HAL_SYS_SIGSTOP             19
218
#define CYG_HAL_SYS_SIGTSTP             20
219
#define CYG_HAL_SYS_SIGTTIN             21
220
#define CYG_HAL_SYS_SIGTTOU             22
221
#define CYG_HAL_SYS_SIGURG              23
222
#define CYG_HAL_SYS_SIGXCPU             24
223
#define CYG_HAL_SYS_SIGXFSZ             25
224
#define CYG_HAL_SYS_SIGVTALRM           26
225
#define CYG_HAL_SYS_SIGPROF             27
226
#define CYG_HAL_SYS_SIGWINCH            28
227
#define CYG_HAL_SYS_SIGIO               29
228
#define CYG_HAL_SYS_SIGPWR              30
229
#define CYG_HAL_SYS_SIGSYS              31
230
 
231
#define CYG_HAL_SYS_SA_NOCLDSTOP        0x00000001
232
#define CYG_HAL_SYS_SA_NOCLDWAIT        0x00000002
233
#define CYG_HAL_SYS_SA_SIGINFO          0x00000004
234
#define CYG_HAL_SYS_SA_RESTART          0x10000000
235
#define CYG_HAL_SYS_SA_NODEFER          0x40000000
236
#define CYG_HAL_SYS_SIG_BLOCK           0
237
#define CYG_HAL_SYS_SIG_UNBLOCK         1
238
#define CYG_HAL_SYS_SIG_SETMASK         2
239
 
240
#define CYG_HAL_SYS__NSIG               64
241
#define CYG_HAL_SYS__SIGBITS            (8 * sizeof(unsigned long))
242
#define CYG_HAL_SYS__SIGELT(_d_)        ((_d_) / CYG_HAL_SYS__SIGBITS)
243
#define CYG_HAL_SYS__SIGMASK(_d_)       ((unsigned long)1 << ((_d_) % CYG_HAL_SYS__SIGBITS))
244
 
245
typedef struct cyg_hal_sys_sigset_t {
246
    unsigned long hal_sig_bits[CYG_HAL_SYS__NSIG / CYG_HAL_SYS__SIGBITS];
247
} cyg_hal_sys_sigset_t;
248
 
249
#define CYG_HAL_SYS_SIGFILLSET(_set_)                                                   \
250
    CYG_MACRO_START                                                                     \
251
        unsigned int __i;                                                               \
252
        for (__i = 0; __i < (CYG_HAL_SYS__NSIG / CYG_HAL_SYS__SIGBITS); __i++) {        \
253
            (_set_)->hal_sig_bits[__i] = ~0;                                            \
254
        }                                                                               \
255
    CYG_MACRO_END
256
 
257
#define CYG_HAL_SYS_SIGEMPTYSET(_set_)                                                  \
258
    CYG_MACRO_START                                                                     \
259
        unsigned int __i;                                                               \
260
        for (__i = 0; __i < (CYG_HAL_SYS__NSIG / CYG_HAL_SYS__SIGBITS); __i++) {        \
261
            (_set_)->hal_sig_bits[__i] = 0;                                             \
262
        }                                                                               \
263
    CYG_MACRO_END
264
 
265
#define CYG_HAL_SYS_SIGADDSET(_set_, _bit_)                                                     \
266
    CYG_MACRO_START                                                                             \
267
    (_set_)->hal_sig_bits[CYG_HAL_SYS__SIGELT(_bit_ - 1)] |= CYG_HAL_SYS__SIGMASK(_bit_ - 1);   \
268
    CYG_MACRO_END
269
 
270
#define CYG_HAL_SYS_SIGDELSET(_set_, _bit_)                                                     \
271
    CYG_MACRO_START                                                                             \
272
    (_set_)->hal_sig_bits[CYG_HAL_SYS__SIGELT(_bit_ - 1)] &= ~CYG_HAL_SYS__SIGMASK(_bit_ - 1);  \
273
    CYG_MACRO_END
274
 
275
#define CYG_HAL_SYS_SIGISMEMBER(_set_, _bit_)                                                   \
276
    (0 != ((_set_)->hal_sig_bits[CYG_HAL_SYS__SIGELT(_bit_ - 1)] & CYG_HAL_SYS__SIGMASK(_bit_ - 1)))
277
 
278
struct cyg_hal_sys_sigaction {
279
    void        (*hal_handler)(int);
280
    long        hal_mask;
281
    int         hal_flags;
282
    void        (*hal_bogus)(int);
283
};
284
 
285
// Time support.
286
struct cyg_hal_sys_timeval {
287
    long        hal_tv_sec;
288
    long        hal_tv_usec;
289
};
290
 
291
struct cyg_hal_sys_timezone {
292
    int         hal_tz_minuteswest;
293
    int         hal_tz_dsttime;
294
};
295
 
296
// Select support. Initially this is used only by the idle handler.
297
#define CYG_HAL_SYS_FD_SETSIZE          1024
298
#define CYG_HAL_SYS__NFDBITS            (8 * sizeof(unsigned long))
299
#define CYG_HAL_SYS__FDELT(_d_)         ((_d_) / CYG_HAL_SYS__NFDBITS)
300
#define CYG_HAL_SYS__FDMASK(_d_)        ((unsigned long)1 << ((_d_) % CYG_HAL_SYS__NFDBITS))
301
 
302
struct cyg_hal_sys_fd_set {
303
    unsigned long hal_fds_bits[CYG_HAL_SYS_FD_SETSIZE / CYG_HAL_SYS__NFDBITS];
304
};
305
#define CYG_HAL_SYS_FD_ZERO(_fdsp_)                                     \
306
    do {                                                                \
307
        unsigned int __i;                                               \
308
        for (__i = 0;                                                   \
309
             __i < (CYG_HAL_SYS_FD_SETSIZE / CYG_HAL_SYS__NFDBITS);     \
310
             __i++) {                                                   \
311
           (_fdsp_)->hal_fds_bits[__i] = 0;                             \
312
     } while (0);
313
 
314
#define CYG_HAL_SYS_FD_SET(_fd_, _fdsp_)                                \
315
    CYG_MACRO_START                                                     \
316
    (_fdsp_)->hal_fds_bits[CYG_HAL_SYS__FDELT(_fd_)] |= CYG_HAL_SYS__FDMASK(_fd_); \
317
    CYG_MACRO_END
318
 
319
#define CYG_HAL_SYS_FD_CLR(_fd_, _fdsp_)                                \
320
    CYG_MACRO_START                                                     \
321
    (_fdsp_)->hal_fds_bits[CYG_HAL_SYS__FDELT(_fd_)] &= ~CYG_HAL_SYS__FDMASK(_fd_); \
322
    CYG_MACRO_END
323
 
324
#define CYG_HAL_SYS_FD_ISSET(_fd_, _fdsp_) \
325
    (0 != ((_fdsp_)->hal_fds_bits[CYG_HAL_SYS__FDELT(_fd_)] & CYG_HAL_SYS__FDMASK(_fd_)))
326
 
327
// Interval timer support, needed for the clock.
328
#define CYG_HAL_SYS_ITIMER_REAL     0
329
#define CYG_HAL_SYS_ITIMER_VIRTUAL  1
330
#define CYG_HAL_SYS_ITIMER_PROF     2
331
 
332
struct cyg_hal_sys_itimerval {
333
    struct cyg_hal_sys_timeval  hal_it_interval;
334
    struct cyg_hal_sys_timeval  hal_it_value;
335
};
336
 
337
// System calls and related constants, or rather the subset that is
338
// needed internally.
339
#define CYG_HAL_SYS_R_OK    0x04
340
#define CYG_HAL_SYS_W_OK    0x02
341
#define CYG_HAL_SYS_X_OK    0x01
342
#define CYG_HAL_SYS_F_OK    0x00
343
 
344
/* lseek whence flags */
345
#define CYG_HAL_SYS_SEEK_SET        0       /* Seek from beginning of file.  */
346
#define CYG_HAL_SYS_SEEK_CUR        1       /* Seek from current position.  */
347
#define CYG_HAL_SYS_SEEK_END        2       /* Seek from end of file.  */
348
 
349
/* open/fcntl flags */
350
 
351
#define CYG_HAL_SYS_O_RDONLY        0
352
#define CYG_HAL_SYS_O_WRONLY        1
353
#define CYG_HAL_SYS_O_RDWR          2
354
#define CYG_HAL_SYS_O_CREAT       100
355
#define CYG_HAL_SYS_O_EXCL        200
356
#define CYG_HAL_SYS_O_NOCTTY      400
357
#define CYG_HAL_SYS_O_TRUNC      1000
358
#define CYG_HAL_SYS_O_APPEND     2000
359
#define CYG_HAL_SYS_O_NONBLOCK   4000
360
#define CYG_HAL_SYS_O_NDELAY     CYG_HAL_SYS_O_NONBLOCK
361
#define CYG_HAL_SYS_O_SYNC      10000
362
#define CYG_HAL_SYS_O_FSYNC     CYG_HAL_SYS_O_SYNC
363
#define CYG_HAL_SYS_O_ASYNC     20000
364
 
365
/* open mode flags */
366
#define CYG_HAL_SYS_S_IRUSR 400
367
#define CYG_HAL_SYS_S_IREAD CYG_HAL_SYS_S_IRUSR
368
#define CYG_HAL_SYS_S_IWUSR 200
369
#define CYG_HAL_SYS_S_IWRITE CYG_HAL_SYS_S_IWUSR
370
#define CYG_HAL_SYS_S_IXUSR 100
371
#define CYG_HAL_SYS_S_IEXEC CYG_HAL_SYS_S_IXUSR
372
#define CYG_HAL_SYS_S_IRWXU \
373
  (CYG_HAL_SYS_S_IREAD|CYG_HAL_SYS_S_IWRITE|CYG_HAL_SYS_S_IEXEC)
374
#define CYG_HAL_SYS_S_IRWXG (CYG_HAL_SYS_S_IRWXU>>3)
375
#define CYG_HAL_SYS_S_IRGRP (CYG_HAL_SYS_S_IRUSR>>3)
376
#define CYG_HAL_SYS_S_IWGRP (CYG_HAL_SYS_S_IWUSR>>3)
377
#define CYG_HAL_SYS_S_IXGRP (CYG_HAL_SYS_S_IXUSR>>3)
378
#define CYG_HAL_SYS_S_IRWXO (CYG_HAL_SYS_S_IRWXG>>3)
379
#define CYG_HAL_SYS_S_IROTH (CYG_HAL_SYS_S_IRGRP>>3)
380
#define CYG_HAL_SYS_S_IWOTH (CYG_HAL_SYS_S_IWGRP>>3)
381
#define CYG_HAL_SYS_S_IXOTH (CYG_HAL_SYS_S_IXGRP>>3)
382
 
383
struct cyg_hal_sys_mmap_args {
384
        unsigned long addr;
385
        unsigned long len;
386
        unsigned long prot;
387
        unsigned long flags;
388
        unsigned long fd;
389
        unsigned long offset;
390
};
391
 
392
/* Protection flags for mmap */
393
#define CYG_HAL_SYS_PROT_READ       0x1     /* page can be read */
394
#define CYG_HAL_SYS_PROT_WRITE      0x2     /* page can be written */
395
#define CYG_HAL_SYS_PROT_EXEC       0x4     /* page can be executed */
396
#define CYG_HAL_SYS_PROT_NONE       0x0     /* page can not be accessed */
397
 
398
/* Sharing types and other flags */
399
#define CYG_HAL_SYS_MAP_SHARED      0x01     /* Share changes.  */
400
#define CYG_HAL_SYS_MAP_PRIVATE     0x02     /* Changes are private.  */
401
#define CYG_HAL_SYS_MAP_FIXED       0x10     /* Interpret addr exactly.  */
402
 
403
// System calls, or rather the subset that is needed internally.
404
externC unsigned long   cyg_hal_sys_write(int, const void*, long);
405
externC unsigned long   cyg_hal_sys_read(int, void*, long);
406
externC int             cyg_hal_sys_lseek(int, int, int);
407
externC int             cyg_hal_sys_open(const char *,int,int);
408
externC int             cyg_hal_sys_fdatasync(int);
409
externC int             cyg_hal_sys_sigaction(int,
410
                                              const struct cyg_hal_sys_sigaction*,
411
                                              struct cyg_hal_sys_sigaction*);
412
externC int             cyg_hal_sys_sigprocmask(int,
413
                                                const cyg_hal_sys_sigset_t*,
414
                                                cyg_hal_sys_sigset_t*);
415
externC int             cyg_hal_sys__newselect(int,
416
                                               struct cyg_hal_sys_fd_set*,
417
                                               struct cyg_hal_sys_fd_set*,
418
                                               struct cyg_hal_sys_fd_set*,
419
                                               struct cyg_hal_sys_timeval*);
420
externC int             cyg_hal_sys_setitimer(int,
421
                                              const struct cyg_hal_sys_itimerval*,
422
                                              struct cyg_hal_sys_itimerval*);
423
externC int             cyg_hal_sys_gettimeofday(struct cyg_hal_sys_timeval*,
424
                                                 struct cyg_hal_sys_timezone*);
425
 
426
externC int             cyg_hal_sys_access(const char*, int);
427
externC int             cyg_hal_sys_fork(void);
428
externC int             cyg_hal_sys_execve(const char*, const char* [], const char* []);
429
externC int             cyg_hal_sys_pipe(int []);
430
externC int             cyg_hal_sys_close(int);
431
externC int             cyg_hal_sys_dup2(int, int);
432
 
433
// The actual implementation appears to return the new brk() value.
434
externC void*           cyg_hal_sys_brk(void*);
435
 
436
// Returns the number of characters placed in the buffer or <0 for error,
437
// not a char*. 
438
externC int             cyg_hal_sys_getcwd(char*, int);
439
 
440
// mmap on the "host" system - this may be unportable.
441
externC int             cyg_hal_sys_mmap(struct cyg_hal_sys_mmap_args *);
442
 
443
// Access to environmental data
444
extern int              cyg_hal_sys_argc;
445
extern const char**     cyg_hal_sys_argv;
446
extern const char**     cyg_hal_sys_environ;
447
 
448
// ----------------------------------------------------------------------------
449
// Interaction between the application and the auxiliary.
450
 
451
// Is the  auxiliary actually in use/available? This flag should be tested by
452
// device drivers prior to attempting any communication with the auxiliary.
453
extern cyg_bool synth_auxiliary_running;
454
 
455
// The fundamental I/O operation: sending a request to the auxiliary and
456
// optionally getting back a reply. A null pointer for the response field
457
// indicates that no reply is expected. 
458
externC void synth_auxiliary_xchgmsg(int /* devid */, int /* request */,
459
                                     int /* arg1  */, int /* arg2 */,
460
                                     const unsigned char* /* txdata */, int /* txlen */,
461
                                     int* /* response */,
462
                                     unsigned char* /* rxdata */,  int* /* actual_rxlen */,
463
                                     int /* rxlen */);
464
 
465
// Request that the auxiliary instantiates a given device, loading appropriate
466
// support code as required. This function takes the following arguments:
467
// 1) the location of the package that should provide this device, e.g.
468
//    devs/eth/synth
469
// 2) the version of that package currently being used, e.g. "current"
470
// 3) the name of the device, e.g. "ethernet". This identifies the
471
//    Tcl script that should be loaded to handle requests for this device.
472
// 4) the name of the device instance, e.g. "eth0".
473
// 5) device-specific initialization data. 
474
externC int  synth_auxiliary_instantiate(const char*, const char*, const char*, const char*, const char*);
475
 
476
// Support for generating strings
477
#define SYNTH_MAKESTRING1(a) #a
478
#define SYNTH_MAKESTRING(a)  SYNTH_MAKESTRING1(a)
479
 
480
//-----------------------------------------------------------------------------
481
#endif // ifndef CYGONCE_HAL_HAL_IO_H
482
// End of hal_io.h

powered by: WebSVN 2.1.0

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