13#define CTAPHID_PACKET_SIZE 64
14#define CTAPHID_INIT_DATA 57
15#define CTAPHID_CONT_DATA 59
16#define CTAPHID_MAX_MSG_SIZE 2048
18#define CTAPHID_BROADCAST_CID 0xFFFFFFFF
21#define CTAPHID_PING 0x01
22#define CTAPHID_MSG 0x03
23#define CTAPHID_LOCK 0x04
24#define CTAPHID_INIT 0x06
25#define CTAPHID_WINK 0x08
26#define CTAPHID_CBOR 0x10
27#define CTAPHID_CANCEL 0x11
28#define CTAPHID_KEEPALIVE 0x3B
29#define CTAPHID_ERROR 0x3F
32#define CTAPHID_ERR_INVALID_CMD 0x01
33#define CTAPHID_ERR_INVALID_PAR 0x02
34#define CTAPHID_ERR_INVALID_LEN 0x03
35#define CTAPHID_ERR_INVALID_SEQ 0x04
36#define CTAPHID_ERR_MSG_TIMEOUT 0x05
37#define CTAPHID_ERR_CHANNEL_BUSY 0x06
38#define CTAPHID_ERR_LOCK_REQUIRED 0x0A
39#define CTAPHID_ERR_INVALID_CHANNEL 0x0B
40#define CTAPHID_ERR_OTHER 0x7F
43#define CTAPHID_VENDOR_FIRST 0x40
44#define CTAPHID_VENDOR_LAST 0x7F
47#define CTAPHID_STATUS_PROCESSING 0x01
48#define CTAPHID_STATUS_UPNEEDED 0x02
51#define CTAPHID_CAP_WINK 0x01
52#define CTAPHID_CAP_CBOR 0x04
void ctaphid_get_cmd_counts(uint32_t *cbor_count, uint32_t *msg_count)
Returns cumulative counters for CTAPHID CBOR and MSG commands.
bool ctaphid_init(void)
Initializes CTAPHID transport state and synchronization primitives.
void ctaphid_check_timeout(void)
Expires active channels whose message assembly timeout elapsed.
bool ctaphid_is_busy(void)
Reports whether any CTAPHID channel currently has an active transaction.
uint32_t ctaphid_get_current_cid(void)
Returns the channel identifier of the currently processed request.
bool ctaphid_has_response(void)
Indicates whether any channel has a response queued for host retrieval.
void ctaphid_reset_cmd_counts(void)
Resets CTAPHID command counters.
bool ctaphid_get_response_packet(uint8_t *packet)
Retrieves the next response HID packet from a per-channel response queue.
void ctaphid_send_error(uint32_t cid, uint8_t error)
Queues a CTAPHID ERROR response for the given channel.
bool ctaphid_process_packet(const uint8_t *packet)
Processes one incoming 64-byte CTAPHID packet.
void ctaphid_send_keepalive(uint32_t cid, uint8_t status)
Sends a CTAPHID KEEPALIVE packet immediately over USB.
uint8_t * response_buffer
uint16_t response_buffer_size