mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-04-26 18:09:16 -04:00

This is an import of the fw-2 tag of tkey-libs. We import the entire tkey-libs repo minus dot files into the tillitis-key1 repo to make it very simple not to make mistakes regarding which firmware tag depends on which tkey-libs tag, especially considering locking down with NVCM. Please see README for information about developing with another tkey-libs or how to import future tkey-libs. Since tkey-libs is now a part of the repo we also add tkey-libs to the clean_fw target.
40 lines
620 B
C
40 lines
620 B
C
// SPDX-FileCopyrightText: 2022 Tillitis AB <tillitis.se>
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#ifndef TKEY_PROTO_H
|
|
#define TKEY_PROTO_H
|
|
|
|
enum endpoints {
|
|
DST_HW_IFPGA = 0x00,
|
|
DST_HW_AFPGA = 0x01,
|
|
DST_FW = 0x02,
|
|
DST_SW = 0x03
|
|
};
|
|
|
|
enum cmdlen {
|
|
LEN_1,
|
|
LEN_4,
|
|
LEN_32,
|
|
LEN_128
|
|
};
|
|
|
|
#define CMDLEN_MAXBYTES 128
|
|
|
|
enum status {
|
|
STATUS_OK,
|
|
STATUS_BAD
|
|
};
|
|
|
|
struct frame_header {
|
|
uint8_t id;
|
|
enum endpoints endpoint;
|
|
size_t len;
|
|
};
|
|
|
|
uint8_t genhdr(uint8_t id, uint8_t endpoint, uint8_t status, enum cmdlen len);
|
|
int parseframe(uint8_t b, struct frame_header *hdr);
|
|
#endif
|