blob: 369d1677f7ff9741195ea63f4aabc494a4d2afce [file] [log] [blame]
developer02e65912023-08-17 16:33:10 +08001/* adapter_driver197_init.c
2 *
3 * Adapter top level module, Security-IP-197 driver's entry point.
4 */
5
6/*****************************************************************************
7* Copyright (c) 2011-2020 by Rambus, Inc. and/or its subsidiaries.
8*
9* This program is free software: you can redistribute it and/or modify
10* it under the terms of the GNU General Public License as published by
11* the Free Software Foundation, either version 2 of the License, or
12* any later version.
13*
14* This program is distributed in the hope that it will be useful,
15* but WITHOUT ANY WARRANTY; without even the implied warranty of
16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17* GNU General Public License for more details.
18*
19* You should have received a copy of the GNU General Public License
20* along with this program. If not, see <http://www.gnu.org/licenses/>.
21*****************************************************************************/
22
23/*----------------------------------------------------------------------------
24 * This module implements (provides) the following interface(s):
25 */
26
27#include "api_driver197_init.h" // Driver Init API
28
29
30/*----------------------------------------------------------------------------
31 * This module uses (requires) the following interface(s):
32 */
33
34// Top-level Adapter configuration
35#include "cs_adapter.h" // ADAPTER_DRIVER_NAME
36
37// Adapter Initialization API
38#include "adapter_init.h" // Adapter_*
39#include "adapter_global_init.h" // Adapter_Global_Init/UnInit()
40#include "adapter_global_cs_init.h" // Adapter_Global_Cs_Init/UnInit()
41#include "adapter_global_drbg_init.h" // Adapter_Global_DRBG_Init/UnInit()
42
43// Logging API
44#include "log.h" // LOG_INFO
45
46
47/*----------------------------------------------------------------------------
48 * Driver197_Init
49 */
50int
51Driver197_Init(void)
52{
53 LOG_INFO("\n\t Driver197_Init \n");
54
55 LOG_INFO("%s driver: initializing\n", ADAPTER_DRIVER_NAME);
56
57 Adapter_Report_Build_Params();
58
59 if (!Adapter_Init())
60 {
61 return -1;
62 }
63
64 if (!Adapter_Global_Init())
65 {
66 Adapter_UnInit();
67 return -1;
68 }
69
70 if (!Adapter_Global_Cs_Init())
71 {
72 Adapter_Global_UnInit();
73 Adapter_UnInit();
74 return -1;
75 }
76
77 if (!Adapter_Global_DRBG_Init())
78 {
79 Adapter_Global_Cs_UnInit();
80 Adapter_Global_UnInit();
81 Adapter_UnInit();
82 return -1;
83 }
84
85 LOG_INFO("\n\t Driver197_Init done \n");
86
87 return 0; // success
88}
89
90
91/*----------------------------------------------------------------------------
92 * Driver197_Exit
93 */
94void
95Driver197_Exit(void)
96{
97 LOG_INFO("\n\t Driver197_Exit \n");
98
99 LOG_INFO("%s driver: exit\n", ADAPTER_DRIVER_NAME);
100
101 Adapter_Global_DRBG_UnInit();
102 Adapter_Global_Cs_UnInit();
103 Adapter_Global_UnInit();
104 Adapter_UnInit();
105
106 LOG_INFO("\n\t Driver197_Exit done \n");
107}
108
109
110#include "adapter_driver197_init_ext.h"
111
112
113/* end of file adapter_driver197_init.c */