forked from nrfconnect/sdk-nrf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhw_cc310.c
More file actions
71 lines (53 loc) · 1.52 KB
/
hw_cc310.c
File metadata and controls
71 lines (53 loc) · 1.52 KB
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
/*
* Copyright (c) 2019-2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
#include <zephyr/init.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zephyr/kernel.h>
#include <zephyr/irq.h>
#include <zephyr/device.h>
#include <nrf_cc3xx_platform.h>
#if CONFIG_HW_CC3XX
static int hw_cc3xx_init_internal(const struct device *dev)
{
ARG_UNUSED(dev);
int res;
/* Initialize the cc3xx HW with or without RNG support */
#if CONFIG_ENTROPY_CC3XX
res = nrf_cc3xx_platform_init();
#else
res = nrf_cc3xx_platform_init_no_rng();
#endif
return res;
}
static int hw_cc3xx_init(const struct device *dev)
{
int res;
/* Set the RTOS abort APIs */
nrf_cc3xx_platform_abort_init();
/* Set the RTOS mutex APIs */
nrf_cc3xx_platform_mutex_init();
/* Enable the hardware */
res = hw_cc3xx_init_internal(dev);
return res;
}
/* Driver initalization done when mutex is not usable (pre kernel) */
SYS_INIT(hw_cc3xx_init_internal, PRE_KERNEL_1,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
/* Driver initialization when mutex is usable (post kernel) */
SYS_INIT(hw_cc3xx_init, POST_KERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_HW_CC3XX */
#if CONFIG_HW_CC3XX_INTERRUPT
void hw_cc3XX_interrupt_init(void)
{
IRQ_CONNECT(DT_ARM_CRYPTOCELL_310_ARM_CRYPTOCELL_310_IRQ_0,
DT_ARM_CRYPTOCELL_310_ARM_CRYPTOCELL_310_IRQ_0_PRIORITY,
CRYPTOCELL_IRQHandler, NULL, 0);
irq_enable(DT_ARM_CRYPTOCELL_310_ARM_CRYPTOCELL_310_IRQ_0);
}
#endif /* CONFIG_HW_CC3XX_INTERRUPT */