blob: 095e353a26aef8da41c88472e6ed90239098f1a2 [file] [log] [blame]
Steve Muckle0a9c0872022-02-16 05:58:07 +00001/*******************************************************************************
2* Copyright (C) 2018 Cadence Design Systems, Inc.
3*
4* Permission is hereby granted, free of charge, to any person obtaining
5* a copy of this software and associated documentation files (the
6* "Software"), to use this Software with Cadence processor cores only and
7* not with any other processors and platforms, subject to
8* the following conditions:
9*
10* The above copyright notice and this permission notice shall be included
11* in all copies or substantial portions of the Software.
12*
13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
17* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21******************************************************************************/
22
23#ifndef __XF_H
24#error "xf-proto.h mustn't be included directly"
25#endif
26
27/*******************************************************************************
28 * Forward types declarations
29 ******************************************************************************/
30
31/* ...component string identifier */
32typedef const char *xf_id_t;
33
34/* ...handle to proxy data */
35typedef struct xf_proxy xf_proxy_t;
36
37/* ...handle to component data */
38typedef struct xf_handle xf_handle_t;
39
40/* ...buffer pool */
41typedef struct xf_pool xf_pool_t;
42
43/* ...individual buffer from pool */
44typedef struct xf_buffer xf_buffer_t;
45
46/* ...buffer pool type */
47typedef u32 xf_pool_type_t;
48
49/* ...user-message */
50typedef struct xf_user_msg xf_user_msg_t;
51
52/* ...proxy-message */
53typedef struct xf_proxy_msg xf_proxy_msg_t;
54
55/* ...response callback */
56typedef void (*xf_response_cb)(xf_handle_t *h, xf_user_msg_t *msg);
57
58typedef void* xaf_mem_malloc_fxn_t(s32 size, s32 id);
59typedef void xaf_mem_free_fxn_t(void* ptr, s32 id);
60
61/*******************************************************************************
62 * High-level API functions
63 ******************************************************************************/
64
65/* ...component operations */
66extern int xf_open(xf_proxy_t *proxy, xf_handle_t *handle, xf_id_t id, u32 core, xf_response_cb cb);
67extern void xf_close(xf_handle_t *handle);
68extern int xf_command(xf_handle_t *handle, u32 dst, u32 opcode, void *buf, u32 length);
69extern int xf_route(xf_handle_t *src, u32 s_port, xf_handle_t *dst, u32 d_port, u32 num, u32 size, u32 align);
70extern int xf_unroute(xf_handle_t *src, u32 s_port);
71
72/* ...shared buffers operations */
73extern int xf_pool_alloc(xf_proxy_t *proxy, u32 number, u32 length, xf_pool_type_t type, xf_pool_t **pool, s32 id,
74 xaf_mem_malloc_fxn_t, xaf_mem_free_fxn_t);
75extern void xf_pool_free(xf_pool_t *pool, s32 id, xaf_mem_free_fxn_t);
76extern xf_buffer_t * xf_buffer_get(xf_pool_t *pool);
77extern void xf_buffer_put(xf_buffer_t *buffer);
78
79/* ...proxy operations */
80extern int xf_proxy_init(xf_proxy_t *proxy, u32 core, void *p_shmem);
81extern void xf_proxy_close(xf_proxy_t *proxy);
82