1 /**
2  * @file    sc.h
3  * @brief   Smart Card (SC) interface functions and data types.
4  */
5 
6 /******************************************************************************
7  *
8  * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
9  * Analog Devices, Inc.),
10  * Copyright (C) 2023-2024 Analog Devices, Inc.
11  *
12  * Licensed under the Apache License, Version 2.0 (the "License");
13  * you may not use this file except in compliance with the License.
14  * You may obtain a copy of the License at
15  *
16  *     http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  *
24  ******************************************************************************/
25 
26 #ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32572_SC_H_
27 #define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32572_SC_H_
28 
29 /* **** Includes **** */
30 #include "mxc_device.h"
31 #include "scn_regs.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /**
38  * @defgroup scn Smart Card (SC)
39  * @ingroup periphlibs
40  * @{
41  */
42 
43 /* **** Definitions **** */
44 /**
45  * Bitmasks for each smart card device
46  */
47 typedef enum {
48     MXC_SC_DEV_MIN = 0,
49     MXC_SC_DEV0 = MXC_SC_DEV_MIN, /**< Smart Card 0 */
50     MXC_SC_DEV1, /**< Smart Card 1 */
51     MXC_SC_DEV_MAX = MXC_SC_DEV1,
52     MXC_SC_DEV_COUNT /**< Number of Smart Card Devices */
53 } mxc_sc_id_t;
54 
55 /* **** Structures **** */
56 /**
57   * @brief      Structure for smart card register
58   *
59   */
60 typedef struct {
61     mxc_scn_regs_t *reg_sc;
62 } mxc_sc_info_t;
63 
64 /**
65   * @brief      Structure to save smart card state
66   *
67   */
68 typedef struct {
69     unsigned char first_init;
70     mxc_sc_info_t sc[MXC_SC_DEV_COUNT];
71 } mxc_sc_context_t;
72 
73 /* **** Function Prototypes **** */
74 
75 /**
76  * @brief       Inititalize Smart Card Interface
77  *
78  * @param       id Smart Card interface id
79  * @return      Success/Fail, see \ref MXC_Error_Codes for a list of return codes.
80  */
81 int mxc_sc_init(mxc_sc_id_t id);
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 /**@} end of group sc */
88 #endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32572_SC_H_
89