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/] [openmcapi/] [1.0/] [test/] [support_suite/] [mcapid_support.h] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
/*
2
 * Copyright (c) 2010, Mentor Graphics Corporation
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 met:
7
 *
8
 * 1. Redistributions of source code must retain the above copyright notice,
9
 *    this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
11
 *    this list of conditions and the following disclaimer in the documentation
12
 *    and/or other materials provided with the distribution.
13
 * 3. Neither the name of the <ORGANIZATION> nor the names of its contributors
14
 *    may be used to endorse or promote products derived from this software
15
 *    without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
 * POSSIBILITY OF SUCH DAMAGE.
28
 */
29
 
30
/************************************************************************
31
*
32
*   FILENAME
33
*
34
*       support.h
35
*
36
*
37
*************************************************************************/
38
 
39
#ifndef  _MCAPID_SUPPORT_H_
40
#define  _MCAPID_SUPPORT_H_
41
 
42
#include <mcapi.h>
43
 
44
/* Registration service macros. */
45
#define MCAPID_SVC_LEN          64                      /* The maximum length of a service name. */
46
#define MCAPID_MAX_SERVICES     64                      /* The maximum number of simultaneous registered services. */
47
#define MCAPID_REG_MSG_LEN      MCAPID_SVC_LEN + 4 + 4  /* The length of a registration message. */
48
#define MCAPID_REG_SERVER_NODE  1 /* XXX always? */
49
#define MCAPID_REG_SERVER_PORT  20000
50
 
51
/* Registration service packet offsets. */
52
#define MCAPID_SVCREG_TYPE_OFFSET   0
53
#define MCAPID_SVCREG_PORT_OFFSET   4
54
#define MCAPID_SVCREG_NODE_OFFSET   8
55
#define MCAPID_SVCREG_RXENDP_OFFSET 12
56
#define MCAPID_SVCREG_STATUS_OFFSET 16
57
#define MCAPID_SVCREG_NAME_OFFSET   20
58
 
59
/* Registration request types. */
60
#define MCAPID_REG_SVC              0   /* Register an endpoint for a service. */
61
#define MCAPID_REM_SVC              1   /* Unregister an endpoint with a service. */
62
#define MCAPID_GET_SVC              2   /* Get the endpoint registered for a service. */
63
 
64
typedef struct _MCAPID_SERVICE_STRUCT_
65
{
66
    char                service[MCAPID_SVC_LEN];
67
    mcapi_port_t        port;
68
    mcapi_node_t        node;
69
    mcapi_uint32_t      avail;
70
} MCAPID_SERVICE_STRUCT;
71
 
72
/* MCAPID_STRUCT type values. */
73
#define MCAPI_CHAN_PKT_TX_TYPE      0   /* TX side of packet channel. */
74
#define MCAPI_CHAN_PKT_RX_TYPE      1   /* RX side of packet channel. */
75
#define MCAPI_CHAN_SCL_TX_TYPE      2   /* TX side of scalar channel. */
76
#define MCAPI_CHAN_SCL_RX_TYPE      3   /* RX side of scalar channel. */
77
#define MCAPI_MSG_TX_TYPE           4   /* Client side of message. */
78
#define MCAPI_MSG_RX_TYPE           5   /* Server side of message. */
79
 
80
typedef struct _MCAPID_USER_STRUCT_
81
{
82
    /* Provided by the user. */
83
    int                 type;           /* See types listed above. */
84
    mcapi_port_t        local_port;     /* The port ID of the local side or MCAPI_PORT_ANY. */
85
    char                *service;       /* The name of the service to register (server) or get (client). */
86
    int                 retry;          /* The number of times to attempt to get a service as a client. */
87
    char                test_name[16];
88
    void *              (*func)(void *argv);
89
    MCAPI_THREAD_PTR_ENTRY(thread_entry);
90
} MCAPID_USER_STRUCT;
91
 
92
typedef struct _MCAPID_STRUCT_
93
{
94
    /* Provided by the user. */
95
    int                 type;           /* See types listed above. */
96
    mcapi_port_t        local_port;     /* The port ID of the local side or MCAPI_PORT_ANY. */
97
    mcapi_node_t        node;
98
    char                *service;       /* The name of the service to register (server) or get (client). */
99
    int                 retry;          /* The number of times to attempt to get a service as a client. */
100
    void *              (*func)(void *argv);
101
    MCAPI_THREAD_PTR_ENTRY(thread_entry);
102
 
103
    /* Returned to the user. */
104
    mcapi_endpoint_t    local_endp;
105
    mcapi_endpoint_t    foreign_endp;
106
    mcapi_status_t      status;         /* The status of the test. */
107
    mcapi_request_t     request;        /* The request structure to use to check the status of the open call. */
108
    mcapi_sclchan_send_hndl_t   scl_tx_handle;
109
    mcapi_sclchan_recv_hndl_t   scl_rx_handle;
110
    mcapi_pktchan_send_hndl_t   pkt_tx_handle;
111
    mcapi_pktchan_recv_hndl_t   pkt_rx_handle;
112
 
113
    MCAPI_THREAD        task_ptr;
114
    int                 state;
115
    void                *app_spec;      /* Application specific data structure area. */
116
} MCAPID_STRUCT;
117
 
118
int MCAPID_Create_Service(MCAPID_STRUCT *);
119
void MCAPID_Destroy_Service(MCAPID_STRUCT *, int);
120
mcapi_status_t MCAPID_Get_Service(char *, mcapi_endpoint_t *);
121
mcapi_status_t MCAPID_Register_Service(char *, mcapi_node_t node, mcapi_port_t port);
122
mcapi_status_t MCAPID_Remove_Service(char *, mcapi_node_t node, mcapi_port_t port);
123
mcapi_status_t MCAPID_Create_Thread(MCAPI_THREAD_PTR_ENTRY(thread_entry), MCAPID_STRUCT *);
124
void MCAPID_Finished(void);
125
void MCAPID_Cleanup(MCAPID_STRUCT *);
126
void MCAPID_Sleep(unsigned);
127
unsigned long MCAPID_Time(void);
128
 
129
MCAPI_THREAD_ENTRY(MCAPID_Registration_Server);
130
 
131
#endif /* _MCAPID_SUPPORT_H_ */

powered by: WebSVN 2.1.0

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