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