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_hibi_fdev/] [1.0/] [src/] [mcapi_datatypes.h] - Blame information for rev 172

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 172 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
 
42
/******************************************************************
43
           definitions and constants
44
 ******************************************************************/
45
#ifndef MCAPI_PORT_ANY
46
#define MCAPI_PORT_ANY 0xffffffff
47
#endif
48
 
49
#ifndef MCAPI_INFINITE
50
#define MCAPI_INFINITE  0xffffffff
51
#endif
52
 
53
#ifndef MCAPI_MAX_PRIORITY
54
#define MCAPI_MAX_PRIORITY 10
55
#endif
56
 
57
#define MCAPI_TRUE 1
58
#define MCAPI_FALSE 0
59
 
60
#define MCAPI_NULL NULL
61
 
62
#define MCAPI_OUT
63
/* could define this one as const */
64
#define MCAPI_IN    
65
 
66
#ifndef MAX_QUEUE_ELEMENTS
67
#define MAX_QUEUE_ELEMENTS 64 
68
#endif
69
 
70
/******************************************************************
71
           datatypes
72
******************************************************************/
73
/* error codes */
74
typedef enum {
75
  MCAPI_INCOMPLETE,
76
  MCAPI_SUCCESS,
77
  MCAPI_ENO_INIT,       /* The MCAPI environment could not be initialized.  */
78
  MCAPI_ENO_FINAL,      /* The MCAPI environment could not be finalized.  */
79
  MCAPI_ENOT_ENDP,      /* Argument is not an endpoint descriptor.  */
80
  MCAPI_EMESS_LIMIT,    /* The message size exceeds the maximum size allowed by the MCAPI implementation.  */
81
  MCAPI_ENO_BUFFER,     /* No more message buffers available.  */
82
  MCAPI_ENO_REQUEST,    /* No more request handles available.  */
83
  MCAPI_ENO_MEM,        /* No memory available.  */
84
  MCAPI_ENODE_NOTINIT,  /* The node is not initialized.  */
85
  MCAPI_EEP_NOTALLOWED, /* Endpoints cannot be created on this node.  */
86
  MCAPI_EPORT_NOTVALID, /* The parameter is not a valid port  */
87
  MCAPI_ENODE_NOTVALID, /* The parameter is not a valid node.  */
88
  MCAPI_ENO_ENDPOINT,   /* No such endpoint exists  */
89
  MCAPI_ENOT_OWNER,     /* This node does not own the given endpoint */
90
  MCAPI_ECHAN_OPEN,     /* A channel is open on this endpoint */
91
  MCAPI_ECONNECTED,     /* A channel connection has already been established for the given endpoint.*/
92
  MCAPI_EATTR_INCOMP,   /* Connection of endpoints with incompatible attributes not allowed.*/
93
  MCAPI_ECHAN_TYPE,     /* Attempt to open a packet channel on an endpoint that has been connected with a different channel type.*/
94
  MCAPI_EDIR,           /* Attempt to open a send handle on a port that was connected as a receiver, or vice versa.*/
95
  MCAPI_ENOT_HANDLE,    /* Argument is not a channel handle.*/
96
  MCAPI_EPACK_LIMIT,    /* The message size exceeds the maximum size allowed by the MCAPI implementation.*/
97
  MCAPI_ENOT_VALID_BUF, /* Argument is not a valid buffer descriptor} flags; */
98
  MCAPI_ENOT_OPEN,      /* The endpoint is not open. */
99
  MCAPI_EREQ_CANCELED,  /* The request has been cancelled */
100
  MCAPI_ENOTREQ_HANDLE, /* Invalid request handle */
101
  MCAPI_EENDP_ISCREATED,/* The endpoint has already been created */
102
  MCAPI_EENDP_LIMIT,    /* Max endpoints already exist - no more can be created at this time */
103
  MCAPI_ENOT_CONNECTED, /* The endpoint is not connected */
104
  MCAPI_ESCL_SIZE,      /* Scalar size mismatch - send/recv called with differing sizes */
105
  MCAPI_EPRIO,          /* Incorrect priority level */
106
  MCAPI_INITIALIZED,    /* This node has already called initialize */
107
  MCAPI_EPARAM,         /* Invalid parameter */
108
  MCAPI_ETRUNCATED,     /* The buffer has been truncated */
109
  MCAPI_EREQ_TIMEOUT,   /* The request timed out */
110
} mcapi_status_flags;
111
 
112
/* basic types */
113
typedef int32_t  mcapi_int_t;
114
typedef uint32_t mcapi_uint_t;
115
typedef uint8_t mcapi_uint8_t;
116
typedef uint16_t mcapi_uint16_t;
117
typedef uint32_t mcapi_uint32_t;
118
typedef uint64_t mcapi_uint64_t;
119
typedef uint8_t mcapi_boolean_t;
120
 
121
/* mcapi data */
122
typedef uint32_t mcapi_status_t;
123
typedef uint32_t mcapi_endpoint_t;
124
typedef int  mcapi_node_t;
125
typedef int  mcapi_port_t;
126
typedef char mcapi_version_t[20];
127
typedef int mcapi_priority_t;
128
typedef int mcapi_timeout_t;
129
typedef enum {
130
  OTHER_REQUEST,
131
  OPEN_PKTCHAN,
132
  OPEN_SCLCHAN,
133
  SEND,
134
  RECV,
135
  GET_ENDPT
136
} mcapi_request_type;
137
 
138
typedef struct {
139
  mcapi_boolean_t valid;
140
  size_t size;
141
  mcapi_request_type type;
142
  void* buffer;
143
  void** buffer_ptr;
144
  uint32_t node_num;
145
  uint32_t port_num;
146
  mcapi_boolean_t completed;
147
  mcapi_boolean_t cancelled;
148
  mcapi_endpoint_t handle;
149
  mcapi_status_t status;
150
  mcapi_endpoint_t* endpoint;
151
} mcapi_request_t;
152
 
153
 
154
/* internal handles */
155
typedef uint32_t mcapi_pktchan_recv_hndl_t;
156
typedef uint32_t mcapi_pktchan_send_hndl_t;
157
typedef uint32_t mcapi_sclchan_send_hndl_t;
158
typedef uint32_t mcapi_sclchan_recv_hndl_t;
159
 
160
 
161
/* enum for channel types */
162
typedef enum {
163
  MCAPI_NO_CHAN = 0,
164
  MCAPI_PKT_CHAN,
165
  MCAPI_SCL_CHAN,
166
} channel_type;
167
 
168
 
169
 
170
#endif

powered by: WebSVN 2.1.0

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