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 
9 #pragma once
10 
22 #include "board.h"
23 #include "periph/i2c.h"
24 #include "atca.h"
25 #include "cryptoauthlib.h"
26 
27 #include "kernel_defines.h"
28 
29 #ifdef CUSTOM_ATCA_PARAMS
30 #include "custom_atca_params.h"
31 #endif
32 
33 #if IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A)
34 #include "psa/crypto_types.h"
35 #endif
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
57 #ifndef ATCA_PARAM_I2C
58 #define ATCA_PARAM_I2C (I2C_DEV(0))
59 #endif
60 
61 #ifndef ATCA_PARAM_ADDR
62 #define ATCA_PARAM_ADDR (ATCA_I2C_ADDR)
63 #endif
64 #ifndef ATCA_RX_RETRIES
65 #define ATCA_RX_RETRIES (20)
66 #endif
67 #ifndef ATCA_DEVTYPE
68 #define ATCA_DEVTYPE (ATECC608A)
69 #endif
70 
71 #ifndef ATCA_PARAMS
75 #define ATCA_PARAMS { .iface_type = ATCA_I2C_IFACE, \
76  .devtype = ATCA_DEVTYPE, \
77  .atcai2c.address = ATCA_PARAM_ADDR, \
78  .atcai2c.bus = ATCA_PARAM_I2C, \
79  .atcai2c.baud = -1, \
80  .wake_delay = 1500, \
81  .rx_retries = ATCA_RX_RETRIES }
82 #endif
83 
86 #if IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A)
90 typedef struct {
91  psa_key_location_t atca_loc;
92  ATCAIfaceCfg cfg;
93 } atca_params_t;
94 
98 static const atca_params_t atca_params[] =
99 {
101 };
102 #else
106 static const ATCAIfaceCfg atca_params[] =
107 {
109 };
110 #endif
111 
115 #define ATCA_NUMOF (ARRAY_SIZE(atca_params))
116 
120 extern ATCADevice atca_devs_ptr[ATCA_NUMOF];
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
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:106
#define ATCA_PARAMS
Configuration parameters for the primary ATCA device.
Definition: atca_params.h:75
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:115
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:142