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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel-0-3-0-rc1/] [or1ksim/] [peripheral/] [channels/] [channel.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1070 rprescott
/* channel.h -- Definition of types and structures for
2
   peripheral to communicate with host.  Addapted from UML.
3
 
4
   Copyright (C) 2002 Richard Prescott <rip@step.polymtl.ca>
5 1748 jeremybenn
   Copyright (C) 2008 Embecosm Limited
6 1070 rprescott
 
7 1748 jeremybenn
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
8 1070 rprescott
 
9 1748 jeremybenn
   This file is part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
10 1070 rprescott
 
11 1748 jeremybenn
   This program is free software; you can redistribute it and/or modify it
12
   under the terms of the GNU General Public License as published by the Free
13
   Software Foundation; either version 3 of the License, or (at your option)
14
   any later version.
15 1070 rprescott
 
16 1748 jeremybenn
   This program is distributed in the hope that it will be useful, but WITHOUT
17
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
19
   more details.
20 1070 rprescott
 
21 1748 jeremybenn
   You should have received a copy of the GNU General Public License along
22
   with this program.  If not, see <http://www.gnu.org/licenses/>.  */
23 1070 rprescott
 
24 1748 jeremybenn
/* This program is commented throughout in a fashion suitable for processing
25
   with Doxygen. */
26
 
27
 
28
#ifndef CHANNEL__H
29
#define CHANNEL__H
30
 
31
/*! A data structure representing all the functions required on a channel */
32 1070 rprescott
struct channel_ops
33
{
34 1748 jeremybenn
  void *(*init) (const char *);
35
  int   (*open) (void *);
36
  void  (*close) (void *);
37
  int   (*read) (void *, char *, int);
38
  int   (*write) (void *, const char *, int);
39
  void  (*free) (void *);
40
  int   (*isok) (void *);
41
  char *(*status) (void *);
42 1070 rprescott
};
43
 
44 1748 jeremybenn
/*! A data structure representing a channel. Its operations and data */
45 1070 rprescott
struct channel
46
{
47 1748 jeremybenn
  const struct channel_ops *ops;
48
  void *data;
49 1070 rprescott
};
50
 
51
 
52 1748 jeremybenn
/* Function prototypes for external use */
53
extern struct channel *channel_init (const char *descriptor);
54
extern int             channel_open (struct channel *channel);
55
extern int             channel_read (struct channel *channel,
56
                                     char           *buffer,
57
                                     int             size);
58
extern int             channel_write (struct channel *channel,
59
                                      const char     *buffer,
60
                                      int             size);
61
extern void            channel_close (struct channel *channel);
62 1070 rprescott
 
63 1748 jeremybenn
#endif  /* CHANNEL__H */

powered by: WebSVN 2.1.0

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