atca_params.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef ATCA_PARAMS_H
21 #define ATCA_PARAMS_H
22 
23 #include "board.h"
24 #include "periph/i2c.h"
25 #include "atca.h"
26 #include "cryptoauthlib.h"
27 
28 #include "kernel_defines.h"
29 
30 #ifdef CUSTOM_ATCA_PARAMS
31 #include "custom_atca_params.h"
32 #endif
33 
34 #if IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A)
35 #include "psa/crypto_types.h"
36 #endif
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
58 #ifndef ATCA_PARAM_I2C
59 #define ATCA_PARAM_I2C (I2C_DEV(0))
60 #endif
61 
62 #ifndef ATCA_PARAM_ADDR
63 #define ATCA_PARAM_ADDR (ATCA_I2C_ADDR)
64 #endif
65 #ifndef ATCA_RX_RETRIES
66 #define ATCA_RX_RETRIES (20)
67 #endif
68 #ifndef ATCA_DEVTYPE
69 #define ATCA_DEVTYPE (ATECC608A)
70 #endif
71 
72 #ifndef ATCA_PARAMS
76 #define ATCA_PARAMS { .iface_type = ATCA_I2C_IFACE, \
77  .devtype = ATCA_DEVTYPE, \
78  .atcai2c.address = ATCA_PARAM_ADDR, \
79  .atcai2c.bus = ATCA_PARAM_I2C, \
80  .atcai2c.baud = -1, \
81  .wake_delay = 1500, \
82  .rx_retries = ATCA_RX_RETRIES }
83 #endif
84 
87 #if IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A)
91 typedef struct {
92  psa_key_location_t atca_loc;
93  ATCAIfaceCfg cfg;
94 } atca_params_t;
95 
99 static const atca_params_t atca_params[] =
100 {
102 };
103 #else
107 static const ATCAIfaceCfg atca_params[] =
108 {
110 };
111 #endif
112 
116 #define ATCA_NUMOF (ARRAY_SIZE(atca_params))
117 
121 extern ATCADevice atca_devs_ptr[ATCA_NUMOF];
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif /* ATCA_PARAMS_H */
Default addresses and device descriptor for CryptoAuth devices.
Type definitions for PSA Crypto.
static const ATCAIfaceCfg atca_params[]
Allocation of ATCA device descriptors.
Definition: atca_params.h:107
#define ATCA_PARAMS
Configuration parameters for the primary ATCA device.
Definition: atca_params.h:76
ATCADevice atca_devs_ptr[ATCA_NUMOF]
List of device pointers for all available devices.
#define ATCA_NUMOF
Number of connected devices.
Definition: atca_params.h:116
Low-level I2C peripheral driver interface definition.
Common macros and compiler attributes/pragmas configuration.
uint32_t psa_key_location_t
Encoding of key location indicators.
Definition: lifetime.h:143