blob: d876f60f4fcf925a206c657066f4c49ffa84651f (
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
|
/* Copyright (c) 2019-2022, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef ODP_PLAT_BUFFER_INLINES_H_
#define ODP_PLAT_BUFFER_INLINES_H_
#include <odp/api/event.h>
#include <odp/api/pool_types.h>
#include <odp/api/abi/buffer.h>
#include <odp/api/plat/buffer_inline_types.h>
#include <odp/api/plat/debug_inlines.h>
#include <odp/api/plat/event_inline_types.h>
#include <odp/api/plat/pool_inline_types.h>
/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
extern const _odp_event_inline_offset_t _odp_event_inline_offset;
extern const _odp_buffer_inline_offset_t _odp_buffer_inline_offset;
extern const _odp_pool_inline_offset_t _odp_pool_inline;
#ifndef _ODP_NO_INLINE
/* Inline functions by default */
#define _ODP_INLINE static inline
#define odp_buffer_from_event __odp_buffer_from_event
#define odp_buffer_to_event __odp_buffer_to_event
#define odp_buffer_addr __odp_buffer_addr
#define odp_buffer_size __odp_buffer_size
#define odp_buffer_pool __odp_buffer_pool
#define odp_buffer_user_area __odp_buffer_user_area
#else
#define _ODP_INLINE
#endif
_ODP_INLINE odp_buffer_t odp_buffer_from_event(odp_event_t ev)
{
_ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_BUFFER);
return (odp_buffer_t)ev;
}
_ODP_INLINE odp_event_t odp_buffer_to_event(odp_buffer_t buf)
{
return (odp_event_t)buf;
}
_ODP_INLINE void *odp_buffer_addr(odp_buffer_t buf)
{
return _odp_event_hdr_field((odp_event_t)buf, void *, base_data);
}
_ODP_INLINE uint32_t odp_buffer_size(odp_buffer_t buf)
{
odp_pool_t pool = _odp_event_hdr_field(buf, odp_pool_t, pool);
return _odp_pool_get(pool, uint32_t, seg_len);
}
_ODP_INLINE odp_pool_t odp_buffer_pool(odp_buffer_t buf)
{
return _odp_event_hdr_field(buf, odp_pool_t, pool);
}
_ODP_INLINE void *odp_buffer_user_area(odp_buffer_t buf)
{
return _odp_buffer_get(buf, void *, uarea_addr);
}
/** @endcond */
#endif
|