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

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.swp.api/] [mcapi_transport_nios/] [1.0/] [src/] [mcapi_datatypes.h] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
/*
2
Copyright (c) 2008, The Multicore Association
3
All rights reserved.
4
 
5
Redistribution and use in source and binary forms, with or without
6
modification, are permitted provided that the following conditions are
7
met:
8
 
9
(1) Redistributions of source code must retain the above copyright
10
notice, this list of conditions and the following disclaimer.
11
 
12
(2) Redistributions in binary form must reproduce the above copyright
13
notice, this list of conditions and the following disclaimer in the
14
documentation and/or other materials provided with the distribution.
15
 
16
(3) Neither the name of the Multicore Association nor the names of its
17
contributors may be used to endorse or promote products derived from
18
this software without specific prior written permission.
19
 
20
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
24
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
*/
32
 
33
#ifndef MCAPI_DATATYPES_H
34
#define MCAPI_DATATYPES_H
35
 
36
#include "mcapi_config.h"
37
 
38
#include <stddef.h>  /* for size_t */
39
#include <stdint.h>
40
 
41
#ifdef __TCE__
42
     typedef struct {
43
         int hi;
44
         int lo;
45
     } uint64_t;
46
#endif
47
 
48
/******************************************************************
49
           definitions and constants
50
 ******************************************************************/
51
#ifndef MCAPI_PORT_ANY
52
#define MCAPI_PORT_ANY 0xffffffff
53
#endif
54
 
55
#ifndef MCAPI_INFINITE
56
#define MCAPI_INFINITE  0xffffffff
57
#endif
58
 
59
#ifndef MCAPI_MAX_PRIORITY
60
#define MCAPI_MAX_PRIORITY 10
61
#endif
62
 
63
#define MCAPI_TRUE 1
64
#define MCAPI_FALSE 0
65
 
66
#define MCAPI_NULL NULL
67
 
68
#define MCAPI_OUT
69
/* could define this one as const */
70
#define MCAPI_IN    
71
 
72
#ifndef MAX_QUEUE_ELEMENTS
73
#define MAX_QUEUE_ELEMENTS 64 
74
#endif
75
 
76
/******************************************************************
77
           datatypes
78
******************************************************************/
79
/* error codes */
80
typedef enum {
81
  MCAPI_INCOMPLETE,
82
  MCAPI_SUCCESS,
83
  MCAPI_ENO_INIT,       /* The MCAPI environment could not be initialized.  */
84
  MCAPI_ENO_FINAL,      /* The MCAPI environment could not be finalized.  */
85
  MCAPI_ENOT_ENDP,      /* Argument is not an endpoint descriptor.  */
86
  MCAPI_EMESS_LIMIT,    /* The message size exceeds the maximum size allowed by the MCAPI implementation.  */
87
  MCAPI_ENO_BUFFER,     /* No more message buffers available.  */
88
  MCAPI_ENO_REQUEST,    /* No more request handles available.  */
89
  MCAPI_ENO_MEM,        /* No memory available.  */
90
  MCAPI_ENODE_NOTINIT,  /* The node is not initialized.  */
91
  MCAPI_EEP_NOTALLOWED, /* Endpoints cannot be created on this node.  */
92
  MCAPI_EPORT_NOTVALID, /* The parameter is not a valid port  */
93
  MCAPI_ENODE_NOTVALID, /* The parameter is not a valid node.  */
94
  MCAPI_ENO_ENDPOINT,   /* No such endpoint exists  */
95
  MCAPI_ENOT_OWNER,     /* This node does not own the given endpoint */
96
  MCAPI_ECHAN_OPEN,     /* A channel is open on this endpoint */
97
  MCAPI_ECONNECTED,     /* A channel connection has already been established for the given endpoint.*/
98
  MCAPI_EATTR_INCOMP,   /* Connection of endpoints with incompatible attributes not allowed.*/
99
  MCAPI_ECHAN_TYPE,     /* Attempt to open a packet channel on an endpoint that has been connected with a different channel type.*/
100
  MCAPI_EDIR,           /* Attempt to open a send handle on a port that was connected as a receiver, or vice versa.*/
101
  MCAPI_ENOT_HANDLE,    /* Argument is not a channel handle.*/
102
  MCAPI_EPACK_LIMIT,    /* The message size exceeds the maximum size allowed by the MCAPI implementation.*/
103
  MCAPI_ENOT_VALID_BUF, /* Argument is not a valid buffer descriptor} flags; */
104
  MCAPI_ENOT_OPEN,      /* The endpoint is not open. */
105
  MCAPI_EREQ_CANCELED,  /* The request has been cancelled */
106
  MCAPI_ENOTREQ_HANDLE, /* Invalid request handle */
107
  MCAPI_EENDP_ISCREATED,/* The endpoint has already been created */
108
  MCAPI_EENDP_LIMIT,    /* Max endpoints already exist - no more can be created at this time */
109
  MCAPI_ENOT_CONNECTED, /* The endpoint is not connected */
110
  MCAPI_ESCL_SIZE,      /* Scalar size mismatch - send/recv called with differing sizes */
111
  MCAPI_EPRIO,          /* Incorrect priority level */
112
  MCAPI_INITIALIZED,    /* This node has already called initialize */
113
  MCAPI_EPARAM,         /* Invalid parameter */
114
  MCAPI_ETRUNCATED,     /* The buffer has been truncated */
115
  MCAPI_EREQ_TIMEOUT,   /* The request timed out */
116
} mcapi_status_flags;
117
 
118
/* basic types */
119
typedef int32_t  mcapi_int_t;
120
typedef uint32_t mcapi_uint_t;
121
typedef uint8_t mcapi_uint8_t;
122
typedef uint16_t mcapi_uint16_t;
123
typedef uint32_t mcapi_uint32_t;
124
typedef uint64_t mcapi_uint64_t;
125
typedef uint8_t mcapi_boolean_t;
126
 
127
/* mcapi data */
128
typedef uint32_t mcapi_status_t;
129
typedef uint32_t mcapi_endpoint_t;
130
typedef int  mcapi_node_t;
131
typedef int  mcapi_port_t;
132
typedef char mcapi_version_t[20];
133
typedef int mcapi_priority_t;
134
typedef int mcapi_timeout_t;
135
typedef enum {
136
  OTHER_REQUEST,
137
  OPEN_PKTCHAN,
138
  OPEN_SCLCHAN,
139
  SEND,
140
  RECV,
141
  GET_ENDPT
142
} mcapi_request_type;
143
 
144
typedef struct {
145
  mcapi_boolean_t valid;
146
  size_t size;
147
  mcapi_request_type type;
148
  void* buffer;
149
  void** buffer_ptr;
150
  uint32_t node_num;
151
  uint32_t port_num;
152
  mcapi_boolean_t completed;
153
  mcapi_boolean_t cancelled;
154
  mcapi_endpoint_t handle;
155
  mcapi_status_t status;
156
  mcapi_endpoint_t* endpoint;
157
} mcapi_request_t;
158
 
159
 
160
/* internal handles */
161
typedef uint32_t mcapi_pktchan_recv_hndl_t;
162
typedef uint32_t mcapi_pktchan_send_hndl_t;
163
typedef uint32_t mcapi_sclchan_send_hndl_t;
164
typedef uint32_t mcapi_sclchan_recv_hndl_t;
165
 
166
 
167
/* enum for channel types */
168
typedef enum {
169
  MCAPI_NO_CHAN = 0,
170
  MCAPI_PKT_CHAN,
171
  MCAPI_SCL_CHAN,
172
} channel_type;
173
 
174
 
175
 
176
#endif

powered by: WebSVN 2.1.0

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