|
19 | 19 | * See the License for the specific language governing permissions and
|
20 | 20 | * limitations under the License.
|
21 | 21 | */
|
22 |
| -#include "atecc608a_se.h" |
23 | 22 | #include "atecc608a_utils.h"
|
24 | 23 |
|
25 | 24 | #include "atca_basic.h"
|
26 | 25 |
|
27 |
| -ATCAIfaceCfg atca_iface_config = { |
28 |
| - .iface_type = ATCA_I2C_IFACE, |
29 |
| - .devtype = ATECC608A, |
30 |
| - .atcai2c.slave_address = 0xC0, |
31 |
| - .atcai2c.bus = 2, |
32 |
| - .atcai2c.baud = 400000, |
33 |
| - .wake_delay = 1500, |
34 |
| - .rx_retries = 20, |
35 |
| -}; |
36 |
| - |
37 |
| -psa_status_t atecc608a_to_psa_error(ATCA_STATUS ret) |
38 |
| -{ |
39 |
| - switch (ret) |
40 |
| - { |
41 |
| - case ATCA_SUCCESS: |
42 |
| - case ATCA_RX_NO_RESPONSE: |
43 |
| - case ATCA_WAKE_SUCCESS: |
44 |
| - return PSA_SUCCESS; |
45 |
| - case ATCA_BAD_PARAM: |
46 |
| - case ATCA_INVALID_ID: |
47 |
| - return PSA_ERROR_INVALID_ARGUMENT; |
48 |
| - case ATCA_ASSERT_FAILURE: |
49 |
| - return PSA_ERROR_TAMPERING_DETECTED; |
50 |
| - case ATCA_SMALL_BUFFER: |
51 |
| - return PSA_ERROR_BUFFER_TOO_SMALL; |
52 |
| - case ATCA_RX_CRC_ERROR: |
53 |
| - case ATCA_RX_FAIL: |
54 |
| - case ATCA_STATUS_CRC: |
55 |
| - case ATCA_RESYNC_WITH_WAKEUP: |
56 |
| - case ATCA_PARITY_ERROR: |
57 |
| - case ATCA_TX_TIMEOUT: |
58 |
| - case ATCA_RX_TIMEOUT: |
59 |
| - case ATCA_TOO_MANY_COMM_RETRIES: |
60 |
| - case ATCA_COMM_FAIL: |
61 |
| - case ATCA_TIMEOUT: |
62 |
| - case ATCA_TX_FAIL: |
63 |
| - case ATCA_NO_DEVICES: |
64 |
| - return PSA_ERROR_COMMUNICATION_FAILURE; |
65 |
| - case ATCA_UNIMPLEMENTED: |
66 |
| - return PSA_ERROR_NOT_SUPPORTED; |
67 |
| - case ATCA_ALLOC_FAILURE: |
68 |
| - return PSA_ERROR_INSUFFICIENT_MEMORY; |
69 |
| - case ATCA_BAD_OPCODE: |
70 |
| - case ATCA_CONFIG_ZONE_LOCKED: |
71 |
| - case ATCA_DATA_ZONE_LOCKED: |
72 |
| - case ATCA_NOT_LOCKED: |
73 |
| - case ATCA_WAKE_FAILED: |
74 |
| - case ATCA_STATUS_UNKNOWN: |
75 |
| - case ATCA_STATUS_ECC: |
76 |
| - case ATCA_STATUS_SELFTEST_ERROR: |
77 |
| - case ATCA_CHECKMAC_VERIFY_FAILED: |
78 |
| - case ATCA_PARSE_ERROR: |
79 |
| - case ATCA_FUNC_FAIL: |
80 |
| - case ATCA_GEN_FAIL: |
81 |
| - case ATCA_EXECUTION_ERROR: |
82 |
| - case ATCA_HEALTH_TEST_ERROR: |
83 |
| - case ATCA_INVALID_SIZE: |
84 |
| - default: |
85 |
| - return PSA_ERROR_HARDWARE_FAILURE; |
86 |
| - } |
87 |
| -} |
88 |
| - |
89 | 26 | psa_status_t atecc608a_get_serial_number(uint8_t* buffer,
|
90 | 27 | size_t buffer_size,
|
91 | 28 | size_t *buffer_length)
|
|
0 commit comments