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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [peripheral/] [channels/] [channel.h] - Blame information for rev 371

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

Line No. Rev Author Line
1 19 jeremybenn
/* 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
   Copyright (C) 2008 Embecosm Limited
6
 
7
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
8
 
9
   This file is part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
10
 
11
   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
 
16
   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
 
21
   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
 
24
/* 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
struct channel_ops
33
{
34
  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
};
43
 
44
/*! A data structure representing a channel. Its operations and data */
45
struct channel
46
{
47
  const struct channel_ops *ops;
48
  void *data;
49
};
50
 
51
 
52
/* 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
 
63
#endif  /* CHANNEL__H */

powered by: WebSVN 2.1.0

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