VSF Documented
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_${SERIES/RNG_IP}_RNG_H__
19#define __HAL_DRIVER_${SERIES/RNG_IP}_RNG_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "hal/vsf_hal_cfg.h"
24
25#if VSF_HAL_USE_RNG == ENABLED
26
27// HW/IPCore
32// HW/IPCore end
33
34#include "../../__device.h"
35
36/*\note Refer to template/README.md for usage cases.
37 * For peripheral drivers, blackbox mode is recommended but not required, reimplementation part MUST be open.
38 * For IPCore drivers, class structure, MULTI_CLASS configuration, reimplementation and class APIs should be open to user.
39 * For emulated drivers, **** No reimplementation ****.
40 */
41
42/*\note Includes CAN ONLY be put here. */
43/*\note If current header is for a peripheral driver(hw driver), and inherit from an IPCore driver, include IPCore header here. */
44
45// IPCore
46#if defined(__VSF_HAL_${RNG_IP}_RNG_CLASS_IMPLEMENT)
47# define __VSF_CLASS_IMPLEMENT__
48#elif defined(__VSF_HAL_${RNG_IP}_RNG_CLASS_INHERIT__)
49# define __VSF_CLASS_INHERIT__
50#endif
51
52#include "utilities/ooc_class.h"
53// IPCore end
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
59/*============================ MACROS ========================================*/
60
61/*\note VSF_${RNG_IP}_RNG_CFG_MULTI_CLASS should be implemented for IP drives and open to user,
62 * while VSF_HW_RNG_CFG_MULTI_CLASS should be in rng.c.
63 */
64
65// IPCore
66#ifndef VSF_${RNG_IP}_RNG_CFG_MULTI_CLASS
67# define VSF_${RNG_IP}_RNG_CFG_MULTI_CLASS VSF_RNG_CFG_MULTI_CLASS
68#endif
69// IPCore end
70
71// HW
72/*\note hw RNG driver can reimplement following types:
73 * To enable reimplementation, please enable macro below:
74 * VSF_RNG_CFG_REIMPLEMENT_TYPE_MODE for vsf_rng_mode_t
75 * VSF_RNG_CFG_REIMPLEMENT_TYPE_STATUS for vsf_rng_status_t
76 * VSF_RNG_CFG_REIMPLEMENT_TYPE_IRQ_MASK for vsf_rng_irq_mask_t
77 * VSF_RNG_CFG_REIMPLEMENT_TYPE_CTRL for vsf_rng_ctrl_t
78 * VSF_RNG_CFG_REIMPLEMENT_TYPE_CFG for vsf_rng_cfg_t
79 * VSF_RNG_CFG_REIMPLEMENT_TYPE_CAPABILITY for vsf_rng_capability_t
80 * Reimplementation is used for optimization hw/IPCore drivers, reimplement the bit mask according to hw registers.
81 * *** DO NOT reimplement these in emulated drivers. ***
82 */
83
84#define VSF_RNG_CFG_REIMPLEMENT_TYPE_MODE ENABLED
85#define VSF_RNG_CFG_REIMPLEMENT_TYPE_STATUS ENABLED
86#define VSF_RNG_CFG_REIMPLEMENT_TYPE_IRQ_MASK ENABLED
87#define VSF_RNG_CFG_REIMPLEMENT_TYPE_CTRL ENABLED
88#define VSF_RNG_CFG_REIMPLEMENT_TYPE_CFG ENABLED
89#define VSF_RNG_CFG_REIMPLEMENT_TYPE_CAPABILITY ENABLED
90// HW end
91
92/*============================ MACROFIED FUNCTIONS ===========================*/
93/*============================ TYPES =========================================*/
94
95// IPCore
96vsf_class(vsf_${rng_ip}_rng_t) {
97#if VSF_${RNG_IP}_CFG_MULTI_CLASS == ENABLED
98 public_member(
99 vsf_rng_t vsf_rng;
100 )
101#endif
102
103/*\note You can add more member in vsf_${rng_ip}_rng_t instance.
104 * For members accessible from child, put in protected_member.
105 * Else, put in private_member.
106 */
107
108 protected_member(
109 vsf_${rng_ip}_rng_reg_t *reg;
110 vsf_rng_isr_t isr;
112};
113
114
115/*============================ INCLUDES ======================================*/
116
117// IPCore
118/*\note Extern APIs for ip core diriver.
119 * There is no requirement about how APIs of IPCore drivers should be implemented.
120 * Just consider the simplicity for actual peripheral drivers.
121 */
122// IPCore end
123
124#ifdef __cplusplus
125}
126#endif
127
128// IPCore
129#undef __VSF_HAL_${RNG_IP}_RNG_CLASS_IMPLEMENT
130#undef __VSF_HAL_${RNG_IP}_RNG_CLASS_INHERIT__
131// IPCore end
132
133#endif // VSF_HAL_USE_RNG
134#endif // __HAL_DRIVER_${SERIES/RNG_IP}_RNG_H__
135/* EOF */
Definition adc.h:94
#define vsf_class(__name)
Definition ooc_class.h:48
Definition vsf_template_rng.h:172
vsf_rng_isr_t isr
Definition rng.h:111
class vsf_$ * reg
Generated from commit: vsfteam/vsf@2b286be