VSF Documented
multiplex_rng.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __HAL_DRIVER_COMMON_MULTIPLEX_RNG_H__
19#define __HAL_DRIVER_COMMON_MULTIPLEX_RNG_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "hal/vsf_hal_cfg.h"
24
25#if (VSF_HAL_USE_RNG == ENABLED) && (VSF_HAL_USE_MULTIPLEX_RNG == ENABLED)
26
27#if defined(__VSF_RNG_MULTIPLEX_CLASS_IMPLEMENT)
28# undef __VSF_RNG_MULTIPLEX_CLASS_IMPLEMENT
29# define __VSF_CLASS_IMPLEMENT__
30#endif
31
32#include "utilities/ooc_class.h"
33
34/*============================ MACROS ========================================*/
35
36#ifndef VSF_MULTIPLEX_RNG_CFG_MULTI_CLASS
37# define VSF_MULTIPLEX_RNG_CFG_MULTI_CLASS VSF_RNG_CFG_MULTI_CLASS
38#endif
39
40#ifndef VSF_MULTIPLEXER_RNG_CFG_MASK_TYPE
41# define VSF_MULTIPLEXER_RNG_CFG_MASK_TYPE uint8_t
42#endif
43
44/*============================ MACROFIED FUNCTIONS ===========================*/
45
46#if VSF_MULTIPLEX_RNG_CFG_MULTI_CLASS == ENABLED
47# define __describe_multiplex_rng_op() .op = &vsf_multiplex_rng_op,
48#else
49# define __describe_multiplex_rng_op()
50#endif
51
52#define __describe_multiplex_rng(__multiplexer, __name) \
53 vsf_multiplex_rng_t __name = { \
54 __describe_multiplex_rng_op() \
55 .multiplexer = &(__multiplexer), \
56 };
57
58#define __describe_multiplexer_rng(__name, __rng, ...) \
59 vsf_multiplexer_rng_t __name = { \
60 .rng_ptr = __rng, \
61 }; \
62 VSF_MFOREACH_ARG1(__describe_multiplex_rng, __name, __VA_ARGS__)
63
64#define describe_multiplexer_rng(__name, __rng, ...) \
65 __describe_multiplexer_rng(__name, __rng, __VA_ARGS__)
66
67/*============================ TYPES =========================================*/
68
70
72
73vsf_class(vsf_multiplexer_rng_t) {
74 public_member(
75 vsf_rng_t *rng_ptr;
76 )
77
78 private_member(
79 vsf_slist_queue_t waiting_queue;
80
81 vsf_multiplex_rng_t *req_m_rng;
83 )
84};
85
87 public_member(
89 implement(vsf_rng_t)
90#endif
91 vsf_multiplexer_rng_t * const multiplexer;
92 )
93
94 private_member(
95 vsf_slist_node_t slist_node;
96 uint8_t id;
97
98 struct {
99 uint32_t *buffer;
100 uint32_t num;
101 void *param;
102 vsf_rng_on_ready_callback_t *on_ready_cb;
103 } request;
105};
106
107/*============================ GLOBAL VARIABLES ==============================*/
108
109#define VSF_RNG_CFG_DEC_PREFIX vsf_multiplex
110#define VSF_RNG_CFG_DEC_UPCASE_PREFIX VSF_MULTIPLEX
111#define VSF_RNG_CFG_DEC_EXTERN_OP ENABLED
113
114/*============================ LOCAL VARIABLES ===============================*/
115/*============================ PROTOTYPES ====================================*/
116/*============================ IMPLEMENTATION ================================*/
117
118#endif // VSF_HAL_USE_RNG && VSF_HAL_USE_MULTIPLEX_RNG
119#endif // __HAL_DRIVER_COMMON_MULTIPLEX_RNG_H__
#define ENABLED
Definition __type.h:28
Definition multiplex_rng.h:86
#define VSF_MULTIPLEXER_RNG_CFG_MASK_TYPE
Definition multiplex_rng.h:41
#define VSF_MULTIPLEX_RNG_CFG_MULTI_CLASS
Definition multiplex_rng.h:37
VSF_MULTIPLEXER_RNG_CFG_MASK_TYPE vsf_rng_multiplex_mask_t
Definition multiplex_rng.h:69
#define vsf_class(__name)
Definition ooc_class.h:52
#define vsf_declare_class(__name)
Definition ooc_class.h:49
unsigned uint32_t
Definition stdint.h:9
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_template_rng.h:197
Definition vsf_list.h:876
Definition vsf_list.h:896
void vsf_rng_on_ready_callback_t(void *param, uint32_t *buffer, uint32_t num)
Definition vsf_template_rng.h:177
Generated from commit: vsfteam/vsf@bf47061