aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/buffer/subsystem.c
blob: d47525cf93c2b3b1a963cb180e321a3c4a6c3609 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* Copyright (c) 2017, ARM Limited. All rights reserved.
 *
 * Copyright (c) 2017, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */
#include <odp/api/buffer.h>
#include <odp_buffer_subsystem.h>
#include <odp_debug_internal.h>
#include <odp_module.h>

ODP_SUBSYSTEM_DEFINE(buffer, "memory buffer public APIs",
		     BUFFER_SUBSYSTEM_VERSION);

ODP_SUBSYSTEM_CONSTRUCTOR(buffer)
{
	odp_subsystem_constructor(buffer);
}

odp_buffer_t odp_buffer_from_event(odp_event_t ev)
{
	odp_buffer_module_t *mod;

	mod = odp_subsystem_active_module(buffer, mod);
	return mod->buffer_from_event(ev);
}

odp_event_t odp_buffer_to_event(odp_buffer_t buf)
{
	odp_buffer_module_t *mod;

	mod = odp_subsystem_active_module(buffer, mod);
	return mod->buffer_to_event(buf);
}

void *odp_buffer_addr(odp_buffer_t buf)
{
	odp_buffer_module_t *mod;

	mod = odp_subsystem_active_module(buffer, mod);
	return mod->buffer_addr(buf);
}

uint32_t odp_buffer_size(odp_buffer_t buf)
{
	odp_buffer_module_t *mod;

	mod = odp_subsystem_active_module(buffer, mod);
	return mod->buffer_size(buf);
}

void odp_buffer_print(odp_buffer_t buf)
{
	odp_buffer_module_t *mod;

	mod = odp_subsystem_active_module(buffer, mod);
	return mod->buffer_print(buf);
}

uint64_t odp_buffer_to_u64(odp_buffer_t hdl)
{
	odp_buffer_module_t *mod;

	mod = odp_subsystem_active_module(buffer, mod);
	return mod->buffer_to_u64(hdl);
}

odp_buffer_t odp_buffer_alloc(odp_pool_t pool_hdl)
{
	odp_buffer_module_t *mod;

	mod = odp_subsystem_active_module(buffer, mod);
	return mod->buffer_alloc(pool_hdl);
}

int odp_buffer_alloc_multi(odp_pool_t pool_hdl, odp_buffer_t buf[], int num)
{
	odp_buffer_module_t *mod;

	mod = odp_subsystem_active_module(buffer, mod);
	return mod->buffer_alloc_multi(pool_hdl, buf, num);
}

void odp_buffer_free(odp_buffer_t buf)
{
	odp_buffer_module_t *mod;

	mod = odp_subsystem_active_module(buffer, mod);
	return mod->buffer_free(buf);
}

void odp_buffer_free_multi(const odp_buffer_t buf[], int num)
{
	odp_buffer_module_t *mod;

	mod = odp_subsystem_active_module(buffer, mod);
	return mod->buffer_free_multi(buf, num);
}

odp_pool_t odp_buffer_pool(odp_buffer_t buf)
{
	odp_buffer_module_t *mod;

	mod = odp_subsystem_active_module(buffer, mod);
	return mod->buffer_pool(buf);
}

int odp_buffer_is_valid(odp_buffer_t buf)
{
	odp_buffer_module_t *mod;

	mod = odp_subsystem_active_module(buffer, mod);
	return mod->buffer_is_valid(buf);
}