1 /***************************************************************************//**
2 * \file cy_crypto_server.h
3 * \version 2.90
4 *
5 * \brief
6 *  This file provides the prototypes for common API
7 *  in the Crypto driver.
8 *
9 ********************************************************************************
10 * \copyright
11 * Copyright (c) (2020-2022), Cypress Semiconductor Corporation (an Infineon company) or
12 * an affiliate of Cypress Semiconductor Corporation.
13 * SPDX-License-Identifier: Apache-2.0
14 *
15 * Licensed under the Apache License, Version 2.0 (the "License");
16 * you may not use this file except in compliance with the License.
17 * You may obtain a copy of the License at
18 *
19 *    http://www.apache.org/licenses/LICENSE-2.0
20 *
21 * Unless required by applicable law or agreed to in writing, software
22 * distributed under the License is distributed on an "AS IS" BASIS,
23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 * See the License for the specific language governing permissions and
25 * limitations under the License.
26 *******************************************************************************/
27 
28 #if !defined (CY_CRYPTO_SERVER_H)
29 #define CY_CRYPTO_SERVER_H
30 
31 #include "cy_device.h"
32 
33 #if defined (CY_IP_MXCRYPTO)
34 
35 #include "cy_crypto_common.h"
36 
37 #if defined(__cplusplus)
38 extern "C" {
39 #endif
40 
41 /**
42 * \addtogroup group_crypto_srv_functions
43 * \{
44 */
45 
46 /*******************************************************************************
47 * Function Name: Cy_Crypto_Server_Start
48 ****************************************************************************//**
49 *
50 * This function starts the Full functionality for the Crypto server on the
51 * server side core, sets up an interrupt for the IPC Crypto channel, sets up an
52 * interrupt to catch Crypto HW errors.
53 *
54 * This function available for Server side only.
55 *
56 * \note
57 * The Crypto server can be run as singleton (not multi-instance) application on
58 * the one of available cores at the same time.
59 *
60 * \param config
61 * The Crypto configuration structure.
62 *
63 * \param context
64 * The pointer to the \ref cy_stc_crypto_server_context_t structure that stores
65 * the Crypto server context.
66 *
67 * \return
68 * \ref cy_en_crypto_status_t
69 *
70 * \funcusage
71 * \snippet crypto/snippet/main.c snippet_myCryptoServerStart
72 *
73 *******************************************************************************/
74 cy_en_crypto_status_t Cy_Crypto_Server_Start(cy_stc_crypto_config_t const *config,
75                                              cy_stc_crypto_server_context_t *context);
76 
77 /*******************************************************************************
78 * Function Name: Cy_Crypto_Server_Stop
79 ****************************************************************************//**
80 *
81 * This function stops the Crypto server by disabling the IPC notify interrupt
82 * and Crypto error interrupt.
83 *
84 * This function available for Server side only.
85 *
86 * \return
87 * \ref cy_en_crypto_status_t
88 *
89 *******************************************************************************/
90 cy_en_crypto_status_t Cy_Crypto_Server_Stop(void);
91 
92 /*******************************************************************************
93 * Function Name: Cy_Crypto_Server_Process
94 ****************************************************************************//**
95 *
96 * This function parses input data received from the Crypto Client,
97 * runs the appropriate Crypto function and releases the Crypto IPC channel.
98 *
99 * This function available for Server side only.
100 *
101 * \note
102 * This function should be used only when user register own GetDataHandler function.
103 *
104 *******************************************************************************/
105 void Cy_Crypto_Server_Process(void);
106 
107 /*******************************************************************************
108 * Function Name: Cy_Crypto_Server_GetDataHandler
109 ****************************************************************************//**
110 *
111 * This function is a IPC Crypto channel notify interrupt-routine.
112 * It receives information from the Crypto client,
113 * runs the process if user not setup own handler.
114 *
115 * This function available for Server side only.
116 *
117 *******************************************************************************/
118 void Cy_Crypto_Server_GetDataHandler(void);
119 
120 /*******************************************************************************
121 * Function Name: Cy_Crypto_Server_ErrorHandler
122 ****************************************************************************//**
123 *
124 * This function is a routine to handle an interrupt caused by the Crypto
125 * hardware error.
126 *
127 * This function available for Server side only.
128 *
129 *******************************************************************************/
130 void Cy_Crypto_Server_ErrorHandler(void);
131 
132 /** \} group_crypto_srv_functions */
133 
134 /** Backward compatibility macro for the Server Start_xx functions -
135     it starts the Server with common functionality configuration */
136 #define Cy_Crypto_Server_Start_Base               Cy_Crypto_Server_Start
137 #define Cy_Crypto_Server_Start_Extra              Cy_Crypto_Server_Start
138 #define Cy_Crypto_Server_Start_Full               Cy_Crypto_Server_Start
139 
140 #if defined(__cplusplus)
141 }
142 #endif
143 
144 #endif /* CY_IP_MXCRYPTO */
145 
146 #endif /* #if !defined (CY_CRYPTO_SERVER_H) */
147 
148 
149 /* [] END OF FILE */
150